Reintroduce karaf restart in tapi functional tests
[transportpce.git] / tests / transportpce_tests / tapi / test03_tapi_device_change_notifications.py
index 8c029aa1cc495ec75d4c9f1e0294951871007408..2a4f3f2925851ee1dc588861eb8ab7db9c89c81a 100644 (file)
@@ -36,61 +36,70 @@ class UuidServices:
 
 class TransportPCEFulltesting(unittest.TestCase):
 
-    cr_serv_sample_data = {
-        "input": {
-            "end-point": [
-                {
-                    "layer-protocol-name": "DSR",
-                    "service-interface-point": {
-                        "service-interface-point-uuid": "b1f4bd3b-7fa9-367b-a8ab-6e80293238df"
-                    },
-                    "administrative-state": "UNLOCKED",
-                    "operational-state": "ENABLED",
-                    "direction": "BIDIRECTIONAL",
-                    "role": "SYMMETRIC",
-                    "protection-role": "WORK",
-                    "local-id": "XPDR-C1-XPDR1",
-                    "name": [
+    cr_serv_input_data = {
+        "end-point": [
+            {
+                "layer-protocol-name": "DSR",
+                "service-interface-point": {
+                    "service-interface-point-uuid": "b1f4bd3b-7fa9-367b-a8ab-6e80293238df"
+                },
+                "administrative-state": "UNLOCKED",
+                "operational-state": "ENABLED",
+                "direction": "BIDIRECTIONAL",
+                "role": "SYMMETRIC",
+                "protection-role": "WORK",
+                "local-id": "XPDR-C1-XPDR1",
+                "name": [
                         {
                             "value-name": "OpenROADM node id",
                             "value": "XPDR-C1-XPDR1"
                         }
-                    ]
+                ]
+            },
+            {
+                "layer-protocol-name": "DSR",
+                "service-interface-point": {
+                    "service-interface-point-uuid": "b5964ce9-274c-3f68-b4d1-83c0b61bc74e"
                 },
-                {
-                    "layer-protocol-name": "DSR",
-                    "service-interface-point": {
-                        "service-interface-point-uuid": "b5964ce9-274c-3f68-b4d1-83c0b61bc74e"
-                    },
-                    "administrative-state": "UNLOCKED",
-                    "operational-state": "ENABLED",
-                    "direction": "BIDIRECTIONAL",
-                    "role": "SYMMETRIC",
-                    "protection-role": "WORK",
-                    "local-id": "XPDR-A1-XPDR1",
-                    "name": [
+                "administrative-state": "UNLOCKED",
+                "operational-state": "ENABLED",
+                "direction": "BIDIRECTIONAL",
+                "role": "SYMMETRIC",
+                "protection-role": "WORK",
+                "local-id": "XPDR-A1-XPDR1",
+                "name": [
                         {
                             "value-name": "OpenROADM node id",
                             "value": "XPDR-A1-XPDR1"
                         }
-                    ]
+                ]
+            }
+        ],
+        "connectivity-constraint": {
+            "service-layer": "ETH",
+            "service-type": "POINT_TO_POINT_CONNECTIVITY",
+            "service-level": "Some service-level",
+            "requested-capacity": {
+                "total-size": {
+                    "value": "100",
+                    "unit": "GB"
                 }
-            ],
-            "connectivity-constraint": {
-                "service-layer": "ETH",
-                "service-type": "POINT_TO_POINT_CONNECTIVITY",
-                "service-level": "Some service-level",
-                "requested-capacity": {
-                    "total-size": {
-                        "value": "100",
-                        "unit": "GB"
-                    }
-                }
-            },
-            "state": "Some state"
-        }
+            }
+        },
+        "state": "Some state"
     }
 
+    del_serv_input_data = {"service-id-or-name": "TBD"}
+
+    tapi_topo = {"topology-id-or-name": "TBD"}
+
+    node_details = {
+        "topology-id-or-name": "TBD",
+        "node-id-or-name": "TBD"
+    }
+
+    tapi_serv_details = {"service-id-or-name": "TBD"}
+
     processes = []
     uuid_services = UuidServices()
     WAITING = 25  # nominal value is 300
@@ -119,7 +128,6 @@ class TransportPCEFulltesting(unittest.TestCase):
             print("tapi installation feature failed...")
             test_utils.shutdown_process(cls.processes[0])
             sys.exit(2)
-        cls.processes = test_utils.start_tpce()
         cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION_221),
                                                ('roadma', cls.NODE_VERSION_221),
                                                ('roadmc', cls.NODE_VERSION_221),
@@ -131,11 +139,11 @@ class TransportPCEFulltesting(unittest.TestCase):
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
-        time.sleep(10)
 
     def setUp(self):  # instruction executed before each test method
         # pylint: disable=consider-using-f-string
         print("execution of {}".format(self.id().split(".")[-1]))
+        time.sleep(1)
 
     def test_01_connect_xpdrA(self):
         response = test_utils.mount_device("XPDR-A1", ('xpdra', self.NODE_VERSION_221))
@@ -154,35 +162,39 @@ class TransportPCEFulltesting(unittest.TestCase):
         self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201)
 
     def test_05_connect_xprdA_N1_to_roadmA_PP1(self):
-        response = test_utils.connect_xpdr_to_rdm_request("XPDR-A1", "1", "1",
-                                                          "ROADM-A1", "1", "SRG1-PP1-TXRX")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        self.assertIn('Xponder Roadm Link created successfully', res["output"]["result"])
+        response = test_utils.transportpce_api_rpc_request(
+            'transportpce-networkutils', 'init-xpdr-rdm-links',
+            {'links-input': {'xpdr-node': 'XPDR-A1', 'xpdr-num': '1', 'network-num': '1',
+                             'rdm-node': 'ROADM-A1', 'srg-num': '1', 'termination-point-num': 'SRG1-PP1-TXRX'}})
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        self.assertIn('Xponder Roadm Link created successfully', response["output"]["result"])
         time.sleep(2)
 
     def test_06_connect_roadmA_PP1_to_xpdrA_N1(self):
-        response = test_utils.connect_rdm_to_xpdr_request("XPDR-A1", "1", "1",
-                                                          "ROADM-A1", "1", "SRG1-PP1-TXRX")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        self.assertIn('Roadm Xponder links created successfully', res["output"]["result"])
+        response = test_utils.transportpce_api_rpc_request(
+            'transportpce-networkutils', 'init-rdm-xpdr-links',
+            {'links-input': {'xpdr-node': 'XPDR-A1', 'xpdr-num': '1', 'network-num': '1',
+                             'rdm-node': 'ROADM-A1', 'srg-num': '1', 'termination-point-num': 'SRG1-PP1-TXRX'}})
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        self.assertIn('Roadm Xponder links created successfully', response["output"]["result"])
         time.sleep(2)
 
     def test_07_connect_xprdC_N1_to_roadmC_PP1(self):
-        response = test_utils.connect_xpdr_to_rdm_request("XPDR-C1", "1", "1",
-                                                          "ROADM-C1", "1", "SRG1-PP1-TXRX")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        self.assertIn('Xponder Roadm Link created successfully', res["output"]["result"])
+        response = test_utils.transportpce_api_rpc_request(
+            'transportpce-networkutils', 'init-xpdr-rdm-links',
+            {'links-input': {'xpdr-node': 'XPDR-C1', 'xpdr-num': '1', 'network-num': '1',
+                             'rdm-node': 'ROADM-C1', 'srg-num': '1', 'termination-point-num': 'SRG1-PP1-TXRX'}})
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        self.assertIn('Xponder Roadm Link created successfully', response["output"]["result"])
         time.sleep(2)
 
     def test_08_connect_roadmC_PP1_to_xpdrC_N1(self):
-        response = test_utils.connect_rdm_to_xpdr_request("XPDR-C1", "1", "1",
-                                                          "ROADM-C1", "1", "SRG1-PP1-TXRX")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        self.assertIn('Roadm Xponder links created successfully', res["output"]["result"])
+        response = test_utils.transportpce_api_rpc_request(
+            'transportpce-networkutils', 'init-rdm-xpdr-links',
+            {'links-input': {'xpdr-node': 'XPDR-C1', 'xpdr-num': '1', 'network-num': '1',
+                             'rdm-node': 'ROADM-C1', 'srg-num': '1', 'termination-point-num': 'SRG1-PP1-TXRX'}})
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        self.assertIn('Roadm Xponder links created successfully', response["output"]["result"])
         time.sleep(2)
 
     def test_09_add_omsAttributes_ROADMA_ROADMC(self):
@@ -197,7 +209,8 @@ class TransportPCEFulltesting(unittest.TestCase):
                 "fiber-type": "smf",
                 "SRLG-length": 100000,
                 "pmd": 0.5}]}}
