X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Ftransportpce_tests%2F2.2.1%2Ftest_renderer_service_path_nominal.py;h=da93789ef90b13781fabb1e2b9f4309d75ed6142;hb=f14d37954ffcf069743b1c1b8f52811606667ed8;hp=30b9dff45f42ab66f58a0af5022580d6603114ce;hpb=de9c823434160ba713e598018cd1cfc09d8cbb08;p=transportpce.git diff --git a/tests/transportpce_tests/2.2.1/test_renderer_service_path_nominal.py b/tests/transportpce_tests/2.2.1/test_renderer_service_path_nominal.py index 30b9dff45..da93789ef 100644 --- a/tests/transportpce_tests/2.2.1/test_renderer_service_path_nominal.py +++ b/tests/transportpce_tests/2.2.1/test_renderer_service_path_nominal.py @@ -24,8 +24,8 @@ import test_utils class TransportPCERendererTesting(unittest.TestCase): - honeynode_process1 = None - honeynode_process2 = None + sim_process1 = None + sim_process2 = None odl_process = None restconf_baseurl = "http://localhost:8181/restconf" @@ -33,19 +33,10 @@ class TransportPCERendererTesting(unittest.TestCase): @classmethod def setUpClass(cls): - print("starting honeynode1...") - cls.honeynode_process1 = test_utils.start_xpdra_honeynode() - time.sleep(20) - - print("starting honeynode2...") - cls.honeynode_process2 = test_utils.start_roadma_honeynode() - time.sleep(20) - print("all honeynodes started") - - print("starting opendaylight...") cls.odl_process = test_utils.start_tpce() - time.sleep(60) - print("opendaylight started") + + cls.sim_process1 = test_utils.start_sim('xpdra') + cls.sim_process2 = test_utils.start_sim('roadma') @classmethod def tearDownClass(cls): @@ -54,16 +45,16 @@ class TransportPCERendererTesting(unittest.TestCase): child.wait() cls.odl_process.send_signal(signal.SIGINT) cls.odl_process.wait() - for child in psutil.Process(cls.honeynode_process1.pid).children(): + for child in psutil.Process(cls.sim_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(): + cls.sim_process1.send_signal(signal.SIGINT) + cls.sim_process1.wait() + for child in psutil.Process(cls.sim_process2.pid).children(): child.send_signal(signal.SIGINT) child.wait() - cls.honeynode_process2.send_signal(signal.SIGINT) - cls.honeynode_process2.wait() + cls.sim_process2.send_signal(signal.SIGINT) + cls.sim_process2.wait() def setUp(self): print("execution of {}".format(self.id().split(".")[-1])) @@ -80,14 +71,16 @@ class TransportPCERendererTesting(unittest.TestCase): "netconf-node-topology:username": "admin", "netconf-node-topology:password": "admin", "netconf-node-topology:host": "127.0.0.1", - "netconf-node-topology:port": "17841", + "netconf-node-topology:port": test_utils.sims['roadma']['port'], "netconf-node-topology:tcp-only": "false", "netconf-node-topology:pass-through": {}}]} headers = {'content-type': 'application/json'} response = requests.request( "PUT", url, data=json.dumps(data), headers=headers, auth=('admin', 'admin')) - self.assertEqual(response.status_code, requests.codes.created) + self.assertIn(response.status_code, [requests.codes.created, + requests.codes.ok]) + # self.assertEqual(response.status_code, requests.codes.created) time.sleep(20) def test_02_xpdr_device_connected(self): @@ -99,14 +92,16 @@ class TransportPCERendererTesting(unittest.TestCase): "netconf-node-topology:username": "admin", "netconf-node-topology:password": "admin", "netconf-node-topology:host": "127.0.0.1", - "netconf-node-topology:port": "17840", + "netconf-node-topology:port": test_utils.sims['xpdra']['port'], "netconf-node-topology:tcp-only": "false", "netconf-node-topology:pass-through": {}}]} headers = {'content-type': 'application/json'} response = requests.request( "PUT", url, data=json.dumps(data), headers=headers, auth=('admin', 'admin')) - self.assertEqual(response.status_code, requests.codes.created) + # self.assertEqual(response.status_code, requests.codes.created) + self.assertIn(response.status_code, [requests.codes.created, + requests.codes.ok]) time.sleep(20) def test_03_rdm_portmapping(self): @@ -140,14 +135,16 @@ class TransportPCERendererTesting(unittest.TestCase): {'supported-interface-capability': ['org-openroadm-port-types:if-OCH'], 'supporting-port': '1', 'supporting-circuit-pack-name': '1/0/1-PLUG-NET', 'logical-connection-point': 'XPDR1-NETWORK1', 'port-qual': 'xpdr-network', - 'port-direction': 'bidirectional', 'connection-map-lcp': 'XPDR1-CLIENT1'}, + 'port-direction': 'bidirectional', 'connection-map-lcp': 'XPDR1-CLIENT1', + 'lcp-hash-val': '8e128ba57560403cfd4ffafae38cd941'}, res['nodes'][0]['mapping']) self.assertIn( {'supported-interface-capability': ['org-openroadm-port-types:if-100GE'], 'supporting-port': 'C1', 'supporting-circuit-pack-name': '1/0/1-PLUG-CLIENT', 'logical-connection-point': 'XPDR1-CLIENT1', 'port-direction': 'bidirectional', - 'connection-map-lcp': 'XPDR1-NETWORK1', 'port-qual': 'xpdr-client'}, + 'connection-map-lcp': 'XPDR1-NETWORK1', 'port-qual': 'xpdr-client', + 'lcp-hash-val': '3ed8ed1336784ac7c2f66c22f2f03d8'}, res['nodes'][0]['mapping']) def test_05_service_path_create(self): @@ -182,10 +179,17 @@ class TransportPCERendererTesting(unittest.TestCase): "GET", url, headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() - self.assertDictContainsSubset({'name': 'DEG1-TTP-TXRX-nmc-7', 'administrative-state': 'inService', - 'supporting-circuit-pack-name': '1/0', - 'type': 'org-openroadm-interfaces:networkMediaChannelConnectionTerminationPoint', - 'supporting-port': 'L1'}, res['interface'][0]) + # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2 + self.assertDictEqual( + dict({ + 'name': 'DEG1-TTP-TXRX-nmc-7', + 'administrative-state': 'inService', + 'supporting-circuit-pack-name': '1/0', + 'type': 'org-openroadm-interfaces:networkMediaChannelConnectionTerminationPoint', + 'supporting-port': 'L1' + }, **res['interface'][0]), + res['interface'][0] + ) self.assertDictEqual( {u'frequency': 195.8, u'width': 40}, res['interface'][0]['org-openroadm-network-media-channel-interfaces:nmc-ctp']) @@ -200,10 +204,17 @@ class TransportPCERendererTesting(unittest.TestCase): "GET", url, headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() - self.assertDictContainsSubset({'name': 'DEG1-TTP-TXRX-mc-7', 'administrative-state': 'inService', - 'supporting-circuit-pack-name': '1/0', - 'type': 'org-openroadm-interfaces:mediaChannelTrailTerminationPoint', - 'supporting-port': 'L1'}, res['interface'][0]) + # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2 + self.assertDictEqual( + dict({ + 'name': 'DEG1-TTP-TXRX-mc-7', + 'administrative-state': 'inService', + 'supporting-circuit-pack-name': '1/0', + 'type': 'org-openroadm-interfaces:mediaChannelTrailTerminationPoint', + 'supporting-port': 'L1' + }, **res['interface'][0]), + res['interface'][0] + ) self.assertDictEqual( {u'min-freq': 195.775, u'max-freq': 195.825}, res['interface'][0]['org-openroadm-media-channel-interfaces:mc-ttp']) @@ -218,10 +229,17 @@ class TransportPCERendererTesting(unittest.TestCase): "GET", url, headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() - self.assertDictContainsSubset({'name': 'SRG1-PP3-TXRX-nmc-7', 'administrative-state': 'inService', - 'supporting-circuit-pack-name': '3/0', - 'type': 'org-openroadm-interfaces:networkMediaChannelConnectionTerminationPoint', - 'supporting-port': 'C3'}, res['interface'][0]) + # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2 + self.assertDictEqual( + dict({ + 'name': 'SRG1-PP3-TXRX-nmc-7', + 'administrative-state': 'inService', + 'supporting-circuit-pack-name': '3/0', + 'type': 'org-openroadm-interfaces:networkMediaChannelConnectionTerminationPoint', + 'supporting-port': 'C3' + }, **res['interface'][0]), + res['interface'][0] + ) self.assertDictEqual( {u'frequency': 195.8, u'width': 40}, res['interface'][0]['org-openroadm-network-media-channel-interfaces:nmc-ctp']) @@ -252,10 +270,14 @@ class TransportPCERendererTesting(unittest.TestCase): "GET", url, headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() - self.assertDictContainsSubset( - {'connection-name': 'SRG1-PP3-TXRX-DEG1-TTP-TXRX-7', - 'opticalControlMode': 'off'}, - res['roadm-connections'][0]) + # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2 + self.assertDictEqual( + dict({ + 'connection-name': 'SRG1-PP3-TXRX-DEG1-TTP-TXRX-7', + 'opticalControlMode': 'off' + }, **res['roadm-connections'][0]), + res['roadm-connections'][0] + ) self.assertDictEqual( {'src-if': 'SRG1-PP3-TXRX-nmc-7'}, res['roadm-connections'][0]['source']) @@ -273,12 +295,17 @@ class TransportPCERendererTesting(unittest.TestCase): "GET", url, headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() - self.assertDictContainsSubset( - {'name': 'XPDR1-NETWORK1-7', 'administrative-state': 'inService', - 'supporting-circuit-pack-name': '1/0/1-PLUG-NET', - 'type': 'org-openroadm-interfaces:opticalChannel', - 'supporting-port': '1'}, - res['interface'][0]) + # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2 + self.assertDictEqual( + dict({ + 'name': 'XPDR1-NETWORK1-7', + 'administrative-state': 'inService', + 'supporting-circuit-pack-name': '1/0/1-PLUG-NET', + 'type': 'org-openroadm-interfaces:opticalChannel', + 'supporting-port': '1' + }, **res['interface'][0]), + res['interface'][0] + ) self.assertDictEqual( {u'rate': u'org-openroadm-common-types:R100G', u'transmit-power': -5, @@ -295,13 +322,18 @@ class TransportPCERendererTesting(unittest.TestCase): "GET", url, headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() - self.assertDictContainsSubset( - {'name': 'XPDR1-NETWORK1-OTU', 'administrative-state': 'inService', - 'supporting-circuit-pack-name': '1/0/1-PLUG-NET', - 'type': 'org-openroadm-interfaces:otnOtu', - 'supporting-port': '1', - 'supporting-interface': 'XPDR1-NETWORK1-7'}, - res['interface'][0]) + # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2 + self.assertDictEqual( + dict({ + 'name': 'XPDR1-NETWORK1-OTU', + 'administrative-state': 'inService', + 'supporting-circuit-pack-name': '1/0/1-PLUG-NET', + 'type': 'org-openroadm-interfaces:otnOtu', + 'supporting-port': '1', + 'supporting-interface': 'XPDR1-NETWORK1-7' + }, **res['interface'][0]), + res['interface'][0] + ) self.assertDictEqual( {u'rate': u'org-openroadm-otn-common-types:OTU4', u'fec': u'scfec'}, @@ -317,17 +349,25 @@ class TransportPCERendererTesting(unittest.TestCase): "GET", url, headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() - self.assertDictContainsSubset( - {'name': 'XPDR1-NETWORK1-ODU', 'administrative-state': 'inService', - 'supporting-circuit-pack-name': '1/0/1-PLUG-NET', - 'type': 'org-openroadm-interfaces:otnOdu', - 'supporting-port': '1', - 'supporting-interface': 'XPDR1-NETWORK1-OTU'}, - res['interface'][0]) - self.assertDictContainsSubset( - {'rate': 'org-openroadm-otn-common-types:ODU4', - u'monitoring-mode': u'terminated'}, - res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']) + # the 2 following statements replace self.assertDictContainsSubset deprecated in python 3.2 + self.assertDictEqual( + dict({ + 'name': 'XPDR1-NETWORK1-ODU', + 'administrative-state': 'inService', + 'supporting-circuit-pack-name': '1/0/1-PLUG-NET', + 'type': 'org-openroadm-interfaces:otnOdu', + 'supporting-port': '1', + 'supporting-interface': 'XPDR1-NETWORK1-OTU' + }, **res['interface'][0]), + res['interface'][0] + ) + self.assertDictEqual( + dict({ + 'rate': 'org-openroadm-otn-common-types:ODU4', + u'monitoring-mode': u'terminated' + }, **res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']), + res['interface'][0]['org-openroadm-otn-odu-interfaces:odu'] + ) self.assertDictEqual({u'exp-payload-type': u'07', u'payload-type': u'07'}, res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']['opu']) @@ -341,12 +381,17 @@ class TransportPCERendererTesting(unittest.TestCase): "GET", url, headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() - self.assertDictContainsSubset( - {'name': 'XPDR1-CLIENT1-ETHERNET', 'administrative-state': 'inService', - 'supporting-circuit-pack-name': '1/0/1-PLUG-CLIENT', - 'type': 'org-openroadm-interfaces:ethernetCsmacd', - 'supporting-port': 'C1'}, - res['interface'][0]) + # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2 + self.assertDictEqual( + dict({ + 'name': 'XPDR1-CLIENT1-ETHERNET', + 'administrative-state': 'inService', + 'supporting-circuit-pack-name': '1/0/1-PLUG-CLIENT', + 'type': 'org-openroadm-interfaces:ethernetCsmacd', + 'supporting-port': 'C1' + }, **res['interface'][0]), + res['interface'][0] + ) self.assertDictEqual( {u'fec': u'off', u'speed': 100000}, res['interface'][0]['org-openroadm-ethernet-interfaces:ethernet'])