Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

...

exclude.*

Netconf testtool

Netconf testtool (or netconf device simulator) is a tool that:

...

java -Xmx1G -XX:MaxPermSize=256M -jar netconf-testtool-1.0.0-SNAPSHOT-executable.jar

This execution runs the testtool with default for all parameters and you should see this log output from the testtool :

  10
  :
  31
  :
  08.206 [main] INFO  o.o.c.n.t.t.NetconfDeviceSimulator - Starting 1, SSH simulated devices starting on port 17830
10
  :
  31
  :
  08.675 [main] INFO  o.o.c.n.t.t.NetconfDeviceSimulator - All simulated devices started successfully from port 17830 to 17830

Default parameters

The default parameters for testtool are:

...

Testtool help

usage: netconf testool [
  -h] [
  --device-count DEVICES-COUNT] [
  --schemas-dir SCHEMAS-DIR] [
  --notification-file NOTIFICATION-FILE] [
  --starting-port STARTING-PORT]
                       [
  --generate-config-connection-timeout GENERATE-CONFIG-CONNECTION-TIMEOUT] [
  --generate-config-address GENERATE-CONFIG-ADDRESS]
                       [
  --generate-configs-batch-size GENERATE-CONFIGS-BATCH-SIZE] [
  --distribution-folder DISTRO-FOLDER] [
  --ssh SSH] [
  --exi EXI] [
  --debug DEBUG]
 
Netconf device simulator. Detailed info can be found at https:
  //wiki.opendaylight.org/view/OpenDaylight_Controller:Netconf:Testtool#Building_testtool
 
optional arguments:
  -h, --help             show this help message and exit
  --device-count DEVICES-COUNT
                         Number of simulated netconf devices to spin
  --schemas-dir SCHEMAS-DIR
                         Directory containing yang schemas to describe simulated devices. Some schemas e.g. netconf monitoring and inet types are included by default
  --notification-file NOTIFICATION-FILE
                         Xml file containing notifications that should be sent to clients after create subscription is called
  --starting-port STARTING-PORT
                         First port for simulated device. Each other device will have previous+
  1 port number
  --generate-config-connection-timeout GENERATE-CONFIG-CONNECTION-TIMEOUT
                         Timeout to be generated in initial config files
  --generate-config-address GENERATE-CONFIG-ADDRESS
                         Address to be placed in generated configs
  --generate-configs-batch-size GENERATE-CONFIGS-BATCH-SIZE
                         Number of connector configs per generated file
  --distribution-folder DISTRO-FOLDER
                         Directory where the karaf distribution for controller is located
  --ssh SSH              Whether to use ssh for transport or just pure tcp
  --exi EXI              Whether to use exi to transport xml content
  --debug DEBUG          Whether to use debug log level instead of INFO

...

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:

  <?xml version=
  '1.0' encoding=
  'UTF-8' standalone=
  'yes'
  ?>
<notifications>
 
<!-- Notifications are processed in the order they are defined in XML -->
 
<!-- Notification that is sent only once right after create-subscription is called -->
<notification>
		<!-- 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 -->
		<content><!
  [CDATA[
			<notification xmlns=
  "urn:ietf:params:xml:ns:netconf:notification:1.0"
  >
			    <eventTime>
  2011
  -01-04T12:
  30
  :
  46
  </eventTime>
			    <random-notification xmlns=
  "http://www.opendaylight.org/netconf/event:1.0"
  >
			        <random-content>single no delay</random-content>
			    </random-notification>
			</notification>
		]
  ]
  ></content>
</notification>
 
<!-- Repeated Notification that is sent 5 times with 2 second delay inbetween -->
<notification>
		<!-- Delay in seconds from previous notification -->
		<delay>2>
  2
  </delay>
		<!-- Number of times this notification should be repeated -->
		<times>
  5
  </times>
		<content><!
  [CDATA[
			<notification xmlns=
  "urn:ietf:params:xml:ns:netconf:notification:1.0"
  >
			    <eventTime>XXXX</eventTime>
			    <random-notification xmlns=
  "http://www.opendaylight.org/netconf/event:1.0"
  >
			        <random-content>scheduled 5 times 10 seconds each</random-content>
			    </random-notification>
			</notification>
		]
  ]
  ></content>