-        response = test_utils.add_oms_attr_request("ROADM-A1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG1-DEG1-TTP-TXRX", data)
+        response = test_utils.add_oms_attr_request(
+            "ROADM-A1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG1-DEG1-TTP-TXRX", data)
         self.assertEqual(response.status_code, requests.codes.created)
 
     def test_10_add_omsAttributes_ROADMC_ROADMA(self):
@@ -212,16 +225,16 @@ class TransportPCEFulltesting(unittest.TestCase):
                 "fiber-type": "smf",
                 "SRLG-length": 100000,
                 "pmd": 0.5}]}}
-        response = test_utils.add_oms_attr_request("ROADM-C1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG2-DEG2-TTP-TXRX", data)
+        response = test_utils.add_oms_attr_request(
+            "ROADM-C1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG2-DEG2-TTP-TXRX", data)
         self.assertEqual(response.status_code, requests.codes.created)
 
 # test service-create for Eth service from xpdr to xpdr
     def test_11_create_connectivity_service_Ethernet(self):
-        response = test_utils.tapi_create_connectivity_request(self.cr_serv_sample_data)
+        response = test_utils.transportpce_api_rpc_request(
+            'tapi-connectivity', 'create-connectivity-service', self.cr_serv_input_data)
         time.sleep(self.WAITING)
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        self.uuid_services.eth = res['output']['service']['uuid']
+        self.uuid_services.eth = response['output']['service']['uuid']
         # pylint: disable=consider-using-f-string
 
         input_dict_1 = {'administrative-state': 'LOCKED',
@@ -236,42 +249,33 @@ class TransportPCEFulltesting(unittest.TestCase):
         input_dict_3 = {'value-name': 'OpenROADM node id',
                         'value': 'XPDR-A1-XPDR1'}
 
-        self.assertDictEqual(dict(input_dict_1, **res['output']['service']),
-                             res['output']['service'])
-        self.assertDictEqual(dict(input_dict_2, **res['output']['service']['end-point'][0]['name'][0]),
-                             res['output']['service']['end-point'][0]['name'][0])
-        self.assertDictEqual(dict(input_dict_3, **res['output']['service']['end-point'][1]['name'][0]),
-                             res['output']['service']['end-point'][1]['name'][0])
+        self.assertDictEqual(dict(input_dict_1, **response['output']['service']),
+                             response['output']['service'])
+        self.assertDictEqual(dict(input_dict_2, **response['output']['service']['end-point'][0]['name'][0]),
+                             response['output']['service']['end-point'][0]['name'][0])
+        self.assertDictEqual(dict(input_dict_3, **response['output']['service']['end-point'][1]['name'][0]),
+                             response['output']['service']['end-point'][1]['name'][0])
         # If the gate fails is because of the waiting time not being enough
-        time.sleep(self.WAITING)
+#        time.sleep(self.WAITING)
 
     def test_12_get_service_Ethernet(self):
-        response = test_utils.get_service_list_request("services/" + str(self.uuid_services.eth))
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        self.assertEqual(
-            res['services'][0]['administrative-state'], 'inService')
-        self.assertEqual(
-            res['services'][0]['service-name'], self.uuid_services.eth)
-        self.assertEqual(
-            res['services'][0]['connection-type'], 'service')
-        self.assertEqual(
-            res['services'][0]['lifecycle-state'], 'planned')
-        time.sleep(2)
+        response = test_utils.get_ordm_serv_list_attr_request("services", str(self.uuid_services.eth))
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        self.assertEqual(response['services'][0]['administrative-state'], 'inService')
+        self.assertEqual(response['services'][0]['service-name'], str(self.uuid_services.eth))
+        self.assertEqual(response['services'][0]['connection-type'], 'service')
+        self.assertEqual(response['services'][0]['lifecycle-state'], 'planned')
+        time.sleep(1)
 
     def test_13_get_connectivity_service_Ethernet(self):
-        response = test_utils.tapi_get_connectivity_request(str(self.uuid_services.eth))
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        self.assertEqual(
-            res['output']['service']['operational-state'], 'ENABLED')
-        self.assertEqual(
-            res['output']['service']['name'][0]['value'], self.uuid_services.eth)
-        self.assertEqual(
-            res['output']['service']['administrative-state'], 'UNLOCKED')
-        self.assertEqual(
-            res['output']['service']['lifecycle-state'], 'INSTALLED')
-        time.sleep(2)
+        self.tapi_serv_details["service-id-or-name"] = str(self.uuid_services.eth)
+        response = test_utils.transportpce_api_rpc_request(
+            'tapi-connectivity', 'get-connectivity-service-details', self.tapi_serv_details)
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        self.assertEqual(response['output']['service']['operational-state'], 'ENABLED')
+        self.assertEqual(response['output']['service']['name'][0]['value'], self.uuid_services.eth)
+        self.assertEqual(response['output']['service']['administrative-state'], 'UNLOCKED')
+        self.assertEqual(response['output']['service']['lifecycle-state'], 'INSTALLED')
 
     def test_14_change_status_line_port_xpdrc(self):
         url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/1%2F0%2F1-PLUG-NET/ports/1"
@@ -282,15 +286,15 @@ class TransportPCEFulltesting(unittest.TestCase):
             "port-qual": "xpdr-network"}]}
         response = requests.request("PUT", url.format("http://127.0.0.1:8144/restconf"),
                                     data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON,
-                                    auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
+                                    auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD),
+                                    timeout=test_utils.REQUEST_TIMEOUT)
         self.assertEqual(response.status_code, requests.codes.ok)
         time.sleep(2)
 
     def test_15_check_update_portmapping(self):
