Enforce autopep8 via pre-commit 18/98218/2
authorguillaume.lambert <guillaume.lambert@orange.com>
Fri, 29 Oct 2021 09:51:54 +0000 (11:51 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Mon, 22 Nov 2021 11:42:00 +0000 (12:42 +0100)
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: Ia0021347c46488ecc2a922f4e370ca5ad4edafd9

.pre-commit-config.yaml
docs/conf.py
tests/transportpce_tests/1.2.1/test01_portmapping.py
tests/transportpce_tests/2.2.1/test13_tapi_full_multi_layer.py
tests/transportpce_tests/2.2.1/test14_otn_switch_end2end.py
tests/transportpce_tests/common/test_utils.py

index bc040d936f7f30b49164946d68aaa516a788e985..baa871ba7c4d9103d8dd1ce8d6492a577144e5c3 100644 (file)
@@ -19,3 +19,10 @@ repos:
       - id: remove-tabs
         stages: [commit]
         exclude: '^(.git/|docs/make.bat|docs/Makefile|ordmodels/)'
+
+  - repo: https://github.com/pre-commit/mirrors-autopep8
+    rev: v1.5.7
+    hooks:
+      - id: autopep8
+        args: ['--in-place', '--max-line-length=120']
+
index ed284d5097b7eafa304804355d49d71c9bb640ee..0eae088536aa042748898abbfc46033b1e264919 100644 (file)
@@ -18,4 +18,3 @@ linkcheck_ignore = [
     'https://0201.nccdn.net/1_2/000/000/134/c50/Open-ROADM-MSA-release-2-Device-White-paper-v1-1.pdf'
 ]
 linkcheck_timeout = 300
-
index 47c8a56ac98c62fa1ab2967bfcd92bc4e85c2ed6..f9a1b51f77e273e4b5715d1440180d913a7dde76 100644 (file)
@@ -243,6 +243,5 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
             res['errors']['error'])
 
 
-
 if __name__ == "__main__":
     unittest.main(verbosity=2)
index b25d96c48c9c36137ab03e6d1598ce790fefcc72..4901b377c6c4bf88e290d65b9026b0dee9fe5148 100644 (file)
@@ -34,7 +34,7 @@ class TransportPCEtesting(unittest.TestCase):
                     "layer-protocol-name": "PHOTONIC_MEDIA",
                     "service-interface-point": {
                         "service-interface-point-uuid": "b1a0d883-32b8-3b0b-93d6-7ed074f6f107"
-                },
+                    },
                     "administrative-state": "UNLOCKED",
                     "operational-state": "ENABLED",
                     "direction": "BIDIRECTIONAL",
@@ -52,7 +52,7 @@ class TransportPCEtesting(unittest.TestCase):
                     "layer-protocol-name": "PHOTONIC_MEDIA",
                     "service-interface-point": {
                         "service-interface-point-uuid": "d1d6305e-179b-346f-b02d-8260aebe1ce8"
-                },
+                    },
                     "administrative-state": "UNLOCKED",
                     "operational-state": "ENABLED",
                     "direction": "BIDIRECTIONAL",
@@ -257,11 +257,11 @@ class TransportPCEtesting(unittest.TestCase):
         print("photonic media service uuid : {}".format(res['output']['service']['uuid']))
 
         input_dict_1 = {'administrative-state': 'LOCKED',
-            'lifecycle-state': 'PLANNED',
-            'operational-state': 'DISABLED',
-            'service-type': 'POINT_TO_POINT_CONNECTIVITY',
-            'service-layer': 'PHOTONIC_MEDIA',
-            'connectivity-direction': 'BIDIRECTIONAL'
+                        'lifecycle-state': 'PLANNED',
+                        'operational-state': 'DISABLED',
+                        'service-type': 'POINT_TO_POINT_CONNECTIVITY',
+                        'service-layer': 'PHOTONIC_MEDIA',
+                        'connectivity-direction': 'BIDIRECTIONAL'
                         }
         input_dict_2 = {'value-name': 'OpenROADM node id',
                         'value': 'SPDR-SC1-XPDR1'}
