fix some pylint issues
[transportpce.git] / tests / transportpce_tests / 2.2.1 / test_otn_end2end.py
index 2d2e4f46d9a3458c164ea31552b39b1ac9bd805f..d2208da6d8727f05201635885b552b3b65ce6f09 100644 (file)
@@ -132,6 +132,7 @@ class TransportPCEtesting(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")
@@ -497,12 +498,12 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertEqual(nb_links, 4)
         for link in res['network'][0]['ietf-network-topology:link']:
             linkId = link['link-id']
-            if (linkId == 'OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1' or
-                    linkId == 'OTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1'):
+            if (linkId in ('OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1',
+                           'OTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1')):
                 self.assertEqual(link['org-openroadm-otn-network-topology:available-bandwidth'], 0)
                 self.assertEqual(link['org-openroadm-otn-network-topology:used-bandwidth'], 100000)
-            elif (linkId == 'ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1' or
-                  linkId == 'ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1'):
+            elif (linkId in ('ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1',
+                             'ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1')):
                 self.assertEqual(link['org-openroadm-otn-network-topology:available-bandwidth'], 100000)
                 self.assertEqual(link['org-openroadm-otn-network-topology:used-bandwidth'], 0)
                 self.assertEqual(link['transportpce-topology:otn-link-type'], 'ODTU4')
@@ -517,10 +518,10 @@ class TransportPCEtesting(unittest.TestCase):
         response = test_utils.get_otn_topo_request()
         res = response.json()
         for node in res['network'][0]['node']:
-            if (node['node-id'] == 'SPDR-SA1-XPDR1' or 'SPDR-SC1-XPDR1'):
+            if node['node-id'] == 'SPDR-SA1-XPDR1' or 'SPDR-SC1-XPDR1':
                 tpList = node['ietf-network-topology:termination-point']
                 for tp in tpList:
-                    if (tp['tp-id'] == 'XPDR1-NETWORK1'):
+                    if tp['tp-id'] == 'XPDR1-NETWORK1':
                         xpdrTpPortConAt = tp['org-openroadm-otn-network-topology:xpdr-tp-port-connection-attributes']
                         self.assertEqual(len(xpdrTpPortConAt['ts-pool']), 80)
                         self.assertEqual(len(xpdrTpPortConAt['odtu-tpn-pool'][0]['tpn-pool']), 80)
@@ -748,8 +749,8 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertEqual(nb_links, 4)
         for link in res['network'][0]['ietf-network-topology:link']:
             linkId = link['link-id']
-            if (linkId == 'ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1' or
-                    linkId == 'ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1'):
+            if (linkId in ('ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1',
+                           'ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1')):
                 self.assertEqual(link['org-openroadm-otn-network-topology:available-bandwidth'], 90000)
                 self.assertEqual(link['org-openroadm-otn-network-topology:used-bandwidth'], 10000)
 
@@ -757,13 +758,13 @@ class TransportPCEtesting(unittest.TestCase):
         response = test_utils.get_otn_topo_request()
         res = response.json()
         for node in res['network'][0]['node']:
-            if (node['node-id'] == 'SPDR-SA1-XPDR1' or 'SPDR-SC1-XPDR1'):
+            if node['node-id'] == 'SPDR-SA1-XPDR1' or 'SPDR-SC1-XPDR1':
                 tpList = node['ietf-network-topology:termination-point']
                 for tp in tpList:
-                    if (tp['tp-id'] == 'XPDR1-NETWORK1'):
+                    if tp['tp-id'] == 'XPDR1-NETWORK1':
                         xpdrTpPortConAt = tp['org-openroadm-otn-network-topology:xpdr-tp-port-connection-attributes']
                         self.assertEqual(len(xpdrTpPortConAt['ts-pool']), 72)
-                        tsPoolList = [i for i in range(1, 9)]
+                        tsPoolList = list(range(1, 9))
                         self.assertNotIn(tsPoolList, xpdrTpPortConAt['ts-pool'])
                         self.assertEqual(len(xpdrTpPortConAt['odtu-tpn-pool'][0]['tpn-pool']), 79)
                         self.assertNotIn(1, xpdrTpPortConAt['odtu-tpn-pool'][0]['tpn-pool'])
@@ -810,8 +811,8 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertEqual(nb_links, 4)
         for link in res['network'][0]['ietf-network-topology:link']:
             linkId = link['link-id']
-            if (linkId == 'ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1' or
-                    linkId == 'ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1'):
+            if (linkId in ('ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1',
+                           'ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1')):
                 self.assertEqual(link['org-openroadm-otn-network-topology:available-bandwidth'], 100000)
                 self.assertEqual(link['org-openroadm-otn-network-topology:used-bandwidth'], 0)
 
@@ -822,7 +823,7 @@ class TransportPCEtesting(unittest.TestCase):
             if (node['node-id'] == 'SPDR-SA1-XPDR1' or 'SPDR-SC1-XPDR1'):
                 tpList = node['ietf-network-topology:termination-point']
                 for tp in tpList:
-                    if (tp['tp-id'] == 'XPDR1-NETWORK1'):
+                    if tp['tp-id'] == 'XPDR1-NETWORK1':
                         xpdrTpPortConAt = tp['org-openroadm-otn-network-topology:xpdr-tp-port-connection-attributes']
                         self.assertEqual(len(xpdrTpPortConAt['ts-pool']), 80)
                         self.assertEqual(len(xpdrTpPortConAt['odtu-tpn-pool'][0]['tpn-pool']), 80)
@@ -853,10 +854,10 @@ class TransportPCEtesting(unittest.TestCase):
         response = test_utils.get_otn_topo_request()
         res = response.json()
         for node in res['network'][0]['node']:
-            if (node['node-id'] == 'SPDR-SA1-XPDR1' or 'SPDR-SC1-XPDR1'):
+            if node['node-id'] == 'SPDR-SA1-XPDR1' or 'SPDR-SC1-XPDR1':
                 tpList = node['ietf-network-topology:termination-point']
                 for tp in tpList:
-                    if (tp['tp-id'] == 'XPDR1-NETWORK1'):
+                    if tp['tp-id'] == 'XPDR1-NETWORK1':
                         xpdrTpPortConAt = tp['org-openroadm-otn-network-topology:xpdr-tp-port-connection-attributes']
                         self.assertNotIn('ts-pool', dict.keys(xpdrTpPortConAt))
                         self.assertNotIn('odtu-tpn-pool', dict.keys(xpdrTpPortConAt))