-        response = test_utils.portmapping_request("XPDR-C1")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        mapping_list = res['nodes'][0]['mapping']
+        response = test_utils.get_portmapping_node_attr("XPDR-C1", None, None)
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        mapping_list = response['nodes'][0]['mapping']
         for mapping in mapping_list:
             if mapping['logical-connection-point'] == 'XPDR1-NETWORK1':
                 self.assertEqual(mapping['port-oper-state'], 'OutOfService',
@@ -305,11 +309,9 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(1)
 
     def test_16_check_update_openroadm_topo(self):
-        url = test_utils.URL_CONFIG_ORDM_TOPO
-        response = test_utils.get_request(url)
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        node_list = res['network'][0]['node']
+        response = test_utils.get_ietf_network_request('openroadm-topology', 'config')
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        node_list = response['network'][0]['node']
         nb_updated_tp = 0
         for node in node_list:
             self.assertEqual(node['org-openroadm-common-network:operational-state'], 'inService')
@@ -325,7 +327,7 @@ class TransportPCEFulltesting(unittest.TestCase):
                     self.assertEqual(tp['org-openroadm-common-network:administrative-state'], 'inService')
         self.assertEqual(nb_updated_tp, 1, "Only one termination-point should have been modified")
 
-        link_list = res['network'][0]['ietf-network-topology:link']
+        link_list = response['network'][0]['ietf-network-topology:link']
         updated_links = ['XPDR-C1-XPDR1-XPDR1-NETWORK1toROADM-C1-SRG1-SRG1-PP1-TXRX',
                          'ROADM-C1-SRG1-SRG1-PP1-TXRXtoXPDR-C1-XPDR1-XPDR1-NETWORK1']
         nb_updated_link = 0
@@ -341,10 +343,12 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(1)
 
     def test_17_check_update_tapi_neps(self):
-        response = test_utils.tapi_get_node_details_request("T0 - Full Multi-layer topology", "XPDR-C1-XPDR1+OTSi")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        nep_list = res['output']['node']['owned-node-edge-point']
+        self.node_details["topology-id-or-name"] = test_utils.T0_FULL_MULTILAYER_TOPO
+        self.node_details["node-id-or-name"] = "XPDR-C1-XPDR1+OTSi"
+        response = test_utils.transportpce_api_rpc_request(
+            'tapi-topology', 'get-node-details', self.node_details)
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        nep_list = response['output']['node']['owned-node-edge-point']
         nb_updated_neps = 0
         for nep in nep_list:
             if 'XPDR1-NETWORK1' in nep['name'][0]['value']:
@@ -358,10 +362,11 @@ class TransportPCEFulltesting(unittest.TestCase):
                                  "Operational State should be 'ENABLED'")
                 self.assertEqual(nep['administrative-state'], 'UNLOCKED',
                                  "Administrative State should be 'UNLOCKED'")