@@ -278,7 +278,7 @@ class TransportPCEtesting(unittest.TestCase):
 
     def test_16_get_service_PhotonicMedia(self):
         response = test_utils.get_service_list_request(
-            "services/"+ str(service_pm_uuid))
+            "services/" + str(service_pm_uuid))
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertEqual(
@@ -308,11 +308,11 @@ class TransportPCEtesting(unittest.TestCase):
         print("odu service uuid : {}".format(res['output']['service']['uuid']))
 
         input_dict_1 = {'administrative-state': 'LOCKED',
-            'lifecycle-state': 'PLANNED',
-            'operational-state': 'DISABLED',
-            'service-type': 'POINT_TO_POINT_CONNECTIVITY',
-            'service-layer': 'ODU',
-            'connectivity-direction': 'BIDIRECTIONAL'
+                        'lifecycle-state': 'PLANNED',
+                        'operational-state': 'DISABLED',
+                        'service-type': 'POINT_TO_POINT_CONNECTIVITY',
+                        'service-layer': 'ODU',
+                        'connectivity-direction': 'BIDIRECTIONAL'
                         }
         input_dict_2 = {'value-name': 'OpenROADM node id',
                         'value': 'SPDR-SC1-XPDR1'}
@@ -329,7 +329,7 @@ class TransportPCEtesting(unittest.TestCase):
 
     def test_18_get_service_ODU(self):
         response = test_utils.get_service_list_request(
-            "services/"+ str(service_odu_uuid))
+            "services/" + str(service_odu_uuid))
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertEqual(
@@ -360,11 +360,11 @@ class TransportPCEtesting(unittest.TestCase):
         print("dsr service uuid : {}".format(res['output']['service']['uuid']))
 
         input_dict_1 = {'administrative-state': 'LOCKED',
-            'lifecycle-state': 'PLANNED',
-            'operational-state': 'DISABLED',
-            'service-type': 'POINT_TO_POINT_CONNECTIVITY',
-            'service-layer': 'DSR',
-            'connectivity-direction': 'BIDIRECTIONAL'
+                        'lifecycle-state': 'PLANNED',
+                        'operational-state': 'DISABLED',
+                        'service-type': 'POINT_TO_POINT_CONNECTIVITY',
+                        'service-layer': 'DSR',
+                        'connectivity-direction': 'BIDIRECTIONAL'
                         }
         input_dict_2 = {'value-name': 'OpenROADM node id',
                         'value': 'SPDR-SC1-XPDR1'}
@@ -384,7 +384,7 @@ class TransportPCEtesting(unittest.TestCase):
 
     def test_20_get_service_DSR(self):
         response = test_utils.get_service_list_request(
-            "services/"+ str(service_dsr_uuid))
+            "services/" + str(service_dsr_uuid))
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertEqual(
@@ -423,9 +423,9 @@ class TransportPCEtesting(unittest.TestCase):
         time.sleep(2)
 
     def test_22_delete_connectivity_service_DSR(self):
-       response = test_utils.tapi_delete_connectivity_request(service_dsr_uuid)
-       self.assertEqual(response.status_code, requests.codes.no_content)
-       time.sleep(self.WAITING)
+        response = test_utils.tapi_delete_connectivity_request(service_dsr_uuid)
+        self.assertEqual(response.status_code, requests.codes.no_content)
+        time.sleep(self.WAITING)
 
     def test_23_delete_connectivity_service_ODU(self):
         response = test_utils.tapi_delete_connectivity_request(service_odu_uuid)
index 110111e3e00b12b94bb73e0f8a33ab4814efbc59..d66e72641640774865108b87a8897461496315a3 100644 (file)
@@ -1111,9 +1111,9 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertEqual(nb_links, 4)
         for link in res['network'][0]['ietf-network-topology:link']:
             self.assertEqual(
-                    link['org-openroadm-otn-network-topology:available-bandwidth'], 0)
+                link['org-openroadm-otn-network-topology:available-bandwidth'], 0)
             self.assertEqual(
-                    link['org-openroadm-otn-network-topology:used-bandwidth'], 100000)
+                link['org-openroadm-otn-network-topology:used-bandwidth'], 100000)
 
     def test_60_delete_service_100GE_ABC(self):
         response = test_utils.service_delete_request("service-100GE-ABC")
