fix few bugs and unused issues in functional tests 09/92409/5
authorguillaume.lambert <guillaume.lambert@orange.com>
Fri, 4 Sep 2020 09:32:21 +0000 (11:32 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Fri, 18 Sep 2020 14:32:41 +0000 (16:32 +0200)
pointed out by pylint

JIRA: TRNSPRTPCE-320
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: I37d95d2df919fd020fecf2750452442fb482ffb7

14 files changed:
tests/transportpce_tests/1.2.1/test_end2end.py
tests/transportpce_tests/1.2.1/test_gnpy.py
tests/transportpce_tests/1.2.1/test_olm.py
tests/transportpce_tests/1.2.1/test_pce.py
tests/transportpce_tests/1.2.1/test_renderer_service_path_nominal.py
tests/transportpce_tests/1.2.1/test_topoPortMapping.py
tests/transportpce_tests/1.2.1/test_topology.py
tests/transportpce_tests/2.2.1/test_end2end.py
tests/transportpce_tests/2.2.1/test_olm.py
tests/transportpce_tests/2.2.1/test_otn_renderer.py
tests/transportpce_tests/2.2.1/test_otn_topology.py
tests/transportpce_tests/2.2.1/test_renderer_service_path_nominal.py
tests/transportpce_tests/2.2.1/test_topoPortMapping.py
tests/transportpce_tests/2.2.1/test_topology.py

index 7854f06fc45024ec3e3604f9dfc1d90545ef1ea4..5266a609554a9ec934c9b83a7b3c04a33ec06c9d 100644 (file)
@@ -11,7 +11,6 @@
 # pylint: disable=no-member
 # pylint: disable=too-many-public-methods
 
-import json
 import time
 import unittest
 
index de8e19f2a8c7bc12df11e2cf2657d740546d25f8..da50405238c18914297fd12d279f9615608c8318 100644 (file)
@@ -13,7 +13,6 @@
 # pylint: disable=too-many-public-methods
 
 import unittest
-import json
 import os
 import sys
 import time
@@ -23,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
index 3315a049eed551098445b4eca0ffa23d1bffcbc9..0d4aca50768ff69d598a284677d95fda19e0161e 100644 (file)
@@ -14,7 +14,6 @@
 
 import unittest
 import time
-import json
 import requests
 from common import test_utils
 
index 4b4443bed23b8ac23b1d6f659a84a18446f55d26..58d4a6cc8d617f8e4801afde34e56a91110cb7b0 100644 (file)
@@ -12,7 +12,6 @@
 # pylint: disable=too-many-public-methods
 
 import unittest
-import json
 import os
 import sys
 import time
index 33b0f3ceccb5657182da7a9bfbc8966a07c83246..fd420db7ab60a89f23e536bada051f274df9c50d 100644 (file)
@@ -13,7 +13,6 @@
 # pylint: disable=too-many-public-methods
 
 import unittest
-import json
 import time
 import requests
 from common import test_utils
index f1a460103811268d2b8a0c48bbfb7aecbc2ccdd7..48b501fa724db82092e5cec6b48a53b2ce25cf2e 100644 (file)
@@ -46,20 +46,15 @@ class TransportPCEtesting(unittest.TestCase):
         responseTopo = test_utils.get_ordm_topo_request("")
         resTopo = responseTopo.json()
         nbNode = len(resTopo['network'][0]['node'])
-        nbMapCumul = 0
-        nbMappings = 0
         for i in range(0, nbNode):
             nodeId = resTopo['network'][0]['node'][i]['node-id']
             nodeMapId = nodeId.split("-")[0]
-            responseMapList = test_utils.portmapping_request(nodeMapId)
-            resMapList = responseMapList.json()
-            nbMappings = len(resMapList['nodes'][0]['mapping']) - nbMapCumul
+            test_utils.portmapping_request(nodeMapId)
             nbTp = len(resTopo['network'][0]['node'][i]['ietf-network-topology:termination-point'])
-            nbMapCurrent = 0
             for j in range(0, nbTp):
                 tpId = resTopo['network'][0]['node'][i]['ietf-network-topology:termination-point'][j]['tp-id']
                 if((not "CP" in tpId) and (not "CTP" in tpId)):
-                    responseMap = test_utils.portmapping_request(nodeMapId+"/mapping/"+tpId)
+                    test_utils.portmapping_request(nodeMapId+"/mapping/"+tpId)
 
     # Disconnect the ROADMA
     def test_03_disconnect_rdm(self):
index 87423ca6eda613c53121ac6d964b6b62f73d8908..c30bb7992b09218bc19bf27d957db02ed91c147c 100644 (file)
@@ -12,7 +12,6 @@
 # pylint: disable=no-member
 # pylint: disable=too-many-public-methods
 
-import json
 import time
 import unittest
 import requests
@@ -472,7 +471,6 @@ class TransportPCETopologyTesting(unittest.TestCase):
         R2RLink = ['ROADMA01-DEG1-DEG1-TTP-TXRXtoROADMC01-DEG2-DEG2-TTP-TXRX',
                    'ROADMC01-DEG2-DEG2-TTP-TXRXtoROADMA01-DEG1-DEG1-TTP-TXRX']
         for i in range(0, nbLink):
-            nodeType = res['network'][0]['ietf-network-topology:link'][i]['org-openroadm-common-network:link-type']
             link_id = res['network'][0]['ietf-network-topology:link'][i]['link-id']
             if(link_id in R2RLink):
                 find = False
@@ -733,7 +731,6 @@ class TransportPCETopologyTesting(unittest.TestCase):
                    'ROADMB01-DEG1-DEG1-TTP-TXRXtoROADMA01-DEG2-DEG2-TTP-TXRX',
                    'ROADMB01-DEG2-DEG2-TTP-TXRXtoROADMC01-DEG1-DEG1-TTP-TXRX']
         for i in range(0, nbLink):
