fix some pylint issues
[transportpce.git] / tests / transportpce_tests / 1.2.1 / test_end2end.py
index abba02530dc5c8b31b85d0613065daafea20359e..43c0348130c47a143b76a8c6882a4819758dfe2f 100644 (file)
@@ -8,8 +8,9 @@
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
 
+# pylint: disable=no-member
+# pylint: disable=too-many-public-methods
 
-import json
 import time
 import unittest
 
@@ -19,22 +20,22 @@ from common import test_utils
 
 class TransportPCEFulltesting(unittest.TestCase):
 
-    cr_serv_sample_data = { "input": {
-                "sdnc-request-header": {
-                    "request-id": "e3028bae-a90f-4ddd-a83f-cf224eba0e58",
-                    "rpc-action": "service-create",
-                    "request-system-id": "appname",
-                    "notification-url":
-                        "http://localhost:8585/NotificationServer/notify"
-                },
-                "service-name": "service1",
-                "common-id": "ASATT1234567",
-                "connection-type": "service",
-                "service-a-end": {
-                    "service-rate": "100",
-                    "node-id": "XPDRA01",
-                    "service-format": "Ethernet",
-                    "clli": "SNJSCAMCJP8",
+    cr_serv_sample_data = {"input": {
+        "sdnc-request-header": {
+            "request-id": "e3028bae-a90f-4ddd-a83f-cf224eba0e58",
+            "rpc-action": "service-create",
+            "request-system-id": "appname",
+            "notification-url":
+            "http://localhost:8585/NotificationServer/notify"
+        },
+        "service-name": "service1",
+        "common-id": "ASATT1234567",
+        "connection-type": "service",
+        "service-a-end": {
+            "service-rate": "100",
+            "node-id": "XPDRA01",
+            "service-format": "Ethernet",
+            "clli": "SNJSCAMCJP8",
                     "tx-direction": {
                         "port": {
                             "port-device-name":
@@ -52,7 +53,7 @@ class TransportPCEFulltesting(unittest.TestCase):
                             "lgx-port-shelf": "00"
                         }
                     },
-                    "rx-direction": {
+            "rx-direction": {
                         "port": {
                             "port-device-name":
                                 "ROUTER_SNJSCAMCJP8_000000.00_00",
@@ -69,13 +70,13 @@ class TransportPCEFulltesting(unittest.TestCase):
                             "lgx-port-shelf": "00"
                         }
                     },
-                    "optic-type": "gray"
-                },
-                "service-z-end": {
-                    "service-rate": "100",
-                    "node-id": "XPDRC01",
-                    "service-format": "Ethernet",
-                    "clli": "SNJSCAMCJT4",
+            "optic-type": "gray"
+        },
+        "service-z-end": {
+            "service-rate": "100",
+            "node-id": "XPDRC01",
+            "service-format": "Ethernet",
+            "clli": "SNJSCAMCJT4",
                     "tx-direction": {
                         "port": {
                             "port-device-name":
@@ -93,7 +94,7 @@ class TransportPCEFulltesting(unittest.TestCase):
                             "lgx-port-shelf": "00"
                         }
                     },
-                    "rx-direction": {
+            "rx-direction": {
                         "port": {
                             "port-device-name":
                                 "ROUTER_SNJSCAMCJT4_000000.00_00",
@@ -110,12 +111,12 @@ class TransportPCEFulltesting(unittest.TestCase):
                             "lgx-port-shelf": "00"
                         }
                     },
-                    "optic-type": "gray"
-                },
-                "due-date": "2016-11-28T00:00:01Z",
-                "operator-contact": "pw1234"
-            }
-        }
+            "optic-type": "gray"
+        },
+        "due-date": "2016-11-28T00:00:01Z",
+        "operator-contact": "pw1234"
+    }
+    }
     processes = None
     WAITING = 20
 
@@ -126,6 +127,7 @@ class TransportPCEFulltesting(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")
@@ -160,20 +162,6 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(2)
 
     def test_06_connect_roadmA_PP1_to_xpdrA_N1(self):
-        url = "{}/operations/transportpce-networkutils:init-rdm-xpdr-links"
-        data = {
-            "networkutils:input": {
-                "networkutils:links-input": {
-                    "networkutils:xpdr-node": "XPDRA01",
-                    "networkutils:xpdr-num": "1",
-                    "networkutils:network-num": "1",
-                    "networkutils:rdm-node": "ROADMA01",
-                    "networkutils:srg-num": "1",
-                    "networkutils:termination-point-num": "SRG1-PP1-TXRX"
-                }
-            }
-        }
-        response = test_utils.post_request(url, data)
         response = test_utils.connect_rdm_to_xpdr_request("XPDRA01", "1", "1",
                                                           "ROADMA01", "1", "SRG1-PP1-TXRX")
         self.assertEqual(response.status_code, requests.codes.ok)
@@ -545,22 +533,7 @@ class TransportPCEFulltesting(unittest.TestCase):
     # contains 2 elements
 
     def test_29_delete_eth_service3(self):
-        url = "{}/operations/org-openroadm-service:service-delete"
-        data = {"input": {
-            "sdnc-request-header": {
-                "request-id": "e3028bae-a90f-4ddd-a83f-cf224eba0e58",
-                "rpc-action": "service-delete",
-                "request-system-id": "appname",
-                "notification-url":
-                    "http://localhost:8585/NotificationServer/notify"
-            },
-            "service-delete-req-info": {
-                "service-name": "service3",
-                "tail-retention": "no"
-            }
-        }
-        }
-        response = test_utils.post_request(url, data)
+        response = test_utils.service_delete_request("service3")
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertIn('Service \'service3\' does not exist in datastore',
@@ -571,22 +544,7 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(20)
 
     def test_30_delete_eth_service1(self):
-        url = "{}/operations/org-openroadm-service:service-delete"
-        data = {"input": {
-            "sdnc-request-header": {
-                "request-id": "e3028bae-a90f-4ddd-a83f-cf224eba0e58",
-                "rpc-action": "service-delete",
-                "request-system-id": "appname",
-                "notification-url":
-                    "http://localhost:8585/NotificationServer/notify"
-            },
-            "service-delete-req-info": {
-                "service-name": "service1",
-                "tail-retention": "no"
-            }
-        }
-        }
-        response = test_utils.post_request(url, data)
+        response = test_utils.service_delete_request("service1")
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertIn('Renderer service delete in progress',
@@ -595,22 +553,7 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(20)
 
     def test_31_delete_eth_service2(self):
-        url = "{}/operations/org-openroadm-service:service-delete"
-        data = {"input": {
-            "sdnc-request-header": {
-                "request-id": "e3028bae-a90f-4ddd-a83f-cf224eba0e58",
-                "rpc-action": "service-delete",
-                "request-system-id": "appname",
-                "notification-url":
-                    "http://localhost:8585/NotificationServer/notify"
-            },
-            "service-delete-req-info": {
-                "service-name": "service2",
-                "tail-retention": "no"
-            }
-        }
-        }
-        response = test_utils.post_request(url, data)
+        response = test_utils.service_delete_request("service2")
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertIn('Renderer service delete in progress',
@@ -823,22 +766,7 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(3)
 
     def test_44_delete_oc_service1(self):
-        url = "{}/operations/org-openroadm-service:service-delete"
-        data = {"input": {
-            "sdnc-request-header": {
-                "request-id": "e3028bae-a90f-4ddd-a83f-cf224eba0e58",
-                "rpc-action": "service-delete",
-                "request-system-id": "appname",
-                "notification-url":
-                    "http://localhost:8585/NotificationServer/notify"
-            },
-            "service-delete-req-info": {
-                "service-name": "service1",
-                "tail-retention": "no"
-            }
-        }
-        }
-        response = test_utils.post_request(url, data)
+        response = test_utils.service_delete_request("service1")
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertIn('Renderer service delete in progress',
@@ -847,22 +775,7 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(20)
 
     def test_45_delete_oc_service2(self):
-        url = "{}/operations/org-openroadm-service:service-delete"
-        data = {"input": {
-            "sdnc-request-header": {
-                "request-id": "e3028bae-a90f-4ddd-a83f-cf224eba0e58",
-                "rpc-action": "service-delete",
-                "request-system-id": "appname",
-                "notification-url":
-                    "http://localhost:8585/NotificationServer/notify"
-            },
-            "service-delete-req-info": {
-                "service-name": "service2",
-                "tail-retention": "no"
-            }
-        }
-        }
-        response = test_utils.post_request(url, data)
+        response = test_utils.service_delete_request("service2")
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertIn('Renderer service delete in progress',
@@ -873,7 +786,7 @@ class TransportPCEFulltesting(unittest.TestCase):
     def test_46_get_no_oc_services(self):
         print("start test")
         response = test_utils.get_service_list_request("")
-        self.assertEqual(response.status_code, requests.codes.not_found)
+        self.assertEqual(response.status_code, requests.codes.conflict)
         res = response.json()
         self.assertIn(
             {
@@ -912,22 +825,7 @@ class TransportPCEFulltesting(unittest.TestCase):
     def test_50_loop_create_oc_service(self):
         response = test_utils.get_service_list_request("services/service1")
         if response.status_code != 404:
-            url = "{}/operations/org-openroadm-service:service-delete"
-            data = {"input": {
-                "sdnc-request-header": {
-                    "request-id": "e3028bae-a90f-4ddd-a83f-cf224eba0e58",
-                    "rpc-action": "service-delete",
-                    "request-system-id": "appname",
-                    "notification-url":
-                        "http://localhost:8585/NotificationServer/notify"
-                },
-                "service-delete-req-info": {
-                    "service-name": "service1",
-                    "tail-retention": "no"
-                }
-            }
-            }
-            test_utils.post_request(url, data)
+            response = test_utils.service_delete_request("service1")
             time.sleep(5)
 
         for i in range(1, 6):