7 NETCONF is an XML-based protocol used for configuration and monitoring
8 devices in the network. The base NETCONF protocol is described in
9 `RFC-6241 <http://tools.ietf.org/html/rfc6241>`__.
11 **NETCONF in OpenDaylight:.**
13 OpenDaylight supports the NETCONF protocol as a northbound server as
14 well as a southbound plugin. It also includes a set of test tools for
15 simulating NETCONF devices and clients.
17 Southbound (netconf-connector)
18 ------------------------------
20 The NETCONF southbound plugin is capable of connecting to remote NETCONF
21 devices and exposing their configuration/operational datastores, RPCs
22 and notifications as MD-SAL mount points. These mount points allow
23 applications and remote users (over RESTCONF) to interact with the
26 In terms of RFCs, the connector supports:
28 - `RFC-6241 <http://tools.ietf.org/html/rfc6241>`__
30 - `RFC-5277 <https://tools.ietf.org/html/rfc5277>`__
32 - `RFC-6022 <https://tools.ietf.org/html/rfc6022>`__
34 - `draft-ietf-netconf-yang-library-06 <https://tools.ietf.org/html/draft-ietf-netconf-yang-library-06>`__
36 **Netconf-connector is fully model-driven (utilizing the YANG modeling
37 language) so in addition to the above RFCs, it supports any
38 data/RPC/notifications described by a YANG model that is implemented by
43 NETCONF southbound can be activated by installing
44 ``odl-netconf-connector-all`` Karaf feature.
46 Netconf-connector configuration
47 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49 There are 2 ways for configuring netconf-connector: NETCONF or RESTCONF.
50 This guide focuses on using RESTCONF.
55 The default configuration contains all the necessary dependencies (file:
56 01-netconf.xml) and a single instance of netconf-connector (file:
57 99-netconf-connector.xml) called **controller-config** which connects
58 itself to the NETCONF northbound in OpenDaylight in a loopback fashion.
59 The connector mounts the NETCONF server for config-subsystem in order to
60 enable RESTCONF protocol for config-subsystem. This RESTCONF still goes
61 via NETCONF, but using RESTCONF is much more user friendly than using
64 Spawning additional netconf-connectors while the controller is running
65 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
69 1. OpenDaylight is running
71 2. In Karaf, you must have the netconf-connector installed (at the Karaf
72 prompt, type: ``feature:install odl-netconf-connector-all``); the
73 loopback NETCONF mountpoint will be automatically configured and
76 3. Wait until log displays following entry:
77 RemoteDevice{controller-config}: NETCONF connector initialized
80 To configure a new netconf-connector you need to send following request
84 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules
88 - Accept application/xml
90 - Content-Type application/xml
94 <module xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
95 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">prefix:sal-netconf-connector</type>
96 <name>new-netconf-device</name>
97 <address xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">127.0.0.1</address>
98 <port xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">830</port>
99 <username xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">admin</username>
100 <password xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">admin</password>
101 <tcp-only xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">false</tcp-only>
102 <event-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
103 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-event-executor</type>
104 <name>global-event-executor</name>
106 <binding-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
107 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type>
108 <name>binding-osgi-broker</name>
110 <dom-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
111 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">prefix:dom-broker-osgi-registry</type>
112 <name>dom-broker</name>
114 <client-dispatcher xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
115 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf">prefix:netconf-client-dispatcher</type>
116 <name>global-netconf-dispatcher</name>
118 <processing-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
119 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:threadpool</type>
120 <name>global-netconf-processing-executor</name>
121 </processing-executor>
122 <keepalive-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
123 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:scheduled-threadpool</type>
124 <name>global-netconf-ssh-scheduled-executor</name>
125 </keepalive-executor>
128 This spawns a new netconf-connector which tries to connect to (or mount)
129 a NETCONF device at 127.0.0.1 and port 830. You can check the
130 configuration of config-subsystem’s configuration datastore. The new
131 netconf-connector will now be present there. Just invoke:
134 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/controller-config/yang-ext:mount/config:modules
136 The response will contain the module for new-netconf-device.
138 Right after the new netconf-connector is created, it writes some useful
139 metadata into the datastore of MD-SAL under the network-topology
140 subtree. This metadata can be found at:
143 http://localhost:8181/restconf/operational/network-topology:network-topology/
145 Information about connection status, device capabilities, etc. can be
148 Connecting to a device not supporting NETCONF monitoring
149 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
151 The netconf-connector in OpenDaylight relies on ietf-netconf-monitoring
152 support when connecting to remote NETCONF device. The
153 ietf-netconf-monitoring support allows netconf-connector to list and
154 download all YANG schemas that are used by the device. NETCONF connector
155 can only communicate with a device if it knows the set of used schemas
156 (or at least a subset). However, some devices use YANG models internally
157 but do not support NETCONF monitoring. Netconf-connector can also
158 communicate with these devices, but you have to side load the necessary
159 yang models into OpenDaylight’s YANG model cache for netconf-connector.
160 In general there are 2 situations you might encounter:
162 **1. NETCONF device does not support ietf-netconf-monitoring but it does
163 list all its YANG models as capabilities in HELLO message**
165 This could be a device that internally uses only ietf-inet-types YANG
166 model with revision 2010-09-24. In the HELLO message that is sent from
167 this device there is this capability reported:
171 urn:ietf:params:xml:ns:yang:ietf-inet-types?module=ietf-inet-types&revision=2010-09-24
173 **For such devices you only need to put the schema into folder
174 cache/schema inside your Karaf distribution.**
178 The file with YANG schema for ietf-inet-types has to be called
179 ietf-inet-types@2010-09-24.yang. It is the required naming format of
182 **2. NETCONF device does not support ietf-netconf-monitoring and it does
183 NOT list its YANG models as capabilities in HELLO message**
185 Compared to device that lists its YANG models in HELLO message, in this
186 case there would be no capability with ietf-inet-types in the HELLO
187 message. This type of device basically provides no information about the
188 YANG schemas it uses so its up to the user of OpenDaylight to properly
189 configure netconf-connector for this device.
191 Netconf-connector has an optional configuration attribute called
192 yang-module-capabilities and this attribute can contain a list of "YANG
193 module based" capabilities. So by setting this configuration attribute,
194 it is possible to override the "yang-module-based" capabilities reported
195 in HELLO message of the device. To do this, we need to modify the
196 configuration of netconf-connector by adding this XML (It needs to be
197 added next to the address, port, username etc. configuration elements):
201 <yang-module-capabilities xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
202 <capability xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
203 urn:ietf:params:xml:ns:yang:ietf-inet-types?module=ietf-inet-types&revision=2010-09-24
205 </yang-module-capabilities>
207 **Remember to also put the YANG schemas into the cache folder.**
211 For putting multiple capabilities, you just need to replicate the
212 capability xml element inside yang-module-capability element.
213 Capability element is modeled as a leaf-list. With this
214 configuration, we would make the remote device report usage of
215 ietf-inet-types in the eyes of netconf-connector.
217 Reconfiguring Netconf-Connector While the Controller is Running
218 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
220 It is possible to change the configuration of a running module while the
221 whole controller is running. This example will continue where the last
222 left off and will change the configuration for the brand new
223 netconf-connector after it was spawned. Using one RESTCONF request, we
224 will change both username and password for the netconf-connector.
226 To update an existing netconf-connector you need to send following
230 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
234 <module xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
235 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">prefix:sal-netconf-connector</type>
236 <name>new-netconf-device</name>
237 <username xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">bob</username>
238 <password xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">passwd</password>
239 <tcp-only xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">false</tcp-only>
240 <event-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
241 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-event-executor</type>
242 <name>global-event-executor</name>
244 <binding-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
245 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type>
246 <name>binding-osgi-broker</name>
248 <dom-registry xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
249 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">prefix:dom-broker-osgi-registry</type>
250 <name>dom-broker</name>
252 <client-dispatcher xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
253 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf">prefix:netconf-client-dispatcher</type>
254 <name>global-netconf-dispatcher</name>
256 <processing-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
257 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:threadpool</type>
258 <name>global-netconf-processing-executor</name>
259 </processing-executor>
260 <keepalive-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf">
261 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool">prefix:scheduled-threadpool</type>
262 <name>global-netconf-ssh-scheduled-executor</name>
263 </keepalive-executor>
266 Since a PUT is a replace operation, the whole configuration must be
267 specified along with the new values for username and password. This
268 should result in a 2xx response and the instance of netconf-connector
269 called new-netconf-device will be reconfigured to use username bob and
270 password passwd. New configuration can be verified by executing:
273 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
275 With new configuration, the old connection will be closed and a new one
278 Destroying Netconf-Connector While the Controller is Running
279 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
281 Using RESTCONF one can also destroy an instance of a module. In case of
282 netconf-connector, the module will be destroyed, NETCONF connection
283 dropped and all resources will be cleaned. To do this, simply issue a
284 request to following URL:
287 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 The last element of the URL is the name of the instance and its
290 predecessor is the type of that module (In our case the type is
291 **sal-netconf-connector** and name **new-netconf-device**). The type and
292 name are actually the keys of the module list.
294 Netconf-connector configuration with MD-SAL
295 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
297 It is also possible to configure new NETCONF connectors directly through
298 MD-SAL with the usage of the network-topology model. You can configure
299 new NETCONF connectors both through the NETCONF server for MD-SAL (port
300 2830) or RESTCONF. This guide focuses on RESTCONF.
304 To enable NETCONF connector configuration through MD-SAL install
305 either the ``odl-netconf-topology`` or
306 ``odl-netconf-clustered-topology`` feature. We will explain the
307 difference between these features later.
312 1. OpenDaylight is running
314 2. In Karaf, you must have the ``odl-netconf-topology`` or
315 ``odl-netconf-clustered-topology`` feature installed.
317 3. Feature ``odl-restconf`` must be installed
319 4. Wait until log displays following entry:
323 Successfully pushed configuration snapshot 02-netconf-topology.xml(odl-netconf-topology,odl-netconf-topology)
329 GET http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/
331 returns a non-empty response, for example:
335 <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
336 <topology-id>topology-netconf</topology-id>
339 Spawning new NETCONF connectors
340 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
342 To create a new NETCONF connector you need to send the following request
347 PUT http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device
351 - Accept: application/xml
353 - Content-Type: application/xml
359 <node xmlns="urn:TBD:params:xml:ns:yang:network-topology">
360 <node-id>new-netconf-device</node-id>
361 <host xmlns="urn:opendaylight:netconf-node-topology">127.0.0.1</host>
362 <port xmlns="urn:opendaylight:netconf-node-topology">17830</port>
363 <username xmlns="urn:opendaylight:netconf-node-topology">admin</username>
364 <password xmlns="urn:opendaylight:netconf-node-topology">admin</password>
365 <tcp-only xmlns="urn:opendaylight:netconf-node-topology">false</tcp-only>
366 <!-- non-mandatory fields with default values, you can safely remove these if you do not wish to override any of these values-->
367 <reconnect-on-changed-schema xmlns="urn:opendaylight:netconf-node-topology">false</reconnect-on-changed-schema>
368 <connection-timeout-millis xmlns="urn:opendaylight:netconf-node-topology">20000</connection-timeout-millis>
369 <max-connection-attempts xmlns="urn:opendaylight:netconf-node-topology">0</max-connection-attempts>
370 <between-attempts-timeout-millis xmlns="urn:opendaylight:netconf-node-topology">2000</between-attempts-timeout-millis>
371 <sleep-factor xmlns="urn:opendaylight:netconf-node-topology">1.5</sleep-factor>
372 <!-- keepalive-delay set to 0 turns off keepalives-->
373 <keepalive-delay xmlns="urn:opendaylight:netconf-node-topology">120</keepalive-delay>
376 Note that the device name in <node-id> element must match the last
377 element of the restconf URL.
379 Reconfiguring an existing connector
380 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
382 The steps to reconfigure an existing connector are exactly the same as
383 when spawning a new connector. The old connection will be disconnected
384 and a new connector with the new configuration will be created.
386 Deleting an existing connector
387 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
389 To remove an already configured NETCONF connector you need to send the
394 DELETE http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device
396 Connecting to a device supporting only NETCONF 1.0
397 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
399 OpenDaylight is schema-based distribution and heavily depends on YANG
400 models. However some legacy NETCONF devices are not schema-based and
401 implement just RFC 4741. This type of device does not utilize YANG
402 models internally and OpenDaylight does not know how to communicate
403 with such devices, how to validate data, or what the semantics of data
406 NETCONF connector can communicate also with these devices, but the
407 trade-offs are worsened possibilities in utilization of NETCONF
408 mountpoints. Using RESTCONF with such devices is not suported. Also
409 communicating with schemaless devices from application code is slightly
412 To connect to schemaless device, there is a optional configuration option
413 in netconf-node-topology model called schemaless. You have to set this
416 Clustered NETCONF connector
417 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
419 To spawn NETCONF connectors that are cluster-aware you need to install
420 the ``odl-netconf-clustered-topology`` karaf feature.
424 The ``odl-netconf-topology`` and ``odl-netconf-clustered-topology``
425 features are considered **INCOMPATIBLE**. They both manage the same
426 space in the datastore and would issue conflicting writes if
429 Configuration of clustered NETCONF connectors works the same as the
430 configuration through the topology model in the previous section.
432 When a new clustered connector is configured the configuration gets
433 distributed among the member nodes and a NETCONF connector is spawned on
434 each node. From these nodes a master is chosen which handles the schema
435 download from the device and all the communication with the device. You
436 will be able to read/write to/from the device from all slave nodes due
437 to the proxy data brokers implemented.
439 You can use the ``odl-netconf-clustered-topology`` feature in a single
440 node scenario as well but the code that uses akka will be used, so for a
441 scenario where only a single node is used, ``odl-netconf-topology``
444 Netconf-connector utilization
445 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
447 Once the connector is up and running, users can utilize the new mount
448 point instance. By using RESTCONF or from their application code. This
449 chapter deals with using RESTCONF and more information for app
450 developers can be found in the developers guide or in the official
451 tutorial application **ncmount** that can be found in the coretutorials
454 - https://github.com/opendaylight/coretutorials/tree/stable/beryllum/ncmount
456 Reading data from the device
457 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
459 Just invoke (no body needed):
462 http://localhost:8080/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device/yang-ext:mount/
464 This will return the entire content of operation datastore from the
465 device. To view just the configuration datastore, change **operational**
466 in this URL to **config**.
468 Writing configuration data to the device
469 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
471 In general, you cannot simply write any data you want to the device. The
472 data have to conform to the YANG models implemented by the device. In
473 this example we are adding a new interface-configuration to the mounted
474 device (assuming the device supports Cisco-IOS-XR-ifmgr-cfg YANG model).
475 In fact this request comes from the tutorial dedicated to the
476 **ncmount** tutorial app.
479 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
483 <interface-configuration xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg">
485 <interface-name>mpls</interface-name>
486 <description>Interface description</description>
487 <bandwidth>32</bandwidth>
488 <link-status></link-status>
489 </interface-configuration>
491 Should return 200 response code with no body.
495 This call is transformed into a couple of NETCONF RPCs. Resulting
496 NETCONF RPCs that go directly to the device can be found in the
497 OpenDaylight logs after invoking ``log:set TRACE
498 org.opendaylight.controller.sal.connect.netconf`` in the Karaf
499 shell. Seeing the NETCONF RPCs might help with debugging.
501 This request is very similar to the one where we spawned a new netconf
502 device. That’s because we used the loopback netconf-connector to write
503 configuration data into config-subsystem datastore and config-subsystem
504 picked it up from there.
509 Devices can implement any additional RPC and as long as it provides YANG
510 models for it, it can be invoked from OpenDaylight. Following example
511 shows how to invoke the get-schema RPC (get-schema is quite common among
512 netconf devices). Invoke:
515 http://localhost:8181/restconf/operations/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device/yang-ext:mount/ietf-netconf-monitoring:get-schema
519 <input xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
520 <identifier>ietf-yang-types</identifier>
521 <version>2013-07-15</version>
524 This call should fetch the source for ietf-yang-types YANG model from
527 Netconf-connector + Netopeer
528 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
530 `Netopeer <https://github.com/cesnet/netopeer>`__ (an open-source
531 NETCONF server) can be used for testing/exploring NETCONF southbound in
534 Netopeer installation
535 ^^^^^^^^^^^^^^^^^^^^^
537 A `Docker <https://www.docker.com/>`__ container with netopeer will be
538 used in this guide. To install Docker and start the `netopeer
539 image <https://index.docker.io/u/dockeruser/netopeer/>`__ perform
542 1. Install docker http://docs.docker.com/linux/step_one/
544 2. Start the netopeer image:
548 docker run -rm -t -p 1831:830 dockeruser/netopeer
550 3. Verify netopeer is running by invoking (netopeer should send its
551 HELLO message right away:
555 ssh root@localhost -p 1831 -s netconf
558 Mounting netopeer NETCONF server
559 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
563 - OpenDaylight is started with features ``odl-restconf-all`` and
564 ``odl-netconf-connector-all``.
566 - Netopeer is up and running in docker
568 Now just follow the chapter: `Spawning
569 netconf-connector <#_spawning_additional_netconf_connectors_while_the_controller_is_running>`__.
570 In the payload change the:
572 - name, e.g., to netopeer
574 - username/password to your system credentials
580 After netopeer is mounted successfully, its configuration can be read
581 using RESTCONF by invoking:
584 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/netopeer/yang-ext:mount/
586 Northbound (NETCONF servers)
587 ----------------------------
589 OpenDaylight provides 2 types of NETCONF servers:
591 - **NETCONF server for config-subsystem (listening by default on port
594 - Serves as a default interface for config-subsystem and allows
595 users to spawn/reconfigure/destroy modules (or applications) in
598 - **NETCONF server for MD-SAL (listening by default on port 2830)**
600 - Serves as an alternative interface for MD-SAL (besides RESTCONF)
601 and allows users to read/write data from MD-SAL’s datastore and to
602 invoke its rpcs (NETCONF notifications are not available in the
603 Boron release of OpenDaylight)
607 The reason for having 2 NETCONF servers is that config-subsystem and
608 MD-SAL are 2 different components of OpenDaylight and require
609 different approach for NETCONF message handling and data
610 translation. These 2 components will probably merge in the future.
612 NETCONF server for config-subsystem
613 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
615 This NETCONF server is the primary interface for config-subsystem. It
616 allows the users to interact with config-subsystem in a standardized
619 In terms of RFCs, these are supported:
621 - `RFC-6241 <http://tools.ietf.org/html/rfc6241>`__
623 - `RFC-5277 <https://tools.ietf.org/html/rfc5277>`__
625 - `RFC-6470 <https://tools.ietf.org/html/rfc6470>`__
627 - (partially, only the schema-change notification is available in
630 - `RFC-6022 <https://tools.ietf.org/html/rfc6022>`__
632 For regular users it is recommended to use RESTCONF + the
633 controller-config loopback mountpoint instead of using pure NETCONF. How
634 to do that is spesific for each component/module/application in
635 OpenDaylight and can be found in their dedicated user guides.
637 NETCONF server for MD-SAL
638 ~~~~~~~~~~~~~~~~~~~~~~~~~
640 This NETCONF server is just a generic interface to MD-SAL in
641 OpenDaylight. It uses the stadard MD-SAL APIs and serves as an
642 alternative to RESTCONF. It is fully model driven and supports any data
643 and rpcs that are supported by MD-SAL.
645 In terms of RFCs, these are supported:
647 - `RFC-6241 <http://tools.ietf.org/html/rfc6241>`__
649 - `RFC-6022 <https://tools.ietf.org/html/rfc6022>`__
651 - `draft-ietf-netconf-yang-library-06 <https://tools.ietf.org/html/draft-ietf-netconf-yang-library-06>`__
653 Notifications over NETCONF are not supported in the Boron release.
657 Install NETCONF northbound for MD-SAL by installing feature:
658 ``odl-netconf-mdsal`` in karaf. Default binding port is **2830**.
663 The default configuration can be found in file: *08-netconf-mdsal.xml*.
664 The file contains the configuration for all necessary dependencies and a
665 single SSH endpoint starting on port 2830. There is also a (by default
666 disabled) TCP endpoint. It is possible to start multiple endpoints at
667 the same time either in the initial configuration file or while
668 OpenDaylight is running.
670 The credentials for SSH endpoint can also be configured here, the
671 defaults are admin/admin. Credentials in the SSH endpoint are not yet
672 managed by the centralized AAA component and have to be configured
675 Verifying MD-SAL’s NETCONF server
676 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
678 After the NETCONF server is available it can be examined by a command
683 ssh admin@localhost -p 2830 -s netconf
685 The server will respond by sending its HELLO message and can be used as
686 a regular NETCONF server from then on.
688 Mounting the MD-SAL’s NETCONF server
689 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
691 To perform this operation, just spawn a new netconf-connector as
692 described in `Spawning
693 netconf-connector <#_spawning_additional_netconf_connectors_while_the_controller_is_running>`__.
694 Just change the ip to "127.0.0.1" port to "2830" and its name to
697 Now the MD-SAL’s datastore can be read over RESTCONF via NETCONF by
701 http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/controller-mdsal/yang-ext:mount
705 This might not seem very useful, since MD-SAL can be accessed
706 directly from RESTCONF or from Application code, but the same method
707 can be used to mount and control other OpenDaylight instances by the
708 "master OpenDaylight".
713 **NETCONF testtool is a set of standalone runnable jars that can:**
715 - Simulate NETCONF devices (suitable for scale testing)
717 - Stress/Performance test NETCONF devices
719 - Stress/Performance test RESTCONF devices
721 These jars are part of OpenDaylight’s controller project and are built
722 from the NETCONF codebase in OpenDaylight.
726 Download testtool from OpenDaylight Nexus at:
727 https://nexus.opendaylight.org/content/repositories/public/org/opendaylight/netconf/netconf-testtool/1.1.0-Boron/
729 **Nexus contains 3 executable tools:**
731 - executable.jar - device simulator
733 - stress.client.tar.gz - NETCONF stress/performance measuring tool
735 - perf-client.jar - RESTCONF stress/performance measuring tool
739 Each executable tool provides help. Just invoke ``java -jar
740 <name-of-the-tool.jar> --help``
742 NETCONF device simulator
743 ~~~~~~~~~~~~~~~~~~~~~~~~
745 NETCONF testtool (or NETCONF device simulator) is a tool that
747 - Simulates 1 or more NETCONF devices
749 - Is suitable for scale, performance or crud testing
751 - Uses core implementation of NETCONF server from OpenDaylight
753 - Generates configuration files for controller so that the OpenDaylight
754 distribution (Karaf) can easily connect to all simulated devices
756 - Provides broad configuration options
758 - Can start a fully fledged MD-SAL datastore
760 - Supports notifications
765 1. Check out latest NETCONF repository from
766 `git <https://git.opendaylight.org/gerrit/#/admin/projects/netconf>`__
768 2. Move into the ``opendaylight/netconf/tools/netconf-testtool/`` folder
770 3. Build testtool using the ``mvn clean install`` command
775 Netconf-testtool is now part of default maven build profile for
776 controller and can be also downloaded from nexus. The executable jar for
777 testtool can be found at:
778 `nexus-artifacts <https://nexus.opendaylight.org/content/repositories/public/org/opendaylight/netconf/netconf-testtool/1.1.0-Boron/>`__
783 1. After successfully building or downloading, move into the
784 ``opendaylight/netconf/tools/netconf-testtool/target/`` folder and
785 there is file ``netconf-testtool-1.1.0-SNAPSHOT-executable.jar`` (or
786 if downloaded from nexus just take that jar file)
788 2. Execute this file using, e.g.:
792 java -jar netconf-testtool-1.1.0-SNAPSHOT-executable.jar
794 This execution runs the testtool with default for all parameters and
795 you should see this log output from the testtool :
799 10:31:08.206 [main] INFO o.o.c.n.t.t.NetconfDeviceSimulator - Starting 1, SSH simulated devices starting on port 17830
800 10:31:08.675 [main] INFO o.o.c.n.t.t.NetconfDeviceSimulator - All simulated devices started successfully from port 17830 to 17830
805 The default parameters for testtool are:
809 - Run 1 simulated device
811 - Device port is 17830
813 - YANG modules used by device are only: ietf-netconf-monitoring,
814 ietf-yang-types, ietf-inet-types (these modules are required for
815 device in order to support NETCONF monitoring and are included in the
818 - Connection timeout is set to 30 minutes (quite high, but when testing
819 with 10000 devices it might take some time for all of them to fully
820 establish a connection)
822 - Debug level is set to false
824 - No distribution is modified to connect automatically to the NETCONF
830 To verify that the simulated device is up and running, we can try to
831 connect to it using command line ssh tool. Execute this command to
832 connect to the device:
836 ssh admin@localhost -p 17830 -s netconf
838 Just accept the server with yes (if required) and provide any password
839 (testtool accepts all users with all passwords). You should see the
840 hello message sent by simulated device.
847 usage: netconf testool [-h] [--device-count DEVICES-COUNT] [--devices-per-port DEVICES-PER-PORT] [--schemas-dir SCHEMAS-DIR] [--notification-file NOTIFICATION-FILE]
848 [--initial-config-xml-file INITIAL-CONFIG-XML-FILE] [--starting-port STARTING-PORT] [--generate-config-connection-timeout GENERATE-CONFIG-CONNECTION-TIMEOUT]
849 [--generate-config-address GENERATE-CONFIG-ADDRESS] [--generate-configs-batch-size GENERATE-CONFIGS-BATCH-SIZE] [--distribution-folder DISTRO-FOLDER] [--ssh SSH] [--exi EXI]
850 [--debug DEBUG] [--md-sal MD-SAL]
852 NETCONF device simulator. Detailed info can be found at https://wiki.opendaylight.org/view/OpenDaylight_Controller:Netconf:Testtool#Building_testtool
855 -h, --help show this help message and exit
856 --device-count DEVICES-COUNT
857 Number of simulated netconf devices to spin. This is the number of actual ports open for the devices.
858 --devices-per-port DEVICES-PER-PORT
859 Amount of config files generated per port to spoof more devices then are actually running
860 --schemas-dir SCHEMAS-DIR
861 Directory containing yang schemas to describe simulated devices. Some schemas e.g. netconf monitoring and inet types are included by default
862 --notification-file NOTIFICATION-FILE
863 Xml file containing notifications that should be sent to clients after create subscription is called
864 --initial-config-xml-file INITIAL-CONFIG-XML-FILE
865 Xml file containing initial simulatted configuration to be returned via get-config rpc
866 --starting-port STARTING-PORT
867 First port for simulated device. Each other device will have previous+1 port number
868 --generate-config-connection-timeout GENERATE-CONFIG-CONNECTION-TIMEOUT
869 Timeout to be generated in initial config files
870 --generate-config-address GENERATE-CONFIG-ADDRESS
871 Address to be placed in generated configs
872 --generate-configs-batch-size GENERATE-CONFIGS-BATCH-SIZE
873 Number of connector configs per generated file
874 --distribution-folder DISTRO-FOLDER
875 Directory where the karaf distribution for controller is located
876 --ssh SSH Whether to use ssh for transport or just pure tcp
877 --exi EXI Whether to use exi to transport xml content
878 --debug DEBUG Whether to use debug log level instead of INFO
879 --md-sal MD-SAL Whether to use md-sal datastore instead of default simulated datastore.
884 Testtool default simple datastore supported operations:
887 returns YANG schemas loaded from user specified directory,
890 always returns OK and stores the XML from the input in a local
891 variable available for get-config and get RPC. Every edit-config
892 replaces the previous data,
895 always returns OK, but does not actually commit the data,
898 returns local XML stored by edit-config,
901 returns local XML stored by edit-config with netconf-state subtree,
902 but also supports filtering.
905 returns always OK with no lock guarantee
908 returns always OK and after the operation is triggered, provided
909 NETCONF notifications (if any) are fed to the client. No filtering
910 or stream recognition is supported.
912 Note: when operation="delete" is present in the payload for edit-config,
913 it will wipe its local store to simulate the removal of data.
915 When using the MD-SAL datastore testtool behaves more like normal
916 NETCONF server and is suitable for crud testing. create-subscription is
917 not supported when testtool is running with the MD-SAL datastore.
922 Testtool supports notifications via the --notification-file switch. To
923 trigger the notification feed, create-subscription operation has to be
924 invoked. The XML file provided should look like this example file:
928 <?xml version='1.0' encoding='UTF-8' standalone='yes'?>
931 <!-- Notifications are processed in the order they are defined in XML -->
933 <!-- Notification that is sent only once right after create-subscription is called -->
935 <!-- Content of each notification entry must contain the entire notification with event time. Event time can be hardcoded, or generated by testtool if XXXX is set as eventtime in this XML -->
937 <notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
938 <eventTime>2011-01-04T12:30:46</eventTime>
939 <random-notification xmlns="http://www.opendaylight.org/netconf/event:1.0">
940 <random-content>single no delay</random-content>
941 </random-notification>
946 <!-- Repeated Notification that is sent 5 times with 2 second delay inbetween -->
948 <!-- Delay in seconds from previous notification -->
950 <!-- Number of times this notification should be repeated -->
953 <notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
954 <eventTime>XXXX</eventTime>
955 <random-notification xmlns="http://www.opendaylight.org/netconf/event:1.0">
956 <random-content>scheduled 5 times 10 seconds each</random-content>
957 </random-notification>
962 <!-- Single notification that is sent only once right after the previous notification -->
966 <notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
967 <eventTime>XXXX</eventTime>
968 <random-notification xmlns="http://www.opendaylight.org/netconf/event:1.0">
969 <random-content>single with delay</random-content>
970 </random-notification>
977 Connecting testtool with controller Karaf distribution
978 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
980 Auto connect to OpenDaylight
981 ''''''''''''''''''''''''''''
983 It is possible to make OpenDaylight auto connect to the simulated
984 devices spawned by testtool (so user does not have to post a
985 configuration for every NETCONF connector via RESTCONF). The testtool is
986 able to modify the OpenDaylight distribution to auto connect to the
987 simulated devices after feature ``odl-netconf-connector-all`` is
988 installed. When running testtool, issue this command (just point the
989 testool to the distribution:
993 java -jar netconf-testtool-1.1.0-SNAPSHOT-executable.jar --device-count 10 --distribution-folder ~/distribution-karaf-0.4.0-SNAPSHOT/ --debug true
995 With the distribution-folder parameter, the testtool will modify the
996 distribution to include configuration for netconf-connector to connect
997 to all simulated devices. So there is no need to spawn
998 netconf-connectors via RESTCONF.
1000 Running testtool and OpenDaylight on different machines
1001 '''''''''''''''''''''''''''''''''''''''''''''''''''''''
1003 The testtool binds by default to 0.0.0.0 so it should be accessible from
1004 remote machines. However you need to set the parameter
1005 "generate-config-address" (when using autoconnect) to the address of
1006 machine where testtool will be run so OpenDaylight can connect. The
1007 default value is localhost.
1009 Executing operations via RESTCONF on a mounted simulated device
1010 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1012 Simulated devices support basic RPCs for editing their config. This part
1013 shows how to edit data for simulated device via RESTCONF.
1018 The controller and RESTCONF assume that the data that can be manipulated
1019 for mounted device is described by a YANG schema. For demonstration, we
1020 will define a simple YANG model:
1026 namespace "urn:opendaylight:test";
1029 revision "2014-10-17";
1040 Save this schema in file called test@2014-10-17.yang and store it a
1041 directory called test-schemas/, e.g., your home folder.
1043 Editing data for simulated device
1044 '''''''''''''''''''''''''''''''''
1046 - Start the device with following command:
1050 java -jar netconf-testtool-1.1.0-SNAPSHOT-executable.jar --device-count 10 --distribution-folder ~/distribution-karaf-0.4.0-SNAPSHOT/ --debug true --schemas-dir ~/test-schemas/
1052 - Start OpenDaylight
1054 - Install odl-netconf-connector-all feature
1056 - Install odl-restconf feature
1058 - Check that you can see config data for simulated device by executing
1063 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/17830-sim-device/yang-ext:mount/
1065 - The data should be just and empty data container
1067 - Now execute edit-config request by executing a POST request to:
1071 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/17830-sim-device/yang-ext:mount
1077 Accept application/xml
1078 Content-Type application/xml
1084 <cont xmlns="urn:opendaylight:test">
1088 - Check that you can see modified config data for simulated device by
1089 executing GET request to
1093 http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/17830-sim-device/yang-ext:mount/
1095 - Check that you can see the same modified data in operational for
1096 simulated device by executing GET request to
1100 http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/17830-sim-device/yang-ext:mount/
1104 Data will be mirrored in operational datastore only when using the
1105 default simple datastore.
1110 Slow creation of devices on virtual machines
1111 ''''''''''''''''''''''''''''''''''''''''''''
1113 When testtool seems to take unusually long time to create the devices
1114 use this flag when running it:
1118 -Dorg.apache.sshd.registerBouncyCastle=false
1123 When testtool or OpenDaylight starts to fail with TooManyFilesOpen
1124 exception, you need to increase the limit of open files in your OS. To
1125 find out the limit in linux execute:
1131 Example sufficient configuration in linux:
1135 core file size (blocks, -c) 0
1136 data seg size (kbytes, -d) unlimited
1137 scheduling priority (-e) 0
1138 file size (blocks, -f) unlimited
1139 pending signals (-i) 63338
1140 max locked memory (kbytes, -l) 64
1141 max memory size (kbytes, -m) unlimited
1142 open files (-n) 500000
1143 pipe size (512 bytes, -p) 8
1144 POSIX message queues (bytes, -q) 819200
1145 real-time priority (-r) 0
1146 stack size (kbytes, -s) 8192
1147 cpu time (seconds, -t) unlimited
1148 max user processes (-u) 63338
1149 virtual memory (kbytes, -v) unlimited
1150 file locks (-x) unlimited
1152 To set these limits edit file: /etc/security/limits.conf, for example:
1156 * hard nofile 500000
1157 * soft nofile 500000
1158 root hard nofile 500000
1159 root soft nofile 500000
1164 The testtool might end unexpectedly with a simple message: "Killed".
1165 This means that the OS killed the tool due to too much memory consumed
1166 or too many threads spawned. To find out the reason on linux you can use
1171 dmesg | egrep -i -B100 'killed process'
1173 Also take a look at this file: /proc/sys/kernel/threads-max. It limits
1174 the number of threads spawned by a process. Sufficient (but probably
1175 much more than enough) value is, e.g., 126676
1177 NETCONF stress/performance measuring tool
1178 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1180 This is basically a NETCONF client that puts NETCONF servers under heavy
1181 load of NETCONF RPCs and measures the time until a configurable amount
1182 of them is processed.
1184 RESTCONF stress-performance measuring tool
1185 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1187 Very similar to NETCONF stress tool with the difference of using
1188 RESTCONF protocol instead of NETCONF.
1190 YANGLIB remote repository
1191 -------------------------
1193 There are scenarios in NETCONF deployment, that require for a centralized
1194 YANG models repository. YANGLIB plugin provides such remote repository.
1196 To start this plugin, you have to install odl-yanglib feature. Then you
1197 have to configure YANGLIB either through RESTCONF or NETCONF. We will
1198 show how to configure YANGLIB through RESTCONF.
1200 YANGLIB configuration through RESTCONF
1201 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1203 You have to specify what local YANG modules directory you want to provide.
1204 Then you have to specify address and port whre you want to provide YANG
1205 sources. For example, we want to serve yang sources from folder /sources
1206 on localhost:5000 adress. The configuration for this scenario will be
1211 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
1215 - Accept: application/xml
1217 - Content-Type: application/xml
1223 <module xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
1224 <name>example</name>
1225 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:yanglib:impl">prefix:yanglib</type>
1226 <broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:yanglib:impl">
1227 <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type>
1228 <name>binding-osgi-broker</name>
1230 <cache-folder xmlns="urn:opendaylight:params:xml:ns:yang:controller:yanglib:impl">/sources</cache-folder>
1231 <binding-addr xmlns="urn:opendaylight:params:xml:ns:yang:controller:yanglib:impl">localhost</binding-addr>
1232 <binding-port xmlns="urn:opendaylight:params:xml:ns:yang:controller:yanglib:impl">5000</binding-port>
1235 This should result in a 2xx response and new YANGLIB instance should be
1236 created. This YANGLIB takes all YANG sources from /sources folder and
1237 for each generates URL in form:
1241 http://localhost:5000/schemas/{modelName}/{revision}
1243 On this URL will be hosted YANG source for particular module.
1245 YANGLIB instance also write this URL along with source identifier to
1246 ietf-netconf-yang-library/modules-state/module list.
1248 Netconf-connector with YANG library as fallback
1249 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1251 There is an optional configuration in netconf-connector called
1252 yang-library. You can specify YANG library to be plugged as additional
1253 source provider into the mount's schema repository. Since YANGLIB
1254 plugin is advertising provided modules through yang-library model, we
1255 can use it in mount point's configuration as YANG library. To do this,
1256 we need to modify the configuration of netconf-connector by adding this
1261 <yang-library xmlns="urn:opendaylight:netconf-node-topology">
1262 <yang-library-url xmlns="urn:opendaylight:netconf-node-topology">http://localhost:8181/restconf/operational/ietf-yang-library:modules-state</yang-library-url>
1263 <username xmlns="urn:opendaylight:netconf-node-topology">admin</username>
1264 <password xmlns="urn:opendaylight:netconf-node-topology">admin</password>
1267 This will register YANGLIB provided sources as a fallback schemas for
1268 particular mount point.