1 .. _netconf-user-guide:
17 NETCONF is an XML-based protocol used for configuration and monitoring
18 devices in the network. The base NETCONF protocol is described in
19 `RFC-6241 <http://tools.ietf.org/html/rfc6241>`__.
21 **NETCONF in OpenDaylight:.**
23 OpenDaylight supports the NETCONF protocol as a northbound server as
24 well as a southbound plugin. It also includes a set of test tools for
25 simulating NETCONF devices and clients.
27 Southbound (netconf-connector)
28 ------------------------------
30 The NETCONF southbound plugin is capable of connecting to remote NETCONF
31 devices and exposing their configuration/operational datastores, RPCs
32 and notifications as MD-SAL mount points. These mount points allow
33 applications and remote users (over RESTCONF) to interact with the
36 In terms of RFCs, the connector supports:
38 - `RFC-6241 <http://tools.ietf.org/html/rfc6241>`__
40 - `RFC-5277 <https://tools.ietf.org/html/rfc5277>`__
42 - `RFC-6022 <https://tools.ietf.org/html/rfc6022>`__
44 - `draft-ietf-netconf-yang-library-06 <https://tools.ietf.org/html/draft-ietf-netconf-yang-library-06>`__
46 **Netconf-connector is fully model-driven (utilizing the YANG modeling
47 language) so in addition to the above RFCs, it supports any
48 data/RPC/notifications described by a YANG model that is implemented by
53 NETCONF southbound can be activated by installing
54 ``odl-netconf-connector-all`` Karaf feature.
56 Netconf-connector configuration
57 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59 There are 2 ways for configuring netconf-connector: NETCONF or RESTCONF.
60 This guide focuses on using RESTCONF.
64 There are 2 different endpoints related to RESTCONF protocols:
66 - | ``http://localhost:8181/restconf`` is related to `draft-bierman-netconf-restconf-02 <https://tools.ietf.org/html/draft-bierman-netconf-restconf-02>`__,
67 | can be activated by installing ``odl-restconf-nb-bierman02``
69 | This user guide uses this approach.
71 - | ``http://localhost:8181/rests`` is related to `RFC-8040 <https://tools.ietf.org/html/rfc8040>`__,
72 | can be activated by installing ``odl-restconf-nb-rfc8040``
75 | In case of `RFC-8040 <https://tools.ietf.org/html/rfc8040>`__
76 resources for configuration and operational datastores start
79 http://localhost:8181/rests/data/network-topology:network-topology
80 with response of both datastores. It's allowed to use query
81 parameters to distinguish between them.
83 http://localhost:8181/rests/data/network-topology:network-topology?content=config
84 for configuration datastore
86 http://localhost:8181/rests/data/network-topology:network-topology?content=nonconfig
87 for operational datastore.
89 | Also in case of `RFC-8040 <https://tools.ietf.org/html/rfc8040>`__,
90 if a data node in the path expression is a YANG leaf-list or list
91 node, the path segment has to be constructed by having leaf-list or
92 list node name, followed by an "=" character, then followed by the
93 leaf-list or list value. Any reserved characters must be
96 http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf?content=config
97 for retrieving data from configuration datastore for
98 topology-netconf value of topology list is equivalent to the deprecated request
100 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf,
101 which is related to `draft-bierman-netconf-restconf-02
102 <https://tools.ietf.org/html/draft-bierman-netconf-restconf-02>`__.
107 Default configuration
108 ^^^^^^^^^^^^^^^^^^^^^
110 The default configuration contains all the necessary dependencies (file:
111 01-netconf.xml) and a single instance of netconf-connector (file:
112 99-netconf-connector.xml) called **controller-config** which connects
113 itself to the NETCONF northbound in OpenDaylight in a loopback fashion.
114 The connector mounts the NETCONF server for config-subsystem in order to
115 enable RESTCONF protocol for config-subsystem. This RESTCONF still goes
116 via NETCONF, but using RESTCONF is much more user friendly than using
119 Spawning additional netconf-connectors while the controller is running
120 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
124 1. OpenDaylight is running
126 2. In Karaf, you must have the netconf-connector installed (at the Karaf
127 prompt, type: ``feature:install odl-netconf-connector-all``); the
128 loopback NETCONF mountpoint will be automatically configured and
131 3. Wait until log displays following entry:
132 RemoteDevice{controller-config}: NETCONF connector initialized
135 To configure a new netconf-connector you need to send following request
139 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules
143 - Accept application/xml
145 - Content-Type application/xml
149 <module xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
150 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">prefix:sal-netconf-connector</type>
151 <name>new-netconf-device</name>
152 <address xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">127.0.0.1</address>
153 <port xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">830</port>
154 <username xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">admin</username>
155 <password xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">admin</password>
156 <tcp-only xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">false</tcp-only>
157 <event-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
158 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-event-executor</type>
159 <name>global-event-executor</name>
161 <binding-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
162 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type>
163 <name>binding-osgi-broker</name>
165 <dom-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
166 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">prefix:dom-broker-osgi-registry</type>
167 <name>dom-broker</name>
169 <client-dispatcher xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
170 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf">prefix:netconf-client-dispatcher</type>
171 <name>global-netconf-dispatcher</name>
173 <processing-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
174 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:threadpool</type>
175 <name>global-netconf-processing-executor</name>
176 </processing-executor>
177 <keepalive-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
178 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:scheduled-threadpool</type>
179 <name>global-netconf-ssh-scheduled-executor</name>
180 </keepalive-executor>
183 This spawns a new netconf-connector which tries to connect to (or mount)
184 a NETCONF device at 127.0.0.1 and port 830. You can check the
185 configuration of config-subsystem’s configuration datastore. The new
186 netconf-connector will now be present there. Just invoke:
189 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules
191 The response will contain the module for new-netconf-device.
193 Right after the new netconf-connector is created, it writes some useful
194 metadata into the datastore of MD-SAL under the network-topology
195 subtree. This metadata can be found at:
198 http://localhost:8181/restconf/operational/network-topology:network-topology/
200 Information about connection status, device capabilities, etc. can be
203 Connecting to a device not supporting NETCONF monitoring
204 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
206 The netconf-connector in OpenDaylight relies on ietf-netconf-monitoring
207 support when connecting to remote NETCONF device. The
208 ietf-netconf-monitoring support allows netconf-connector to list and
209 download all YANG schemas that are used by the device. NETCONF connector
210 can only communicate with a device if it knows the set of used schemas
211 (or at least a subset). However, some devices use YANG models internally
212 but do not support NETCONF monitoring. Netconf-connector can also
213 communicate with these devices, but you have to side load the necessary
214 yang models into OpenDaylight’s YANG model cache for netconf-connector.
215 In general there are 2 situations you might encounter:
217 **1. NETCONF device does not support ietf-netconf-monitoring but it does
218 list all its YANG models as capabilities in HELLO message**
220 This could be a device that internally uses only ietf-inet-types YANG
221 model with revision 2010-09-24. In the HELLO message that is sent from
222 this device there is this capability reported:
226 urn:ietf:params:xml:ns:yang:ietf-inet-types?module=ietf-inet-types&revision=2010-09-24
228 **For such devices you only need to put the schema into folder
229 cache/schema inside your Karaf distribution.**
233 The file with YANG schema for ietf-inet-types has to be called
234 ietf-inet-types@2010-09-24.yang. It is the required naming format of
237 **2. NETCONF device does not support ietf-netconf-monitoring and it does
238 NOT list its YANG models as capabilities in HELLO message**
240 Compared to device that lists its YANG models in HELLO message, in this
241 case there would be no capability with ietf-inet-types in the HELLO
242 message. This type of device basically provides no information about the
243 YANG schemas it uses so its up to the user of OpenDaylight to properly
244 configure netconf-connector for this device.
246 Netconf-connector has an optional configuration attribute called
247 yang-module-capabilities and this attribute can contain a list of "YANG
248 module based" capabilities. So by setting this configuration attribute,
249 it is possible to override the "yang-module-based" capabilities reported
250 in HELLO message of the device. To do this, we need to modify the
251 configuration of netconf-connector by adding this XML (It needs to be
252 added next to the address, port, username etc. configuration elements):
256 <yang-module-capabilities xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
257 <capability xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
258 urn:ietf:params:xml:ns:yang:ietf-inet-types?module=ietf-inet-types&revision=2010-09-24
260 </yang-module-capabilities>
262 **Remember to also put the YANG schemas into the cache folder.**
266 For putting multiple capabilities, you just need to replicate the
267 capability xml element inside yang-module-capability element.
268 Capability element is modeled as a leaf-list. With this
269 configuration, we would make the remote device report usage of
270 ietf-inet-types in the eyes of netconf-connector.
272 Reconfiguring Netconf-Connector While the Controller is Running
273 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
275 It is possible to change the configuration of a running module while the
276 whole controller is running. This example will continue where the last
277 left off and will change the configuration for the brand new
278 netconf-connector after it was spawned. Using one RESTCONF request, we
279 will change both username and password for the netconf-connector.
281 To update an existing netconf-connector you need to send following
285 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/odl-sal-netconf-connector-cfg:sal-netconf-connector/new-netconf-device
289 <module xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
290 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">prefix:sal-netconf-connector</type>
291 <name>new-netconf-device</name>
292 <username xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">bob</username>
293 <password xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">passwd</password>
294 <tcp-only xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">false</tcp-only>
295 <event-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
296 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-event-executor</type>
297 <name>global-event-executor</name>
299 <binding-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
300 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type>
301 <name>binding-osgi-broker</name>
303 <dom-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
304 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">prefix:dom-broker-osgi-registry</type>
305 <name>dom-broker</name>
307 <client-dispatcher xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
308 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf">prefix:netconf-client-dispatcher</type>
309 <name>global-netconf-dispatcher</name>
311 <processing-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
312 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:threadpool</type>
313 <name>global-netconf-processing-executor</name>
314 </processing-executor>
315 <keepalive-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
316 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:scheduled-threadpool</type>
317 <name>global-netconf-ssh-scheduled-executor</name>
318 </keepalive-executor>
321 Since a PUT is a replace operation, the whole configuration must be
322 specified along with the new values for username and password. This
323 should result in a 2xx response and the instance of netconf-connector
324 called new-netconf-device will be reconfigured to use username bob and
325 password passwd. New configuration can be verified by executing:
328 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/odl-sal-netconf-connector-cfg:sal-netconf-connector/new-netconf-device
330 With new configuration, the old connection will be closed and a new one
333 Destroying Netconf-Connector While the Controller is Running
334 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
336 Using RESTCONF one can also destroy an instance of a module. In case of
337 netconf-connector, the module will be destroyed, NETCONF connection
338 dropped and all resources will be cleaned. To do this, simply issue a
339 request to following URL:
342 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/odl-sal-netconf-connector-cfg:sal-netconf-connector/new-netconf-device
344 The last element of the URL is the name of the instance and its
345 predecessor is the type of that module (In our case the type is
346 **sal-netconf-connector** and name **new-netconf-device**). The type and
347 name are actually the keys of the module list.
349 Netconf-connector configuration with MD-SAL
350 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
352 It is also possible to configure new NETCONF connectors directly through
353 MD-SAL with the usage of the network-topology model. You can configure
354 new NETCONF connectors both through the NETCONF server for MD-SAL (port
355 2830) or RESTCONF. This guide focuses on RESTCONF.
359 To enable NETCONF connector configuration through MD-SAL install
360 either the ``odl-netconf-topology`` or
361 ``odl-netconf-clustered-topology`` feature. We will explain the
362 difference between these features later.
367 1. OpenDaylight is running
369 2. In Karaf, you must have the ``odl-netconf-topology`` or
370 ``odl-netconf-clustered-topology`` feature installed.
372 3. Feature ``odl-restconf`` must be installed
374 4. Wait until log displays following entry:
378 Successfully pushed configuration snapshot 02-netconf-topology.xml(odl-netconf-topology,odl-netconf-topology)
384 GET http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/
386 returns a non-empty response, for example:
390 <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
391 <topology-id>topology-netconf</topology-id>
394 Spawning new NETCONF connectors
395 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
397 To create a new NETCONF connector you need to send the following request
402 PUT http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device
406 - Accept: application/xml
408 - Content-Type: application/xml
414 <node xmlns="urn:TBD:params:xml:ns:yang:network-topology">
415 <node-id>new-netconf-device</node-id>
416 <host xmlns="urn:opendaylight:netconf-node-topology">127.0.0.1</host>
417 <port xmlns="urn:opendaylight:netconf-node-topology">17830</port>
418 <username xmlns="urn:opendaylight:netconf-node-topology">admin</username>
419 <password xmlns="urn:opendaylight:netconf-node-topology">admin</password>
420 <tcp-only xmlns="urn:opendaylight:netconf-node-topology">false</tcp-only>
421 <!-- non-mandatory fields with default values, you can safely remove these if you do not wish to override any of these values-->
422 <reconnect-on-changed-schema xmlns="urn:opendaylight:netconf-node-topology">false</reconnect-on-changed-schema>
423 <connection-timeout-millis xmlns="urn:opendaylight:netconf-node-topology">20000</connection-timeout-millis>
424 <max-connection-attempts xmlns="urn:opendaylight:netconf-node-topology">0</max-connection-attempts>
425 <between-attempts-timeout-millis xmlns="urn:opendaylight:netconf-node-topology">2000</between-attempts-timeout-millis>
426 <sleep-factor xmlns="urn:opendaylight:netconf-node-topology">1.5</sleep-factor>
427 <!-- keepalive-delay set to 0 turns off keepalives-->
428 <keepalive-delay xmlns="urn:opendaylight:netconf-node-topology">120</keepalive-delay>
431 Note that the device name in <node-id> element must match the last
432 element of the restconf URL.
434 Reconfiguring an existing connector
435 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
437 The steps to reconfigure an existing connector are exactly the same as
438 when spawning a new connector. The old connection will be disconnected
439 and a new connector with the new configuration will be created.
441 Deleting an existing connector
442 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
444 To remove an already configured NETCONF connector you need to send the
449 DELETE http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device
451 Connecting to a device supporting only NETCONF 1.0
452 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
454 OpenDaylight is schema-based distribution and heavily depends on YANG
455 models. However some legacy NETCONF devices are not schema-based and
456 implement just RFC 4741. This type of device does not utilize YANG
457 models internally and OpenDaylight does not know how to communicate
458 with such devices, how to validate data, or what the semantics of data
461 NETCONF connector can communicate also with these devices, but the
462 trade-offs are worsened possibilities in utilization of NETCONF
463 mountpoints. Using RESTCONF with such devices is not suported. Also
464 communicating with schemaless devices from application code is slightly
467 To connect to schemaless device, there is a optional configuration option
468 in netconf-node-topology model called schemaless. You have to set this
471 Clustered NETCONF connector
472 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
474 To spawn NETCONF connectors that are cluster-aware you need to install
475 the ``odl-netconf-clustered-topology`` karaf feature.
479 The ``odl-netconf-topology`` and ``odl-netconf-clustered-topology``
480 features are considered **INCOMPATIBLE**. They both manage the same
481 space in the datastore and would issue conflicting writes if
484 Configuration of clustered NETCONF connectors works the same as the
485 configuration through the topology model in the previous section.
487 When a new clustered connector is configured the configuration gets
488 distributed among the member nodes and a NETCONF connector is spawned on
489 each node. From these nodes a master is chosen which handles the schema
490 download from the device and all the communication with the device. You
491 will be able to read/write to/from the device from all slave nodes due
492 to the proxy data brokers implemented.
494 You can use the ``odl-netconf-clustered-topology`` feature in a single
495 node scenario as well but the code that uses akka will be used, so for a
496 scenario where only a single node is used, ``odl-netconf-topology``
499 Netconf-connector utilization
500 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
502 Once the connector is up and running, users can utilize the new mount
503 point instance. By using RESTCONF or from their application code. This
504 chapter deals with using RESTCONF and more information for app
505 developers can be found in the developers guide or in the official
506 tutorial application **ncmount** that can be found in the coretutorials
509 - https://github.com/opendaylight/coretutorials/tree/stable/beryllum/ncmount
511 Reading data from the device
512 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
514 Just invoke (no body needed):
517 http://localhost:8080/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device/yang-ext:mount/
519 This will return the entire content of operation datastore from the
520 device. To view just the configuration datastore, change **operational**
521 in this URL to **config**.
523 Writing configuration data to the device
524 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
526 In general, you cannot simply write any data you want to the device. The
527 data have to conform to the YANG models implemented by the device. In
528 this example we are adding a new interface-configuration to the mounted
529 device (assuming the device supports Cisco-IOS-XR-ifmgr-cfg YANG model).
530 In fact this request comes from the tutorial dedicated to the
531 **ncmount** tutorial app.
534 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device/yang-ext:mount/Cisco-IOS-XR-ifmgr-cfg:interface-configurations
538 <interface-configuration xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg">
540 <interface-name>mpls</interface-name>
541 <description>Interface description</description>
542 <bandwidth>32</bandwidth>
543 <link-status></link-status>
544 </interface-configuration>
546 Should return 200 response code with no body.
550 This call is transformed into a couple of NETCONF RPCs. Resulting
551 NETCONF RPCs that go directly to the device can be found in the
552 OpenDaylight logs after invoking ``log:set TRACE
553 org.opendaylight.controller.sal.connect.netconf`` in the Karaf
554 shell. Seeing the NETCONF RPCs might help with debugging.
556 This request is very similar to the one where we spawned a new netconf
557 device. That’s because we used the loopback netconf-connector to write
558 configuration data into config-subsystem datastore and config-subsystem
559 picked it up from there.
564 Devices can implement any additional RPC and as long as it provides YANG
565 models for it, it can be invoked from OpenDaylight. Following example
566 shows how to invoke the get-schema RPC (get-schema is quite common among
567 netconf devices). Invoke:
570 http://localhost:8181/restconf/operations/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device/yang-ext:mount/ietf-netconf-monitoring:get-schema
574 <input xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
575 <identifier>ietf-yang-types</identifier>
576 <version>2013-07-15</version>
579 This call should fetch the source for ietf-yang-types YANG model from
582 Netconf-connector + Netopeer
583 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
585 `Netopeer <https://github.com/cesnet/netopeer>`__ (an open-source
586 NETCONF server) can be used for testing/exploring NETCONF southbound in
589 Netopeer installation
590 ^^^^^^^^^^^^^^^^^^^^^
592 A `Docker <https://www.docker.com/>`__ container with netopeer will be
593 used in this guide. To install Docker and start the `netopeer
594 image <https://index.docker.io/u/dockeruser/netopeer/>`__ perform
597 1. Install docker http://docs.docker.com/linux/step_one/
599 2. Start the netopeer image:
603 docker run --rm -t -p 1831:830 dockeruser/netopeer
605 3. Verify netopeer is running by invoking (netopeer should send its
606 HELLO message right away:
610 ssh root@localhost -p 1831 -s netconf
613 Mounting netopeer NETCONF server
614 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
618 - OpenDaylight is started with features ``odl-restconf-all`` and
619 ``odl-netconf-connector-all``.
621 - Netopeer is up and running in docker
623 Now just follow the chapter: `Spawning
624 netconf-connector <#_spawning_additional_netconf_connectors_while_the_controller_is_running>`__.
625 In the payload change the:
627 - name, e.g., to netopeer
629 - username/password to your system credentials
635 After netopeer is mounted successfully, its configuration can be read
636 using RESTCONF by invoking:
639 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/netopeer/yang-ext:mount/
641 Northbound (NETCONF servers)
642 ----------------------------
644 OpenDaylight provides 2 types of NETCONF servers:
646 - **NETCONF server for config-subsystem (listening by default on port
649 - Serves as a default interface for config-subsystem and allows
650 users to spawn/reconfigure/destroy modules (or applications) in
653 - **NETCONF server for MD-SAL (listening by default on port 2830)**
655 - Serves as an alternative interface for MD-SAL (besides RESTCONF)
656 and allows users to read/write data from MD-SAL’s datastore and to
657 invoke its rpcs (NETCONF notifications are not available in the
658 Boron release of OpenDaylight)
662 The reason for having 2 NETCONF servers is that config-subsystem and
663 MD-SAL are 2 different components of OpenDaylight and require
664 different approach for NETCONF message handling and data
665 translation. These 2 components will probably merge in the future.
669 Since Nitrogen release, there is performance regression in NETCONF
670 servers accepting SSH connections. While opening a connection takes
671 less than 10 seconds on Carbon, on Nitrogen time can increase up to
672 60 seconds. Please see https://bugs.opendaylight.org/show_bug.cgi?id=9020
674 NETCONF server for config-subsystem
675 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
677 This NETCONF server is the primary interface for config-subsystem. It
678 allows the users to interact with config-subsystem in a standardized
681 In terms of RFCs, these are supported:
683 - `RFC-6241 <http://tools.ietf.org/html/rfc6241>`__
685 - `RFC-5277 <https://tools.ietf.org/html/rfc5277>`__
687 - `RFC-6470 <https://tools.ietf.org/html/rfc6470>`__
689 - (partially, only the schema-change notification is available in
692 - `RFC-6022 <https://tools.ietf.org/html/rfc6022>`__
694 For regular users it is recommended to use RESTCONF + the
695 controller-config loopback mountpoint instead of using pure NETCONF. How
696 to do that is spesific for each component/module/application in
697 OpenDaylight and can be found in their dedicated user guides.
699 NETCONF server for MD-SAL
700 ~~~~~~~~~~~~~~~~~~~~~~~~~
702 This NETCONF server is just a generic interface to MD-SAL in
703 OpenDaylight. It uses the stadard MD-SAL APIs and serves as an
704 alternative to RESTCONF. It is fully model driven and supports any data
705 and rpcs that are supported by MD-SAL.
707 In terms of RFCs, these are supported:
709 - `RFC-6241 <http://tools.ietf.org/html/rfc6241>`__
711 - `RFC-6022 <https://tools.ietf.org/html/rfc6022>`__
713 - `draft-ietf-netconf-yang-library-06 <https://tools.ietf.org/html/draft-ietf-netconf-yang-library-06>`__
715 Notifications over NETCONF are not supported in the Boron release.
719 Install NETCONF northbound for MD-SAL by installing feature:
720 ``odl-netconf-mdsal`` in karaf. Default binding port is **2830**.
725 The default configuration can be found in file: *08-netconf-mdsal.xml*.
726 The file contains the configuration for all necessary dependencies and a
727 single SSH endpoint starting on port 2830. There is also a (by default
728 disabled) TCP endpoint. It is possible to start multiple endpoints at
729 the same time either in the initial configuration file or while
730 OpenDaylight is running.
732 The credentials for SSH endpoint can also be configured here, the
733 defaults are admin/admin. Credentials in the SSH endpoint are not yet
734 managed by the centralized AAA component and have to be configured
737 Verifying MD-SAL’s NETCONF server
738 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
740 After the NETCONF server is available it can be examined by a command
745 ssh admin@localhost -p 2830 -s netconf
747 The server will respond by sending its HELLO message and can be used as
748 a regular NETCONF server from then on.
750 Mounting the MD-SAL’s NETCONF server
751 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
753 To perform this operation, just spawn a new netconf-connector as
754 described in `Spawning
755 netconf-connector <#_spawning_additional_netconf_connectors_while_the_controller_is_running>`__.
756 Just change the ip to "127.0.0.1" port to "2830" and its name to
759 Now the MD-SAL’s datastore can be read over RESTCONF via NETCONF by
763 http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/controller-mdsal/yang-ext:mount
767 This might not seem very useful, since MD-SAL can be accessed
768 directly from RESTCONF or from Application code, but the same method
769 can be used to mount and control other OpenDaylight instances by the
770 "master OpenDaylight".
772 NETCONF stress/performance measuring tool
773 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
775 This is basically a NETCONF client that puts NETCONF servers under heavy
776 load of NETCONF RPCs and measures the time until a configurable amount
777 of them is processed.
779 RESTCONF stress-performance measuring tool
780 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
782 Very similar to NETCONF stress tool with the difference of using
783 RESTCONF protocol instead of NETCONF.
785 YANGLIB remote repository
786 -------------------------
788 There are scenarios in NETCONF deployment, that require for a centralized
789 YANG models repository. YANGLIB plugin provides such remote repository.
791 To start this plugin, you have to install odl-yanglib feature. Then you
792 have to configure YANGLIB either through RESTCONF or NETCONF. We will
793 show how to configure YANGLIB through RESTCONF.
795 YANGLIB configuration through RESTCONF
796 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
798 You have to specify what local YANG modules directory you want to provide.
799 Then you have to specify address and port whre you want to provide YANG
800 sources. For example, we want to serve yang sources from folder /sources
801 on localhost:5000 adress. The configuration for this scenario will be
806 PUT http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules/module/yanglib:yanglib/example
810 - Accept: application/xml
812 - Content-Type: application/xml
818 <module xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
820 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:yanglib:impl">prefix:yanglib</type>
821 <broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:yanglib:impl">
822 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type>
823 <name>binding-osgi-broker</name>
825 <cache-folder xmlns="urn:opendaylight:params:xml:ns:yang:controller:yanglib:impl">/sources</cache-folder>
826 <binding-addr xmlns="urn:opendaylight:params:xml:ns:yang:controller:yanglib:impl">localhost</binding-addr>
827 <binding-port xmlns="urn:opendaylight:params:xml:ns:yang:controller:yanglib:impl">5000</binding-port>
830 This should result in a 2xx response and new YANGLIB instance should be
831 created. This YANGLIB takes all YANG sources from /sources folder and
832 for each generates URL in form:
836 http://localhost:5000/schemas/{modelName}/{revision}
838 On this URL will be hosted YANG source for particular module.
840 YANGLIB instance also write this URL along with source identifier to
841 ietf-netconf-yang-library/modules-state/module list.
843 Netconf-connector with YANG library as fallback
844 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
846 There is an optional configuration in netconf-connector called
847 yang-library. You can specify YANG library to be plugged as additional
848 source provider into the mount's schema repository. Since YANGLIB
849 plugin is advertising provided modules through yang-library model, we
850 can use it in mount point's configuration as YANG library. To do this,
851 we need to modify the configuration of netconf-connector by adding this
856 <yang-library xmlns="urn:opendaylight:netconf-node-topology">
857 <yang-library-url xmlns="urn:opendaylight:netconf-node-topology">http://localhost:8181/restconf/operational/ietf-yang-library:modules-state</yang-library-url>
858 <username xmlns="urn:opendaylight:netconf-node-topology">admin</username>
859 <password xmlns="urn:opendaylight:netconf-node-topology">admin</password>
862 This will register YANGLIB provided sources as a fallback schemas for
863 particular mount point.
870 The call home feature is experimental and will change in a future
871 release. In particular, the Yang models will change to those specified
872 in the `RFC 8071 <https://tools.ietf.org/html/rfc8071>`__
874 Call Home Installation
875 ~~~~~~~~~~~~~~~~~~~~~~
877 ODL Call-Home server is installed in Karaf by installing karaf feature
878 ``odl-netconf-callhome-ssh``. RESTCONF feature is recommended for
879 configuring Call Home & testing its functionality.
883 feature:install odl-netconf-callhome-ssh
888 In order to test Call Home functionality we recommend Netopeer.
889 See `Netopeer Call Home <https://github.com/CESNET/netopeer/wiki/CallHome>`__ to learn how to enable call-home on Netopeer.
891 Northbound Call-Home API
892 ~~~~~~~~~~~~~~~~~~~~~~~~
894 The northbound Call Home API is used for administering the Call-Home Server. The
895 following describes this configuration.
900 Configuring global credentials
901 ''''''''''''''''''''''''''''''
903 ODL Call-Home server allows user to configure global credentials, which
904 will be used for devices which does not have device-specific credentials
907 This is done by creating
908 ``/odl-netconf-callhome-server:netconf-callhome-server/global/credentials``
909 with username and passwords specified.
911 *Configuring global username & passwords to try*
916 /restconf/config/odl-netconf-callhome-server:netconf-callhome-server/global/credentials HTTP/1.1
917 Content-Type: application/json
918 Accept: application/json
925 "username": "example",
926 "passwords": [ "first-password-to-try", "second-password-to-try" ]
930 Configuring to accept any ssh server key using global credentials
931 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
933 By default Netconf Call-Home Server accepts only incoming connections
935 ``/odl-netconf-callhome-server:netconf-callhome-server/allowed-devices``,
936 if user desire to allow all incoming connections, it is possible to set
937 ``accept-all-ssh-keys`` to ``true`` in
938 ``/odl-netconf-callhome-server:netconf-callhome-server/global``.
940 The name of this devices in ``netconf-topology`` will be in format
941 ``ip-address:port``. For naming devices see Device-Specific
944 *Allowing unknown devices to connect*
946 This is a debug feature and should not be used in production. Besides being an obvious
947 security issue, this also causes the Call-Home Server to drastically increase its output
953 /restconf/config/odl-netconf-callhome-server:netconf-callhome-server/global HTTP/1.1
954 Content-Type: application/json
955 Accept: application/json
961 "accept-all-ssh-keys": "true"
965 Device-Specific Configuration
966 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
968 Allowing Device & Configuring Name
969 ''''''''''''''''''''''''''''''''''
971 Netconf Call Home Server uses device provided SSH server key (host key)
972 to identify device. The pairing of name and server key is configured in
973 ``/odl-netconf-callhome-server:netconf-callhome-server/allowed-devices``.
974 This list is colloquially called a whitelist.
976 If the Call-Home Server finds the SSH host key in the whitelist, it continues
977 to negotiate a NETCONF connection over an SSH session. If the SSH host key is
978 not found, the connection between the Call Home server and the device is dropped
979 immediately. In either case, the device that connects to the Call home server
980 leaves a record of its presence in the operational store.
982 *Example of configuring device*
987 /restconf/config/odl-netconf-callhome-server:netconf-callhome-server/allowed-devices/device/example HTTP/1.1
988 Content-Type: application/json
989 Accept: application/json
995 "unique-id": "example",
996 "ssh-host-key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDHoH1jMjltOJnCt999uaSfc48ySutaD3ISJ9fSECe1Spdq9o9mxj0kBTTTq+2V8hPspuW75DNgN+V/rgJeoUewWwCAasRx9X4eTcRrJrwOQKzb5Fk+UKgQmenZ5uhLAefi2qXX/agFCtZi99vw+jHXZStfHm9TZCAf2zi+HIBzoVksSNJD0VvPo66EAvLn5qKWQD4AdpQQbKqXRf5/W8diPySbYdvOP2/7HFhDukW8yV/7ZtcywFUIu3gdXsrzwMnTqnATSLPPuckoi0V2jd8dQvEcu1DY+rRqmqu0tEkFBurlRZDf1yhNzq5xWY3OXcjgDGN+RxwuWQK3cRimcosH"
1000 Configuring Device with Device-specific Credentials
1001 '''''''''''''''''''''''''''''''''''''''''''''''''''
1003 Call Home Server also allows to configure credentials per device basis,
1004 this is done by introducing ``credentials`` container into
1005 device-specific configuration. Format is same as in global credentials.
1007 *Configuring Device with Credentials*
1009 .. code-block:: none
1012 /restconf/config/odl-netconf-callhome-server:netconf-callhome-server/allowed-devices/device/example HTTP/1.1
1013 Content-Type: application/json
1014 Accept: application/json
1016 .. code-block:: json
1020 "unique-id": "example",
1022 "username": "example",
1023 "passwords": [ "password" ]
1025 "ssh-host-key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDHoH1jMjltOJnCt999uaSfc48ySutaD3ISJ9fSECe1Spdq9o9mxj0kBTTTq+2V8hPspuW75DNgN+V/rgJeoUewWwCAasRx9X4eTcRrJrwOQKzb5Fk+UKgQmenZ5uhLAefi2qXX/agFCtZi99vw+jHXZStfHm9TZCAf2zi+HIBzoVksSNJD0VvPo66EAvLn5qKWQD4AdpQQbKqXRf5/W8diPySbYdvOP2/7HFhDukW8yV/7ZtcywFUIu3gdXsrzwMnTqnATSLPPuckoi0V2jd8dQvEcu1DY+rRqmqu0tEkFBurlRZDf1yhNzq5xWY3OXcjgDGN+RxwuWQK3cRimcosH"
1032 Once an entry is made into the config side of "allowed-devices", the Call-Home Server will
1033 populate an corresponding operational device that is the same as the config device but
1034 has an additional status. By default, this status is *DISCONNECTED*. Once a device calls
1035 home, this status will change to one of:
1037 *CONNECTED* — The device is currently connected and the NETCONF mount is available for network
1040 *FAILED_AUTH_FAILURE* — The last attempted connection was unsuccessful because the Call-Home
1041 Server was unable to provide the acceptable credentials of the device. The device is also
1042 disconnected and not available for network management.
1044 *FAILED_NOT_ALLOWED* — The last attempted connection was unsuccessful because the device was
1045 not recognized as an acceptable device. The device is also disconnected and not available for
1048 *FAILED* — The last attempted connection was unsuccessful for a reason other than not
1049 allowed to connect or incorrect client credentials. The device is also disconnected and not
1050 available for network management.
1052 *DISCONNECTED* — The device is currently disconnected.
1057 Devices which are not on the whitelist might try to connect to the Call-Home Server. In
1058 these cases, the server will keep a record by instantiating an operational device. There
1059 will be no corresponding config device for these rogues. They can be identified readily
1060 because their device id, rather than being user-supplied, will be of the form
1061 "address:port". Note that if a device calls back multiple times, there will only be
1062 a single operatinal entry (even if the port changes); these devices are recognized by
1063 their unique host key.
1065 Southbound Call-Home API
1066 ~~~~~~~~~~~~~~~~~~~~~~~~
1068 The Call-Home Server listens for incoming TCP connections and assumes that the other side of
1069 the connection is a device calling home via a NETCONF connection with SSH for
1070 management. The server uses port 6666 by default and this can be configured via a
1071 blueprint configuration file.
1073 The device **must** initiate the connection and the server will not try to re-establish the
1074 connection in case of a drop. By requirement, the server cannot assume it has connectivity
1075 to the device due to NAT or firewalls among others.