X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=tests%2Ftransportpce_tests%2Ftest_portmapping.py;h=ef5180cf7e221074e87ae1aedb7ee7bcc9435843;hb=1bf8f74f6404b719d1f1b038596bb1546cc87f14;hp=c51744b14a3c545fb6c02e47fa0931dc9cf57011;hpb=217f3afb6b4a51a5dd5124ae057dd3d37a6d7fb2;p=transportpce.git diff --git a/tests/transportpce_tests/test_portmapping.py b/tests/transportpce_tests/test_portmapping.py index c51744b14..ef5180cf7 100644 --- a/tests/transportpce_tests/test_portmapping.py +++ b/tests/transportpce_tests/test_portmapping.py @@ -22,27 +22,31 @@ import unittest class TransportPCEPortMappingTesting(unittest.TestCase): - testtools_process1 = None - testtools_process2 = None + honeynode_process1 = None + honeynode_process2 = None odl_process = None restconf_baseurl = "http://localhost:8181/restconf" +#START_IGNORE_XTESTING + @classmethod - def __start_testtools(cls): - executable = ("./netconf/netconf/tools/netconf-testtool/target/" - "netconf-testtool-1.5.0-SNAPSHOT-executable.jar") + def __start_honeynode1(cls): + executable = ("./honeynode/honeynode-distribution/target/honeynode-distribution-1.18.01-hc" + "/honeynode-distribution-1.18.01/honeycomb-tpce") if os.path.isfile(executable): - with open('testtools1.log', 'w') as outfile: - cls.testtools_process1 = subprocess.Popen( - ["java", "-jar", executable, "--schemas-dir", "schemas", - "--initial-config-xml", "sample_configs/ord_1.2.1/sample-config-ROADM.xml", - "--starting-port", "17830"], + with open('honeynode1.log', 'w') as outfile: + cls.honeynode_process1 = subprocess.Popen( + [executable, "17831", "sample_configs/openroadm/2.1/oper-XPDRA.xml"], stdout=outfile) - with open('testtools2.log', 'w') as outfile: - cls.testtools_process2 = subprocess.Popen( - ["java", "-jar", executable, "--schemas-dir", "schemas", - "--initial-config-xml", "sample_configs/ord_1.2.1/sample-config-XPDR.xml", - "--starting-port", "17831"], + + @classmethod + def __start_honeynode2(cls): + executable = ("./honeynode/honeynode-distribution/target/honeynode-distribution-1.18.01-hc" + "/honeynode-distribution-1.18.01/honeycomb-tpce") + if os.path.isfile(executable): + with open('honeynode2.log', 'w') as outfile: + cls.honeynode_process2 = subprocess.Popen( + [executable, "17830", "sample_configs/openroadm/2.1/oper-ROADMA.xml"], stdout=outfile) @classmethod @@ -55,26 +59,37 @@ class TransportPCEPortMappingTesting(unittest.TestCase): @classmethod def setUpClass(cls): - cls.__start_testtools() + cls.__start_honeynode1() + time.sleep(20) + cls.__start_honeynode2() + time.sleep(20) cls.__start_odl() time.sleep(60) @classmethod def tearDownClass(cls): - cls.testtools_process1.send_signal(signal.SIGINT) - cls.testtools_process1.wait() - cls.testtools_process2.send_signal(signal.SIGINT) - cls.testtools_process2.wait() for child in psutil.Process(cls.odl_process.pid).children(): child.send_signal(signal.SIGINT) child.wait() cls.odl_process.send_signal(signal.SIGINT) cls.odl_process.wait() + for child in psutil.Process(cls.honeynode_process1.pid).children(): + child.send_signal(signal.SIGINT) + child.wait() + cls.honeynode_process1.send_signal(signal.SIGINT) + cls.honeynode_process1.wait() + for child in psutil.Process(cls.honeynode_process2.pid).children(): + child.send_signal(signal.SIGINT) + child.wait() + cls.honeynode_process2.send_signal(signal.SIGINT) + cls.honeynode_process2.wait() def setUp(self): print ("execution of {}".format(self.id().split(".")[-1])) time.sleep(10) +#END_IGNORE_XTESTING + # def test_01_restconfAPI(self): # url = ("{}/operational/network-topology:network-topology/topology/" # "topology-netconf/node/controller-config".format(self.restconf_baseurl)) @@ -85,20 +100,19 @@ class TransportPCEPortMappingTesting(unittest.TestCase): # self.assertEqual(res['node'] [0] ['netconf-node-topology:connection-status'], # 'connected') - def test_02_restconfAPI(self): - url = ("{}/config/portmapping:network/nodes/controller-config" - .format(self.restconf_baseurl)) - headers = {'content-type': 'application/json'} - response = requests.request( - "GET", url, headers=headers, auth=('admin', 'admin')) - self.assertEqual(response.status_code, requests.codes.not_found) - res = response.json() - self.assertIn( - {"error-type":"application", "error-tag":"data-missing", - "error-message":"Request could not be completed because the relevant data model content does not exist "}, - res['errors']['error']) +# def test_02_restconfAPI(self): +# url = ("{}/config/transportpce-portmapping:network/nodes/controller-config".format(self.restconf_baseurl)) +# headers = {'content-type': 'application/json'} +# response = requests.request( +# "GET", url, headers=headers, auth=('admin', 'admin')) +# self.assertEqual(response.status_code, requests.codes.not_found) +# res = response.json() +# self.assertIn( +# {"error-type":"application", "error-tag":"data-missing", +# "error-message":"Request could not be completed because the relevant data model content does not exist "}, +# res['errors']['error']) - def test_03_rdm_device_connected(self): + def test_01_rdm_device_connected(self): url = ("{}/config/network-topology:" "network-topology/topology/topology-netconf/node/ROADMA" .format(self.restconf_baseurl)) @@ -117,7 +131,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase): self.assertEqual(response.status_code, requests.codes.created) time.sleep(20) - def test_04_rdm_device_connected(self): + def test_02_rdm_device_connected(self): url = ("{}/operational/network-topology:" "network-topology/topology/topology-netconf/node/ROADMA" .format(self.restconf_baseurl)) @@ -131,8 +145,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase): 'connected') time.sleep(10) - def test_05_rdm_portmapping_DEG1_TTP_TXRX(self): - url = ("{}/config/portmapping:network/" + def test_03_rdm_portmapping_DEG1_TTP_TXRX(self): + url = ("{}/config/transportpce-portmapping:network/" "nodes/ROADMA/mapping/DEG1-TTP-TXRX" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json'} @@ -145,8 +159,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase): 'logical-connection-point': 'DEG1-TTP-TXRX'}, res['mapping']) - def test_06_rdm_portmapping_SRG1_PP7_TXRX(self): - url = ("{}/config/portmapping:network/" + def test_04_rdm_portmapping_SRG1_PP7_TXRX(self): + url = ("{}/config/transportpce-portmapping:network/" "nodes/ROADMA/mapping/SRG1-PP7-TXRX" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json'} @@ -159,8 +173,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase): 'logical-connection-point': 'SRG1-PP7-TXRX'}, res['mapping']) - def test_07_rdm_portmapping_SRG3_PP1_TXRX(self): - url = ("{}/config/portmapping:network/" + def test_05_rdm_portmapping_SRG3_PP1_TXRX(self): + url = ("{}/config/transportpce-portmapping:network/" "nodes/ROADMA/mapping/SRG3-PP1-TXRX" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json'} @@ -173,7 +187,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase): 'logical-connection-point': 'SRG3-PP1-TXRX'}, res['mapping']) - def test_08_xpdr_device_connected(self): + def test_06_xpdr_device_connected(self): url = ("{}/config/network-topology:" "network-topology/topology/topology-netconf/node/XPDRA" .format(self.restconf_baseurl)) @@ -192,7 +206,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase): self.assertEqual(response.status_code, requests.codes.created) time.sleep(20) - def test_09_xpdr_device_connected(self): + def test_07_xpdr_device_connected(self): url = ("{}/operational/network-topology:" "network-topology/topology/topology-netconf/node/XPDRA" .format(self.restconf_baseurl)) @@ -206,9 +220,9 @@ class TransportPCEPortMappingTesting(unittest.TestCase): 'connected') time.sleep(10) - def test_10_xpdr_portmapping_NETWORK1(self): - url = ("{}/config/portmapping:network/" - "nodes/XPDRA/mapping/NETWORK1" + def test_08_xpdr_portmapping_NETWORK1(self): + url = ("{}/config/transportpce-portmapping:network/" + "nodes/XPDRA/mapping/XPDR1-NETWORK1" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json'} response = requests.request( @@ -217,12 +231,56 @@ class TransportPCEPortMappingTesting(unittest.TestCase): res = response.json() self.assertIn( {'supporting-port': '1', 'supporting-circuit-pack-name': '1/0/1-PLUG-NET', - 'logical-connection-point': 'NETWORK1'}, + 'logical-connection-point': 'XPDR1-NETWORK1'}, + res['mapping']) + + def test_09_xpdr_portmapping_NETWORK2(self): + url = ("{}/config/transportpce-portmapping:network/" + "nodes/XPDRA/mapping/XPDR1-NETWORK2" + .format(self.restconf_baseurl)) + headers = {'content-type': 'application/json'} + response = requests.request( + "GET", url, headers=headers, auth=('admin', 'admin')) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertIn( + {'supporting-port': '1', 'supporting-circuit-pack-name': '1/0/2-PLUG-NET', + 'logical-connection-point': 'XPDR1-NETWORK2'}, + res['mapping']) + + def test_10_xpdr_portmapping_CLIENT1(self): + url = ("{}/config/transportpce-portmapping:network/" + "nodes/XPDRA/mapping/XPDR1-CLIENT1" + .format(self.restconf_baseurl)) + headers = {'content-type': 'application/json'} + response = requests.request( + "GET", url, headers=headers, auth=('admin', 'admin')) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertIn( + {'supporting-port': 'C1', + 'supporting-circuit-pack-name': '1/0/C1-PLUG-CLIENT', + 'logical-connection-point': 'XPDR1-CLIENT1'}, + res['mapping']) + + def test_11_xpdr_portmapping_CLIENT2(self): + url = ("{}/config/transportpce-portmapping:network/" + "nodes/XPDRA/mapping/XPDR1-CLIENT2" + .format(self.restconf_baseurl)) + headers = {'content-type': 'application/json'} + response = requests.request( + "GET", url, headers=headers, auth=('admin', 'admin')) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertIn( + {'supporting-port': 'C2', + 'supporting-circuit-pack-name': '1/0/C2-PLUG-CLIENT', + 'logical-connection-point': 'XPDR1-CLIENT2'}, res['mapping']) - def test_11_xpdr_portmapping_CLIENT1(self): - url = ("{}/config/portmapping:network/" - "nodes/XPDRA/mapping/CLIENT1" + def test_12_xpdr_portmapping_CLIENT4(self): + url = ("{}/config/transportpce-portmapping:network/" + "nodes/XPDRA/mapping/XPDR1-CLIENT4" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json'} response = requests.request( @@ -230,12 +288,12 @@ class TransportPCEPortMappingTesting(unittest.TestCase): self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn( - {'supporting-port': '1', - 'supporting-circuit-pack-name': '1/0/2-PLUG-CLIENT', - 'logical-connection-point': 'CLIENT1'}, + {'supporting-port': 'C4', + 'supporting-circuit-pack-name': '1/0/C4-PLUG-CLIENT', + 'logical-connection-point': 'XPDR1-CLIENT4'}, res['mapping']) - def test_12_xpdr_device_disconnected(self): + def test_13_xpdr_device_disconnected(self): url = ("{}/config/network-topology:" "network-topology/topology/topology-netconf/node/XPDRA" .format(self.restconf_baseurl)) @@ -246,7 +304,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase): self.assertEqual(response.status_code, requests.codes.ok) time.sleep(20) - def test_13_xpdr_device_disconnected(self): + def test_14_xpdr_device_disconnected(self): url = ("{}/operational/network-topology:network-topology/topology/" "topology-netconf/node/XPDRA".format(self.restconf_baseurl)) headers = {'content-type': 'application/json'} @@ -256,13 +314,11 @@ class TransportPCEPortMappingTesting(unittest.TestCase): res = response.json() self.assertIn( {"error-type":"application", "error-tag":"data-missing", - "error-message":"Request could not be completed because the relevant data model content does not exist "}, + "error-message":"Request could not be completed because the relevant data model content does not exist"}, res['errors']['error']) - def test_14_xpdr_device_disconnected(self): - url = ("{}/config/portmapping:network/" - "nodes/XPDRA" - .format(self.restconf_baseurl)) + def test_15_xpdr_device_disconnected(self): + url = ("{}/config/transportpce-portmapping:network/nodes/XPDRA".format(self.restconf_baseurl)) headers = {'content-type': 'application/json'} response = requests.request( "GET", url, headers=headers, auth=('admin', 'admin')) @@ -270,12 +326,11 @@ class TransportPCEPortMappingTesting(unittest.TestCase): res = response.json() self.assertIn( {"error-type":"application", "error-tag":"data-missing", - "error-message":"Request could not be completed because the relevant data model content does not exist "}, + "error-message":"Request could not be completed because the relevant data model content does not exist"}, res['errors']['error']) - def test_15_rdm_device_disconnected(self): - url = ("{}/config/network-topology:" - "network-topology/topology/topology-netconf/node/ROADMA" + def test_16_rdm_device_disconnected(self): + url = ("{}/config/network-topology:network-topology/topology/topology-netconf/node/ROADMA" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json'} response = requests.request( @@ -284,9 +339,9 @@ class TransportPCEPortMappingTesting(unittest.TestCase): self.assertEqual(response.status_code, requests.codes.ok) time.sleep(20) - def test_16_rdm_device_disconnected(self): - url = ("{}/operational/network-topology:network-topology/topology/" - "topology-netconf/node/ROADMA".format(self.restconf_baseurl)) + def test_17_rdm_device_disconnected(self): + url = ("{}/operational/network-topology:network-topology/topology/topology-netconf/node/ROADMA" + .format(self.restconf_baseurl)) headers = {'content-type': 'application/json'} response = requests.request( "GET", url, headers=headers, auth=('admin', 'admin')) @@ -294,12 +349,11 @@ class TransportPCEPortMappingTesting(unittest.TestCase): res = response.json() self.assertIn( {"error-type":"application", "error-tag":"data-missing", - "error-message":"Request could not be completed because the relevant data model content does not exist "}, + "error-message":"Request could not be completed because the relevant data model content does not exist"}, res['errors']['error']) - def test_17_rdm_device_disconnected(self): - url = ("{}/config/portmapping:network/nodes/ROADMA" - .format(self.restconf_baseurl)) + def test_18_rdm_device_disconnected(self): + url = ("{}/config/transportpce-portmapping:network/nodes/ROADMA".format(self.restconf_baseurl)) headers = {'content-type': 'application/json'} response = requests.request( "GET", url, headers=headers, auth=('admin', 'admin')) @@ -307,7 +361,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase): res = response.json() self.assertIn( {"error-type":"application", "error-tag":"data-missing", - "error-message":"Request could not be completed because the relevant data model content does not exist "}, + "error-message":"Request could not be completed because the relevant data model content does not exist"}, res['errors']['error'])