Fix new pylint issues in functional tests
[transportpce.git] / tests / transportpce_tests / 1.2.1 / test02_topo_portmapping.py
index a2f88b5f6ad8b4d6547f6d4ec542d444fa64ba83..03a02307a68efa97fa2779e45086e51cc2c198df 100644 (file)
@@ -12,7 +12,6 @@
 # pylint: disable=no-member
 # pylint: disable=too-many-public-methods
 # a pylint false positive due to unittest
-# pylint: disable=no-self-use
 
 import time
 import unittest
@@ -52,19 +51,17 @@ class TransportPCEtesting(unittest.TestCase):
 
     # Verify the termination points of the ROADMA
     def test_02_compare_Openroadm_topology_portmapping_rdm(self):
-        responseTopo = test_utils_rfc8040.get_request(test_utils_rfc8040.URL_CONFIG_ORDM_TOPO)
-        resTopo = responseTopo.json()
-        firstEntry = resTopo['ietf-network:network'][0]['node']
-        for i in range(0, len(firstEntry)):
-            nodeId = firstEntry[i]['node-id']
+        resTopo = test_utils_rfc8040.get_ietf_network_request('openroadm-topology', 'config')
+        self.assertEqual(resTopo['status_code'], requests.codes.ok)
+        for node in resTopo['network'][0]['node']:
+            nodeId = node['node-id']
             nodeMapId = nodeId.split("-")[0]
-            response = test_utils_rfc8040.get_portmapping_node_info(nodeMapId)
+            response = test_utils_rfc8040.get_portmapping_node_attr(nodeMapId, "node-info", None)
             self.assertEqual(response['status_code'], requests.codes.ok)
-            nbTp = len(firstEntry[i]['ietf-network-topology:termination-point'])
-            for j in range(0, nbTp):
-                tpId = firstEntry[i]['ietf-network-topology:termination-point'][j]['tp-id']
-                if((not "CP" in tpId) and (not "CTP" in tpId)):
-                    response2 = test_utils_rfc8040.portmapping_request(nodeMapId, tpId)
+            for tp in node['ietf-network-topology:termination-point']:
+                tpId = tp['tp-id']
+                if (not "CP" in tpId) and (not "CTP" in tpId):
+                    response2 = test_utils_rfc8040.get_portmapping_node_attr(nodeMapId, "mapping", tpId)
                     self.assertEqual(response2['status_code'], requests.codes.ok)
 
     # Disconnect the ROADMA