From: Guillaume Lambert Date: Wed, 2 Jun 2021 20:20:10 +0000 (+0200) Subject: Add and run some linters via tox and pre-commit X-Git-Tag: 4.0.0~81 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;ds=inline;h=refs%2Fchanges%2F11%2F96411%2F3;p=transportpce.git Add and run some linters via tox and pre-commit Signed-off-by: Guillaume Lambert Change-Id: I097c1267eab3eba18c571929e67490817d0a8ffd --- diff --git a/.gitlint b/.gitlint new file mode 100644 index 000000000..85c1b7ae6 --- /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 index 000000000..1363f0bc2 --- /dev/null +++ b/.pre-commit-config.yaml @@ -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/)' diff --git a/debug_tools/netconf_TCP_SSH_hijackingproxy.pl b/debug_tools/netconf_TCP_SSH_hijackingproxy.pl index e1d35fc4d..e4799d66c 100755 --- a/debug_tools/netconf_TCP_SSH_hijackingproxy.pl +++ b/debug_tools/netconf_TCP_SSH_hijackingproxy.pl @@ -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) diff --git a/lighty/docs/TransportPCE.postman_collection.json b/lighty/docs/TransportPCE.postman_collection.json index 7e4effd20..f2519149d 100644 --- a/lighty/docs/TransportPCE.postman_collection.json +++ b/lighty/docs/TransportPCE.postman_collection.json @@ -1,467 +1,467 @@ { - "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 diff --git a/pce/src/test/resources/gnpy/gnpy_network.json b/pce/src/test/resources/gnpy/gnpy_network.json index 231dc53c8..f2d63a221 100644 --- a/pce/src/test/resources/gnpy/gnpy_network.json +++ b/pce/src/test/resources/gnpy/gnpy_network.json @@ -137,6 +137,6 @@ } ] } - + } } \ No newline at end of file diff --git a/tapimodels/src/main/yang/tapi-eth@2018-12-10.yang b/tapimodels/src/main/yang/tapi-eth@2018-12-10.yang index 2d68ee5c9..fdca15722 100644 --- a/tapimodels/src/main/yang/tapi-eth@2018-12-10.yang +++ b/tapimodels/src/main/yang/tapi-eth@2018-12-10.yang @@ -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 { diff --git a/tapimodels/src/main/yang/tapi-topology@2018-12-10.yang b/tapimodels/src/main/yang/tapi-topology@2018-12-10.yang index 208da160b..2ceeb77b4 100644 --- a/tapimodels/src/main/yang/tapi-topology@2018-12-10.yang +++ b/tapimodels/src/main/yang/tapi-topology@2018-12-10.yang @@ -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."; diff --git a/tests/installMavenCentOS.sh b/tests/installMavenCentOS.sh index c95df62f5..ae3f76b01 100755 --- a/tests/installMavenCentOS.sh +++ b/tests/installMavenCentOS.sh @@ -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 index 0de041d43..000000000 --- a/tests/netconf.patch +++ /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 notificationsFile, - final Optional initialConfigXMLFile) { - this.caps = caps; -- simulatedOperationService = new SimulatedOperationService( -+ this.simulatedOperationService = new SimulatedOperationService( - idProvider.getCurrentSessionId(), notificationsFile, initialConfigXMLFile); - } - - @Override - public Set 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 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 getDefaultYangResources() { -- return defaultYangResources; -+ return this.defaultYangResources; - } - - public void setDefaultYangResources(final Set 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 getModels() { -- return models; -+ return this.models; - } - - public void setModels(final Set models) { -@@ -175,7 +175,7 @@ public class Configuration { - } - - public Set getCapabilities() { -- return capabilities; -+ return this.capabilities; - } - - public void setCapabilities(final Set 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 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 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 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 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"; -+ } -+ -+ -+} diff --git a/tests/sample_configs/NW-for-test-5-4.xml b/tests/sample_configs/NW-for-test-5-4.xml index b534c602e..20d05c964 100644 --- a/tests/sample_configs/NW-for-test-5-4.xml +++ b/tests/sample_configs/NW-for-test-5-4.xml @@ -8245,7 +8245,7 @@ - + OpenROADM-3-2-DEG3-to-OpenROADM-2-3-DEG3 OpenROADM-2-3-DEG3-to-OpenROADM-3-2-DEG3 fiber3223 diff --git a/tests/sample_configs/NW-simple-topology.xml b/tests/sample_configs/NW-simple-topology.xml index 600db4deb..646868ba2 100644 --- a/tests/sample_configs/NW-simple-topology.xml +++ b/tests/sample_configs/NW-simple-topology.xml @@ -4618,7 +4618,7 @@ OpenROADM-5-1-DEG1-to-OpenROADM-5-2-DEG1 OpenROADM-5-2-DEG1-to-OpenROADM-5-1-DEG1 ROADM-TO-ROADM - OpenROADM-5-1-DEG1DEG1-TTP-TX + OpenROADM-5-1-DEG1DEG1-TTP-TX OpenROADM-5-2-DEG1DEG1-TTP-RX inService inService @@ -4867,7 +4867,7 @@ - + OpenROADM-5-1-DEG3-to-OpenROADM-4-2-DEG3 OpenROADM-4-2-DEG3-to-OpenROADM-5-1-DEG3 ROADM-TO-ROADM diff --git a/tests/sample_configs/openroadm/2.2.1/oper-ROADMA.xml b/tests/sample_configs/openroadm/2.2.1/oper-ROADMA.xml index 55ede8cbd..0425debb9 100644 --- a/tests/sample_configs/openroadm/2.2.1/oper-ROADMA.xml +++ b/tests/sample_configs/openroadm/2.2.1/oper-ROADMA.xml @@ -140,7 +140,7 @@ x:if-OCH - + true 1/0/ETH-PLUG port @@ -649,12 +649,12 @@ OMS-DEG2-TTP-TXRX 2/0 L1 - OTS-DEG2-TTP-TXRX - openROADM-if:openROADMOpticalMultiplex - TBD + OTS-DEG2-TTP-TXRX + openROADM-if:openROADMOpticalMultiplex + TBD TBD inService - inService + inService diff --git a/tests/sample_configs/openroadm/2.2.1/oper-ROADMC.xml b/tests/sample_configs/openroadm/2.2.1/oper-ROADMC.xml index 1bd584bd0..a020be60e 100644 --- a/tests/sample_configs/openroadm/2.2.1/oper-ROADMC.xml +++ b/tests/sample_configs/openroadm/2.2.1/oper-ROADMC.xml @@ -542,12 +542,12 @@ OMS-DEG1-TTP-TXRX 1/0 L1 - OTS-DEG1-TTP-TXRX - openROADM-if:openROADMOpticalMultiplex - TBD + OTS-DEG1-TTP-TXRX + openROADM-if:openROADMOpticalMultiplex + TBD TBD inService - inService + inService diff --git a/tests/sample_configs/openroadm/2.2.1/oper-SPDRC.xml b/tests/sample_configs/openroadm/2.2.1/oper-SPDRC.xml index 3b3f990f4..27a1eea34 100644 --- a/tests/sample_configs/openroadm/2.2.1/oper-SPDRC.xml +++ b/tests/sample_configs/openroadm/2.2.1/oper-SPDRC.xml @@ -1719,7 +1719,7 @@ CP3-S10 - + CP3-S11 @@ -1759,7 +1759,7 @@ CP3-S20 - + CP3-S21 @@ -1799,7 +1799,7 @@ CP3-S30 - + CP3-S31 @@ -1839,7 +1839,7 @@ CP3-S40 - + CP3-S41 @@ -1879,7 +1879,7 @@ CP3-S50 - + CP3-S51 @@ -1919,7 +1919,7 @@ CP3-S60 - + CP3-S61 @@ -1959,7 +1959,7 @@ CP3-S70 - + CP3-S71 @@ -2535,7 +2535,7 @@ 6 - + 3 mpdr @@ -2833,7 +2833,7 @@ - + 3 non-blocking @@ -2966,7 +2966,7 @@ CP3-S0 - + 11 1000000000 0 @@ -3096,7 +3096,7 @@ CP3-S0 - + 21 1000000000 0 @@ -3226,7 +3226,7 @@ CP3-S0 - + 31 1000000000 0 @@ -3356,7 +3356,7 @@ CP3-S0 - + 41 1000000000 0 @@ -3486,7 +3486,7 @@ CP3-S0 - + 51 1000000000 0 @@ -3616,7 +3616,7 @@ CP3-S0 - + 61 1000000000 0 @@ -3746,7 +3746,7 @@ CP3-S0 - + 71 1000000000 0 diff --git a/tox.ini b/tox.ini index 302df92c8..59e210daf 100644 --- 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 +