-        response = test_utils.tapi_get_node_details_request("T0 - Full Multi-layer topology", "XPDR-C1-XPDR1+DSR")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        nep_list = res['output']['node']['owned-node-edge-point']
+        self.node_details["node-id-or-name"] = "XPDR-C1-XPDR1+DSR"
+        response = test_utils.transportpce_api_rpc_request(
+            'tapi-topology', 'get-node-details', self.node_details)
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        nep_list = response['output']['node']['owned-node-edge-point']
         for nep in nep_list:
             if 'XPDR1-NETWORK1' in nep['name'][0]['value']:
                 self.assertEqual(nep['operational-state'], 'DISABLED',
@@ -378,11 +383,12 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(1)
 
     def test_18_check_update_tapi_links(self):
-        response = test_utils.tapi_get_topology_details_request("T0 - Full Multi-layer topology")
+        self.tapi_topo["topology-id-or-name"] = test_utils.T0_FULL_MULTILAYER_TOPO
+        response = test_utils.transportpce_api_rpc_request(
+            'tapi-topology', 'get-topology-details', self.tapi_topo)
         time.sleep(2)
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        link_list = res['output']['topology']['link']
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        link_list = response['output']['topology']['link']
         nb_updated_link = 0
         for link in link_list:
             if all(x in link['name'][0]['value'] for x in ['XPDR-C1-XPDR1', 'XPDR1-NETWORK1']):
@@ -397,22 +403,18 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(1)
 
     def test_19_check_update_service_Ethernet(self):
-        response = test_utils.get_service_list_request(
-            "services/" + str(self.uuid_services.eth))
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        self.assertEqual(res['services'][0]['operational-state'], 'outOfService')
-        self.assertEqual(res['services'][0]['administrative-state'], 'inService')
-        time.sleep(1)
+        response = test_utils.get_ordm_serv_list_attr_request("services", str(self.uuid_services.eth))
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        self.assertEqual(response['services'][0]['operational-state'], 'outOfService')
+        self.assertEqual(response['services'][0]['administrative-state'], 'inService')
 
     def test_20_check_update_connectivity_service_Ethernet(self):
-        response = test_utils.tapi_get_connectivity_request(str(self.uuid_services.eth))
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        self.assertEqual(
-            res['output']['service']['operational-state'], 'DISABLED')
-        self.assertEqual(
-            res['output']['service']['administrative-state'], 'LOCKED')
+        self.tapi_serv_details["service-id-or-name"] = str(self.uuid_services.eth)
+        response = test_utils.transportpce_api_rpc_request(
+            'tapi-connectivity', 'get-connectivity-service-details', self.tapi_serv_details)
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        self.assertEqual(response['output']['service']['operational-state'], 'DISABLED')
+        self.assertEqual(response['output']['service']['administrative-state'], 'LOCKED')
         time.sleep(1)
 
     def test_21_restore_status_line_port_xpdrc(self):
@@ -424,15 +426,15 @@ class TransportPCEFulltesting(unittest.TestCase):
             "port-qual": "xpdr-network"}]}
         response = requests.request("PUT", url.format("http://127.0.0.1:8144/restconf"),
                                     data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON,
-                                    auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
+                                    auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD),
+                                    timeout=test_utils.REQUEST_TIMEOUT)
         self.assertEqual(response.status_code, requests.codes.ok)
         time.sleep(2)
 
     def test_22_check_update_portmapping_ok(self):