</notification>
 
<!-- Single notification that is sent only once right after the previous notification -->
<notification>
		<delay>
  2
  </delay>
		<content><!
  [CDATA[
			<notification xmlns=
  "urn:ietf:params:xml:ns:netconf:notification:1.0"
  >
			    <eventTime>XXXX</eventTime>
			    <random-notification xmlns=
  "http://www.opendaylight.org/netconf/event:1.0"
  >
			        <random-content>single with delay</random-content>
			    </random-notification>
			</notification>
		]
  ]
  ></content>
</notification>
 
</notifications>

Connecting testtool with controller karaf distribution

...

java -Xmx1G -XX:MaxPermSize=256M -jar netconf-testtool-0.3.0-SNAPSHOT-executable.jar --device-count 10 --distribution-folder ~/distribution-karaf-0.2.0-Helium/ --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.

...

java -jar netconf-testtool-0.3.0-SNAPSHOT-executable.jar --device-count 10 --distribution-folder ../../../distribution/opendaylight-karaf/target/assembly/ --debug true

Executing operations via Restconf on a mounted simulated device

...

module test {
    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 directory called test-schemas/ in e.g. home folder.

...

java -Xmx1G -XX:MaxPermSize=256M -jar netconf-testtool-0.3.0-SNAPSHOT-executable.jar --device-count 10 --distribution-folder ~/distribution-karaf-0.2.0-Helium/ --debug true --schemas-dir ~/test-schemas/
  • Start helium distribution
  • Install odl-netconf-connector-ssh feature
  • Install odl-restconf feature\
  • Check that you can see config data for simulated device by Executing GET request to
http:
  //localhost:8181/restconf/config/opendaylight-inventory:nodes/node/17830-sim-device/yang-ext:mount/
  • The data should be just and empty data container
  • Now execute edit-config request by executing a POST request to:
http:
  //localhost:8181/restconf/config/opendaylight-inventory:nodes/node/17830-sim-device/yang-ext:mount

with headers:

Accept application/xml
Content-Type application/xml

and payload:

  <cont xmlns=
  "urn:opendaylight:test"
  >
  <l>Content</l>
</cont>
  • Check that you can see modified config data for simulated device by Executing GET request to
http:
  //localhost:8181/restconf/config/opendaylight-inventory:nodes/node/17830-sim-device/yang-ext:mount/
  • Check that you can see the same modified data in operational for simulated device by Executing GET request to
http:
  //localhost:8181/restconf/operational/opendaylight-inventory:nodes/node/17830-sim-device/yang-ext:mount/

Known problems

Slow creation of devices on virtual machines

When testtool seems to take unusually long time to create the devices use this flag when running it:

  -Dorg.apache.sshd.registerBouncyCastle
  =
  false

Too many files open

When testtool or ODL starts to fail with TooManyFilesOpen exception, you need to increase the limit of open files in your OS. To find out the limit in linux execute:

...

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (
  -e) 0
file size               (blocks, -f) unlimited
pending signals                 (
  -i) 63338
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (
  -n) 500000
pipe size            (
  512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (
  -r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (
  -u) 63338
virtual memory          (kbytes, -v) unlimited
file locks                      (
  -x) unlimited

To set these limits edit file: /etc/security/limits.conf e.g:

  *         hard    nofile      500000
*         soft    nofile      500000
root      hard    nofile      500000
root      soft    nofile      500000

"Namespace  urn:opendaylight:params:xml:ns:yang:controller:md:sal:connector:netconf  is not owned by a module"

...

dmesg | egrep -i -B100 'killed process'

Also take a look at this file: /proc/sys/kernel/threads-max. It limits the number of threads spawned by a process. Sufficient(but probably much more than enough) value is e.g. 126676