These jars are part of OpenDaylight’s controller project and are built
from the NETCONF codebase in OpenDaylight.
-.. tip::
-
- Download the Sodium SR2 testtool from OpenDaylight Nexus at:
- https://nexus.opendaylight.org/content/repositories/public/org/opendaylight/netconf/netconf-testtool/1.7.2/
-
**Nexus contains 3 executable tools:**
- executable.jar - device simulator
- Uses core implementation of NETCONF server from OpenDaylight
-- Generates configuration files for controller so that the OpenDaylight
- distribution (Karaf) can easily connect to all simulated devices
+- Allows for automatic sending of connector configurations through RESTCONF to the controller. This makes it easy for
+ the OpenDaylight distribution (Karaf) to connect to all simulated devices once the simulator starts.
- Provides broad configuration options
1. After successfully building or downloading, move into the
``opendaylight/netconf/tools/netconf-testtool/target/`` folder and
- there is file ``netconf-testtool-1.1.0-SNAPSHOT-executable.jar`` (or
- if downloaded from nexus just take that jar file)
+ there is file ``netconf-testtool-[VERSION]-executable.jar`` (or
+ if downloaded from nexus just take that \*-executable.jar file)
2. Execute this file using, e.g.:
::
- java -jar netconf-testtool-1.1.0-SNAPSHOT-executable.jar
+ java -jar netconf-testtool-[VERSION]-executable.jar
This execution runs the testtool with default for all parameters and
you should see this log output from the testtool :
- Debug level is set to false
-- No distribution is modified to connect automatically to the NETCONF
- testtool
+- Other default parameters can be seen with ``--help`` option
Verifying testtool
^^^^^^^^^^^^^^^^^^
--debug {true,false} Whether to use debug log level instead of INFO (default: false)
--md-sal {true,false} Whether to use md-sal datastore instead of default simulated datastore. (default: false)
--time-out TIME-OUT the maximum time in seconds for executing each PATCH request (default: 20)
- -ip IP Ip address which will be used for creating a socket address.It can either be a machine
+ --ip IP Ip address which will be used for creating a socket address.It can either be a machine
name, such as java.sun.com, or a textual representation of its IP address. (default:
0.0.0.0)
--thread-pool-size THREAD-POOL-SIZE
one.Usable for testing buggy device behavior.
-
Supported operations
^^^^^^^^^^^^^^^^^^^^
Notification support
^^^^^^^^^^^^^^^^^^^^
-Testtool supports notifications via the --notification-file switch. To
+Testtool supports notifications via the ``--notification-file`` switch. To
trigger the notification feed, create-subscription operation has to be
invoked. The XML file provided should look like this example file:
Auto connect to OpenDaylight
''''''''''''''''''''''''''''
-It is possible to make OpenDaylight auto connect to the simulated
-devices spawned by testtool (so user does not have to post a
-configuration for every NETCONF connector via RESTCONF). The testtool is
-able to modify the OpenDaylight distribution to auto connect to the
-simulated devices after feature ``odl-netconf-connector-all`` is
-installed. When running testtool, issue this command (just point the
-testool to the distribution:
+You can set up the testtool to automatically connect to the Controller. When you provide
+the ``--controller-ip`` and ``--controller-port`` parameters, the testtool will send a PATCH request to the Controller
+netconf-topology with the device connector configuration.
::
- java -jar netconf-testtool-1.1.0-SNAPSHOT-executable.jar --device-count 10 --distribution-folder ~/distribution-karaf-0.4.0-SNAPSHOT/ --debug true
+ java -jar netconf-testtool-[VERSION]-executable.jar --device-count 10 --controller-ip 127.0.0.1 --controller-port 8181 --debug true
-With the distribution-folder parameter, the testtool will modify the
-distribution to include configuration for netconf-connector to connect
-to all simulated devices. So there is no need to spawn
-netconf-connectors via RESTCONF.
Running testtool and OpenDaylight on different machines
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
::
module test {
- yang-version 1;
- namespace "urn:opendaylight:test";
- prefix "tt";
-
- revision "2014-10-17";
-
-
- container cont {
-
- leaf l {
- type string;
- }
- }
+ yang-version 1;
+ namespace "urn:opendaylight:test";
+ prefix "tt";
+ revision "2014-10-17";
+
+ container cont {
+ leaf l {
+ type string;
+ }
+ }
}
directory called test-schemas/, e.g., your home folder.
Editing data for simulated device
'''''''''''''''''''''''''''''''''
-- Start the device with following command:
-
- ::
+- Start OpenDaylight
- 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/
+- Install odl-netconf-topology and odl-restconf-nb features
-- Start OpenDaylight
+- Start the device with following command:
-- Install odl-netconf-connector-all feature
+ ::
-- Install odl-restconf feature
+ java -jar netconf-testtool-[VERSION]-executable.jar --controller-ip 127.0.0.1 --controller-port 8181 --debug true --schemas-dir ~/test-schemas/
-- Check that you can see config data for simulated device by executing
- GET request to
+- Check that you can see config data for simulated device by executing GET request to:
::
- http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/17830-sim-device/yang-ext:mount/
+ http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=17830-sim-device/yang-ext:mount?content=config
- The data should be just and empty data container
::
- http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/17830-sim-device/yang-ext:mount
+ http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=17830-sim-device/yang-ext:mount
with headers:
<cont xmlns="urn:opendaylight:test">
<l>Content</l>
</cont>
+- Response should be 201 with empty body
- Check that you can see modified config data for simulated device by
executing GET request to
::
- http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/17830-sim-device/yang-ext:mount/
+ http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=17830-sim-device/yang-ext:mount?content=config
- Check that you can see the same modified data in operational for
simulated device by executing GET request to
::
- http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/17830-sim-device/yang-ext:mount/
+ http://localhost:8181/rests/data/network-topology:network-topology/topology=topology-netconf/node=17830-sim-device/yang-ext:mount?content=nonconfig
.. warning::
The input and output of the custom RPC should be provided with ``--rpc-config`` parameter as a path to the file containing
definition of input and output. The format of the custom RPC file is xml as shown below.
-Start the device with following command:
-
-::
-
- java -jar netconf/tools/netconf-testtool/target/netconf-testtool-1.7.0-SNAPSHOT-executable.jar --schemas-dir ~/test-schemas/ --rpc-config ~/tmp/customrpc.xml --debug=true
-
-Example YANG model file:
+Example YANG model file (stored in folder ~/test-schemas/):
::
module example-ops {
- namespace "urn:example-ops:reboot";
- prefix "ops";
+ namespace "urn:example-ops:reboot";
+ prefix "ops";
- import ietf-yang-types {
+ import ietf-yang-types {
prefix "yang";
- }
-
-
- revision "2016-07-07" {
- description "Initial version.";
- reference "example document.";
- }
-
-
- rpc reboot {
- description "Reboot operation.";
- input {
- leaf delay {
- type uint32;
- units "seconds";
- default 0;
- description
- "Delay in seconds.";
- }
- leaf message {
- type string;
- description
- "Log message.";
- }
- }
- }
- }
+ }
+
+ revision "2016-07-07" {
+ description "Initial version.";
+ reference "example document.";
+ }
+
+ rpc reboot {
+ description "Reboot operation.";
+ input {
+ leaf delay {
+ type uint32;
+ units "seconds";
+ default 0;
+ description "Delay in seconds.";
+ }
+ leaf message {
+ type string;
+ description "Log message.";
+ }
+ }
+ }
+ }
-Example payload (RPC config file customrpc.xml):
+Example payload (RPC config file ~/tmp/customrpc.xml):
::
</rpc>
</rpcs>
+Start the device with following command:
+
+::
+
+ java -jar netconf-testtool-[VERSION]-executable.jar --controller-ip 127.0.0.1 --controller-port 8181 --schemas-dir ~/test-schemas/ --rpc-config ~/tmp/customrpc.xml --debug=true
+
Example of use:
::
- POST http://localhost:8181/restconf/operations/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device/yang-ext:mount/example-ops:get-reboot-info
+ POST http://localhost:8181/rests/operations/network-topology:network-topology/topology=topology-netconf/node=17830-sim-device/yang-ext:mount/example-ops:reboot
+
+With body:
+
+::
+
+ <?xml version="1.0" encoding="UTF-8" ?>
+ <input xmlns="urn:example-ops:reboot">
+ <delay>300</delay>
+ <message>message</message>
+ </input>
-If successful the command will return code 200.
+If successful the response should be 204.