-        response = test_utils.portmapping_request("XPDR-C1")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        mapping_list = res['nodes'][0]['mapping']
+        response = test_utils.get_portmapping_node_attr("XPDR-C1", None, None)
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        mapping_list = response['nodes'][0]['mapping']
         for mapping in mapping_list:
             self.assertEqual(mapping['port-oper-state'], 'InService',
                              "Operational State should be 'InService'")
@@ -441,11 +443,9 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(1)
 
     def test_23_check_update_openroadm_topo_ok(self):
-        url = test_utils.URL_CONFIG_ORDM_TOPO
-        response = test_utils.get_request(url)
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        node_list = res['network'][0]['node']
+        response = test_utils.get_ietf_network_request('openroadm-topology', 'config')
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        node_list = response['network'][0]['node']
         for node in node_list:
             self.assertEqual(node['org-openroadm-common-network:operational-state'], 'inService')
             self.assertEqual(node['org-openroadm-common-network:administrative-state'], 'inService')
@@ -454,27 +454,30 @@ class TransportPCEFulltesting(unittest.TestCase):
                 self.assertEqual(tp['org-openroadm-common-network:operational-state'], 'inService')
                 self.assertEqual(tp['org-openroadm-common-network:administrative-state'], 'inService')
 
-        link_list = res['network'][0]['ietf-network-topology:link']
+        link_list = response['network'][0]['ietf-network-topology:link']
         for link in link_list:
             self.assertEqual(link['org-openroadm-common-network:operational-state'], 'inService')
             self.assertEqual(link['org-openroadm-common-network:administrative-state'], 'inService')
         time.sleep(1)
 
     def test_24_check_update_tapi_neps_ok(self):
-        response = test_utils.tapi_get_node_details_request("T0 - Full Multi-layer topology", "XPDR-C1-XPDR1+OTSi")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        nep_list = res['output']['node']['owned-node-edge-point']
+        self.node_details["topology-id-or-name"] = test_utils.T0_FULL_MULTILAYER_TOPO
+        self.node_details["node-id-or-name"] = "XPDR-C1-XPDR1+OTSi"
+        response = test_utils.transportpce_api_rpc_request(
+            'tapi-topology', 'get-node-details', self.node_details)
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        nep_list = response['output']['node']['owned-node-edge-point']
         for nep in nep_list:
             self.assertEqual(nep['operational-state'], 'ENABLED',
                              "Operational State should be 'ENABLED'")
             self.assertEqual(nep['administrative-state'], 'UNLOCKED',
                              "Administrative State should be 'UNLOCKED'")
 
-        response = test_utils.tapi_get_node_details_request("T0 - Full Multi-layer topology", "XPDR-C1-XPDR1+DSR")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        nep_list = res['output']['node']['owned-node-edge-point']
+        self.node_details["node-id-or-name"] = "XPDR-C1-XPDR1+DSR"
+        response = test_utils.transportpce_api_rpc_request(
+            'tapi-topology', 'get-node-details', self.node_details)
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        nep_list = response['output']['node']['owned-node-edge-point']
         for nep in nep_list:
             self.assertEqual(nep['operational-state'], 'ENABLED',
                              "Operational State should be 'ENABLED'")
@@ -483,16 +486,14 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(1)
 
     def test_25_check_update_tapi_links_ok(self):
-        response = test_utils.tapi_get_topology_details_request(
-            "T0 - Full Multi-layer topology")
+        self.tapi_topo["topology-id-or-name"] = test_utils.T0_FULL_MULTILAYER_TOPO
+        response = test_utils.transportpce_api_rpc_request(
+            'tapi-topology', 'get-topology-details', self.tapi_topo)
         time.sleep(2)
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        link_list = res['output']['topology']['link']
+        link_list = response['output']['topology']['link']
         for link in link_list:
             self.assertEqual(link['operational-state'], 'ENABLED')
             self.assertEqual(link['administrative-state'], 'UNLOCKED')
-
         time.sleep(1)
 
     def test_26_check_update_service1_ok(self):
@@ -512,15 +513,15 @@ class TransportPCEFulltesting(unittest.TestCase):
             "port-qual": "roadm-external"}]}
         response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"),
                                     data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON,
-                                    auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
+                                    auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD),
+                                    timeout=test_utils.REQUEST_TIMEOUT)
         self.assertEqual(response.status_code, requests.codes.ok)
         time.sleep(2)
 
     def test_29_check_update_portmapping(self):