-            nodeType = res['network'][0]['ietf-network-topology:link'][i]['org-openroadm-common-network:link-type']
             link_id = res['network'][0]['ietf-network-topology:link'][i]['link-id']
             if(link_id in R2RLink):
                 find = False
@@ -858,7 +855,7 @@ class TransportPCETopologyTesting(unittest.TestCase):
         nbNode = len(res['network'][0]['node'])
         self.assertEqual(nbNode, 1)
         for i in range(0, nbNode-1):
-            self.assertNotEqual(res['network'][0]['node'][1]['org-openroadm-clli-network:clli'], 'NodeC')
+            self.assertNotEqual(res['network'][0]['node'][i]['org-openroadm-clli-network:clli'], 'NodeC')
 
     def test_35_disconnect_XPDRA(self):
         response = test_utils.unmount_device("XPDRA01")
index e45603b6826fa2e8239bcabd67f430aa278d47fe..99a50a287bdf6a265689b3bbb00829ae25842bd6 100644 (file)
@@ -12,7 +12,6 @@
 # pylint: disable=too-many-public-methods
 
 import unittest
-import json
 import time
 import requests
 from common import test_utils
index a09a1e65ff6251c18d7d13c008b8caf061762735..f7b331ccc1b36a9402cb69202d2319f8c91dc4a2 100644 (file)
@@ -14,7 +14,6 @@
 
 import unittest
 import time
-import json
 import requests
 from common import test_utils
 
index f4ec82795db6825f61a06004d1676c2559b6528c..4646fb1fdd8915cd3f3799ec4e89732ce5b138e0 100644 (file)
@@ -13,7 +13,6 @@
 # pylint: disable=too-many-public-methods
 
 import unittest
-import json
 import time
 import requests
 from common import test_utils
@@ -52,16 +51,16 @@ class TransportPCEtesting(unittest.TestCase):
     def test_02_get_portmapping_CLIENT4(self):
         response = test_utils.portmapping_request("SPDR-SA1/mapping/XPDR1-CLIENT4")
         self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        self.assertEqual('CP1-SFP4-P1', res['mapping'][0]['supporting-port'])
-        self.assertEqual('CP1-SFP4', res['mapping'][0]['supporting-circuit-pack-name'])
-        self.assertEqual('XPDR1-CLIENT4', res['mapping'][0]['logical-connection-point'])
-        self.assertEqual('bidirectional', res['mapping'][0]['port-direction'])
-        self.assertEqual('xpdr-client', res['mapping'][0]['port-qual'])
-        self.assertEqual('FqlcrxV7p3g=', res['mapping'][0]['lcp-hash-val'])
-        self.assertIn('org-openroadm-port-types:if-10GE-ODU2e', res['mapping'][0]['supported-interface-capability'])
-        self.assertIn('org-openroadm-port-types:if-10GE-ODU2', res['mapping'][0]['supported-interface-capability'])
-        self.assertIn('org-openroadm-port-types:if-10GE', res['mapping'][0]['supported-interface-capability'])
+        res_mapping = (response.json())['mapping'][0]
+        self.assertEqual('CP1-SFP4-P1', res_mapping['supporting-port'])
+        self.assertEqual('CP1-SFP4', res_mapping['supporting-circuit-pack-name'])
+        self.assertEqual('XPDR1-CLIENT4', res_mapping['logical-connection-point'])
+        self.assertEqual('bidirectional', res_mapping['port-direction'])
+        self.assertEqual('xpdr-client', res_mapping['port-qual'])
+        self.assertEqual('FqlcrxV7p3g=', res_mapping['lcp-hash-val'])
+        self.assertIn('org-openroadm-port-types:if-10GE-ODU2e', res_mapping['supported-interface-capability'])
+        self.assertIn('org-openroadm-port-types:if-10GE-ODU2', res_mapping['supported-interface-capability'])
+        self.assertIn('org-openroadm-port-types:if-10GE', res_mapping['supported-interface-capability'])
 
     def test_03_get_portmapping_NETWORK1(self):
         response = test_utils.portmapping_request("SPDR-SA1/mapping/XPDR1-NETWORK1")
