Add and run some linters via tox and pre-commit 11/96411/3
authorGuillaume Lambert <guillaume.lambert@orange.com>
Wed, 2 Jun 2021 20:20:10 +0000 (22:20 +0200)
committerGuillaume Lambert <guillaume.lambert@orange.com>
Thu, 3 Jun 2021 21:24:06 +0000 (23:24 +0200)
Signed-off-by: Guillaume Lambert <guillaume.lambert@orange.com>
Change-Id: I097c1267eab3eba18c571929e67490817d0a8ffd

15 files changed:
.gitlint [new file with mode: 0644]
.pre-commit-config.yaml [new file with mode: 0644]
debug_tools/netconf_TCP_SSH_hijackingproxy.pl
lighty/docs/TransportPCE.postman_collection.json
pce/src/test/resources/gnpy/gnpy_network.json
tapimodels/src/main/yang/tapi-eth@2018-12-10.yang
tapimodels/src/main/yang/tapi-topology@2018-12-10.yang
tests/installMavenCentOS.sh
tests/netconf.patch [deleted file]
tests/sample_configs/NW-for-test-5-4.xml
tests/sample_configs/NW-simple-topology.xml
tests/sample_configs/openroadm/2.2.1/oper-ROADMA.xml
tests/sample_configs/openroadm/2.2.1/oper-ROADMC.xml
tests/sample_configs/openroadm/2.2.1/oper-SPDRC.xml
tox.ini

diff --git a/.gitlint b/.gitlint
new file mode 100644 (file)
index 0000000..85c1b7a
--- /dev/null
+++ b/.gitlint
@@ -0,0 +1,81 @@
+# All these sections are optional, edit this file as you like.
+[general]
+# Ignore certain rules, you can reference them by their id or by their full
+# name
+# ignore=title-trailing-punctuation, T3
+# verbosity should be a value between 1 and 3, the command line -v flags take
+# precedence over this
+# verbosity = 2
+# By default gitlint will ignore merge commits. Set to 'false' to disable.
+# ignore-merge-commits=true
+# By default gitlint will ignore fixup commits. Set to 'false' to disable.
+# ignore-fixup-commits=true
+# By default gitlint will ignore squash commits. Set to 'false' to disable.
+# ignore-squash-commits=true
+# Enable debug mode (prints more output). Disabled by default.
+# debug=true
+# Set the extra-path where gitlint will search for user defined rules
+# See http://jorisroovers.github.io/gitlint/user_defined_rules for details
+# extra-path=examples/
+# contrib=contrib-title-conventional-commits,contrib-body-requires-signed-off-b
+contrib=contrib-body-requires-signed-off-by
+[title-max-length]
+# line-length=80
+line-length=50
+# [title-must-not-contain-word]
+# Comma-separated list of words that should not occur in the title. Matching is
+# case insensitive. It's fine if the keyword occurs as part of a larger word
+# (so "WIPING" will not cause a violation, but "WIP: my title" will.
+# words=wip
+# [title-match-regex]
+# python like regex (https://docs.python.org/2/library/re.html) that the
+# commit-msg title must be matched to.
+# Note that the regex can contradict with other rules if not used correctly
+# (e.g. title-must-not-contain-word).
+# regex=^US[0-9]*
+[B1]
+# B1 = body-max-line-length
+# line-length=120
+line-length=72
+# [body-min-length]
+# min-length=5
+# [body-is-missing]
+# Whether to ignore this rule on merge commits (which typically only have a title)
+# default = True
+# ignore-merge-commits=false
+# [body-changed-file-mention]
+# List of files that need to be explicitly mentioned in the body when they are
+# changed This is useful for when developers often erroneously edit certain
+# files or git submodules.  By specifying this rule, developers can only change
+# the file when they explicitly reference it in the commit message.
+# files=gitlint/rules.py,README.md
+# [author-valid-email]
+# python like regex (https://docs.python.org/2/library/re.html) that the
+# commit author email address should be matched to
+# For example, use the following regex if you only want to allow email
+# addresses from foo.com
+# regex=[^@]+@foo.com
+# [ignore-by-title]
+# Ignore certain rules for commits of which the title matches a regex
+# E.g. Match commit titles that start with "Release"
+# regex=^Release(.*)
+#
+# Ignore certain rules, you can reference them by their id or by their full name
+# Use 'all' to ignore all rules
+# ignore=T1,body-min-length
+# [ignore-by-body]
+# Ignore certain rules for commits of which the body has a line that matches a
+# regex
+# E.g. Match bodies that have a line that contain "release"
+# regex=(.*)release(.*)
+#
+# Ignore certain rules, you can reference them by their id or by their full name
+# Use 'all' to ignore all rules
+# ignore=T1,body-min-length
+# Enable Conventional Commit subject line enforcement
+# https://www.conventionalcommits.org/en/v1.0.0/
+#
+# Since we want all subjects to be well formed, enforce the topics
+# to the following (fairly standard) topics and require them to be Mixed Case
+#[contrib-title-conventional-commits]
+#types=Fix,Feat,Chore,Docs,Style,Refactor,Perf,Test,Revert,CI,Build
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644 (file)
index 0000000..1363f0b
--- /dev/null
@@ -0,0 +1,21 @@
+---
+repos:
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v4.0.1
+    hooks:
+      - id: trailing-whitespace
+        exclude: '^ordmodels/'
+        # ordmodels trailing blanks shall preferably be fixed in OpenROADM upstream repo
+
+  - repo: https://github.com/jorisroovers/gitlint
+    rev: v0.15.1
+    hooks:
+      - id: gitlint
+        stages: [commit-msg]
+
+  - repo: https://github.com/Lucas-C/pre-commit-hooks
+    rev: v1.1.10
+    hooks:
+      - id: remove-tabs
+        stages: [commit]
+        exclude: '^(.git/|docs/make.bat|docs/Makefile|ordmodels/)'
index e1d35fc4de6ccb88a6318fe935390e77012cb59d..e4799d66c30f68a916e739f67dbe1e9aa94ecf0a 100755 (executable)
@@ -37,7 +37,7 @@ Netconf SSH to TCP proxy to debug netconf exchanges.
 It listens to connections in clear TCP to the given port. When a TCP connection demand is received,
 it establishes a netconf SSH encrypted connection to the host in argument. Netconf rpcs and replies
 are then proxified between both ends.
-By default, exchanges are altered according to the rules specified inside this script and easily 
+By default, exchanges are altered according to the rules specified inside this script and easily
 modifiable. This behaviour can be disabled with the '-s' option.
 For more convenience, the server hello handshake can also alternatively be replaced by the content
 of an external file instead of writing specific rules.