-        response = test_utils.portmapping_request("ROADM-A1")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        mapping_list = res['nodes'][0]['mapping']
+        response = test_utils.get_portmapping_node_attr("ROADM-A1", None, None)
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        mapping_list = response['nodes'][0]['mapping']
         for mapping in mapping_list:
             if mapping['logical-connection-point'] == 'SRG1-PP1-TXRX':
                 self.assertEqual(mapping['port-oper-state'], 'OutOfService',
@@ -535,11 +536,9 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(1)
 
     def test_30_check_update_openroadm_topo(self):
-        url = test_utils.URL_CONFIG_ORDM_TOPO
-        response = test_utils.get_request(url)
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        node_list = res['network'][0]['node']
+        response = test_utils.get_ietf_network_request('openroadm-topology', 'config')
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        node_list = response['network'][0]['node']
         nb_updated_tp = 0
         for node in node_list:
             self.assertEqual(node['org-openroadm-common-network:operational-state'], 'inService')
@@ -555,7 +554,7 @@ class TransportPCEFulltesting(unittest.TestCase):
                     self.assertEqual(tp['org-openroadm-common-network:administrative-state'], 'inService')
         self.assertEqual(nb_updated_tp, 1, "Only one termination-point should have been modified")
 
-        link_list = res['network'][0]['ietf-network-topology:link']
+        link_list = response['network'][0]['ietf-network-topology:link']
         updated_links = ['XPDR-A1-XPDR1-XPDR1-NETWORK1toROADM-A1-SRG1-SRG1-PP1-TXRX',
                          'ROADM-A1-SRG1-SRG1-PP1-TXRXtoXPDR-A1-XPDR1-XPDR1-NETWORK1']
         nb_updated_link = 0
@@ -571,10 +570,12 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(1)
 
     def test_31_check_update_tapi_neps(self):
-        response = test_utils.tapi_get_node_details_request("T0 - Full Multi-layer topology", "ROADM-A1+PHOTONIC_MEDIA")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        nep_list = res['output']['node']['owned-node-edge-point']
+        self.node_details["topology-id-or-name"] = test_utils.T0_FULL_MULTILAYER_TOPO
+        self.node_details["node-id-or-name"] = "ROADM-A1+PHOTONIC_MEDIA"
+        response = test_utils.transportpce_api_rpc_request(
+            'tapi-topology', 'get-node-details', self.node_details)
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        nep_list = response['output']['node']['owned-node-edge-point']
         nb_updated_neps = 0
         for nep in nep_list:
             if 'SRG1-PP1-TXRX' in nep['name'][0]['value']:
@@ -592,12 +593,11 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(1)
 
     def test_32_check_update_tapi_links(self):
-        response = test_utils.tapi_get_topology_details_request(
-            "T0 - Full Multi-layer topology")
+        self.tapi_topo["topology-id-or-name"] = test_utils.T0_FULL_MULTILAYER_TOPO
+        response = test_utils.transportpce_api_rpc_request(
+            'tapi-topology', 'get-topology-details', self.tapi_topo)
         time.sleep(2)
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        link_list = res['output']['topology']['link']
+        link_list = response['output']['topology']['link']
         nb_updated_link = 0
         for link in link_list:
             if all(x in link['name'][0]['value'] for x in ['ROADM-A1', 'SRG1-PP1-TXRX']):
@@ -628,15 +628,15 @@ class TransportPCEFulltesting(unittest.TestCase):
             "port-qual": "roadm-external"}]}
         response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"),
                                     data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON,
-                                    auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
+                                    auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD),
+                                    timeout=test_utils.REQUEST_TIMEOUT)
         self.assertEqual(response.status_code, requests.codes.ok)
         time.sleep(2)
 
     def test_36_check_update_portmapping_ok(self):
-        response = test_utils.portmapping_request("ROADM-A1")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        mapping_list = res['nodes'][0]['mapping']
+        response = test_utils.get_portmapping_node_attr("ROADM-A1", None, None)
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        mapping_list = response['nodes'][0]['mapping']
         for mapping in mapping_list:
             self.assertEqual(mapping['port-oper-state'], 'InService',
                              "Operational State should be 'InService'")
@@ -648,10 +648,12 @@ class TransportPCEFulltesting(unittest.TestCase):
         self.test_23_check_update_openroadm_topo_ok()
 
     def test_38_check_update_tapi_neps_ok(self):
-        response = test_utils.tapi_get_node_details_request("T0 - Full Multi-layer topology", "ROADM-A1+PHOTONIC_MEDIA")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        nep_list = res['output']['node']['owned-node-edge-point']
+        self.node_details["topology-id-or-name"] = test_utils.T0_FULL_MULTILAYER_TOPO
+        self.node_details["node-id-or-name"] = "ROADM-A1+PHOTONIC_MEDIA"
+        response = test_utils.transportpce_api_rpc_request(
+            'tapi-topology', 'get-node-details', self.node_details)
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        nep_list = response['output']['node']['owned-node-edge-point']
         for nep in nep_list:
             self.assertEqual(nep['operational-state'], 'ENABLED',
                              "Operational State should be 'ENABLED'")
@@ -680,15 +682,15 @@ class TransportPCEFulltesting(unittest.TestCase):
             "port-qual": "roadm-external"}]}
         response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"),
                                     data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON,
