X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Ftransportpce_tests%2F2.2.1%2Ftest_otn_renderer.py;h=04f09c6d11e6de9cd1d0a11504363b86bd6cccc0;hb=f4d7679be9ffcc5ef14241cbfe9040c1c177b260;hp=0ca2613b3e2c565b868a7c07ba7a5694a04b8584;hpb=2fb3efccb6a5f65056111c952eddf15ca30af35a;p=transportpce.git diff --git a/tests/transportpce_tests/2.2.1/test_otn_renderer.py b/tests/transportpce_tests/2.2.1/test_otn_renderer.py index 0ca2613b3..04f09c6d1 100644 --- a/tests/transportpce_tests/2.2.1/test_otn_renderer.py +++ b/tests/transportpce_tests/2.2.1/test_otn_renderer.py @@ -19,7 +19,7 @@ import subprocess import time import unittest import logging -import test_utils +from common import test_utils def extract_a_from_b(a, b): @@ -28,33 +28,19 @@ def extract_a_from_b(a, b): class TransportPCEtesting(unittest.TestCase): - honeynode_process1 = None - odl_process = None + processes = None restconf_baseurl = "http://localhost:8181/restconf" @classmethod def setUpClass(cls): - print("starting honeynode1...") - cls.honeynode_process1 = test_utils.start_spdra_honeynode() - time.sleep(30) - - print("starting opendaylight...") - cls.odl_process = test_utils.start_tpce() - time.sleep(60) - print("opendaylight started") + cls.processes = test_utils.start_tpce() + cls.processes = test_utils.start_sims(['spdrav2']) @classmethod def tearDownClass(cls): - 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 process in cls.processes: + test_utils.shutdown_process(process) + print("all processes killed") def setUp(self): time.sleep(5) @@ -68,7 +54,7 @@ class TransportPCEtesting(unittest.TestCase): "netconf-node-topology:username": "admin", "netconf-node-topology:password": "admin", "netconf-node-topology:host": "127.0.0.1", - "netconf-node-topology:port": "17845", + "netconf-node-topology:port": test_utils.sims['spdrav2']['port'], "netconf-node-topology:tcp-only": "false", "netconf-node-topology:pass-through": {}}]} headers = {'content-type': 'application/json'} @@ -105,9 +91,9 @@ class TransportPCEtesting(unittest.TestCase): 'supporting-port': 'CP1-SFP4-P1', 'supporting-circuit-pack-name': 'CP1-SFP4', 'logical-connection-point': 'XPDR1-CLIENT1', - 'port-direction': 'bidirectional', + 'port-direction': 'bidirectional', 'port-qual': 'xpdr-client', - 'lcp-hash-val': '8b3efff522736722500b5e68fb6e696e'}, + 'lcp-hash-val': '8b3efff522736722500b5e68fb6e696e'}, res['mapping']) def test_03_get_portmapping_NETWORK1(self): @@ -204,7 +190,7 @@ class TransportPCEtesting(unittest.TestCase): ''' self.assertDictEqual(input_dict, extract_a_from_b(input_dict, - res['interface'][0]) + res['interface'][0]) ) self.assertDictEqual( {u'frequency': 196.1, u'rate': u'org-openroadm-common-types:R100G', @@ -278,16 +264,16 @@ class TransportPCEtesting(unittest.TestCase): res = response.json() self.assertIn( {"logical-connection-point": "XPDR1-NETWORK1", - "supporting-port": "CP1-CFP0-P1", - "supported-interface-capability": [ - "org-openroadm-port-types:if-OCH-OTU4-ODU4" - ], - "port-direction": "bidirectional", - "port-qual": "xpdr-network", - "supporting-circuit-pack-name": "CP1-CFP0", - "xponder-type": "mpdr", - "supporting-odu4": "XPDR1-NETWORK1-ODU4", - "lcp-hash-val": "1021db8d2affe7386705c438c67ea21f" + "supporting-port": "CP1-CFP0-P1", + "supported-interface-capability": [ + "org-openroadm-port-types:if-OCH-OTU4-ODU4" + ], + "port-direction": "bidirectional", + "port-qual": "xpdr-network", + "supporting-circuit-pack-name": "CP1-CFP0", + "xponder-type": "mpdr", + "supporting-odu4": "XPDR1-NETWORK1-ODU4", + "lcp-hash-val": "1021db8d2affe7386705c438c67ea21f" }, res['mapping']) @@ -314,7 +300,7 @@ class TransportPCEtesting(unittest.TestCase): self.assertDictEqual(input_dict_2, extract_a_from_b(input_dict_2, res['interface'][0][ - 'org-openroadm-otn-odu-interfaces:odu']) + 'org-openroadm-otn-odu-interfaces:odu']) ) ''' @@ -408,16 +394,16 @@ class TransportPCEtesting(unittest.TestCase): 'type': 'org-openroadm-interfaces:otnOdu', 'supporting-port': 'CP1-SFP4-P1'} input_dict_2 = { - 'odu-function': 'org-openroadm-otn-common-types:ODU-TTP-CTP', - 'rate': 'org-openroadm-otn-common-types:ODU2e', - 'monitoring-mode': 'terminated'} + 'odu-function': 'org-openroadm-otn-common-types:ODU-TTP-CTP', + 'rate': 'org-openroadm-otn-common-types:ODU2e', + 'monitoring-mode': 'terminated'} self.assertDictEqual(input_dict_1, extract_a_from_b(input_dict_1, - res['interface'][0]) + res['interface'][0]) ) self.assertDictEqual(input_dict_2, extract_a_from_b(input_dict_2, res['interface'][0][ - 'org-openroadm-otn-odu-interfaces:odu']) + 'org-openroadm-otn-odu-interfaces:odu']) ) ''' @@ -451,9 +437,9 @@ class TransportPCEtesting(unittest.TestCase): 'type': 'org-openroadm-interfaces:otnOdu', 'supporting-port': 'CP1-CFP0-P1'} input_dict_2 = { - 'odu-function': 'org-openroadm-otn-common-types:ODU-CTP', - 'rate': 'org-openroadm-otn-common-types:ODU2e', - 'monitoring-mode': 'monitored'} + 'odu-function': 'org-openroadm-otn-common-types:ODU-CTP', + 'rate': 'org-openroadm-otn-common-types:ODU2e', + 'monitoring-mode': 'monitored'} input_dict_3 = {'trib-port-number': 1} @@ -464,14 +450,14 @@ class TransportPCEtesting(unittest.TestCase): self.assertDictEqual(input_dict_2, extract_a_from_b(input_dict_2, res['interface'][0][ - 'org-openroadm-otn-odu-interfaces:odu'] + 'org-openroadm-otn-odu-interfaces:odu'] )) self.assertDictEqual(input_dict_3, extract_a_from_b(input_dict_3, res['interface'][0][ - 'org-openroadm-otn-odu-interfaces:odu'][ - 'parent-odu-allocation'])) + 'org-openroadm-otn-odu-interfaces:odu'][ + 'parent-odu-allocation'])) ''' self.assertDictContainsSubset({'name': 'XPDR1-NETWORK1-ODU2e-service1', 'administrative-state': 'inService', @@ -489,8 +475,8 @@ class TransportPCEtesting(unittest.TestCase): ''' self.assertIn(1, res['interface'][0][ - 'org-openroadm-otn-odu-interfaces:odu'][ - 'parent-odu-allocation']['trib-slots']) + 'org-openroadm-otn-odu-interfaces:odu'][ + 'parent-odu-allocation']['trib-slots']) def test_15_check_ODU2E_connection(self): url = ("{}/config/network-topology:network-topology/topology/topology-netconf/" @@ -503,9 +489,9 @@ class TransportPCEtesting(unittest.TestCase): self.assertEqual(response.status_code, requests.codes.ok) res = response.json() input_dict_1 = { - 'connection-name': + 'connection-name': 'XPDR1-CLIENT1-ODU2e-service1-x-XPDR1-NETWORK1-ODU2e-service1', - 'direction': 'bidirectional' + 'direction': 'bidirectional' } self.assertDictEqual(input_dict_1,