X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Ftransportpce_tests%2F2.2.1%2Ftest14_otn_switch_end2end.py;h=fad074f23ef6acc3d902191cd8b3c73b12b7bedc;hb=a8343688872d307ada1b4521721313a8ac3a3e5e;hp=110111e3e00b12b94bb73e0f8a33ab4814efbc59;hpb=de894bc83aa112264418e7eb6a2f2dd674451745;p=transportpce.git diff --git a/tests/transportpce_tests/2.2.1/test14_otn_switch_end2end.py b/tests/transportpce_tests/2.2.1/test14_otn_switch_end2end.py index 110111e3e..fad074f23 100644 --- a/tests/transportpce_tests/2.2.1/test14_otn_switch_end2end.py +++ b/tests/transportpce_tests/2.2.1/test14_otn_switch_end2end.py @@ -11,13 +11,17 @@ # pylint: disable=no-member # pylint: disable=too-many-public-methods +# pylint: disable=too-many-lines import base64 import unittest import time import requests +# pylint: disable=wrong-import-order import sys sys.path.append('transportpce_tests/common/') +# pylint: disable=wrong-import-position +# pylint: disable=import-error import test_utils # nopep8 @@ -433,8 +437,8 @@ class TransportPCEtesting(unittest.TestCase): res['interface'][0]) self.assertDictEqual( - {u'frequency': 196.1, u'rate': u'org-openroadm-common-types:R100G', - u'transmit-power': -5, u'modulation-format': 'dp-qpsk'}, + {'frequency': 196.1, 'rate': 'org-openroadm-common-types:R100G', + 'transmit-power': -5, 'modulation-format': 'dp-qpsk'}, res['interface'][0]['org-openroadm-optical-channel-interfaces:och']) def test_28_check_interface_OTU4_spdra(self): @@ -475,8 +479,8 @@ class TransportPCEtesting(unittest.TestCase): res['interface'][0]) self.assertDictEqual( - {u'frequency': 196.1, u'rate': u'org-openroadm-common-types:R100G', - u'transmit-power': -5, u'modulation-format': 'dp-qpsk'}, + {'frequency': 196.1, 'rate': 'org-openroadm-common-types:R100G', + 'transmit-power': -5, 'modulation-format': 'dp-qpsk'}, res['interface'][0]['org-openroadm-optical-channel-interfaces:och']) def test_30_check_interface_OTU4_spdrB(self): @@ -522,8 +526,8 @@ class TransportPCEtesting(unittest.TestCase): res = response.json() ele = res['node'][0]['ietf-network-topology:termination-point'][0] self.assertEqual('XPDR2-NETWORK1', ele['tp-id']) - self.assertEqual({u'frequency': 196.1, - u'width': 40}, + self.assertEqual({'frequency': 196.1, + 'width': 40}, ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength']) self.assertEqual('ROADM-A1-SRG1--SRG1-PP3-TXRX', ele['org-openroadm-network-topology:xpdr-network-attributes']['tail-equipment-id']) @@ -593,6 +597,7 @@ class TransportPCEtesting(unittest.TestCase): # test service-create for OCH-OTU4 service from spdrB to spdrC def test_35_create_OCH_OTU4_service_BC(self): + # pylint: disable=line-too-long self.cr_serv_sample_data["input"]["service-name"] = "service-OCH-OTU4-BC" self.cr_serv_sample_data["input"]["service-a-end"]["node-id"] = "SPDR-SB1" self.cr_serv_sample_data["input"]["service-a-end"]["clli"] = "NodeSB" @@ -644,8 +649,8 @@ class TransportPCEtesting(unittest.TestCase): res['interface'][0]) self.assertDictEqual( - {u'frequency': 196.05, u'rate': u'org-openroadm-common-types:R100G', - u'transmit-power': -5, u'modulation-format': 'dp-qpsk'}, + {'frequency': 196.05, 'rate': 'org-openroadm-common-types:R100G', + 'transmit-power': -5, 'modulation-format': 'dp-qpsk'}, res['interface'][0]['org-openroadm-optical-channel-interfaces:och']) def test_38_check_interface_OTU4_spdrB(self): @@ -686,8 +691,8 @@ class TransportPCEtesting(unittest.TestCase): res['interface'][0]) self.assertDictEqual( - {u'frequency': 196.05, u'rate': u'org-openroadm-common-types:R100G', - u'transmit-power': -5, u'modulation-format': 'dp-qpsk'}, + {'frequency': 196.05, 'rate': 'org-openroadm-common-types:R100G', + 'transmit-power': -5, 'modulation-format': 'dp-qpsk'}, res['interface'][0]['org-openroadm-optical-channel-interfaces:och']) def test_40_check_interface_OTU4_spdrC(self): @@ -732,16 +737,17 @@ class TransportPCEtesting(unittest.TestCase): self.assertEqual(response.status_code, requests.codes.ok) res = response.json() liste_tp = res['node'][0]['ietf-network-topology:termination-point'] + # pylint: disable=consider-using-f-string for ele in liste_tp: if ele['tp-id'] == 'XPDR2-NETWORK1': - self.assertEqual({u'frequency': 196.1, - u'width': 40}, + self.assertEqual({'frequency': 196.1, + 'width': 40}, ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength']) self.assertEqual('ROADM-B1-SRG1--SRG1-PP1-TXRX', ele['org-openroadm-network-topology:xpdr-network-attributes']['tail-equipment-id']) elif ele['tp-id'] == 'XPDR2-NETWORK2': - self.assertEqual({u'frequency': 196.05, - u'width': 40}, + self.assertEqual({'frequency': 196.05, + 'width': 40}, ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength']) self.assertEqual('ROADM-B1-SRG1--SRG1-PP2-TXRX', ele['org-openroadm-network-topology:xpdr-network-attributes']['tail-equipment-id']) @@ -823,6 +829,7 @@ class TransportPCEtesting(unittest.TestCase): # test service-create for 100GE service from spdrA to spdrC via spdrB def test_46_create_100GE_service_ABC(self): + # pylint: disable=line-too-long self.cr_serv_sample_data["input"]["service-name"] = "service-100GE-ABC" self.cr_serv_sample_data["input"]["connection-type"] = "service" self.cr_serv_sample_data["input"]["service-a-end"]["service-format"] = "Ethernet" @@ -878,8 +885,8 @@ class TransportPCEtesting(unittest.TestCase): self.assertDictEqual(dict(input_dict, **res['interface'][0]), res['interface'][0]) self.assertDictEqual( - {u'speed': 100000, - u'fec': 'off'}, + {'speed': 100000, + 'fec': 'off'}, res['interface'][0]['org-openroadm-ethernet-interfaces:ethernet']) def test_49_check_interface_ODU4_CLIENT_spdra(self): @@ -904,7 +911,7 @@ class TransportPCEtesting(unittest.TestCase): **res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']), res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']) self.assertDictEqual( - {u'payload-type': u'07', u'exp-payload-type': u'07'}, + {'payload-type': '07', 'exp-payload-type': '07'}, res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']['opu']) def test_50_check_interface_ODU4_NETWORK_spdra(self): @@ -928,7 +935,7 @@ class TransportPCEtesting(unittest.TestCase): **res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']), res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']) self.assertDictEqual( - {u'payload-type': u'07', u'exp-payload-type': u'07'}, + {'payload-type': '07', 'exp-payload-type': '07'}, res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']['opu']) def test_51_check_ODU4_connection_spdra(self): @@ -945,9 +952,9 @@ class TransportPCEtesting(unittest.TestCase): self.assertDictEqual(dict(input_dict_1, **res['odu-connection'][0]), res['odu-connection'][0]) - self.assertDictEqual({u'dst-if': u'XPDR2-NETWORK1-ODU4'}, + self.assertDictEqual({'dst-if': 'XPDR2-NETWORK1-ODU4'}, res['odu-connection'][0]['destination']) - self.assertDictEqual({u'src-if': u'XPDR2-CLIENT1-ODU4'}, + self.assertDictEqual({'src-if': 'XPDR2-CLIENT1-ODU4'}, res['odu-connection'][0]['source']) def test_52_check_interface_100GE_CLIENT_spdrc(self): @@ -964,8 +971,8 @@ class TransportPCEtesting(unittest.TestCase): self.assertDictEqual(dict(input_dict, **res['interface'][0]), res['interface'][0]) self.assertDictEqual( - {u'speed': 100000, - u'fec': 'off'}, + {'speed': 100000, + 'fec': 'off'}, res['interface'][0]['org-openroadm-ethernet-interfaces:ethernet']) def test_53_check_interface_ODU4_CLIENT_spdrc(self): @@ -990,7 +997,7 @@ class TransportPCEtesting(unittest.TestCase): **res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']), res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']) self.assertDictEqual( - {u'payload-type': u'07', u'exp-payload-type': u'07'}, + {'payload-type': '07', 'exp-payload-type': '07'}, res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']['opu']) def test_54_check_interface_ODU4_NETWORK_spdrc(self): @@ -1014,7 +1021,7 @@ class TransportPCEtesting(unittest.TestCase): **res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']), res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']) self.assertDictEqual( - {u'payload-type': u'07', u'exp-payload-type': u'07'}, + {'payload-type': '07', 'exp-payload-type': '07'}, res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']['opu']) def test_55_check_ODU4_connection_spdrc(self): @@ -1031,9 +1038,9 @@ class TransportPCEtesting(unittest.TestCase): self.assertDictEqual(dict(input_dict_1, **res['odu-connection'][0]), res['odu-connection'][0]) - self.assertDictEqual({u'dst-if': u'XPDR2-NETWORK1-ODU4'}, + self.assertDictEqual({'dst-if': 'XPDR2-NETWORK1-ODU4'}, res['odu-connection'][0]['destination']) - self.assertDictEqual({u'src-if': u'XPDR2-CLIENT1-ODU4'}, + self.assertDictEqual({'src-if': 'XPDR2-CLIENT1-ODU4'}, res['odu-connection'][0]['source']) def test_56_check_interface_ODU4_NETWORK1_spdrb(self): @@ -1057,7 +1064,7 @@ class TransportPCEtesting(unittest.TestCase): **res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']), res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']) self.assertDictEqual( - {u'payload-type': u'07', u'exp-payload-type': u'07'}, + {'payload-type': '07', 'exp-payload-type': '07'}, res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']['opu']) def test_57_check_interface_ODU4_NETWORK2_spdrb(self): @@ -1081,7 +1088,7 @@ class TransportPCEtesting(unittest.TestCase): **res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']), res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']) self.assertDictEqual( - {u'payload-type': u'07', u'exp-payload-type': u'07'}, + {'payload-type': '07', 'exp-payload-type': '07'}, res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']['opu']) def test_58_check_ODU4_connection_spdrb(self): @@ -1098,9 +1105,9 @@ class TransportPCEtesting(unittest.TestCase): self.assertDictEqual(dict(input_dict_1, **res['odu-connection'][0]), res['odu-connection'][0]) - self.assertDictEqual({u'dst-if': u'XPDR2-NETWORK2-ODU4'}, + self.assertDictEqual({'dst-if': 'XPDR2-NETWORK2-ODU4'}, res['odu-connection'][0]['destination']) - self.assertDictEqual({u'src-if': u'XPDR2-NETWORK1-ODU4'}, + self.assertDictEqual({'src-if': 'XPDR2-NETWORK1-ODU4'}, res['odu-connection'][0]['source']) def test_59_check_otn_topo_links(self): @@ -1111,9 +1118,9 @@ class TransportPCEtesting(unittest.TestCase): self.assertEqual(nb_links, 4) for link in res['network'][0]['ietf-network-topology:link']: self.assertEqual( - link['org-openroadm-otn-network-topology:available-bandwidth'], 0) + link['org-openroadm-otn-network-topology:available-bandwidth'], 0) self.assertEqual( - link['org-openroadm-otn-network-topology:used-bandwidth'], 100000) + link['org-openroadm-otn-network-topology:used-bandwidth'], 100000) def test_60_delete_service_100GE_ABC(self): response = test_utils.service_delete_request("service-100GE-ABC") @@ -1204,7 +1211,7 @@ class TransportPCEtesting(unittest.TestCase): tp = res['node'][0]['ietf-network-topology:termination-point'][0] self.assertEqual('XPDR2-NETWORK1', tp['tp-id']) self.assertNotIn('wavelength', dict.keys( - tp[u'org-openroadm-network-topology:xpdr-network-attributes'])) + tp['org-openroadm-network-topology:xpdr-network-attributes'])) time.sleep(3) def test_74_check_openroadm_topo_ROADMB_SRG1(self): @@ -1281,9 +1288,8 @@ class TransportPCEtesting(unittest.TestCase): res = response.json() links = res['network'][0]['ietf-network-topology:link'] for link in links: - if ((link["org-openroadm-common-network:link-type"] == "XPONDER-OUTPUT" or - link["org-openroadm-common-network:link-type"] == "XPONDER-INPUT") - and ('SPDR-SB1' in link['link-id'] or 'ROADM-B1' in link['link-id'])): + if (link["org-openroadm-common-network:link-type"] in ('XPONDER-OUTPUT', 'XPONDER-INPUT') + and ('SPDR-SB1' in link['link-id'] or 'ROADM-B1' in link['link-id'])): link_name = link["link-id"] response = test_utils.delete_request(url+link_name) self.assertEqual(response.status_code, requests.codes.ok) @@ -1306,7 +1312,7 @@ class TransportPCEtesting(unittest.TestCase): links = res['network'][0]['ietf-network-topology:link'] for link in links: if (link["org-openroadm-common-network:link-type"] == "ROADM-TO-ROADM" - and 'ROADM-B1' in link['link-id']): + and 'ROADM-B1' in link['link-id']): link_name = link["link-id"] response = test_utils.delete_request(url+link_name) self.assertEqual(response.status_code, requests.codes.ok) @@ -1344,6 +1350,7 @@ class TransportPCEtesting(unittest.TestCase): self.assertEqual(response.status_code, requests.codes.created) def test_83_create_OCH_OTU4_service_AC(self): + # pylint: disable=line-too-long self.cr_serv_sample_data["input"]["service-name"] = "service-OCH-OTU4-AC" self.cr_serv_sample_data["input"]["connection-type"] = "infrastructure" self.cr_serv_sample_data["input"]["service-a-end"]["service-rate"] = "100" @@ -1384,6 +1391,7 @@ class TransportPCEtesting(unittest.TestCase): # test service-create for 100GE service from spdrA to spdrC via spdrB def test_85_create_100GE_service_AC(self): + # pylint: disable=line-too-long self.cr_serv_sample_data["input"]["service-name"] = "service-100GE-AC" self.cr_serv_sample_data["input"]["connection-type"] = "service" self.cr_serv_sample_data["input"]["service-a-end"]["service-format"] = "Ethernet" @@ -1430,7 +1438,6 @@ class TransportPCEtesting(unittest.TestCase): self.test_50_check_interface_ODU4_NETWORK_spdra() self.test_51_check_ODU4_connection_spdra() - def test_88_check_configuration_spdrc(self): self.test_52_check_interface_100GE_CLIENT_spdrc() self.test_53_check_interface_ODU4_CLIENT_spdrc() @@ -1489,8 +1496,7 @@ class TransportPCEtesting(unittest.TestCase): res = response.json() links = res['network'][0]['ietf-network-topology:link'] for link in links: - if (link["org-openroadm-common-network:link-type"] == "XPONDER-OUTPUT" or - link["org-openroadm-common-network:link-type"] == "XPONDER-INPUT"): + if link["org-openroadm-common-network:link-type"] in ('XPONDER-OUTPUT', 'XPONDER-INPUT'): link_name = link["link-id"] response = test_utils.delete_request(url+link_name) self.assertEqual(response.status_code, requests.codes.ok)