-                                    auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
+                                    auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD),
+                                    timeout=test_utils.REQUEST_TIMEOUT)
         self.assertEqual(response.status_code, requests.codes.ok)
         time.sleep(2)
 
     def test_43_check_update_portmapping(self):
-        response = test_utils.portmapping_request("ROADM-A1")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        mapping_list = res['nodes'][0]['mapping']
+        response = test_utils.get_portmapping_node_attr("ROADM-A1", None, None)
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        mapping_list = response['nodes'][0]['mapping']
         for mapping in mapping_list:
             if mapping['logical-connection-point'] == 'DEG2-TTP-TXRX':
                 self.assertEqual(mapping['port-oper-state'], 'OutOfService',
@@ -703,11 +705,9 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(1)
 
     def test_44_check_update_openroadm_topo(self):
-        url = test_utils.URL_CONFIG_ORDM_TOPO
-        response = test_utils.get_request(url)
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        node_list = res['network'][0]['node']
+        response = test_utils.get_ietf_network_request('openroadm-topology', 'config')
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        node_list = response['network'][0]['node']
         nb_updated_tp = 0
         for node in node_list:
             self.assertEqual(node['org-openroadm-common-network:operational-state'], 'inService')
@@ -723,7 +723,7 @@ class TransportPCEFulltesting(unittest.TestCase):
                     self.assertEqual(tp['org-openroadm-common-network:administrative-state'], 'inService')
         self.assertEqual(nb_updated_tp, 1, "Only one termination-point should have been modified")
 
-        link_list = res['network'][0]['ietf-network-topology:link']
+        link_list = response['network'][0]['ietf-network-topology:link']
         updated_links = ['ROADM-C1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG2-DEG2-TTP-TXRX',
                          'ROADM-A1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG1-DEG1-TTP-TXRX']
         nb_updated_link = 0
@@ -739,10 +739,12 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(1)
 
     def test_45_check_update_tapi_neps(self):
-        response = test_utils.tapi_get_node_details_request("T0 - Full Multi-layer topology", "ROADM-A1+PHOTONIC_MEDIA")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        nep_list = res['output']['node']['owned-node-edge-point']
+        self.node_details["topology-id-or-name"] = test_utils.T0_FULL_MULTILAYER_TOPO
+        self.node_details["node-id-or-name"] = "ROADM-A1+PHOTONIC_MEDIA"
+        response = test_utils.transportpce_api_rpc_request(
+            'tapi-topology', 'get-node-details', self.node_details)
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        nep_list = response['output']['node']['owned-node-edge-point']
         nb_updated_neps = 0
         for nep in nep_list:
             if 'DEG2-TTP-TXRX' in nep['name'][0]['value']:
@@ -760,12 +762,12 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(1)
 
     def test_46_check_update_tapi_links(self):
-        response = test_utils.tapi_get_topology_details_request(
-            "T0 - Full Multi-layer topology")
+        self.tapi_topo["topology-id-or-name"] = test_utils.T0_FULL_MULTILAYER_TOPO
+        response = test_utils.transportpce_api_rpc_request(
+            'tapi-topology', 'get-topology-details', self.tapi_topo)
         time.sleep(2)
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        link_list = res['output']['topology']['link']
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        link_list = response['output']['topology']['link']
         nb_updated_link = 0
         for link in link_list:
             if all(x in link['name'][0]['value'] for x in ['ROADM-A1', 'DEG2-TTP-TXRX']):
@@ -796,7 +798,8 @@ class TransportPCEFulltesting(unittest.TestCase):
             "port-qual": "roadm-external"}]}
         response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"),
                                     data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON,
-                                    auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
+                                    auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD),
+                                    timeout=test_utils.REQUEST_TIMEOUT)
         self.assertEqual(response.status_code, requests.codes.ok)
         time.sleep(2)
 
@@ -829,15 +832,15 @@ class TransportPCEFulltesting(unittest.TestCase):
             "port-qual": "roadm-external"}]}
         response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"),
                                     data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON,
-                                    auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD))
+                                    auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD),
+                                    timeout=test_utils.REQUEST_TIMEOUT)
         self.assertEqual(response.status_code, requests.codes.ok)
         time.sleep(2)
 
     def test_57_check_update_portmapping(self):