@@ -146,7 +146,7 @@ if (!$kidpid) {
 
     # copy the socket to standard output
     my $buf;
-    
+
     if (defined ($hello_message)) {
         #retrieve the server hello but do not relay it
         while (my $nread = sysread($ssh_subsocket,$buf,400)) {
@@ -171,9 +171,9 @@ if (!$kidpid) {
         print $client $buf;
         $ssh_subsocket->flush();
         if (defined($verbose))  { print STDOUT  $buf; }
-               
+
     };
+
     kill("TERM", $kidpid);              # send SIGTERM to child
 }
 # the else{} block runs only in the child process (client input relayed to the server)
index 7e4effd20ff3e11ae76d5168d1bf97665a69c37b..f2519149d62830a13756aab1fddccbda65021090 100644 (file)
 {
-       "variables": [],
-       "info": {
-               "name": "TransportPCE",
-               "_postman_id": "2a8c7902-5793-e48c-ebab-72256fcac793",
-               "description": "",
-               "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
-       },
-       "item": [
-               {
-                       "name": "test_portmapping",
-                       "description": "",
-                       "item": [
-                               {
-                                       "name": "test_01_rdm_device_connected",
-                                       "request": {
-                                               "auth": {
-                                                       "type": "basic",
-                                                       "basic": {
-                                                               "username": "admin",
-                                                               "password": "admin",
-                                                               "saveHelperData": true,
-                                                               "showPassword": false
-                                                       }
-                                               },
-                                               "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/ROADMA",
-                                               "method": "PUT",
-                                               "header": [
-                                                       {
-                                                               "key": "Content-Type",
-                                                               "value": "application/json",
-                                                               "description": ""
-                                                       },
-                                                       {
-                                                               "key": "Authorization",
-                                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                                               "description": ""
-                                                       }
-                                               ],
-                                               "body": {
-                                                       "mode": "raw",
-                                                       "raw": "{\n  \"node\" : {\n    \"node-id\": \"ROADMA\",\n    \"host\": \"127.0.0.1\",\n    \"port\": 17830,\n    \"username\": \"admin\",\n    \"password\": \"admin\",\n    \"tcp-only\": false,\n    \"keepalive-delay\": 0,\n    \"pass-through\": {}\n  }\n}\n"
-                                               },
-                                               "description": "connect device 01"
-                                       },
-                                       "response": []
-                               },
-                               {
-                                       "name": "test_02_rdm_device_connected",
-                                       "request": {
-                                               "url": "http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/ROADMA",
-                                               "method": "GET",
-                                               "header": [],
-                                               "body": {},
-                                               "description": ""
-                                       },
-                                       "response": []
-                               },
-                               {
-                                       "name": "test_03_rdm_portmapping_DEG1_TTP_TXRX",
-                                       "request": {
-                                               "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/ROADMA/mapping/DEG1-TTP-TXRX",
-                                               "method": "GET",
-                                               "header": [],
-                                               "body": {},
-                                               "description": ""
-                                       },
-                                       "response": []
-                               },
-                               {
-                                       "name": "test_04_rdm_portmapping_SRG1_PP7_TXRX",
-                                       "request": {
-                                               "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/ROADMA/mapping/SRG1-PP7-TXRX",
-                                               "method": "GET",
-                                               "header": [],
-                                               "body": {},
-                                               "description": ""
-                                       },
-                                       "response": []
-                               },
-                               {
-                                       "name": "test_05_rdm_portmapping_SRG3_PP1_TXRX",
-                                       "request": {
-                                               "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/ROADMA/mapping/SRG3-PP1-TXRX",
-                                               "method": "GET",
-                                               "header": [],
-                                               "body": {},
-                                               "description": ""
-                                       },
-                                       "response": []
-                               },
-                               {
-                                       "name": "test_06_xpdr_device_connected",
-                                       "request": {
-                                               "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/XPDRA",
-                                               "method": "PUT",
-                                               "header": [
-                                                       {
-                                                               "key": "Content-Type",
-                                                               "value": "application/json",
-                                                               "description": ""
-                                                       }
-                                               ],
-                                               "body": {
-                                                       "mode": "raw",
-                                                       "raw": "{\n  \"node\" : {\n    \"node-id\": \"XPDRA\",\n    \"host\": \"127.0.0.1\",\n    \"port\": 17831,\n    \"username\": \"admin\",\n    \"password\": \"admin\",\n    \"tcp-only\": false,\n    \"keepalive-delay\": 0,\n    \"pass-through\": {}\n  }\n}"
-                                               },
-                                               "description": ""
-                                       },
-                                       "response": []
-                               },
-                               {
-                                       "name": "test_07_xpdr_device_connected",
-                                       "request": {
-                                               "url": "http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/XPDRA",
-                                               "method": "GET",
-                                               "header": [],
-                                               "body": {},
-                                               "description": ""
-                                       },
-                                       "response": []
-                               },
-                               {
-                                       "name": "test_08_xpdr_portmapping_NETWORK1",
-                                       "request": {
-                                               "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/XPDRA/mapping/XPDR1-NETWORK1",
-                                               "method": "GET",
-                                               "header": [],
-                                               "body": {},
-                                               "description": ""
-                                       },
-                                       "response": []
-                               },
-                               {
-                                       "name": "test_09_xpdr_portmapping_NETWORK2",
-                                       "request": {
-                                               "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/XPDRA/mapping/XPDR1-NETWORK2",
-                                               "method": "GET",
-                                               "header": [],
-                                               "body": {},
-                                               "description": ""
-                                       },
-                                       "response": []
-                               },
-                               {
-                                       "name": "test_10_xpdr_portmapping_CLIENT1",
-                                       "request": {
-                                               "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/XPDRA/mapping/XPDR1-CLIENT1",
-                                               "method": "GET",
-                                               "header": [],
-                                               "body": {},
-                                               "description": ""
-                                       },
-                                       "response": []
-                               },
-                               {
-                                       "name": "test_11_xpdr_portmapping_CLIENT2",
-                                       "request": {
-                                               "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/XPDRA/mapping/XPDR1-CLIENT2",
-                                               "method": "GET",
-                                               "header": [],
-                                               "body": {},
-                                               "description": ""
-                                       },
-                                       "response": []
-                               },
-                               {
-                                       "name": "test_12_xpdr_portmapping_CLIENT4",
-                                       "request": {
-                                               "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/XPDRA/mapping/XPDR1-CLIENT4",
-                                               "method": "GET",
-                                               "header": [],
-                                               "body": {},
-                                               "description": ""
-                                       },
-                                       "response": []
-                               },
-                               {
-                                       "name": "test_13_xpdr_device_disconnected",
-                                       "request": {
-                                               "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/XPDRA",
-                                               "method": "DELETE",
-                                               "header": [],
-                                               "body": {},
-                                               "description": ""
-                                       },
-                                       "response": []
-                               },
-                               {
-                                       "name": "test_14_xpdr_device_disconnected",
-                                       "request": {
-                                               "url": "http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/XPDRA",
-                                               "method": "GET",
-                                               "header": [],
-                                               "body": {},
-                                               "description": ""
-                                       },
-                                       "response": []
-                               },
-                               {
-                                       "name": "test_15_xpdr_device_disconnected",
-                                       "request": {
-                                               "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/XPDRA",
-                                               "method": "GET",
-                                               "header": [],
-                                               "body": {},
-                                               "description": ""
-                                       },
-                                       "response": []
-                               },
-                               {
-                                       "name": "test_16_rdm_device_disconnected",
-                                       "request": {
-                                               "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/ROADMA",
-                                               "method": "DELETE",
-                                               "header": [],
-                                               "body": {},
-                                               "description": ""
-                                       },
-                                       "response": []
-                               },
-                               {
-                                       "name": "test_17_rdm_device_disconnected",
-                                       "request": {
-                                               "url": "http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/ROADMA",
-                                               "method": "GET",
-                                               "header": [],
-                                               "body": {},
-                                               "description": ""
-                                       },
-                                       "response": []
-                               },
-                               {
-                                       "name": "test_18_rdm_device_disconnected",
-                                       "request": {
-                                               "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/ROADMA",
-                                               "method": "GET",
-                                               "header": [],
-                                               "body": {},
-                                               "description": ""
-                                       },
-                                       "response": []
-                               }
-                       ]
-               },
-               {
-                       "name": "Get Modules",
-                       "request": {
-                               "auth": {
-                                       "type": "basic",
-                                       "basic": {
-                                               "username": "admin",
-                                               "password": "admin",
-                                               "saveHelperData": true,
-                                               "showPassword": false
-                                       }
-                               },
-                               "url": "http://localhost:8181/restconf/modules",
-                               "method": "GET",
-                               "header": [
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": ""
-                               },
-                               "description": "Get installed yang models "
-                       },
-                       "response": []
-               },
-               {
-                       "name": "Get List Of Network Topologies",
-                       "request": {
-                               "auth": {
-                                       "type": "basic",
-                                       "basic": {
-                                               "username": "admin",
-                                               "password": "admin",
-                                               "saveHelperData": true,
-                                               "showPassword": false
-                                       }
-                               },
-                               "url": "http://localhost:8181/restconf/config/network-topology:network-topology",
-                               "method": "GET",
-                               "header": [
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {},
-                               "description": "Get List Of Network Topologies"
-                       },
-                       "response": []
-               },
-               {
-                       "name": "Create NetConf device ",
-                       "request": {
-                               "auth": {
-                                       "type": "basic",
-                                       "basic": {
-                                               "username": "admin",
-                                               "password": "admin",
-                                               "saveHelperData": true,
-                                               "showPassword": false
-                                       }
-                               },
-                               "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device",
-                               "method": "PUT",
-                               "header": [
-                                       {
-                                               "key": "Content-Type",
-                                               "value": "application/json",
-                                               "description": ""
-                                       },
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": "{\n  \"node\" : {\n    \"node-id\": \"new-netconf-device\",\n    \"host\": \"127.0.0.1\",\n    \"port\": 17830,\n    \"username\": \"admin\",\n    \"password\": \"admin\",\n    \"tcp-only\": false,\n    \"keepalive-delay\": 0\n  }\n}\n"
-                               },
-                               "description": "Create NetConf device "
-                       },
-                       "response": []
-               },
-               {
-                       "name": "disconnect device 01",
-                       "request": {
-                               "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/ROADMA",
-                               "method": "DELETE",
-                               "header": [],
-                               "body": {},
-                               "description": "Delete NetConf device"
-                       },
-                       "response": []
-               },
-               {
-                       "name": "disconnect device 02",
-                       "request": {
-                               "auth": {
-                                       "type": "basic",
-                                       "basic": {
-                                               "username": "admin",
-                                               "password": "admin",
-                                               "saveHelperData": true,
-                                               "showPassword": false
-                                       }
-                               },
-                               "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/XPDRA",
-                               "method": "DELETE",
-                               "header": [
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {},
-                               "description": "Delete NetConf device"
-                       },
-                       "response": []
-               },
-               {
-                       "name": "Get Topologies Operational",
-                       "request": {
-                               "auth": {
-                                       "type": "basic",
-                                       "basic": {
-                                               "username": "admin",
-                                               "password": "admin",
-                                               "saveHelperData": true,
-                                               "showPassword": false
-                                       }
-                               },
-                               "url": "http://localhost:8181/restconf/operational/network-topology:network-topology",
-                               "method": "GET",
-                               "header": [
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {},
-                               "description": "Get Topologies Operational"
-                       },
-                       "response": []
-               },
-               {
-                       "name": "connect device 01",
-                       "request": {
-                               "auth": {
-                                       "type": "basic",
-                                       "basic": {
-                                               "username": "admin",
-                                               "password": "admin",
-                                               "saveHelperData": true,
-                                               "showPassword": false
-                                       }
-                               },
-                               "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/ROADMA",
-                               "method": "PUT",
-                               "header": [
-                                       {
-                                               "key": "Content-Type",
-                                               "value": "application/json",
-                                               "description": ""
-                                       },
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": "{\n  \"node\" : {\n    \"node-id\": \"ROADMA\",\n    \"host\": \"127.0.0.1\",\n    \"port\": 17830,\n    \"username\": \"admin\",\n    \"password\": \"admin\",\n    \"tcp-only\": false,\n    \"keepalive-delay\": 0,\n    \"pass-through\": {}\n  }\n}\n"
-                               },
-                               "description": "connect device 01"
-                       },
-                       "response": []
-               },
-               {
-                       "name": "connect device 02",
-                       "request": {
-                               "auth": {
-                                       "type": "basic",
-                                       "basic": {
-                                               "username": "admin",
-                                               "password": "admin",
-                                               "saveHelperData": true,
-                                               "showPassword": false
-                                       }
-                               },
-                               "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/ROADMA",
-                               "method": "PUT",
-                               "header": [
-                                       {
-                                               "key": "Content-Type",
-                                               "value": "application/json",
-                                               "description": ""
-                                       },
-                                       {
-                                               "key": "Authorization",
-                                               "value": "Basic YWRtaW46YWRtaW4=",
-                                               "description": ""
-                                       }
-                               ],
-                               "body": {
-                                       "mode": "raw",
-                                       "raw": "{\n  \"node\" : {\n    \"node-id\": \"XPDRA\",\n    \"host\": \"127.0.0.1\",\n    \"port\": 17831,\n    \"username\": \"admin\",\n    \"password\": \"admin\",\n    \"tcp-only\": false,\n    \"keepalive-delay\": 0,\n    \"pass-through\": {}\n  }\n}\n"
-                               },
-                               "description": "connect device 02"
-                       },
-                       "response": []
-               }
-       ]
+    "variables": [],
+    "info": {
+        "name": "TransportPCE",
+        "_postman_id": "2a8c7902-5793-e48c-ebab-72256fcac793",
+        "description": "",
+        "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
+    },
+    "item": [
+        {
+            "name": "test_portmapping",
+            "description": "",
+            "item": [
+                {
+                    "name": "test_01_rdm_device_connected",
+                    "request": {
+                        "auth": {
+                            "type": "basic",
+                            "basic": {
+                                "username": "admin",
+                                "password": "admin",
+                                "saveHelperData": true,
+                                "showPassword": false
+                            }
+                        },
+                        "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/ROADMA",
+                        "method": "PUT",
+                        "header": [
+                            {
+                                "key": "Content-Type",
+                                "value": "application/json",
+                                "description": ""
+                            },
+                            {
+                                "key": "Authorization",
+                                "value": "Basic YWRtaW46YWRtaW4=",
+                                "description": ""
+                            }
+                        ],
+                        "body": {
+                            "mode": "raw",
+                            "raw": "{\n  \"node\" : {\n    \"node-id\": \"ROADMA\",\n    \"host\": \"127.0.0.1\",\n    \"port\": 17830,\n    \"username\": \"admin\",\n    \"password\": \"admin\",\n    \"tcp-only\": false,\n    \"keepalive-delay\": 0,\n    \"pass-through\": {}\n  }\n}\n"
+                        },
+                        "description": "connect device 01"
+                    },
+                    "response": []
+                },
+                {
+                    "name": "test_02_rdm_device_connected",
+                    "request": {
+                        "url": "http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/ROADMA",
+                        "method": "GET",
+                        "header": [],
+                        "body": {},
+                        "description": ""
+                    },
+                    "response": []
+                },
+                {
+                    "name": "test_03_rdm_portmapping_DEG1_TTP_TXRX",
+                    "request": {
+                        "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/ROADMA/mapping/DEG1-TTP-TXRX",
+                        "method": "GET",
+                        "header": [],
+                        "body": {},
+                        "description": ""
+                    },
+                    "response": []
+                },
+                {
+                    "name": "test_04_rdm_portmapping_SRG1_PP7_TXRX",
+                    "request": {
+                        "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/ROADMA/mapping/SRG1-PP7-TXRX",
+                        "method": "GET",
+                        "header": [],
+                        "body": {},
+                        "description": ""
+                    },
+                    "response": []
+                },
+                {
+                    "name": "test_05_rdm_portmapping_SRG3_PP1_TXRX",
+                    "request": {
+                        "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/ROADMA/mapping/SRG3-PP1-TXRX",
+                        "method": "GET",
+                        "header": [],
+                        "body": {},
+                        "description": ""
+                    },
+                    "response": []
+                },
+                {
+                    "name": "test_06_xpdr_device_connected",
+                    "request": {
+                        "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/XPDRA",
+                        "method": "PUT",
+                        "header": [
+                            {
+                                "key": "Content-Type",
+                                "value": "application/json",
+                                "description": ""
+                            }
+                        ],
+                        "body": {
+                            "mode": "raw",
+                            "raw": "{\n  \"node\" : {\n    \"node-id\": \"XPDRA\",\n    \"host\": \"127.0.0.1\",\n    \"port\": 17831,\n    \"username\": \"admin\",\n    \"password\": \"admin\",\n    \"tcp-only\": false,\n    \"keepalive-delay\": 0,\n    \"pass-through\": {}\n  }\n}"
+                        },
+                        "description": ""
+                    },
+                    "response": []
+                },
+                {
+                    "name": "test_07_xpdr_device_connected",
+                    "request": {
+                        "url": "http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/XPDRA",
+                        "method": "GET",
+                        "header": [],
+                        "body": {},
+                        "description": ""
+                    },
+                    "response": []
+                },
+                {
+                    "name": "test_08_xpdr_portmapping_NETWORK1",
+                    "request": {
+                        "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/XPDRA/mapping/XPDR1-NETWORK1",
+                        "method": "GET",
+                        "header": [],
+                        "body": {},
+                        "description": ""
+                    },
+                    "response": []
+                },
+                {
+                    "name": "test_09_xpdr_portmapping_NETWORK2",
+                    "request": {
+                        "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/XPDRA/mapping/XPDR1-NETWORK2",
+                        "method": "GET",
+                        "header": [],
+                        "body": {},
+                        "description": ""
+                    },
+                    "response": []
+                },
+                {
+                    "name": "test_10_xpdr_portmapping_CLIENT1",
+                    "request": {
+                        "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/XPDRA/mapping/XPDR1-CLIENT1",
+                        "method": "GET",
+                        "header": [],
+                        "body": {},
+                        "description": ""
+                    },
+                    "response": []
+                },
+                {
+                    "name": "test_11_xpdr_portmapping_CLIENT2",
+                    "request": {
+                        "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/XPDRA/mapping/XPDR1-CLIENT2",
+                        "method": "GET",
+                        "header": [],
+                        "body": {},
+                        "description": ""
+                    },
+                    "response": []
+                },
+                {
+                    "name": "test_12_xpdr_portmapping_CLIENT4",
+                    "request": {
+                        "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/XPDRA/mapping/XPDR1-CLIENT4",
+                        "method": "GET",
+                        "header": [],
+                        "body": {},
+                        "description": ""
+                    },
+                    "response": []
+                },
+                {
+                    "name": "test_13_xpdr_device_disconnected",
+                    "request": {
+                        "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/XPDRA",
+                        "method": "DELETE",
+                        "header": [],
+                        "body": {},
+                        "description": ""
+                    },
+                    "response": []
+                },
+                {
+                    "name": "test_14_xpdr_device_disconnected",
+                    "request": {
+                        "url": "http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/XPDRA",
+                        "method": "GET",
+                        "header": [],
+                        "body": {},
+                        "description": ""
+                    },
+                    "response": []
+                },
+                {
+                    "name": "test_15_xpdr_device_disconnected",
+                    "request": {
+                        "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/XPDRA",
+                        "method": "GET",
+                        "header": [],
+                        "body": {},
+                        "description": ""
+                    },
+                    "response": []
+                },
+                {
+                    "name": "test_16_rdm_device_disconnected",
+                    "request": {
+                        "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/ROADMA",
+                        "method": "DELETE",
+                        "header": [],
+                        "body": {},
+                        "description": ""
+                    },
+                    "response": []
+                },
+                {
+                    "name": "test_17_rdm_device_disconnected",
+                    "request": {
+                        "url": "http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/ROADMA",
+                        "method": "GET",
+                        "header": [],
+                        "body": {},
+                        "description": ""
+                    },
+                    "response": []
+                },
+                {
+                    "name": "test_18_rdm_device_disconnected",
+                    "request": {
+                        "url": "http://localhost:8181/restconf/config/transportpce-portmapping:network/nodes/ROADMA",
+                        "method": "GET",
+                        "header": [],
+                        "body": {},
+                        "description": ""
+                    },
+                    "response": []
+                }
+            ]
+        },
+        {
+            "name": "Get Modules",
+            "request": {
+                "auth": {
+                    "type": "basic",
+                    "basic": {
+                        "username": "admin",
+                        "password": "admin",
+                        "saveHelperData": true,
+                        "showPassword": false
+                    }
+                },
+                "url": "http://localhost:8181/restconf/modules",
+                "method": "GET",
+                "header": [
+                    {
+                        "key": "Authorization",
+                        "value": "Basic YWRtaW46YWRtaW4=",
+                        "description": ""
+                    }
+                ],
+                "body": {
+                    "mode": "raw",
+                    "raw": ""
+                },
+                "description": "Get installed yang models "
+            },
+            "response": []
+        },
+        {
+            "name": "Get List Of Network Topologies",
+            "request": {
+                "auth": {
+                    "type": "basic",
+                    "basic": {
+                        "username": "admin",
+                        "password": "admin",
+                        "saveHelperData": true,
+                        "showPassword": false
+                    }
+                },
+                "url": "http://localhost:8181/restconf/config/network-topology:network-topology",
+                "method": "GET",
+                "header": [
+                    {
+                        "key": "Authorization",
+                        "value": "Basic YWRtaW46YWRtaW4=",
+                        "description": ""
+                    }
+                ],
+                "body": {},
+                "description": "Get List Of Network Topologies"
+            },
+            "response": []
+        },
+        {
+            "name": "Create NetConf device ",
+            "request": {
+                "auth": {
+                    "type": "basic",
+                    "basic": {
+                        "username": "admin",
+                        "password": "admin",
+                        "saveHelperData": true,
+                        "showPassword": false
+                    }
+                },
+                "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device",
+                "method": "PUT",
+                "header": [
+                    {
+                        "key": "Content-Type",
+                        "value": "application/json",
+                        "description": ""
+                    },
+                    {
+                        "key": "Authorization",
+                        "value": "Basic YWRtaW46YWRtaW4=",
+                        "description": ""
+                    }
+                ],
+                "body": {
+                    "mode": "raw",
+                    "raw": "{\n  \"node\" : {\n    \"node-id\": \"new-netconf-device\",\n    \"host\": \"127.0.0.1\",\n    \"port\": 17830,\n    \"username\": \"admin\",\n    \"password\": \"admin\",\n    \"tcp-only\": false,\n    \"keepalive-delay\": 0\n  }\n}\n"
+                },
+                "description": "Create NetConf device "
+            },
+            "response": []
+        },
+        {
+            "name": "disconnect device 01",
+            "request": {
+                "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/ROADMA",
+                "method": "DELETE",
+                "header": [],
+                "body": {},
+                "description": "Delete NetConf device"
+            },
+            "response": []
+        },
+        {
+            "name": "disconnect device 02",
+            "request": {
+                "auth": {
+                    "type": "basic",
+                    "basic": {
+                        "username": "admin",
+                        "password": "admin",
+                        "saveHelperData": true,
+                        "showPassword": false
+                    }
+                },
+                "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/XPDRA",
+                "method": "DELETE",
+                "header": [
+                    {
+                        "key": "Authorization",
+                        "value": "Basic YWRtaW46YWRtaW4=",
+                        "description": ""
+                    }
+                ],
+                "body": {},
+                "description": "Delete NetConf device"
+            },
+            "response": []
+        },
+        {
+            "name": "Get Topologies Operational",
+            "request": {
+                "auth": {
+                    "type": "basic",
+                    "basic": {
+                        "username": "admin",
+                        "password": "admin",
+                        "saveHelperData": true,
+                        "showPassword": false
+                    }
+                },
+                "url": "http://localhost:8181/restconf/operational/network-topology:network-topology",
+                "method": "GET",
+                "header": [
+                    {
+                        "key": "Authorization",
+                        "value": "Basic YWRtaW46YWRtaW4=",
+                        "description": ""
+                    }
+                ],
+                "body": {},
+                "description": "Get Topologies Operational"
+            },
+            "response": []
+        },
+        {
+            "name": "connect device 01",
+            "request": {
+                "auth": {
+                    "type": "basic",
+                    "basic": {
+                        "username": "admin",
+                        "password": "admin",
+                        "saveHelperData": true,
+                        "showPassword": false
+                    }
+                },
+                "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/ROADMA",
+                "method": "PUT",
+                "header": [
+                    {
+                        "key": "Content-Type",
+                        "value": "application/json",
+                        "description": ""
+                    },
+                    {
+                        "key": "Authorization",
+                        "value": "Basic YWRtaW46YWRtaW4=",
+                        "description": ""
+                    }
+                ],
+                "body": {
+                    "mode": "raw",
+                    "raw": "{\n  \"node\" : {\n    \"node-id\": \"ROADMA\",\n    \"host\": \"127.0.0.1\",\n    \"port\": 17830,\n    \"username\": \"admin\",\n    \"password\": \"admin\",\n    \"tcp-only\": false,\n    \"keepalive-delay\": 0,\n    \"pass-through\": {}\n  }\n}\n"
+                },
+                "description": "connect device 01"
+            },
+            "response": []
+        },
+        {
+            "name": "connect device 02",
+            "request": {
+                "auth": {
+                    "type": "basic",
+                    "basic": {
+                        "username": "admin",
+                        "password": "admin",
+                        "saveHelperData": true,
+                        "showPassword": false
+                    }
+                },
+                "url": "http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/ROADMA",
+                "method": "PUT",
+                "header": [
+                    {
+                        "key": "Content-Type",
+                        "value": "application/json",
+                        "description": ""
+                    },
+                    {
+                        "key": "Authorization",
+                        "value": "Basic YWRtaW46YWRtaW4=",
+                        "description": ""
+                    }
+                ],
+                "body": {
+                    "mode": "raw",
+                    "raw": "{\n  \"node\" : {\n    \"node-id\": \"XPDRA\",\n    \"host\": \"127.0.0.1\",\n    \"port\": 17831,\n    \"username\": \"admin\",\n    \"password\": \"admin\",\n    \"tcp-only\": false,\n    \"keepalive-delay\": 0,\n    \"pass-through\": {}\n  }\n}\n"
+                },
+                "description": "connect device 02"
+            },
+            "response": []
+        }
+    ]
 }
\ No newline at end of file
index 231dc53c84e630b538814d50eeb106db12b6ddfa..f2d63a221f6fd7ba6d299a11abb18731061a6ba0 100644 (file)
         }
       ]
     }
-   
+
 }
 }
\ No newline at end of file
index 2d68ee5c9d224c88d2e46d100d6f17a4c2c9318f..fdca157220ae5775c58ff75acf376ed62ff13ec3 100644 (file)
@@ -630,7 +630,7 @@ module tapi-eth {
         leaf cc-period {
             type oam-period;
             description "This attribute models the MI_CC_Period signal defined in G.8021 and configured as specified in G8051.
-                It is the period at which the CCM message should be sent. 
+                It is the period at which the CCM message should be sent.
                 Default values are: 3.33 ms for PS, 100 ms for PM, 1 s for FM.";
         }
         leaf cc-priority {
index 208da160b9402ca1513a29c8ae86f4e5f85724fa..2ceeb77b41659a67abf2ae9ded116847116f9f29 100644 (file)
@@ -228,7 +228,7 @@ module tapi-topology {
             description "Provides the ordered structure of layer protocol transitions encapsulated in the TopologicalEntity. The ordering relates to the LinkPort role.";
         }
         description "Relevant for a Link that is formed by abstracting one or more LTPs (in a stack) to focus on the flow and deemphasize the protocol transformation.
-            This abstraction is relevant when considering multi-layer routing. 
+            This abstraction is relevant when considering multi-layer routing.
             The layer protocols of the LTP and the order of their application to the signal is still relevant and need to be accounted for. This is derived from the LTP spec details.
             This Pac provides the relevant abstractions of the LTPs and provides the necessary association to the LTPs involved.
             Links that included details in this Pac are often referred to as Transitional Links.";
index c95df62f5e20f5237c69055ead20fcb6d48365a3..ae3f76b012da952940d3de270599bea424b2b8c9 100755 (executable)
@@ -14,7 +14,7 @@ echo $JAVAC_VER
 if [ "$JAVA_VER" -ge 110 -a "$JAVAC_VER" -ge 110 ];then
         echo "ok, java is 11 or newer"
 else
-       #java 11 installation for CentOS (releng OS image target)
+    #java 11 installation for CentOS (releng OS image target)
         echo "install java 11"
         sudo yum install -y java-11-openjdk java-11-openjdk-devel
         last_installed_jdk11=$(ls -tr1 /usr/lib/jvm/ | grep java-11-openjdk-11 | tail -1)
diff --git a/tests/netconf.patch b/tests/netconf.patch
deleted file mode 100644 (file)
index 0de041d..0000000
+++ /dev/null
@@ -1,417 +0,0 @@
-diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/SimulatedOperationProvider.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/SimulatedOperationProvider.java
-index f2828d1..d3026b8 100644
---- a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/SimulatedOperationProvider.java
-+++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/SimulatedOperationProvider.java
-@@ -26,6 +26,7 @@ import org.opendaylight.netconf.test.tool.rpc.SimulatedDiscardChanges;
- import org.opendaylight.netconf.test.tool.rpc.SimulatedEditConfig;
- import org.opendaylight.netconf.test.tool.rpc.SimulatedGet;
- import org.opendaylight.netconf.test.tool.rpc.SimulatedGetConfig;
-+import org.opendaylight.netconf.test.tool.rpc.SimulatedGetConnectionPortTrail;
- import org.opendaylight.netconf.test.tool.rpc.SimulatedLock;
- import org.opendaylight.netconf.test.tool.rpc.SimulatedUnLock;
-@@ -38,19 +39,19 @@ class SimulatedOperationProvider implements NetconfOperationServiceFactory {
-                                final Optional<File> notificationsFile,
-                                final Optional<File> initialConfigXMLFile) {
-         this.caps = caps;
--        simulatedOperationService = new SimulatedOperationService(
-+        this.simulatedOperationService = new SimulatedOperationService(
-             idProvider.getCurrentSessionId(), notificationsFile, initialConfigXMLFile);
-     }
-     @Override
-     public Set<Capability> getCapabilities() {
--        return caps;
-+        return this.caps;
-     }
-     @Override
-     public AutoCloseable registerCapabilityListener(
-             final CapabilityListener listener) {
--        listener.onCapabilitiesChanged(caps, Collections.emptySet());
-+        listener.onCapabilitiesChanged(this.caps, Collections.emptySet());
-         return () -> {
-         };
-     }
-@@ -58,7 +59,7 @@ class SimulatedOperationProvider implements NetconfOperationServiceFactory {
-     @Override
-     public NetconfOperationService createService(
-             final String netconfSessionIdForReporting) {
--        return simulatedOperationService;
-+        return this.simulatedOperationService;
-     }
-     static class SimulatedOperationService implements NetconfOperationService {
-@@ -76,19 +77,24 @@ class SimulatedOperationProvider implements NetconfOperationServiceFactory {
-         @Override
-         public Set<NetconfOperation> getNetconfOperations() {
-             final DataList storage = new DataList();
--            final SimulatedGet sGet = new SimulatedGet(String.valueOf(currentSessionId), storage);
--            final SimulatedEditConfig sEditConfig = new SimulatedEditConfig(String.valueOf(currentSessionId), storage);
-+            final SimulatedGet sGet = new SimulatedGet(String.valueOf(this.currentSessionId), storage,
-+                    this.initialConfigXMLFile);
-+            final SimulatedEditConfig sEditConfig = new SimulatedEditConfig(String.valueOf(this.currentSessionId),
-+                    storage);
-             final SimulatedGetConfig sGetConfig = new SimulatedGetConfig(
--                String.valueOf(currentSessionId), storage, initialConfigXMLFile);
--            final SimulatedCommit sCommit = new SimulatedCommit(String.valueOf(currentSessionId));
--            final SimulatedLock sLock = new SimulatedLock(String.valueOf(currentSessionId));
--            final SimulatedUnLock sUnlock = new SimulatedUnLock(String.valueOf(currentSessionId));
-+                String.valueOf(this.currentSessionId), storage, this.initialConfigXMLFile);
-+            final SimulatedGetConnectionPortTrail sSimulatedConnectionPortTrail = new SimulatedGetConnectionPortTrail(
-+                    String.valueOf(this.currentSessionId));
-+            final SimulatedCommit sCommit = new SimulatedCommit(String.valueOf(this.currentSessionId));
-+            final SimulatedLock sLock = new SimulatedLock(String.valueOf(this.currentSessionId));
-+            final SimulatedUnLock sUnlock = new SimulatedUnLock(String.valueOf(this.currentSessionId));
-             final SimulatedCreateSubscription sCreateSubs = new SimulatedCreateSubscription(
--                    String.valueOf(currentSessionId), notificationsFile);
-+                    String.valueOf(this.currentSessionId), this.notificationsFile);
-             final SimulatedDiscardChanges sDiscardChanges = new SimulatedDiscardChanges(
--                String.valueOf(currentSessionId));
-+                String.valueOf(this.currentSessionId));
-             return Sets.newHashSet(
--                sGet, sGetConfig, sEditConfig, sCommit, sLock, sUnlock, sCreateSubs, sDiscardChanges);
-+                sGet, sGetConfig, sEditConfig, sCommit, sLock, sUnlock, sCreateSubs, sDiscardChanges,
-+                sSimulatedConnectionPortTrail);
-         }
-         @Override
-diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/config/Configuration.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/config/Configuration.java
-index 6654425..d5bebd6 100644
---- a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/config/Configuration.java
-+++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/config/Configuration.java
-@@ -95,7 +95,7 @@ public class Configuration {
-     }
-     public PublickeyAuthenticator getPublickeyAuthenticator() {
--        return publickeyAuthenticator;
-+        return this.publickeyAuthenticator;
-     }
-     public void setPublickeyAuthenticator(final PublickeyAuthenticator publickeyAuthenticator) {
-@@ -103,7 +103,7 @@ public class Configuration {
-     }
-     public AuthProvider getAuthProvider() {
--        return authProvider;
-+        return this.authProvider;
-     }
-     public void setAuthProvider(final AuthProvider authProvider) {
-@@ -111,7 +111,7 @@ public class Configuration {
-     }
-     public Set<YangResource> getDefaultYangResources() {
--        return defaultYangResources;
-+        return this.defaultYangResources;
-     }
-     public void setDefaultYangResources(final Set<YangResource> defaultYangResources) {
-@@ -119,7 +119,7 @@ public class Configuration {
-     }
-     public int getThreadPoolSize() {
--        return threadPoolSize;
-+        return this.threadPoolSize;
-     }
-     public void setThreadPoolSize(final int threadPoolSize) {
-@@ -127,7 +127,7 @@ public class Configuration {
-     }
-     public int getStartingPort() {
--        return startingPort;
-+        return this.startingPort;
-     }
-     public void setStartingPort(final int startingPort) {
-@@ -135,7 +135,7 @@ public class Configuration {
-     }
-     public int getDeviceCount() {
--        return deviceCount;
-+        return this.deviceCount;
-     }
-     public void setDeviceCount(final int deviceCount) {
-@@ -143,7 +143,7 @@ public class Configuration {
-     }
-     public int getGenerateConfigsTimeout() {
--        return generateConfigsTimeout;
-+        return this.generateConfigsTimeout;
-     }
-     public void setGenerateConfigsTimeout(final int generateConfigsTimeout) {
-@@ -151,7 +151,7 @@ public class Configuration {
-     }
-     public boolean isSsh() {
--        return ssh;
-+        return this.ssh;
-     }
-     public void setSsh(final boolean ssh) {
-@@ -159,7 +159,7 @@ public class Configuration {
-     }
-     public String getIp() {
--        return ip;
-+        return this.ip;
-     }
-     public void setIp(final String ip) {
-@@ -167,7 +167,7 @@ public class Configuration {
-     }
-     public Set<String> getModels() {
--        return models;
-+        return this.models;
-     }
-     public void setModels(final Set<String> models) {
-@@ -175,7 +175,7 @@ public class Configuration {
-     }
-     public Set<String> getCapabilities() {
--        return capabilities;
-+        return this.capabilities;
-     }
-     public void setCapabilities(final Set<String> capabilities) {
-@@ -183,7 +183,7 @@ public class Configuration {
-     }
-     public RpcHandler getRpcHandler() {
--        return rpcHandler;
-+        return this.rpcHandler;
-     }
-     public void setRpcHandler(final RpcHandler rpcHandler) {
-@@ -191,7 +191,7 @@ public class Configuration {
-     }
-     public OperationsCreator getOperationsCreator() {
--        return operationsCreator;
-+        return this.operationsCreator;
-     }
-     public void setOperationsCreator(final OperationsCreator operationsCreator) {
-@@ -200,7 +200,7 @@ public class Configuration {
-     @Deprecated
-     public boolean isMdSal() {
--        return mdSal;
-+        return this.mdSal;
-     }
-     @Deprecated
-@@ -210,7 +210,7 @@ public class Configuration {
-     @Deprecated
-     public File getRpcConfigFile() {
--        return rpcConfigFile;
-+        return this.rpcConfigFile;
-     }
-     @Deprecated
-@@ -220,7 +220,7 @@ public class Configuration {
-     @Deprecated
-     public File getNotificationFile() {
--        return notificationFile;
-+        return this.notificationFile;
-     }
-     @Deprecated
-@@ -230,7 +230,7 @@ public class Configuration {
-     @Deprecated
-     public File getInitialConfigXMLFile() {
--        return initialConfigXMLFile;
-+        return this.initialConfigXMLFile;
-     }
-     @Deprecated
-@@ -240,12 +240,12 @@ public class Configuration {
-     @Deprecated
-     public boolean isXmlConfigurationProvided() {
--        return initialConfigXMLFile != null && notificationFile != null;
-+        return this.initialConfigXMLFile != null;//&& notificationFile != null;
-     }
-     @Deprecated
-     public File getSchemasDir() {
--        return schemasDir;
-+        return this.schemasDir;
-     }
-     @Deprecated
-diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/operations/DefaultOperationsCreator.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/operations/DefaultOperationsCreator.java
-index edfdf6e..0bc0b9d 100644
---- a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/operations/DefaultOperationsCreator.java
-+++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/operations/DefaultOperationsCreator.java
-@@ -30,14 +30,14 @@ public final class DefaultOperationsCreator implements OperationsCreator {
-     private final SimulatedOperationService simulatedOperationService;
-     private DefaultOperationsCreator(final long currentSessionId) {
--        simulatedOperationService = new SimulatedOperationService(currentSessionId);
-+        this.simulatedOperationService = new SimulatedOperationService(currentSessionId);
-     }
-     @Override
-     public NetconfOperationService getNetconfOperationService(final Set<Capability> caps,
-         final SessionIdProvider idProvider,
-         final String netconfSessionIdForReporting) {
--        return simulatedOperationService;
-+        return this.simulatedOperationService;
-     }
-     public static DefaultOperationsCreator getDefaultOperationServiceCreator(final long currentSessionId) {
-@@ -55,17 +55,19 @@ public final class DefaultOperationsCreator implements OperationsCreator {
-         @Override
-         public Set<NetconfOperation> getNetconfOperations() {
-             final DataList storage = new DataList();
--            final SimulatedGet sGet = new SimulatedGet(String.valueOf(currentSessionId), storage);
--            final SimulatedEditConfig sEditConfig = new SimulatedEditConfig(String.valueOf(currentSessionId), storage);
-+            final SimulatedGet sGet = new SimulatedGet(String.valueOf(this.currentSessionId), storage,
-+                    Optional.absent());
-+            final SimulatedEditConfig sEditConfig = new SimulatedEditConfig(String.valueOf(this.currentSessionId),
-+                    storage);
-             final SimulatedGetConfig sGetConfig = new SimulatedGetConfig(
--                String.valueOf(currentSessionId), storage, Optional.absent());
--            final SimulatedCommit sCommit = new SimulatedCommit(String.valueOf(currentSessionId));
--            final SimulatedLock sLock = new SimulatedLock(String.valueOf(currentSessionId));
--            final SimulatedUnLock sUnlock = new SimulatedUnLock(String.valueOf(currentSessionId));
-+                String.valueOf(this.currentSessionId), storage, Optional.absent());
-+            final SimulatedCommit sCommit = new SimulatedCommit(String.valueOf(this.currentSessionId));
-+            final SimulatedLock sLock = new SimulatedLock(String.valueOf(this.currentSessionId));
-+            final SimulatedUnLock sUnlock = new SimulatedUnLock(String.valueOf(this.currentSessionId));
-             final SimulatedCreateSubscription sCreateSubs = new SimulatedCreateSubscription(
--                String.valueOf(currentSessionId), Optional.absent());
-+                String.valueOf(this.currentSessionId), Optional.absent());
-             final SimulatedDiscardChanges sDiscardChanges = new SimulatedDiscardChanges(
--                String.valueOf(currentSessionId));
-+                String.valueOf(this.currentSessionId));
-             return Sets.newHashSet(
-                 sGet, sGetConfig, sEditConfig, sCommit, sLock, sUnlock, sCreateSubs, sDiscardChanges);
-         }
-diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpc/SimulatedGet.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpc/SimulatedGet.java
-index e5b197d..92f71fc 100644
---- a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpc/SimulatedGet.java
-+++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpc/SimulatedGet.java
-@@ -9,27 +9,62 @@
- package org.opendaylight.netconf.test.tool.rpc;
- import com.google.common.base.Optional;
-+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-+import java.io.File;
-+import java.io.IOException;
-+import java.util.Collections;
-+import java.util.List;
- import org.opendaylight.netconf.api.xml.XmlElement;
- import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
- import org.opendaylight.netconf.api.xml.XmlUtil;
- import org.opendaylight.netconf.util.mapping.AbstractLastNetconfOperation;
-+import org.slf4j.Logger;
-+import org.slf4j.LoggerFactory;
- import org.w3c.dom.Document;
- import org.w3c.dom.Element;
-+import org.xml.sax.SAXException;
- public class SimulatedGet extends AbstractLastNetconfOperation {
-     private final DataList storage;
-+    private static final Logger LOG = LoggerFactory.getLogger(SimulatedGet.class);
--    public SimulatedGet(final String netconfSessionIdForReporting, final DataList storage) {
-+    public SimulatedGet(final String netconfSessionIdForReporting, final DataList storage,
-+            final Optional<File> initialConfigXMLFile) {
-         super(netconfSessionIdForReporting);
--        this.storage = storage;
-+
-+        if (initialConfigXMLFile.isPresent()) {
-+            LOG.info("File is present: {}", initialConfigXMLFile.get().getName());
-+            this.storage = loadInitialConfigXMLFile(initialConfigXMLFile.get());
-+        } else {
-+            this.storage = storage;
-+        }
-+    }
-+
-+    @SuppressFBWarnings(value = "DLS_DEAD_LOCAL_STORE")
-+    private DataList loadInitialConfigXMLFile(final File file) {
-+        LOG.info("Loading initial config xml file: {}", file.getName());
-+        DataList configData = new DataList();
-+        List<XmlElement> xmlElementList = Collections.emptyList();
-+        try {
-+            Element element = XmlUtil.readXmlToElement(file);
-+            XmlElement xmlElement = XmlElement.fromDomElement(element);
-+            xmlElementList = xmlElement.getChildElements();
-+            configData.setConfigList(xmlElementList);
-+        } catch (IOException e) {
-+            LOG.info("IO exception loading xml file: {} ", e.getMessage());
-+
-+        } catch (SAXException e) {
-+            LOG.info("SAXException {}", e.getMessage());
-+        }
-+        return configData;
-     }
-     @Override
-     protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) {
-         final Element element = XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY, Optional.absent());
--        for (final XmlElement e : storage.getConfigList()) {
-+        for (final XmlElement e : this.storage.getConfigList()) {
-             final Element domElement = e.getDomElement();
-             element.appendChild(element.getOwnerDocument().importNode(domElement, true));
-         }
-diff --git a/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpc/SimulatedGetConnectionPortTrail.java b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpc/SimulatedGetConnectionPortTrail.java
-new file mode 100644
-index 0000000..551eb71
---- /dev/null
-+++ b/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpc/SimulatedGetConnectionPortTrail.java
-@@ -0,0 +1,42 @@
-+/*
-+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
-+ *
-+ * This program and the accompanying materials are made available under the
-+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
-+ * and is available at http://www.eclipse.org/legal/epl-v10.html
-+ */
-+package org.opendaylight.netconf.test.tool.rpc;
-+
-+import org.opendaylight.netconf.api.DocumentedException;
-+import org.opendaylight.netconf.api.xml.XmlElement;
-+import org.opendaylight.netconf.util.mapping.AbstractLastNetconfOperation;
-+import org.w3c.dom.Document;
-+import org.w3c.dom.Element;
-+
-+public class SimulatedGetConnectionPortTrail extends AbstractLastNetconfOperation {
-+
-+    public SimulatedGetConnectionPortTrail(final String netconfSessionIdForReporting) {
-+        super(netconfSessionIdForReporting);
-+    }
-+
-+    @Override
-+    protected Element handleWithNoSubsequentOperations(Document document, XmlElement operationElement)
-+            throws DocumentedException {
-+        Element portname = document.createElement("port-name");
-+        portname.appendChild(document.createTextNode("L1"));
-+        Element circuitpackname = document.createElement("circuit-pack-name");
-+        circuitpackname.appendChild(document.createTextNode("2/0"));
-+        Element ports = document.createElement("ports");
-+        ports.setAttribute("xmlns", "http://org/openroadm/device");
-+        ports.appendChild(portname);
-+        ports.appendChild(circuitpackname);
-+        return ports;
-+    }
-+
-+    @Override
-+    protected String getOperationName() {
-+        return "get-connection-port-trail";
-+    }
-+
-+
-+}
index b534c602e27663b8d17e565407f3499ef11efdcd..20d05c964eb3b93698b06094b601d7fb0c075cb9 100644 (file)
         </span>
     </OMS-attributes>
 </link>
-<link xmlns="urn:ietf:params:xml:ns:yang:ietf-network-topology"> 
+<link xmlns="urn:ietf:params:xml:ns:yang:ietf-network-topology">
    <link-id>OpenROADM-3-2-DEG3-to-OpenROADM-2-3-DEG3</link-id>
     <opposite-link xmlns="http://org/openroadm/common/network">OpenROADM-2-3-DEG3-to-OpenROADM-3-2-DEG3</opposite-link>
     <clfi xmlns="http://org/openroadm/common/network">fiber3223</clfi>
index 600db4deb71e13f4f12b935f6265ccb0d31b388c..646868ba25a46528a548b9e582ad30e6f1a98890 100644 (file)
     <link-id>OpenROADM-5-1-DEG1-to-OpenROADM-5-2-DEG1</link-id>
     <opposite-link xmlns="http://org/openroadm/common/network">OpenROADM-5-2-DEG1-to-OpenROADM-5-1-DEG1</opposite-link>
     <link-type xmlns="http://org/openroadm/common/network">ROADM-TO-ROADM</link-type>
-    <source><source-node>OpenROADM-5-1-DEG1</source-node><source-tp>DEG1-TTP-TX</source-tp></source>    
+    <source><source-node>OpenROADM-5-1-DEG1</source-node><source-tp>DEG1-TTP-TX</source-tp></source>
     <destination><dest-node>OpenROADM-5-2-DEG1</dest-node><dest-tp>DEG1-TTP-RX</dest-tp></destination>
     <administrative-state xmlns="http://org/openroadm/common/network">inService</administrative-state>
     <operational-state xmlns="http://org/openroadm/common/network">inService</operational-state>
         </span>
     </OMS-attributes>
 </link>
-<link xmlns="urn:ietf:params:xml:ns:yang:ietf-network-topology">    
+<link xmlns="urn:ietf:params:xml:ns:yang:ietf-network-topology">
     <link-id>OpenROADM-5-1-DEG3-to-OpenROADM-4-2-DEG3</link-id>
     <opposite-link xmlns="http://org/openroadm/common/network">OpenROADM-4-2-DEG3-to-OpenROADM-5-1-DEG3</opposite-link>
     <link-type xmlns="http://org/openroadm/common/network">ROADM-TO-ROADM</link-type>
index 55ede8cbd015d5eb31fde1295c790f5959cf33d3..0425debb9ed03d5dc8518149098b0fe5f4afc0e3 100644 (file)
         <supported-interface-capability xmlns:x="http://org/openroadm/port/types">x:if-OCH</supported-interface-capability>
       </ports>
     </circuit-packs>
-    <circuit-packs> 
+    <circuit-packs>
       <is-pluggable-optics>true</is-pluggable-optics>
       <circuit-pack-name>1/0/ETH-PLUG</circuit-pack-name>
       <circuit-pack-type>port</circuit-pack-type>
       <name>OMS-DEG2-TTP-TXRX</name>
       <supporting-circuit-pack-name>2/0</supporting-circuit-pack-name>
       <supporting-port>L1</supporting-port>
-      <supporting-interface>OTS-DEG2-TTP-TXRX</supporting-interface>      
-      <type xmlns:openROADM-if="http://org/openroadm/interfaces">openROADM-if:openROADMOpticalMultiplex</type> 
-      <description>TBD</description>      
+      <supporting-interface>OTS-DEG2-TTP-TXRX</supporting-interface>
+      <type xmlns:openROADM-if="http://org/openroadm/interfaces">openROADM-if:openROADMOpticalMultiplex</type>
+      <description>TBD</description>
       <circuit-id>TBD</circuit-id>
       <operational-state>inService</operational-state>
-      <administrative-state>inService</administrative-state>      
+      <administrative-state>inService</administrative-state>
     </interface>
 
     <protocols>
index 1bd584bd0bd56f61747f5815e422e6aa9bc61318..a020be60e2c2c0159359aa99c87e169ec469db20 100644 (file)
       <name>OMS-DEG1-TTP-TXRX</name>
       <supporting-circuit-pack-name>1/0</supporting-circuit-pack-name>
       <supporting-port>L1</supporting-port>
-      <supporting-interface>OTS-DEG1-TTP-TXRX</supporting-interface>      
-      <type xmlns:openROADM-if="http://org/openroadm/interfaces">openROADM-if:openROADMOpticalMultiplex</type> 
-      <description>TBD</description>      
+      <supporting-interface>OTS-DEG1-TTP-TXRX</supporting-interface>
+      <type xmlns:openROADM-if="http://org/openroadm/interfaces">openROADM-if:openROADMOpticalMultiplex</type>
+      <description>TBD</description>
       <circuit-id>TBD</circuit-id>
       <operational-state>inService</operational-state>
-      <administrative-state>inService</administrative-state>      
+      <administrative-state>inService</administrative-state>
     </interface>
 
     <protocols>
index 3b3f990f4d542136508afc79da326e7409c12c25..27a1eea342dbded9d35eb370b9ca0d284234c666 100644 (file)
         <slot-name>CP3-S10</slot-name>
         <label>CP3S10</label>
       </cp-slots>
-         <cp-slots>
+      <cp-slots>
         <slot-name>CP3-S11</slot-name>
         <label>CP3S11</label>
       </cp-slots>
         <slot-name>CP3-S20</slot-name>
         <label>CP3S20</label>
       </cp-slots>
-         <cp-slots>
+      <cp-slots>
         <slot-name>CP3-S21</slot-name>
         <label>CP3S21</label>
       </cp-slots>
         <slot-name>CP3-S30</slot-name>
         <label>CP3S30</label>
       </cp-slots>
-         <cp-slots>
+      <cp-slots>
         <slot-name>CP3-S31</slot-name>
         <label>CP3S31</label>
       </cp-slots>
         <slot-name>CP3-S40</slot-name>
         <label>CP3S40</label>
       </cp-slots>
-         <cp-slots>
+      <cp-slots>
         <slot-name>CP3-S41</slot-name>
         <label>CP3S41</label>
       </cp-slots>
         <slot-name>CP3-S50</slot-name>
         <label>CP3S50</label>
       </cp-slots>
-         <cp-slots>
+      <cp-slots>
         <slot-name>CP3-S51</slot-name>
         <label>CP3S51</label>
       </cp-slots>
         <slot-name>CP3-S60</slot-name>
         <label>CP3S60</label>
       </cp-slots>
-         <cp-slots>
+      <cp-slots>
         <slot-name>CP3-S61</slot-name>
         <label>CP3S61</label>
       </cp-slots>
         <slot-name>CP3-S70</slot-name>
         <label>CP3S70</label>
       </cp-slots>
-         <cp-slots>
+      <cp-slots>
         <slot-name>CP3-S71</slot-name>
         <label>CP3S71</label>
       </cp-slots>
         <eqpt-srg-id>6</eqpt-srg-id>
       </xpdr-port>
     </xponder>
-       <xponder>
+    <xponder>
       <xpdr-number>3</xpdr-number>
       <xpdr-type>mpdr</xpdr-type>
       <xpdr-port>
         </port-list>
       </non-blocking-list>
     </odu-switching-pools>
-       <odu-switching-pools>
+    <odu-switching-pools>
       <switching-pool-number>3</switching-pool-number>
       <switching-pool-type xmlns:org-openroadm-switching-pool-types="http://org/openroadm/switching-pool-types">non-blocking</switching-pool-type>
       <non-blocking-list>
           <slot-name>CP3-S0</slot-name>
         </pluggable-optics-holder-list>
       </non-blocking-list>
-         <non-blocking-list>
+      <non-blocking-list>
         <nbl-number>11</nbl-number>
         <interconnect-bandwidth-unit>1000000000</interconnect-bandwidth-unit>
         <interconnect-bandwidth>0</interconnect-bandwidth>
           <slot-name>CP3-S0</slot-name>
         </pluggable-optics-holder-list>
       </non-blocking-list>
-         <non-blocking-list>
+      <non-blocking-list>
         <nbl-number>21</nbl-number>
         <interconnect-bandwidth-unit>1000000000</interconnect-bandwidth-unit>
         <interconnect-bandwidth>0</interconnect-bandwidth>
           <slot-name>CP3-S0</slot-name>
         </pluggable-optics-holder-list>
       </non-blocking-list>
-         <non-blocking-list>
+      <non-blocking-list>
         <nbl-number>31</nbl-number>
         <interconnect-bandwidth-unit>1000000000</interconnect-bandwidth-unit>
         <interconnect-bandwidth>0</interconnect-bandwidth>
           <slot-name>CP3-S0</slot-name>
         </pluggable-optics-holder-list>
       </non-blocking-list>
-         <non-blocking-list>
+      <non-blocking-list>
         <nbl-number>41</nbl-number>
         <interconnect-bandwidth-unit>1000000000</interconnect-bandwidth-unit>
         <interconnect-bandwidth>0</interconnect-bandwidth>
           <slot-name>CP3-S0</slot-name>
         </pluggable-optics-holder-list>
       </non-blocking-list>
-         <non-blocking-list>
+      <non-blocking-list>
         <nbl-number>51</nbl-number>
         <interconnect-bandwidth-unit>1000000000</interconnect-bandwidth-unit>
         <interconnect-bandwidth>0</interconnect-bandwidth>
           <slot-name>CP3-S0</slot-name>
         </pluggable-optics-holder-list>
       </non-blocking-list>
-         <non-blocking-list>
+      <non-blocking-list>
         <nbl-number>61</nbl-number>
         <interconnect-bandwidth-unit>1000000000</interconnect-bandwidth-unit>
         <interconnect-bandwidth>0</interconnect-bandwidth>
           <slot-name>CP3-S0</slot-name>
         </pluggable-optics-holder-list>
       </non-blocking-list>
-         <non-blocking-list>
+      <non-blocking-list>
         <nbl-number>71</nbl-number>
         <interconnect-bandwidth-unit>1000000000</interconnect-bandwidth-unit>
         <interconnect-bandwidth>0</interconnect-bandwidth>
diff --git a/tox.ini b/tox.ini
index 302df92c88f163e412508bd59a7881f97fc1eb2b..59e210daf700409038b7f3aa8f8270ffced5c5d5 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -4,6 +4,8 @@ envlist = py3
     docs
     docs-linkcheck
     checkbashisms
+    pre-commit
+    gitlint
 skipsdist = true
 setupdir = tests/
 
@@ -137,3 +139,37 @@ whitelist_externals = sh
 commands =
     pyang --version
     sh -c 'find ../api/ -name target -prune -o -name *.yang -print | while read -r fname; do pyang -f yang --yang-canonical --yang-remove-unused-imports --max-line-length=120 --keep-comments -p../api/src/main/yang/:../ordmodels/common/src/main/yang/:../ordmodels/service/src/main/yang/:../tapimodels/src/main/yang/ "$fname"  -o /tmp/tmpfile.$$ && mv /tmp/tmpfile.$$ "$fname";done'
+
+[testenv:pre-commit-install]
+basepython = python3
+deps = pre-commit
+commands =
+    pre-commit install
+    pre-commit install --hook-type commit-msg
+
+[testenv:pre-commit-uninstall]
+basepython = python3
+deps = pre-commit
+commands =
+    pre-commit uninstall
+    pre-commit uninstall --hook-type commit-msg
+
+[testenv:pre-commit]
+basepython = python3
+deps = pre-commit
+passenv = HOME
+commands =
+    pre-commit run --all-files --show-diff-on-failure
+    pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_EDITMSG
+    # Gitlint only proposes a pre-commit configuration for the commit-msg stage but none for the commit stage.
+    # Its default arguments --passed and --msg-filename are different from CI recommandations.
+    # As a result, the line above is always skipped in jenkins CI since there cannot be a .git/COMMIT_EDITMSG file.
+    # A dedicated gitlint profile for CI is proposed below. Also to behave fine locally, this profile must have access
+    # to the HOME variable so that Gitlint can retrieve Git user settings.
+
+[testenv:gitlint]
+basepython = python3
+deps = gitlint
+commands =
+    gitlint
+