Update testtool documentation 02/104402/11
authorPeter Suna <peter.suna@pantheon.tech>
Wed, 15 Feb 2023 13:58:24 +0000 (14:58 +0100)
committerRobert Varga <nite@hq.sk>
Mon, 27 Mar 2023 13:01:42 +0000 (13:01 +0000)
Update URL in testtool documentation to RFC8040.
Fix the auto-connect section to use the correct parameters,
as the 'scale-util' parameters do not work in the way
described in the documentation.

JIRA: NETCONF-947
Change-Id: I6f3a97073936fa35fe667aae6ab52d1101e0a9a3
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
docs/testtool.rst

index c361a9eb53bbbde15658bc0d84cecc70e395959a..3d4dc2fb5192a12f9594ef79fd234e41aede4084 100644 (file)
@@ -22,11 +22,6 @@ NETCONF testtool
 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
@@ -51,8 +46,8 @@ NETCONF testtool (or NETCONF device simulator) is a tool that
 
 -  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
 
@@ -83,14 +78,14 @@ Running testtool
 
 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 :
@@ -122,8 +117,7 @@ The default parameters for testtool are:
 
 -  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
 ^^^^^^^^^^^^^^^^^^
@@ -215,7 +209,7 @@ Testtool help
       --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
@@ -226,7 +220,6 @@ Testtool help
                              one.Usable for testing buggy device behavior.
 
 
-
 Supported operations
 ^^^^^^^^^^^^^^^^^^^^
 
@@ -268,7 +261,7 @@ not supported when testtool is running with the MD-SAL datastore.
 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:
 
@@ -329,22 +322,14 @@ Connecting testtool with controller Karaf distribution
 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
 '''''''''''''''''''''''''''''''''''''''''''''''''''''''
@@ -371,45 +356,39 @@ will define a simple YANG model:
 ::
 
     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;
+        }
+      }
     }
 
-Save this schema in file called test@2014-10-17.yang and store it a
+Save this schema in file called ``test@2014-10-17.yang`` and store it a
 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
 
@@ -417,7 +396,7 @@ Editing data for simulated device
 
    ::
 
-       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:
 
@@ -433,20 +412,21 @@ Editing data for simulated device
        <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::
 
@@ -463,52 +443,42 @@ with parameter ``--schemas-dir``.
 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):
 
 ::
 
@@ -528,15 +498,31 @@ Example payload (RPC config file 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.