-        response = test_utils.portmapping_request("ROADM-A1")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        mapping_list = res['nodes'][0]['mapping']
+        response = test_utils.get_portmapping_node_attr("ROADM-A1", None, None)
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        mapping_list = response['nodes'][0]['mapping']
         for mapping in mapping_list:
             if mapping['logical-connection-point'] == 'SRG1-PP2-TXRX':
                 self.assertEqual(mapping['port-oper-state'], 'OutOfService',
@@ -852,11 +855,9 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(1)
 
     def test_58_check_update_openroadm_topo(self):
-        url = test_utils.URL_CONFIG_ORDM_TOPO
-        response = test_utils.get_request(url)
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        node_list = res['network'][0]['node']
+        response = test_utils.get_ietf_network_request('openroadm-topology', 'config')
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        node_list = response['network'][0]['node']
         nb_updated_tp = 0
         for node in node_list:
             self.assertEqual(node['org-openroadm-common-network:operational-state'], 'inService')
@@ -872,7 +873,7 @@ class TransportPCEFulltesting(unittest.TestCase):
                     self.assertEqual(tp['org-openroadm-common-network:administrative-state'], 'inService')
         self.assertEqual(nb_updated_tp, 1, "Only one termination-point should have been modified")
 
-        link_list = res['network'][0]['ietf-network-topology:link']
+        link_list = response['network'][0]['ietf-network-topology:link']
         nb_updated_link = 0
         for link in link_list:
             self.assertEqual(link['org-openroadm-common-network:operational-state'], 'inService')
@@ -881,10 +882,12 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(1)
 
     def test_59_check_update_tapi_neps(self):
-        response = test_utils.tapi_get_node_details_request("T0 - Full Multi-layer topology", "ROADM-A1+PHOTONIC_MEDIA")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        nep_list = res['output']['node']['owned-node-edge-point']
+        self.node_details["topology-id-or-name"] = test_utils.T0_FULL_MULTILAYER_TOPO
+        self.node_details["node-id-or-name"] = "ROADM-A1+PHOTONIC_MEDIA"
+        response = test_utils.transportpce_api_rpc_request(
+            'tapi-topology', 'get-node-details', self.node_details)
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        nep_list = response['output']['node']['owned-node-edge-point']
         nb_updated_neps = 0
         for nep in nep_list:
             if 'SRG1-PP2-TXRX' in nep['name'][0]['value']:
@@ -902,12 +905,12 @@ class TransportPCEFulltesting(unittest.TestCase):
         time.sleep(1)
 
     def test_60_check_update_tapi_links(self):
-        response = test_utils.tapi_get_topology_details_request(
-            "T0 - Full Multi-layer topology")
+        self.tapi_topo["topology-id-or-name"] = test_utils.T0_FULL_MULTILAYER_TOPO
+        response = test_utils.transportpce_api_rpc_request(
+            'tapi-topology', 'get-topology-details', self.tapi_topo)
         time.sleep(2)
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        link_list = res['output']['topology']['link']
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        link_list = response['output']['topology']['link']
         nb_updated_link = 0
         for link in link_list:
             if all(x in link['name'][0]['value'] for x in ['ROADM-A1', 'SRG1-PP2-TXRX']):
@@ -928,37 +931,37 @@ class TransportPCEFulltesting(unittest.TestCase):
         self.test_13_get_connectivity_service_Ethernet()
 
     def test_63_delete_connectivity_service_Ethernet(self):
-        response = test_utils.tapi_delete_connectivity_request(str(self.uuid_services.eth))
-        self.assertEqual(response.status_code, requests.codes.no_content)
+        self.del_serv_input_data["service-id-or-name"] = str(self.uuid_services.eth)
+        response = test_utils.transportpce_api_rpc_request(
+            'tapi-connectivity', 'delete-connectivity-service', self.del_serv_input_data)
+        self.assertIn(response['status_code'], (requests.codes.ok, requests.codes.no_content))
         time.sleep(self.WAITING)
 
     def test_64_disconnect_xponders_from_roadm(self):
-        url = "{}/config/ietf-network:networks/network/openroadm-topology/ietf-network-topology:link/"
-        response = test_utils.get_ordm_topo_request("")
-        self.assertEqual(response.status_code, requests.codes.ok)
-        res = response.json()
-        links = res['network'][0]['ietf-network-topology:link']
+        response = test_utils.get_ietf_network_request('openroadm-topology', 'config')
+        self.assertEqual(response['status_code'], requests.codes.ok)
+        links = response['network'][0]['ietf-network-topology:link']
         for link in links:
             if link["org-openroadm-common-network:link-type"] in ('XPONDER-OUTPUT', 'XPONDER-INPUT'):
-                link_name = link["link-id"]
-                response = test_utils.delete_request(url+link_name)
-                self.assertEqual(response.status_code, requests.codes.ok)
+                response = test_utils.del_ietf_network_link_request(
+                    'openroadm-topology', link['link-id'], 'config')
+                self.assertIn(response.status_code, (requests.codes.ok, requests.codes.no_content))
 
     def test_65_disconnect_XPDRA(self):
         response = test_utils.unmount_device("XPDR-A1")
-        self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200)
+        self.assertIn(response.status_code, (requests.codes.ok, requests.codes.no_content))
 
     def test_66_disconnect_XPDRC(self):
         response = test_utils.unmount_device("XPDR-C1")
-        self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200)
+        self.assertIn(response.status_code, (requests.codes.ok, requests.codes.no_content))
 
     def test_67_disconnect_ROADMA(self):
         response = test_utils.unmount_device("ROADM-A1")
-        self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200)
+        self.assertIn(response.status_code, (requests.codes.ok, requests.codes.no_content))
 
     def test_68_disconnect_ROADMC(self):
         response = test_utils.unmount_device("ROADM-C1")
-        self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200)
+        self.assertIn(response.status_code, (requests.codes.ok, requests.codes.no_content))
 
 
 if __name__ == "__main__":