X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Ftransportpce_tests%2Fpce%2Ftest01_pce.py;h=8e8ad6713b73a0775445a6ea38c15319577d29ee;hb=3cce0ff813d5153571057fbd59515fc56663bbf3;hp=bbed914aaa9fd0346ba07fcc8ac9d2732c1b0bdc;hpb=1012f1723c3815f5c704fa9a908c3cfdce58ec31;p=transportpce.git diff --git a/tests/transportpce_tests/pce/test01_pce.py b/tests/transportpce_tests/pce/test01_pce.py index bbed914aa..8e8ad6713 100644 --- a/tests/transportpce_tests/pce/test01_pce.py +++ b/tests/transportpce_tests/pce/test01_pce.py @@ -13,11 +13,14 @@ import unittest import os +# pylint: disable=wrong-import-order import sys import time import requests sys.path.append('transportpce_tests/common/') -import test_utils +# pylint: disable=wrong-import-position +# pylint: disable=import-error +import test_utils # nopep8 class TransportPCEtesting(unittest.TestCase): @@ -31,26 +34,26 @@ class TransportPCEtesting(unittest.TestCase): @classmethod def setUpClass(cls): # pylint: disable=bare-except + sample_files_parsed = False try: - sample_files_parsed = False TOPO_BI_DIR_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "honeynode-topo.xml") - with open(TOPO_BI_DIR_FILE, 'r') as topo_bi_dir: + with open(TOPO_BI_DIR_FILE, 'r', encoding='utf-8') as topo_bi_dir: cls.simple_topo_bi_dir_data = topo_bi_dir.read() TOPO_UNI_DIR_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "NW-simple-topology.xml") - with open(TOPO_UNI_DIR_FILE, 'r') as topo_uni_dir: + with open(TOPO_UNI_DIR_FILE, 'r', encoding='utf-8') as topo_uni_dir: cls.simple_topo_uni_dir_data = topo_uni_dir.read() TOPO_UNI_DIR_COMPLEX_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "sample_configs", "NW-for-test-5-4.xml") - with open(TOPO_UNI_DIR_COMPLEX_FILE, 'r') as topo_uni_dir_complex: + with open(TOPO_UNI_DIR_COMPLEX_FILE, 'r', encoding='utf-8') as topo_uni_dir_complex: cls.complex_topo_uni_dir_data = topo_uni_dir_complex.read() PORT_MAPPING_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), - "..", "..", "sample_configs", "pce_portmapping_121.json") - with open(PORT_MAPPING_FILE, 'r') as port_mapping: + "..", "..", "sample_configs", "pce_portmapping_121.json") + with open(PORT_MAPPING_FILE, 'r', encoding='utf-8') as port_mapping: cls.port_mapping_data = port_mapping.read() sample_files_parsed = True except PermissionError as err: @@ -253,45 +256,9 @@ class TransportPCEtesting(unittest.TestCase): def test_18_success1_path_computation(self): response = test_utils.path_computation_request("request1", "service1", {"service-format": "Ethernet", "service-rate": "100", - "clli": "ORANGE2", "node-id": "XPONDER-2-2", - "tx-direction": {"port": { - "port-device-name": "Some port-device-name", - "port-type": "Some port-type", - "port-name": "Some port-name", - "port-rack": "Some port-rack", - "port-shelf": "Some port-shelf", - "port-slot": "Some port-slot", - "port-sub-slot": "Some port-sub-slot" - }}, - "rx-direction": {"port": { - "port-device-name": "Some port-device-name", - "port-type": "Some port-type", - "port-name": "Some port-name", - "port-rack": "Some port-rack", - "port-shelf": "Some port-shelf", - "port-slot": "Some port-slot", - "port-sub-slot": "Some port-sub-slot" - }}}, + "clli": "ORANGE2", "node-id": "XPONDER-2-2"}, {"service-format": "Ethernet", "service-rate": "100", - "clli": "ORANGE1", "node-id": "XPONDER-1-2", - "tx-direction": {"port": { - "port-device-name": "Some port-device-name", - "port-type": "Some port-type", - "port-name": "Some port-name", - "port-rack": "Some port-rack", - "port-shelf": "Some port-shelf", - "port-slot": "Some port-slot", - "port-sub-slot": "Some port-sub-slot" - }}, - "rx-direction": {"port": { - "port-device-name": "Some port-device-name", - "port-type": "Some port-type", - "port-name": "Some port-name", - "port-rack": "Some port-rack", - "port-shelf": "Some port-shelf", - "port-slot": "Some port-slot", - "port-sub-slot": "Some port-sub-slot" - }}}, + "clli": "ORANGE1", "node-id": "XPONDER-1-2"}, {"customer-code": ["Some customer-code"], "co-routing": {"existing-service": ["Some existing-service"]} }, @@ -354,7 +321,7 @@ class TransportPCEtesting(unittest.TestCase): nbElmPath = len(res['output']['response-parameters']['path-description'] ['aToZ-direction']['aToZ']) self.assertEqual(31, nbElmPath) - link = {"link-id": "OpenROADM-1-3-DEG2-to-OpenROADM-1-2-DEG2", "state":"inService"} + link = {"link-id": "OpenROADM-1-3-DEG2-to-OpenROADM-1-2-DEG2", "state": "inService"} find = False for i in range(0, nbElmPath): resource_i = (res['output']['response-parameters']['path-description']['aToZ-direction']['aToZ'][i] @@ -384,7 +351,7 @@ class TransportPCEtesting(unittest.TestCase): nbElmPath = len(res['output']['response-parameters']['path-description'] ['aToZ-direction']['aToZ']) self.assertEqual(47, nbElmPath) - link = {"link-id": "OpenROADM-1-3-DEG2-to-OpenROADM-1-2-DEG2", "state":"inService"} + link = {"link-id": "OpenROADM-1-3-DEG2-to-OpenROADM-1-2-DEG2", "state": "inService"} find = False for i in range(0, nbElmPath): resource_i = (res['output']['response-parameters']['path-description']['aToZ-direction']['aToZ'][i]