X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Ftransportpce_tests%2F1.2.1%2Ftest_gnpy.py;h=09812bd8d2fc2e2d8f72012fc08ad703bd6c8aae;hb=bc9a08be9d7cdeb30ecffd3c82ddd656a3a23043;hp=20e7d7578a63cfa44f1972cc85932177db8e8140;hpb=d01015f71d50a0e47110d73a640c1a8eb4f2dbd6;p=transportpce.git diff --git a/tests/transportpce_tests/1.2.1/test_gnpy.py b/tests/transportpce_tests/1.2.1/test_gnpy.py index 20e7d7578..09812bd8d 100644 --- a/tests/transportpce_tests/1.2.1/test_gnpy.py +++ b/tests/transportpce_tests/1.2.1/test_gnpy.py @@ -9,8 +9,10 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +# pylint: disable=no-member +# pylint: disable=too-many-public-methods + import unittest -import json import os import sys import time @@ -20,13 +22,6 @@ from common import test_utils class TransportGNPYtesting(unittest.TestCase): - @classmethod - def __init_logfile(cls): - GNPY_LOGFILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), - "..", "..", "transportpce_tests", "gnpy.log") - if os.path.isfile(GNPY_LOFGILE): - os.remove(GNPY_LOFGILE) - topo_cllinet_data = None topo_ordnet_data = None topo_ordtopo_data = None @@ -34,6 +29,7 @@ class TransportGNPYtesting(unittest.TestCase): @classmethod def setUpClass(cls): + # pylint: disable=bare-except try: sample_files_parsed = False TOPO_CLLINET_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), @@ -68,6 +64,7 @@ class TransportGNPYtesting(unittest.TestCase): @classmethod def tearDownClass(cls): + # pylint: disable=not-an-iterable for process in cls.processes: test_utils.shutdown_process(process) print("all processes killed") @@ -105,12 +102,12 @@ class TransportGNPYtesting(unittest.TestCase): self.assertEqual(res['output']['configuration-response-common'][ 'response-message'], 'Path is calculated by PCE') - self.assertEqual(res['output']['gnpy-response'][0]['path-dir'], - 'A-to-Z') - self.assertEqual(res['output']['gnpy-response'][0]['feasibility'], True) self.assertEqual(res['output']['gnpy-response'][1]['path-dir'], - 'Z-to-A') + 'A-to-Z') self.assertEqual(res['output']['gnpy-response'][1]['feasibility'], True) + self.assertEqual(res['output']['gnpy-response'][0]['path-dir'], + 'Z-to-A') + self.assertEqual(res['output']['gnpy-response'][0]['feasibility'], True) time.sleep(5) # Path computed by PCE is not feasible by GNPy and GNPy cannot find @@ -124,7 +121,8 @@ class TransportGNPYtesting(unittest.TestCase): {"include_": {"ordered-hops": [ {"hop-number": "0", "hop-type": {"node-id": "OpenROADM-2"}}, {"hop-number": "1", "hop-type": {"node-id": "OpenROADM-3"}}, - {"hop-number": "2", "hop-type": {"node-id": "OpenROADM-4"}}]}}) + {"hop-number": "2", "hop-type": {"node-id": "OpenROADM-4"}}]} + }) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertEqual(res['output']['configuration-response-common'][ @@ -132,13 +130,13 @@ class TransportGNPYtesting(unittest.TestCase): self.assertEqual(res['output']['configuration-response-common'][ 'response-message'], 'No path available by PCE and GNPy ') - self.assertEqual(res['output']['gnpy-response'][0]['path-dir'], + self.assertEqual(res['output']['gnpy-response'][1]['path-dir'], 'A-to-Z') - self.assertEqual(res['output']['gnpy-response'][0]['feasibility'], + self.assertEqual(res['output']['gnpy-response'][1]['feasibility'], False) - self.assertEqual(res['output']['gnpy-response'][1]['path-dir'], + self.assertEqual(res['output']['gnpy-response'][0]['path-dir'], 'Z-to-A') - self.assertEqual(res['output']['gnpy-response'][1]['feasibility'], + self.assertEqual(res['output']['gnpy-response'][0]['feasibility'], False) time.sleep(5) @@ -151,7 +149,8 @@ class TransportGNPYtesting(unittest.TestCase): "service-format": "Ethernet", "clli": "Node5"}, {"include_": {"ordered-hops": [ {"hop-number": "0", "hop-type": {"node-id": "OpenROADM-2"}}, - {"hop-number": "1", "hop-type": {"node-id": "OpenROADM-3"}}]}}) + {"hop-number": "1", "hop-type": {"node-id": "OpenROADM-3"}}]} + }) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertEqual(res['output']['configuration-response-common'][ @@ -159,12 +158,12 @@ class TransportGNPYtesting(unittest.TestCase): self.assertEqual(res['output']['configuration-response-common'][ 'response-message'], 'Path is calculated by GNPy') - self.assertEqual(res['output']['gnpy-response'][0]['path-dir'], - 'A-to-Z') - self.assertEqual(res['output']['gnpy-response'][0]['feasibility'], True) self.assertEqual(res['output']['gnpy-response'][1]['path-dir'], - 'Z-to-A') + 'A-to-Z') self.assertEqual(res['output']['gnpy-response'][1]['feasibility'], True) + self.assertEqual(res['output']['gnpy-response'][0]['path-dir'], + 'Z-to-A') + self.assertEqual(res['output']['gnpy-response'][0]['feasibility'], True) time.sleep(5) # Not found path by PCE and GNPy cannot find another one @@ -178,7 +177,8 @@ class TransportGNPYtesting(unittest.TestCase): {"hop-number": "0", "hop-type": {"node-id": "OpenROADM-2"}}, {"hop-number": "1", "hop-type": {"node-id": "OpenROADM-3"}}, {"hop-number": "2", "hop-type": {"node-id": "OpenROADM-4"}}, - {"hop-number": "3", "hop-type": {"node-id": "OpenROADM-3"}}]}}) + {"hop-number": "3", "hop-type": {"node-id": "OpenROADM-3"}}]} + }) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertEqual(res['output']['configuration-response-common'][