@@ -1283,7 +1283,7 @@ class TransportPCEtesting(unittest.TestCase):
         for link in links:
             if ((link["org-openroadm-common-network:link-type"] == "XPONDER-OUTPUT" or
                     link["org-openroadm-common-network:link-type"] == "XPONDER-INPUT")
-                and ('SPDR-SB1' in link['link-id'] or 'ROADM-B1' in link['link-id'])):
+                    and ('SPDR-SB1' in link['link-id'] or 'ROADM-B1' in link['link-id'])):
                 link_name = link["link-id"]
                 response = test_utils.delete_request(url+link_name)
                 self.assertEqual(response.status_code, requests.codes.ok)
@@ -1306,7 +1306,7 @@ class TransportPCEtesting(unittest.TestCase):
         links = res['network'][0]['ietf-network-topology:link']
         for link in links:
             if (link["org-openroadm-common-network:link-type"] == "ROADM-TO-ROADM"
-                and 'ROADM-B1' in link['link-id']):
+                    and 'ROADM-B1' in link['link-id']):
                 link_name = link["link-id"]
                 response = test_utils.delete_request(url+link_name)
                 self.assertEqual(response.status_code, requests.codes.ok)
@@ -1430,7 +1430,6 @@ class TransportPCEtesting(unittest.TestCase):
         self.test_50_check_interface_ODU4_NETWORK_spdra()
         self.test_51_check_ODU4_connection_spdra()
 
-
     def test_88_check_configuration_spdrc(self):
         self.test_52_check_interface_100GE_CLIENT_spdrc()
         self.test_53_check_interface_ODU4_CLIENT_spdrc()
index 46bf27a676ddb1b9a0e1978c9b7b4a3dbb0cd2ce..d5118149b0816a022b83040eeea715af8aa07859 100644 (file)
@@ -393,6 +393,7 @@ def service_delete_request(servicename: str,
             "tail-retention": "no"}}}
     return post_request(URL_SERV_DELETE, attr)
 
+
 def service_path_request(operation: str, servicename: str, wavenumber: str, nodes, centerfreq: str,
                          slotwidth: int, minfreq: float, maxfreq: float, lowerslotnumber: int,
                          higherslotnumber: int):
@@ -446,20 +447,24 @@ def path_computation_request(requestid: str, servicename: str, serviceaend, serv
         attr.update(other_attr)
     return post_request(URL_PATH_COMPUTATION_REQUEST, {"input": attr})
 
+
 def tapi_create_connectivity_request(topologyidorname):
     return post_request(URL_TAPI_CREATE_CONNECTIVITY, topologyidorname)
 
+
 def tapi_delete_connectivity_request(serviceidorname):
     attr = {
         "input": {
             "service-id-or-name": serviceidorname}}
-    return post_request(URL_TAPI_DELETE_CONNECTIVITY , attr)
+    return post_request(URL_TAPI_DELETE_CONNECTIVITY, attr)
+
 
 def tapi_get_topology_details_request(topologyidorname):
     attr = {
         "input": {
             "topology-id-or-name": topologyidorname}}
-    return post_request(URL_TAPI_TOPOLOGY_DETAILS , attr)
+    return post_request(URL_TAPI_TOPOLOGY_DETAILS, attr)
+
 
 def tapi_get_node_details_request(topologyidorname, nodeidorname):
     attr = {
@@ -468,12 +473,15 @@ def tapi_get_node_details_request(topologyidorname, nodeidorname):
             "node-id-or-name": nodeidorname}}
     return post_request(URL_TAPI_NODE_DETAILS, attr)
 
+
 def tapi_get_sip_details_request():
     return post_request(URL_TAPI_SIP_LIST, "")
 
+
 def tapi_get_service_list_request():
     return post_request(URL_TAPI_SERVICE_LIST, "")
 
+
 def shutdown_process(process):
     if process is not None:
         for child in psutil.Process(process.pid).children():