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>`__.
104 Examples in the `Spawning new NETCONF connectors`_ section include both bierman02 and rfc8040
108 Default configuration
109 ^^^^^^^^^^^^^^^^^^^^^
111 The default configuration contains all the necessary dependencies (file:
112 01-netconf.xml) and a single instance of netconf-connector (file:
113 99-netconf-connector.xml) called **controller-config** which connects
114 itself to the NETCONF northbound in OpenDaylight in a loopback fashion.
115 The connector mounts the NETCONF server for config-subsystem in order to
116 enable RESTCONF protocol for config-subsystem. This RESTCONF still goes
117 via NETCONF, but using RESTCONF is much more user friendly than using
120 Spawning additional netconf-connectors while the controller is running
121 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
125 1. OpenDaylight is running
127 2. In Karaf, you must have the netconf-connector installed (at the Karaf
128 prompt, type: ``feature:install odl-netconf-connector-all``); the
129 loopback NETCONF mountpoint will be automatically configured and
132 3. Wait until log displays following entry:
133 RemoteDevice{controller-config}: NETCONF connector initialized
136 To configure a new netconf-connector you need to send following request
140 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules
144 - Accept application/xml
146 - Content-Type application/xml
150 <module xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
151 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">prefix:sal-netconf-connector</type>
152 <name>new-netconf-device</name>
153 <address xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">127.0.0.1</address>
154 <port xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">830</port>
155 <username xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">admin</username>
156 <password xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">admin</password>
157 <tcp-only xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">false</tcp-only>
158 <event-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
159 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-event-executor</type>
160 <name>global-event-executor</name>
162 <binding-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
163 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type>
164 <name>binding-osgi-broker</name>
166 <dom-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
167 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">prefix:dom-broker-osgi-registry</type>
168 <name>dom-broker</name>
170 <client-dispatcher xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
171 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf">prefix:netconf-client-dispatcher</type>
172 <name>global-netconf-dispatcher</name>
174 <processing-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
175 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:threadpool</type>
176 <name>global-netconf-processing-executor</name>
177 </processing-executor>
178 <keepalive-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
179 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:scheduled-threadpool</type>
180 <name>global-netconf-ssh-scheduled-executor</name>
181 </keepalive-executor>
184 This spawns a new netconf-connector which tries to connect to (or mount)
185 a NETCONF device at 127.0.0.1 and port 830. You can check the
186 configuration of config-subsystem’s configuration datastore. The new
187 netconf-connector will now be present there. Just invoke:
190 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules
192 The response will contain the module for new-netconf-device.
194 Right after the new netconf-connector is created, it writes some useful
195 metadata into the datastore of MD-SAL under the network-topology
196 subtree. This metadata can be found at:
199 http://localhost:8181/restconf/operational/network-topology:network-topology/
201 Information about connection status, device capabilities, etc. can be
204 Connecting to a device not supporting NETCONF monitoring
205 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
207 The netconf-connector in OpenDaylight relies on ietf-netconf-monitoring
208 support when connecting to remote NETCONF device. The
209 ietf-netconf-monitoring support allows netconf-connector to list and
210 download all YANG schemas that are used by the device. NETCONF connector
211 can only communicate with a device if it knows the set of used schemas
212 (or at least a subset). However, some devices use YANG models internally
213 but do not support NETCONF monitoring. Netconf-connector can also
214 communicate with these devices, but you have to side load the necessary
215 yang models into OpenDaylight’s YANG model cache for netconf-connector.
216 In general there are 2 situations you might encounter:
218 **1. NETCONF device does not support ietf-netconf-monitoring but it does
219 list all its YANG models as capabilities in HELLO message**
221 This could be a device that internally uses only ietf-inet-types YANG
222 model with revision 2010-09-24. In the HELLO message that is sent from
223 this device there is this capability reported:
227 urn:ietf:params:xml:ns:yang:ietf-inet-types?module=ietf-inet-types&revision=2010-09-24
229 **For such devices you only need to put the schema into folder
230 cache/schema inside your Karaf distribution.**
234 The file with YANG schema for ietf-inet-types has to be called
235 ietf-inet-types@2010-09-24.yang. It is the required naming format of
238 **2. NETCONF device does not support ietf-netconf-monitoring and it does
239 NOT list its YANG models as capabilities in HELLO message**
241 Compared to device that lists its YANG models in HELLO message, in this
242 case there would be no capability with ietf-inet-types in the HELLO
243 message. This type of device basically provides no information about the
244 YANG schemas it uses so its up to the user of OpenDaylight to properly
245 configure netconf-connector for this device.
247 Netconf-connector has an optional configuration attribute called
248 yang-module-capabilities and this attribute can contain a list of "YANG
249 module based" capabilities. So by setting this configuration attribute,
250 it is possible to override the "yang-module-based" capabilities reported
251 in HELLO message of the device. To do this, we need to modify the
252 configuration of netconf-connector by adding this XML (It needs to be
253 added next to the address, port, username etc. configuration elements):
257 <yang-module-capabilities xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
258 <capability xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
259 urn:ietf:params:xml:ns:yang:ietf-inet-types?module=ietf-inet-types&revision=2010-09-24
261 </yang-module-capabilities>
263 **Remember to also put the YANG schemas into the cache folder.**
267 For putting multiple capabilities, you just need to replicate the
268 capability xml element inside yang-module-capability element.
269 Capability element is modeled as a leaf-list. With this
270 configuration, we would make the remote device report usage of
271 ietf-inet-types in the eyes of netconf-connector.
273 Reconfiguring Netconf-Connector While the Controller is Running
274 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
276 It is possible to change the configuration of a running module while the
277 whole controller is running. This example will continue where the last
278 left off and will change the configuration for the brand new
279 netconf-connector after it was spawned. Using one RESTCONF request, we
280 will change both username and password for the netconf-connector.
282 To update an existing netconf-connector you need to send following
286 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
290 <module xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
291 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">prefix:sal-netconf-connector</type>
292 <name>new-netconf-device</name>
293 <username xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">bob</username>
294 <password xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">passwd</password>
295 <tcp-only xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">false</tcp-only>
296 <event-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
297 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-event-executor</type>
298 <name>global-event-executor</name>
300 <binding-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
301 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type>
302 <name>binding-osgi-broker</name>
304 <dom-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
305 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">prefix:dom-broker-osgi-registry</type>
306 <name>dom-broker</name>
308 <client-dispatcher xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
309 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf">prefix:netconf-client-dispatcher</type>
310 <name>global-netconf-dispatcher</name>
312 <processing-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
313 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:threadpool</type>
314 <name>global-netconf-processing-executor</name>
315 </processing-executor>
316 <keepalive-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
317 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:scheduled-threadpool</type>
318 <name>global-netconf-ssh-scheduled-executor</name>
319 </keepalive-executor>
322 Since a PUT is a replace operation, the whole configuration must be
323 specified along with the new values for username and password. This
324 should result in a 2xx response and the instance of netconf-connector
325 called new-netconf-device will be reconfigured to use username bob and
326 password passwd. New configuration can be verified by executing:
329 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
331 With new configuration, the old connection will be closed and a new one
334 Destroying Netconf-Connector While the Controller is Running
335 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
337 Using RESTCONF one can also destroy an instance of a module. In case of
338 netconf-connector, the module will be destroyed, NETCONF connection
339 dropped and all resources will be cleaned. To do this, simply issue a
340 request to following URL:
343 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
345 The last element of the URL is the name of the instance and its
346 predecessor is the type of that module (In our case the type is
347 **sal-netconf-connector** and name **new-netconf-device**). The type and
348 name are actually the keys of the module list.
350 Netconf-connector configuration with MD-SAL
351 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
353 It is also possible to configure new NETCONF connectors directly through
354 MD-SAL with the usage of the network-topology model. You can configure
355 new NETCONF connectors both through the NETCONF server for MD-SAL (port
356 2830) or RESTCONF. This guide focuses on RESTCONF.
360 To enable NETCONF connector configuration through MD-SAL install
361 either the ``odl-netconf-topology`` or
362 ``odl-netconf-clustered-topology`` feature. We will explain the
363 difference between these features later.
368 1. OpenDaylight is running
370 2. In Karaf, you must have the ``odl-netconf-topology`` or
371 ``odl-netconf-clustered-topology`` feature installed.
373 3. Feature ``odl-restconf`` must be installed
375 4. Wait until log displays following entry:
379 Successfully pushed configuration snapshot 02-netconf-topology.xml(odl-netconf-topology,odl-netconf-topology)
385 GET http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/
387 returns a non-empty response, for example:
391 <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
392 <topology-id>topology-netconf</topology-id>
395 Spawning new NETCONF connectors
396 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
398 To create a new NETCONF connector you need to send the following PUT request
405 - http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device
407 - http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=new-netconf-device
409 You could use the same body to create the new NETCONF connector with a POST
410 without specifying the node in the URL:
416 - http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf
418 - http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf
422 - Accept: application/xml
424 - Content-Type: application/xml
430 <node xmlns="urn:TBD:params:xml:ns:yang:network-topology">
431 <node-id>new-netconf-device</node-id>
432 <host xmlns="urn:opendaylight:netconf-node-topology">127.0.0.1</host>
433 <port xmlns="urn:opendaylight:netconf-node-topology">17830</port>
434 <username xmlns="urn:opendaylight:netconf-node-topology">admin</username>
435 <password xmlns="urn:opendaylight:netconf-node-topology">admin</password>
436 <tcp-only xmlns="urn:opendaylight:netconf-node-topology">false</tcp-only>
437 <!-- non-mandatory fields with default values, you can safely remove these if you do not wish to override any of these values-->
438 <reconnect-on-changed-schema xmlns="urn:opendaylight:netconf-node-topology">false</reconnect-on-changed-schema>
439 <connection-timeout-millis xmlns="urn:opendaylight:netconf-node-topology">20000</connection-timeout-millis>
440 <max-connection-attempts xmlns="urn:opendaylight:netconf-node-topology">0</max-connection-attempts>
441 <between-attempts-timeout-millis xmlns="urn:opendaylight:netconf-node-topology">2000</between-attempts-timeout-millis>
442 <sleep-factor xmlns="urn:opendaylight:netconf-node-topology">1.5</sleep-factor>
443 <!-- keepalive-delay set to 0 turns off keepalives-->
444 <keepalive-delay xmlns="urn:opendaylight:netconf-node-topology">120</keepalive-delay>
447 Note that the device name in <node-id> element must match the last
448 element of the restconf URL.
450 Reconfiguring an existing connector
451 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
453 The steps to reconfigure an existing connector are exactly the same as
454 when spawning a new connector. The old connection will be disconnected
455 and a new connector with the new configuration will be created. This needs
456 to be done with a PUT request because the node already exists. A POST
457 request will fail for that reason.
459 Additionally, a PATCH request can be used to modify an existing
460 configuration. Currently, only yang-patch (`RFC-8072 <https://tools.ietf.org/html/rfc8072>`__)
461 is supported. The URL would be the same as the above PUT examples.
462 Using JSON for the body, the headers needed for the request would
467 - Accept: application/yang.patch-status+json
469 - Content-Type: application/yang.patch+json
471 Example JSON payload to modify the password entry:
476 "ietf-restconf:yang-patch" : {
481 "operation" : "merge",
486 "node-id": "new-netconf-device",
487 "netconf-node-topology:password" : "newpassword"
497 Deleting an existing connector
498 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
500 To remove an already configured NETCONF connector you need to send a
501 DELETE request to the same PUT request URL that was used to create the
508 - http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device
510 - http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=new-netconf-device
514 No body is needed to delete the node/device
516 Connecting to a device supporting only NETCONF 1.0
517 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
519 OpenDaylight is schema-based distribution and heavily depends on YANG
520 models. However some legacy NETCONF devices are not schema-based and
521 implement just RFC 4741. This type of device does not utilize YANG
522 models internally and OpenDaylight does not know how to communicate
523 with such devices, how to validate data, or what the semantics of data
526 NETCONF connector can communicate also with these devices, but the
527 trade-offs are worsened possibilities in utilization of NETCONF
528 mountpoints. Using RESTCONF with such devices is not suported. Also
529 communicating with schemaless devices from application code is slightly
532 To connect to schemaless device, there is a optional configuration option
533 in netconf-node-topology model called schemaless. You have to set this
536 Clustered NETCONF connector
537 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
539 To spawn NETCONF connectors that are cluster-aware you need to install
540 the ``odl-netconf-clustered-topology`` karaf feature.
544 The ``odl-netconf-topology`` and ``odl-netconf-clustered-topology``
545 features are considered **INCOMPATIBLE**. They both manage the same
546 space in the datastore and would issue conflicting writes if
549 Configuration of clustered NETCONF connectors works the same as the
550 configuration through the topology model in the previous section.
552 When a new clustered connector is configured the configuration gets
553 distributed among the member nodes and a NETCONF connector is spawned on
554 each node. From these nodes a master is chosen which handles the schema
555 download from the device and all the communication with the device. You
556 will be able to read/write to/from the device from all slave nodes due
557 to the proxy data brokers implemented.
559 You can use the ``odl-netconf-clustered-topology`` feature in a single
560 node scenario as well but the code that uses akka will be used, so for a
561 scenario where only a single node is used, ``odl-netconf-topology``
564 Netconf-connector utilization
565 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
567 Once the connector is up and running, users can utilize the new mount
568 point instance. By using RESTCONF or from their application code. This
569 chapter deals with using RESTCONF and more information for app
570 developers can be found in the developers guide or in the official
571 tutorial application **ncmount** that can be found in the coretutorials
574 - https://github.com/opendaylight/coretutorials/tree/master/ncmount
576 Reading data from the device
577 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
579 Just invoke (no body needed):
582 http://localhost:8080/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device/yang-ext:mount/
584 This will return the entire content of operation datastore from the
585 device. To view just the configuration datastore, change **operational**
586 in this URL to **config**.
588 Writing configuration data to the device
589 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
591 In general, you cannot simply write any data you want to the device. The
592 data have to conform to the YANG models implemented by the device. In
593 this example we are adding a new interface-configuration to the mounted
594 device (assuming the device supports Cisco-IOS-XR-ifmgr-cfg YANG model).
595 In fact this request comes from the tutorial dedicated to the
596 **ncmount** tutorial app.
599 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
603 <interface-configuration xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg">
605 <interface-name>mpls</interface-name>
606 <description>Interface description</description>
607 <bandwidth>32</bandwidth>
608 <link-status></link-status>
609 </interface-configuration>
611 Should return 200 response code with no body.
615 This call is transformed into a couple of NETCONF RPCs. Resulting
616 NETCONF RPCs that go directly to the device can be found in the
617 OpenDaylight logs after invoking ``log:set TRACE
618 org.opendaylight.controller.sal.connect.netconf`` in the Karaf
619 shell. Seeing the NETCONF RPCs might help with debugging.
621 This request is very similar to the one where we spawned a new netconf
622 device. That’s because we used the loopback netconf-connector to write
623 configuration data into config-subsystem datastore and config-subsystem
624 picked it up from there.
629 Devices can implement any additional RPC and as long as it provides YANG
630 models for it, it can be invoked from OpenDaylight. Following example
631 shows how to invoke the get-schema RPC (get-schema is quite common among
632 netconf devices). Invoke:
635 http://localhost:8181/restconf/operations/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device/yang-ext:mount/ietf-netconf-monitoring:get-schema
639 <input xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
640 <identifier>ietf-yang-types</identifier>
641 <version>2013-07-15</version>
644 This call should fetch the source for ietf-yang-types YANG model from
647 Netconf-connector + Netopeer
648 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
650 `Netopeer <https://github.com/cesnet/netopeer>`__ (an open-source
651 NETCONF server) can be used for testing/exploring NETCONF southbound in
654 Netopeer installation
655 ^^^^^^^^^^^^^^^^^^^^^
657 A `Docker <https://www.docker.com/>`__ container with netopeer will be
658 used in this guide. To install Docker and start the `netopeer
659 image <https://index.docker.io/u/dockeruser/netopeer/>`__ perform
662 1. Install docker http://docs.docker.com/linux/step_one/
664 2. Start the netopeer image:
668 docker run --rm -t -p 1831:830 dockeruser/netopeer
670 3. Verify netopeer is running by invoking (netopeer should send its
671 HELLO message right away:
675 ssh root@localhost -p 1831 -s netconf
678 Mounting netopeer NETCONF server
679 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
683 - OpenDaylight is started with features ``odl-restconf-all`` and
684 ``odl-netconf-connector-all``.
686 - Netopeer is up and running in docker
688 Now just follow the section: `Spawning new NETCONF connectors`_.
689 In the payload change the:
691 - name, e.g., to netopeer
693 - username/password to your system credentials
699 After netopeer is mounted successfully, its configuration can be read
700 using RESTCONF by invoking:
703 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/netopeer/yang-ext:mount/
705 Northbound (NETCONF servers)
706 ----------------------------
708 OpenDaylight provides 2 types of NETCONF servers:
710 - **NETCONF server for config-subsystem (listening by default on port
713 - Serves as a default interface for config-subsystem and allows
714 users to spawn/reconfigure/destroy modules (or applications) in
717 - **NETCONF server for MD-SAL (listening by default on port 2830)**
719 - Serves as an alternative interface for MD-SAL (besides RESTCONF)
720 and allows users to read/write data from MD-SAL’s datastore and to
721 invoke its rpcs (NETCONF notifications are not available in the
722 Boron release of OpenDaylight)
726 The reason for having 2 NETCONF servers is that config-subsystem and
727 MD-SAL are 2 different components of OpenDaylight and require
728 different approach for NETCONF message handling and data
729 translation. These 2 components will probably merge in the future.
733 Since Nitrogen release, there is performance regression in NETCONF
734 servers accepting SSH connections. While opening a connection takes
735 less than 10 seconds on Carbon, on Nitrogen time can increase up to
736 60 seconds. Please see https://bugs.opendaylight.org/show_bug.cgi?id=9020
738 NETCONF server for config-subsystem
739 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
741 This NETCONF server is the primary interface for config-subsystem. It
742 allows the users to interact with config-subsystem in a standardized
745 In terms of RFCs, these are supported:
747 - `RFC-6241 <http://tools.ietf.org/html/rfc6241>`__
749 - `RFC-5277 <https://tools.ietf.org/html/rfc5277>`__
751 - `RFC-6470 <https://tools.ietf.org/html/rfc6470>`__
753 - (partially, only the schema-change notification is available in
756 - `RFC-6022 <https://tools.ietf.org/html/rfc6022>`__
758 For regular users it is recommended to use RESTCONF + the
759 controller-config loopback mountpoint instead of using pure NETCONF. How
760 to do that is spesific for each component/module/application in
761 OpenDaylight and can be found in their dedicated user guides.
763 NETCONF server for MD-SAL
764 ~~~~~~~~~~~~~~~~~~~~~~~~~
766 This NETCONF server is just a generic interface to MD-SAL in
767 OpenDaylight. It uses the stadard MD-SAL APIs and serves as an
768 alternative to RESTCONF. It is fully model driven and supports any data
769 and rpcs that are supported by MD-SAL.
771 In terms of RFCs, these are supported:
773 - `RFC-6241 <http://tools.ietf.org/html/rfc6241>`__
775 - `RFC-6022 <https://tools.ietf.org/html/rfc6022>`__
777 - `draft-ietf-netconf-yang-library-06 <https://tools.ietf.org/html/draft-ietf-netconf-yang-library-06>`__
779 Notifications over NETCONF are not supported in the Boron release.
783 Install NETCONF northbound for MD-SAL by installing feature:
784 ``odl-netconf-mdsal`` in karaf. Default binding port is **2830**.
789 The default configuration can be found in file: *08-netconf-mdsal.xml*.
790 The file contains the configuration for all necessary dependencies and a
791 single SSH endpoint starting on port 2830. There is also a (by default
792 disabled) TCP endpoint. It is possible to start multiple endpoints at
793 the same time either in the initial configuration file or while
794 OpenDaylight is running.
796 The credentials for SSH endpoint can also be configured here, the
797 defaults are admin/admin. Credentials in the SSH endpoint are not yet
798 managed by the centralized AAA component and have to be configured
801 Verifying MD-SAL’s NETCONF server
802 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
804 After the NETCONF server is available it can be examined by a command
809 ssh admin@localhost -p 2830 -s netconf
811 The server will respond by sending its HELLO message and can be used as
812 a regular NETCONF server from then on.
814 Mounting the MD-SAL’s NETCONF server
815 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
817 To perform this operation, just spawn a new netconf-connector as
818 described in `Spawning new NETCONF connectors`_. Just change the ip to
819 "127.0.0.1" port to "2830" and its name to "controller-mdsal".
821 Now the MD-SAL’s datastore can be read over RESTCONF via NETCONF by
825 http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/controller-mdsal/yang-ext:mount
829 This might not seem very useful, since MD-SAL can be accessed
830 directly from RESTCONF or from Application code, but the same method
831 can be used to mount and control other OpenDaylight instances by the
832 "master OpenDaylight".
834 NETCONF stress/performance measuring tool
835 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
837 This is basically a NETCONF client that puts NETCONF servers under heavy
838 load of NETCONF RPCs and measures the time until a configurable amount
839 of them is processed.
841 RESTCONF stress-performance measuring tool
842 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
844 Very similar to NETCONF stress tool with the difference of using
845 RESTCONF protocol instead of NETCONF.
847 YANGLIB remote repository
848 -------------------------
850 There are scenarios in NETCONF deployment, that require for a centralized
851 YANG models repository. YANGLIB plugin provides such remote repository.
853 To start this plugin, you have to install odl-yanglib feature. Then you
854 have to configure YANGLIB either through RESTCONF or NETCONF. We will
855 show how to configure YANGLIB through RESTCONF.
857 YANGLIB configuration through RESTCONF
858 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
860 You have to specify what local YANG modules directory you want to provide.
861 Then you have to specify address and port whre you want to provide YANG
862 sources. For example, we want to serve yang sources from folder /sources
863 on localhost:5000 adress. The configuration for this scenario will be
868 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
872 - Accept: application/xml
874 - Content-Type: application/xml
880 <module xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
882 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:yanglib:impl">prefix:yanglib</type>
883 <broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:yanglib:impl">
884 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type>
885 <name>binding-osgi-broker</name>
887 <cache-folder xmlns="urn:opendaylight:params:xml:ns:yang:controller:yanglib:impl">/sources</cache-folder>
888 <binding-addr xmlns="urn:opendaylight:params:xml:ns:yang:controller:yanglib:impl">localhost</binding-addr>
889 <binding-port xmlns="urn:opendaylight:params:xml:ns:yang:controller:yanglib:impl">5000</binding-port>
892 This should result in a 2xx response and new YANGLIB instance should be
893 created. This YANGLIB takes all YANG sources from /sources folder and
894 for each generates URL in form:
898 http://localhost:5000/schemas/{modelName}/{revision}
900 On this URL will be hosted YANG source for particular module.
902 YANGLIB instance also write this URL along with source identifier to
903 ietf-netconf-yang-library/modules-state/module list.
905 Netconf-connector with YANG library as fallback
906 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
908 There is an optional configuration in netconf-connector called
909 yang-library. You can specify YANG library to be plugged as additional
910 source provider into the mount's schema repository. Since YANGLIB
911 plugin is advertising provided modules through yang-library model, we
912 can use it in mount point's configuration as YANG library. To do this,
913 we need to modify the configuration of netconf-connector by adding this
918 <yang-library xmlns="urn:opendaylight:netconf-node-topology">
919 <yang-library-url xmlns="urn:opendaylight:netconf-node-topology">http://localhost:8181/restconf/operational/ietf-yang-library:modules-state</yang-library-url>
920 <username xmlns="urn:opendaylight:netconf-node-topology">admin</username>
921 <password xmlns="urn:opendaylight:netconf-node-topology">admin</password>
924 This will register YANGLIB provided sources as a fallback schemas for
925 particular mount point.
932 The call home feature is experimental and will change in a future
933 release. In particular, the Yang models will change to those specified
934 in the `RFC 8071 <https://tools.ietf.org/html/rfc8071>`__
936 Call Home Installation
937 ~~~~~~~~~~~~~~~~~~~~~~
939 ODL Call-Home server is installed in Karaf by installing karaf feature
940 ``odl-netconf-callhome-ssh``. RESTCONF feature is recommended for
941 configuring Call Home & testing its functionality.
945 feature:install odl-netconf-callhome-ssh
950 In order to test Call Home functionality we recommend Netopeer.
951 See `Netopeer Call Home <https://github.com/CESNET/netopeer/wiki/CallHome>`__ to learn how to enable call-home on Netopeer.
953 Northbound Call-Home API
954 ~~~~~~~~~~~~~~~~~~~~~~~~
956 The northbound Call Home API is used for administering the Call-Home Server. The
957 following describes this configuration.
962 Configuring global credentials
963 ''''''''''''''''''''''''''''''
965 ODL Call-Home server allows user to configure global credentials, which
966 will be used for devices which does not have device-specific credentials
969 This is done by creating
970 ``/odl-netconf-callhome-server:netconf-callhome-server/global/credentials``
971 with username and passwords specified.
973 *Configuring global username & passwords to try*
978 /restconf/config/odl-netconf-callhome-server:netconf-callhome-server/global/credentials HTTP/1.1
979 Content-Type: application/json
980 Accept: application/json
987 "username": "example",
988 "passwords": [ "first-password-to-try", "second-password-to-try" ]
992 Configuring to accept any ssh server key using global credentials
993 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
995 By default Netconf Call-Home Server accepts only incoming connections
997 ``/odl-netconf-callhome-server:netconf-callhome-server/allowed-devices``,
998 if user desire to allow all incoming connections, it is possible to set
999 ``accept-all-ssh-keys`` to ``true`` in
1000 ``/odl-netconf-callhome-server:netconf-callhome-server/global``.
1002 The name of this devices in ``netconf-topology`` will be in format
1003 ``ip-address:port``. For naming devices see Device-Specific
1006 *Allowing unknown devices to connect*
1008 This is a debug feature and should not be used in production. Besides being an obvious
1009 security issue, this also causes the Call-Home Server to drastically increase its output
1012 .. code-block:: none
1015 /restconf/config/odl-netconf-callhome-server:netconf-callhome-server/global HTTP/1.1
1016 Content-Type: application/json
1017 Accept: application/json
1019 .. code-block:: json
1023 "accept-all-ssh-keys": "true"
1027 Device-Specific Configuration
1028 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1030 Allowing Device & Configuring Name
1031 ''''''''''''''''''''''''''''''''''
1033 Netconf Call Home Server uses device provided SSH server key (host key)
1034 to identify device. The pairing of name and server key is configured in
1035 ``/odl-netconf-callhome-server:netconf-callhome-server/allowed-devices``.
1036 This list is colloquially called a whitelist.
1038 If the Call-Home Server finds the SSH host key in the whitelist, it continues
1039 to negotiate a NETCONF connection over an SSH session. If the SSH host key is
1040 not found, the connection between the Call Home server and the device is dropped
1041 immediately. In either case, the device that connects to the Call home server
1042 leaves a record of its presence in the operational store.
1044 *Example of configuring device*
1046 .. code-block:: none
1049 /restconf/config/odl-netconf-callhome-server:netconf-callhome-server/allowed-devices/device/example HTTP/1.1
1050 Content-Type: application/json
1051 Accept: application/json
1053 .. code-block:: json
1057 "unique-id": "example",
1058 "ssh-host-key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDHoH1jMjltOJnCt999uaSfc48ySutaD3ISJ9fSECe1Spdq9o9mxj0kBTTTq+2V8hPspuW75DNgN+V/rgJeoUewWwCAasRx9X4eTcRrJrwOQKzb5Fk+UKgQmenZ5uhLAefi2qXX/agFCtZi99vw+jHXZStfHm9TZCAf2zi+HIBzoVksSNJD0VvPo66EAvLn5qKWQD4AdpQQbKqXRf5/W8diPySbYdvOP2/7HFhDukW8yV/7ZtcywFUIu3gdXsrzwMnTqnATSLPPuckoi0V2jd8dQvEcu1DY+rRqmqu0tEkFBurlRZDf1yhNzq5xWY3OXcjgDGN+RxwuWQK3cRimcosH"
1062 Configuring Device with Device-specific Credentials
1063 '''''''''''''''''''''''''''''''''''''''''''''''''''
1065 Call Home Server also allows to configure credentials per device basis,
1066 this is done by introducing ``credentials`` container into
1067 device-specific configuration. Format is same as in global credentials.
1069 *Configuring Device with Credentials*
1071 .. code-block:: none
1074 /restconf/config/odl-netconf-callhome-server:netconf-callhome-server/allowed-devices/device/example HTTP/1.1
1075 Content-Type: application/json
1076 Accept: application/json
1078 .. code-block:: json
1082 "unique-id": "example",
1084 "username": "example",
1085 "passwords": [ "password" ]
1087 "ssh-host-key": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDHoH1jMjltOJnCt999uaSfc48ySutaD3ISJ9fSECe1Spdq9o9mxj0kBTTTq+2V8hPspuW75DNgN+V/rgJeoUewWwCAasRx9X4eTcRrJrwOQKzb5Fk+UKgQmenZ5uhLAefi2qXX/agFCtZi99vw+jHXZStfHm9TZCAf2zi+HIBzoVksSNJD0VvPo66EAvLn5qKWQD4AdpQQbKqXRf5/W8diPySbYdvOP2/7HFhDukW8yV/7ZtcywFUIu3gdXsrzwMnTqnATSLPPuckoi0V2jd8dQvEcu1DY+rRqmqu0tEkFBurlRZDf1yhNzq5xWY3OXcjgDGN+RxwuWQK3cRimcosH"
1094 Once an entry is made into the config side of "allowed-devices", the Call-Home Server will
1095 populate an corresponding operational device that is the same as the config device but
1096 has an additional status. By default, this status is *DISCONNECTED*. Once a device calls
1097 home, this status will change to one of:
1099 *CONNECTED* — The device is currently connected and the NETCONF mount is available for network
1102 *FAILED_AUTH_FAILURE* — The last attempted connection was unsuccessful because the Call-Home
1103 Server was unable to provide the acceptable credentials of the device. The device is also
1104 disconnected and not available for network management.
1106 *FAILED_NOT_ALLOWED* — The last attempted connection was unsuccessful because the device was
1107 not recognized as an acceptable device. The device is also disconnected and not available for
1110 *FAILED* — The last attempted connection was unsuccessful for a reason other than not
1111 allowed to connect or incorrect client credentials. The device is also disconnected and not
1112 available for network management.
1114 *DISCONNECTED* — The device is currently disconnected.
1119 Devices which are not on the whitelist might try to connect to the Call-Home Server. In
1120 these cases, the server will keep a record by instantiating an operational device. There
1121 will be no corresponding config device for these rogues. They can be identified readily
1122 because their device id, rather than being user-supplied, will be of the form
1123 "address:port". Note that if a device calls back multiple times, there will only be
1124 a single operatinal entry (even if the port changes); these devices are recognized by
1125 their unique host key.
1127 Southbound Call-Home API
1128 ~~~~~~~~~~~~~~~~~~~~~~~~
1130 The Call-Home Server listens for incoming TCP connections and assumes that the other side of
1131 the connection is a device calling home via a NETCONF connection with SSH for
1132 management. The server uses port 6666 by default and this can be configured via a
1133 blueprint configuration file.
1135 The device **must** initiate the connection and the server will not try to re-establish the
1136 connection in case of a drop. By requirement, the server cannot assume it has connectivity
1137 to the device due to NAT or firewalls among others.