summaryrefslogtreecommitdiffstats
path: root/doc/developer/northbound/plugins-sysrepo.rst
blob: 186c3a0177d143fa435661f2a640f40b530e9611 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
Installation
------------

Required dependencies
^^^^^^^^^^^^^^^^^^^^^

::

   # apt-get install git cmake build-essential bison flex libpcre3-dev libev-dev \
                     libavl-dev libprotobuf-c-dev protobuf-c-compiler libcmocka0 \
                     libcmocka-dev doxygen libssl-dev libssl-dev libssh-dev

libyang
^^^^^^^

::

   # apt-get install libyang0.16 libyang-dev

Sysrepo
^^^^^^^

::

   $ git clone https://github.com/sysrepo/sysrepo.git
   $ cd sysrepo/
   $ mkdir build; cd build
   $ cmake -DCMAKE_BUILD_TYPE=Release -DGEN_LANGUAGE_BINDINGS=OFF .. && make
   # make install

libnetconf2
^^^^^^^^^^^

::

   $ git clone https://github.com/CESNET/libnetconf2.git
   $ cd libnetconf2/
   $ mkdir build; cd build
   $ cmake .. && make
   # make install

netopeer2
^^^^^^^^^

::

   $ git clone https://github.com/CESNET/Netopeer2.git
   $ cd Netopeer2
   $ cd server
   $ mkdir build; cd build
   $ cmake .. && make
   # make install

**Note:** If ``make install`` fails as it can’t find
``libsysrepo.so.0.7``, then run ``ldconfig`` and try again as it might
not have updated the lib search path

FRR
^^^

Build and install FRR using the ``--enable-sysrepo`` configure-time
option.

Initialization
--------------

Install the FRR YANG modules in the Sysrepo datastore:

::

   # sysrepoctl --install /usr/local/share/yang/ietf-interfaces@2018-01-09.yang 
   # sysrepoctl --install /usr/local/share/yang/frr-vrf.yang 
   # sysrepoctl --install /usr/local/share/yang/frr-interface.yang 
   # sysrepoctl --install /usr/local/share/yang/frr-route-types.yang 
   # sysrepoctl --install /usr/local/share/yang/frr-filter.yang 
   # sysrepoctl --install /usr/local/share/yang/frr-route-map.yang 
   # sysrepoctl --install /usr/local/share/yang/frr-isisd.yang 
   # sysrepoctl --install /usr/local/share/yang/frr-ripd.yang
   # sysrepoctl --install /usr/local/share/yang/frr-ripngd.yang
   # sysrepoctl -c frr-vrf --owner frr --group frr
   # sysrepoctl -c frr-interface --owner frr --group frr
   # sysrepoctl -c frr-route-types --owner frr --group frr
   # sysrepoctl -c frr-filter --owner frr --group frr
   # sysrepoctl -c frr-route-map --owner frr --group frr
   # sysrepoctl -c frr-isisd --owner frr --group frr
   # sysrepoctl -c frr-ripd --owner frr --group frr
   # sysrepoctl -c frr-ripngd --owner frr --group frr

Start netopeer2-server:

::

   # netopeer2-server -d &

Start the FRR daemons with the sysrepo module:

::

   # isisd -M sysrepo --log=stdout

Managing the configuration
--------------------------

The following NETCONF scripts can be used to show and edit the FRR
configuration:
https://github.com/rzalamena/ietf-hackathon-brazil-201907/tree/master/netconf-scripts

Example:

::

   # ./netconf-edit.py 127.0.0.1
   # ./netconf-get-config.py 127.0.0.1
   <?xml version="1.0" encoding="UTF-8"?><data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"><isis xmlns="http://frrouting.org/yang/isisd"><instance><area-tag>testnet</area-tag><is-type>level-1</is-type></instance></isis></data>

..

   NOTE: the ncclient library needs to be installed first:
   ``apt install -y python3-ncclient``

The *sysrepocfg* tool can also be used to show/edit the FRR
configuration. Example:

::

   # sysrepocfg --format=json --import=frr-isisd.json --datastore=running frr-isisd
   # sysrepocfg --format=json --export --datastore=running frr-isisd
   {
     "frr-isisd:isis": {
       "instance": [
         {
           "area-tag": "testnet",
           "is-type": "level-1"
         }
       ]
     }
   }