X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Ftransportpce_tests%2Fwith_docker%2Ftest02_nbinotifications.py;fp=tests%2Ftransportpce_tests%2Fwith_docker%2Ftest02_nbinotifications.py;h=d8e837af34c6ece2ff53bf4c60fdb8d1dd3ad06d;hb=654a9fb915061ac8eb5ec52cacbc3c76a8455aa8;hp=a235b0f5205400cbeac6805eea733d6b5d6d4eb3;hpb=6233872e577c6abc704af61bc26362202017c103;p=transportpce.git diff --git a/tests/transportpce_tests/with_docker/test02_nbinotifications.py b/tests/transportpce_tests/with_docker/test02_nbinotifications.py index a235b0f52..d8e837af3 100644 --- a/tests/transportpce_tests/with_docker/test02_nbinotifications.py +++ b/tests/transportpce_tests/with_docker/test02_nbinotifications.py @@ -21,7 +21,7 @@ import requests sys.path.append('transportpce_tests/common/') # pylint: disable=wrong-import-position # pylint: disable=import-error -import test_utils_rfc8040 # nopep8 +import test_utils # nopep8 class TransportNbiNotificationstesting(unittest.TestCase): @@ -83,33 +83,33 @@ class TransportNbiNotificationstesting(unittest.TestCase): # pylint: disable=unsubscriptable-object # TODO: for lighty manage the activation of NBI notification feature cls.init_failed = False - cls.processes = test_utils_rfc8040.start_tpce() + cls.processes = test_utils.start_tpce() # NBI notification feature is not installed by default in Karaf if "USE_LIGHTY" not in os.environ or os.environ['USE_LIGHTY'] != 'True': print("installing NBI notification feature...") - result = test_utils_rfc8040.install_karaf_feature("odl-transportpce-nbinotifications") + result = test_utils.install_karaf_feature("odl-transportpce-nbinotifications") if result.returncode != 0: cls.init_failed = True print("Restarting OpenDaylight...") - test_utils_rfc8040.shutdown_process(cls.processes[0]) - cls.processes[0] = test_utils_rfc8040.start_karaf() - test_utils_rfc8040.process_list[0] = cls.processes[0] - cls.init_failed = not test_utils_rfc8040.wait_until_log_contains( - test_utils_rfc8040.KARAF_LOG, test_utils_rfc8040.KARAF_OK_START_MSG, time_to_wait=60) + test_utils.shutdown_process(cls.processes[0]) + cls.processes[0] = test_utils.start_karaf() + test_utils.process_list[0] = cls.processes[0] + cls.init_failed = not test_utils.wait_until_log_contains( + test_utils.KARAF_LOG, test_utils.KARAF_OK_START_MSG, time_to_wait=60) if cls.init_failed: print("NBI notification installation feature failed...") - test_utils_rfc8040.shutdown_process(cls.processes[0]) + test_utils.shutdown_process(cls.processes[0]) sys.exit(2) - cls.processes = test_utils_rfc8040.start_sims([('xpdra', cls.NODE_VERSION), - ('roadma', cls.NODE_VERSION), - ('roadmc', cls.NODE_VERSION), - ('xpdrc', cls.NODE_VERSION)]) + cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION), + ('roadma', cls.NODE_VERSION), + ('roadmc', cls.NODE_VERSION), + ('xpdrc', cls.NODE_VERSION)]) @classmethod def tearDownClass(cls): # pylint: disable=not-an-iterable for process in cls.processes: - test_utils_rfc8040.shutdown_process(process) + test_utils.shutdown_process(process) print("all processes killed") def setUp(self): # instruction executed before each test method @@ -117,27 +117,27 @@ class TransportNbiNotificationstesting(unittest.TestCase): print("execution of {}".format(self.id().split(".")[-1])) def test_01_connect_xpdrA(self): - response = test_utils_rfc8040.mount_device("XPDR-A1", ('xpdra', self.NODE_VERSION)) + response = test_utils.mount_device("XPDR-A1", ('xpdra', self.NODE_VERSION)) self.assertEqual(response.status_code, - requests.codes.created, test_utils_rfc8040.CODE_SHOULD_BE_201) + requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_02_connect_xpdrC(self): - response = test_utils_rfc8040.mount_device("XPDR-C1", ('xpdrc', self.NODE_VERSION)) + response = test_utils.mount_device("XPDR-C1", ('xpdrc', self.NODE_VERSION)) self.assertEqual(response.status_code, - requests.codes.created, test_utils_rfc8040.CODE_SHOULD_BE_201) + requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_03_connect_rdmA(self): - response = test_utils_rfc8040.mount_device("ROADM-A1", ('roadma', self.NODE_VERSION)) + response = test_utils.mount_device("ROADM-A1", ('roadma', self.NODE_VERSION)) self.assertEqual(response.status_code, - requests.codes.created, test_utils_rfc8040.CODE_SHOULD_BE_201) + requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_04_connect_rdmC(self): - response = test_utils_rfc8040.mount_device("ROADM-C1", ('roadmc', self.NODE_VERSION)) + response = test_utils.mount_device("ROADM-C1", ('roadmc', self.NODE_VERSION)) self.assertEqual(response.status_code, - requests.codes.created, test_utils_rfc8040.CODE_SHOULD_BE_201) + requests.codes.created, test_utils.CODE_SHOULD_BE_201) def test_05_connect_xprdA_N1_to_roadmA_PP1(self): - response = test_utils_rfc8040.transportpce_api_rpc_request( + 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'}}) @@ -146,7 +146,7 @@ class TransportNbiNotificationstesting(unittest.TestCase): time.sleep(2) def test_06_connect_roadmA_PP1_to_xpdrA_N1(self): - response = test_utils_rfc8040.transportpce_api_rpc_request( + 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'}}) @@ -155,7 +155,7 @@ class TransportNbiNotificationstesting(unittest.TestCase): time.sleep(2) def test_07_connect_xprdC_N1_to_roadmC_PP1(self): - response = test_utils_rfc8040.transportpce_api_rpc_request( + 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'}}) @@ -164,7 +164,7 @@ class TransportNbiNotificationstesting(unittest.TestCase): time.sleep(2) def test_08_connect_roadmC_PP1_to_xpdrC_N1(self): - response = test_utils_rfc8040.transportpce_api_rpc_request( + 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'}}) @@ -173,14 +173,14 @@ class TransportNbiNotificationstesting(unittest.TestCase): time.sleep(2) def test_09_get_notifications_service1(self): - response = test_utils_rfc8040.transportpce_api_rpc_request( + response = test_utils.transportpce_api_rpc_request( 'nbi-notifications', 'get-notifications-process-service', self.nbi_notif_input_data) self.assertEqual(response['status_code'], requests.codes.no_content) time.sleep(2) def test_10_create_eth_service1(self): self.cr_serv_input_data["service-name"] = "service1" - response = test_utils_rfc8040.transportpce_api_rpc_request( + response = test_utils.transportpce_api_rpc_request( 'org-openroadm-service', 'service-create', self.cr_serv_input_data) self.assertEqual(response['status_code'], requests.codes.ok) self.assertIn('PCE calculation in progress', @@ -188,7 +188,7 @@ class TransportNbiNotificationstesting(unittest.TestCase): time.sleep(self.WAITING) def test_11_get_notifications_service1(self): - response = test_utils_rfc8040.transportpce_api_rpc_request( + response = test_utils.transportpce_api_rpc_request( 'nbi-notifications', 'get-notifications-process-service', self.nbi_notif_input_data) self.assertEqual(response['status_code'], requests.codes.ok) self.assertEqual(response['output']['notifications-process-service'][-1]['service-name'], 'service1') @@ -211,7 +211,7 @@ class TransportNbiNotificationstesting(unittest.TestCase): "fiber-type": "smf", "SRLG-length": 100000, "pmd": 0.5}]}} - response = test_utils_rfc8040.add_oms_attr_request( + 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) @@ -227,14 +227,14 @@ class TransportNbiNotificationstesting(unittest.TestCase): "fiber-type": "smf", "SRLG-length": 100000, "pmd": 0.5}]}} - response = test_utils_rfc8040.add_oms_attr_request( + 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_14_create_eth_service1(self): self.cr_serv_input_data["service-name"] = "service1" - response = test_utils_rfc8040.transportpce_api_rpc_request( + response = test_utils.transportpce_api_rpc_request( 'org-openroadm-service', 'service-create', self.cr_serv_input_data) self.assertEqual(response['status_code'], requests.codes.ok) self.assertIn('PCE calculation in progress', @@ -242,7 +242,7 @@ class TransportNbiNotificationstesting(unittest.TestCase): time.sleep(self.WAITING) def test_15_get_eth_service1(self): - response = test_utils_rfc8040.get_ordm_serv_list_attr_request("services", "service1") + response = test_utils.get_ordm_serv_list_attr_request("services", "service1") self.assertEqual(response['status_code'], requests.codes.ok) self.assertEqual(response['services'][0]['administrative-state'], 'inService') self.assertEqual(response['services'][0]['service-name'], 'service1') @@ -250,7 +250,7 @@ class TransportNbiNotificationstesting(unittest.TestCase): self.assertEqual(response['services'][0]['lifecycle-state'], 'planned') def test_16_get_notifications_service1(self): - response = test_utils_rfc8040.transportpce_api_rpc_request( + response = test_utils.transportpce_api_rpc_request( 'nbi-notifications', 'get-notifications-process-service', self.nbi_notif_input_data) self.assertEqual(response['status_code'], requests.codes.ok) self.assertEqual(response['output']['notifications-process-service'][-1]['service-name'], 'service1') @@ -258,7 +258,7 @@ class TransportNbiNotificationstesting(unittest.TestCase): self.assertEqual(response['output']['notifications-process-service'][-1]['message'], 'Service implemented !') def test_17_get_notifications_alarm_service1(self): - response = test_utils_rfc8040.transportpce_api_rpc_request( + response = test_utils.transportpce_api_rpc_request( 'nbi-notifications', 'get-notifications-alarm-service', self.nbi_notif_input_data) self.assertEqual(response['status_code'], requests.codes.ok) self.assertEqual(response['output']['notifications-alarm-service'][-1]['service-name'], 'service1') @@ -277,14 +277,14 @@ class TransportNbiNotificationstesting(unittest.TestCase): "administrative-state": "outOfService", "port-qual": "roadm-external"}]} response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"), - data=json.dumps(body), headers=test_utils_rfc8040.TYPE_APPLICATION_JSON, - auth=(test_utils_rfc8040.ODL_LOGIN, test_utils_rfc8040.ODL_PWD), - timeout=test_utils_rfc8040.REQUEST_TIMEOUT) + data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON, + 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_19_get_notifications_alarm_service1(self): - response = test_utils_rfc8040.transportpce_api_rpc_request( + response = test_utils.transportpce_api_rpc_request( 'nbi-notifications', 'get-notifications-alarm-service', self.nbi_notif_input_data) self.assertEqual(response['status_code'], requests.codes.ok) self.assertEqual(response['output']['notifications-alarm-service'][-1]['service-name'], 'service1') @@ -303,9 +303,9 @@ class TransportNbiNotificationstesting(unittest.TestCase): "administrative-state": "inService", "port-qual": "roadm-external"}]} response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"), - data=json.dumps(body), headers=test_utils_rfc8040.TYPE_APPLICATION_JSON, - auth=(test_utils_rfc8040.ODL_LOGIN, test_utils_rfc8040.ODL_PWD), - timeout=test_utils_rfc8040.REQUEST_TIMEOUT) + data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON, + 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) @@ -314,7 +314,7 @@ class TransportNbiNotificationstesting(unittest.TestCase): def test_22_delete_eth_service1(self): self.del_serv_input_data["service-delete-req-info"]["service-name"] = "service1" - response = test_utils_rfc8040.transportpce_api_rpc_request( + response = test_utils.transportpce_api_rpc_request( 'org-openroadm-service', 'service-delete', self.del_serv_input_data) self.assertEqual(response['status_code'], requests.codes.ok) self.assertIn('Renderer service delete in progress', @@ -322,7 +322,7 @@ class TransportNbiNotificationstesting(unittest.TestCase): time.sleep(20) def test_23_get_notifications_service1(self): - response = test_utils_rfc8040.transportpce_api_rpc_request( + response = test_utils.transportpce_api_rpc_request( 'nbi-notifications', 'get-notifications-process-service', self.nbi_notif_input_data) self.assertEqual(response['status_code'], requests.codes.ok) self.assertEqual(response['output']['notifications-process-service'][-1]['service-name'], 'service1') @@ -331,19 +331,19 @@ class TransportNbiNotificationstesting(unittest.TestCase): time.sleep(2) def test_24_disconnect_XPDRA(self): - response = test_utils_rfc8040.unmount_device("XPDR-A1") + response = test_utils.unmount_device("XPDR-A1") self.assertIn(response.status_code, (requests.codes.ok, requests.codes.no_content)) def test_25_disconnect_XPDRC(self): - response = test_utils_rfc8040.unmount_device("XPDR-C1") + response = test_utils.unmount_device("XPDR-C1") self.assertIn(response.status_code, (requests.codes.ok, requests.codes.no_content)) def test_26_disconnect_ROADMA(self): - response = test_utils_rfc8040.unmount_device("ROADM-A1") + response = test_utils.unmount_device("ROADM-A1") self.assertIn(response.status_code, (requests.codes.ok, requests.codes.no_content)) def test_27_disconnect_ROADMC(self): - response = test_utils_rfc8040.unmount_device("ROADM-C1") + response = test_utils.unmount_device("ROADM-C1") self.assertIn(response.status_code, (requests.codes.ok, requests.codes.no_content))