index e4f5c8d6865b8c3ea715cfb0d7c4ce5ed0d3c57a..4dd6ab7b2ba75fb81555b12d1876b4d8065c2378 100644 (file)
@@ -100,7 +100,6 @@ class TransportPCEtesting(unittest.TestCase):
                     network = 0
                     for j in range(0, nbTps):
                         tpType = res['network'][0]['node'][i]['ietf-network-topology:termination-point'][j]['org-openroadm-common-network:tp-type']
-                        tpId = res['network'][0]['node'][i]['ietf-network-topology:termination-point'][j]['tp-id']
                         if (tpType == 'XPONDER-CLIENT'):
                             client += 1
                         elif (tpType == 'XPONDER-NETWORK'):
@@ -119,7 +118,6 @@ class TransportPCEtesting(unittest.TestCase):
                     network = 0
                     for j in range(0, nbTps):
                         tpType = res['network'][0]['node'][i]['ietf-network-topology:termination-point'][j]['org-openroadm-common-network:tp-type']
-                        tpId = res['network'][0]['node'][i]['ietf-network-topology:termination-point'][j]['tp-id']
                         if (tpType == 'XPONDER-CLIENT'):
                             client += 1
                         elif (tpType == 'XPONDER-NETWORK'):
index e59de8c8d8323efb5495b889e2f153eda4b368a6..f3c47d0a14b7e3107abcefff92e7f5559785dbf4 100644 (file)
@@ -13,7 +13,6 @@
 # pylint: disable=too-many-public-methods
 
 import unittest
-import json
 #from unittest.result import failfast
 import requests
 from common import test_utils
index 14e258d553d16c8a358a30464815a8757cce563f..f92aefdb82fd10a9d47c489ed1f731b863c20e29 100644 (file)
@@ -13,7 +13,6 @@
 # pylint: disable=too-many-public-methods
 
 import unittest
-import json
 import time
 import requests
 from common import test_utils
index 0d3bb206bad5ec57d74d3aefc4949d2fac100bc2..8fa74bfc680918a231c4e0c9129df66fdcf73631 100644 (file)
@@ -14,7 +14,6 @@
 
 import unittest
 import time
-import json
 import logging
 import requests
 from common import test_utils
@@ -478,7 +477,6 @@ class TransportPCEtesting(unittest.TestCase):
         R2RLink = ['ROADM-A1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG1-DEG1-TTP-TXRX',
                    'ROADM-C1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG2-DEG2-TTP-TXRX']
         for i in range(0, nbLink):
-            nodeType = res['network'][0]['ietf-network-topology:link'][i]['org-openroadm-common-network:link-type']
             link_id = res['network'][0]['ietf-network-topology:link'][i]['link-id']
             if(link_id in R2RLink):
                 find = False
@@ -745,7 +743,6 @@ class TransportPCEtesting(unittest.TestCase):
                    'ROADM-B1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG1-DEG1-TTP-TXRX',
                    'ROADM-B1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG2-DEG2-TTP-TXRX']
         for i in range(0, nbLink):
-            nodeType = res['network'][0]['ietf-network-topology:link'][i]['org-openroadm-common-network:link-type']
             link_id = res['network'][0]['ietf-network-topology:link'][i]['link-id']
             if(link_id in R2RLink):
                 find = False
@@ -925,7 +922,7 @@ class TransportPCEtesting(unittest.TestCase):
         nbNode = len(res['network'][0]['node'])
         self.assertEqual(nbNode, 1)
         for i in range(0, nbNode-1):
-            self.assertNotEqual(res['network'][0]['node'][1]['org-openroadm-clli-network:clli'], 'NodeC')
+            self.assertNotEqual(res['network'][0]['node'][i]['org-openroadm-clli-network:clli'], 'NodeC')
 
     def test_35_disconnect_XPDRA(self):
         response = test_utils.unmount_device("XPDR-A1")