X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Ftransportpce_tests%2F1.2.1%2Ftest_olm.py;h=b284f3d7de836b12b18aa6b3ce24feac38dcf106;hb=refs%2Fchanges%2F88%2F89088%2F3;hp=770af549b04966f5f552cce3ae679e0fb77fa195;hpb=90a05b6fd2bbbe1ec64158e35349962fd6164686;p=transportpce.git diff --git a/tests/transportpce_tests/1.2.1/test_olm.py b/tests/transportpce_tests/1.2.1/test_olm.py index 770af549b..b284f3d7d 100644 --- a/tests/transportpce_tests/1.2.1/test_olm.py +++ b/tests/transportpce_tests/1.2.1/test_olm.py @@ -31,31 +31,31 @@ class TransportOlmTesting(unittest.TestCase): odl_process = None restconf_baseurl = "http://localhost:8181/restconf" -#START_IGNORE_XTESTING +# START_IGNORE_XTESTING @classmethod def setUpClass(cls): - print ("starting honeynode1...") + print("starting honeynode1...") cls.honeynode_process1 = test_utils.start_xpdra_honeynode() time.sleep(20) - print ("starting honeynode2...") + print("starting honeynode2...") cls.honeynode_process2 = test_utils.start_roadma_full_honeynode() time.sleep(20) - print ("starting honeynode3...") + print("starting honeynode3...") cls.honeynode_process3 = test_utils.start_roadmc_full_honeynode() time.sleep(20) - print ("starting honeynode4...") + print("starting honeynode4...") cls.honeynode_process4 = test_utils.start_xpdrc_honeynode() time.sleep(20) - print ("all honeynodes started") + print("all honeynodes started") - print ("starting opendaylight...") + print("starting opendaylight...") cls.odl_process = test_utils.start_tpce() time.sleep(60) - print ("opendaylight started") + print("opendaylight started") @classmethod def tearDownClass(cls): @@ -86,15 +86,15 @@ class TransportOlmTesting(unittest.TestCase): cls.honeynode_process4.wait() def setUp(self): - print ("execution of {}".format(self.id().split(".")[-1])) + print("execution of {}".format(self.id().split(".")[-1])) time.sleep(1) -#END_IGNORE_XTESTING +# END_IGNORE_XTESTING def test_01_xpdrA_device_connected(self): url = ("{}/config/network-topology:" "network-topology/topology/topology-netconf/node/XPDRA01" - .format(self.restconf_baseurl)) + .format(self.restconf_baseurl)) data = {"node": [{ "node-id": "XPDRA01", "netconf-node-topology:username": "admin", @@ -113,7 +113,7 @@ class TransportOlmTesting(unittest.TestCase): def test_02_xpdrC_device_connected(self): url = ("{}/config/network-topology:" "network-topology/topology/topology-netconf/node/XPDRC01" - .format(self.restconf_baseurl)) + .format(self.restconf_baseurl)) data = {"node": [{ "node-id": "XPDRC01", "netconf-node-topology:username": "admin", @@ -134,17 +134,17 @@ class TransportOlmTesting(unittest.TestCase): "network-topology/topology/topology-netconf/node/ROADMA01" .format(self.restconf_baseurl)) data = {"node": [{ - "node-id": "ROADMA01", - "netconf-node-topology:username": "admin", - "netconf-node-topology:password": "admin", - "netconf-node-topology:host": "127.0.0.1", - "netconf-node-topology:port": "17821", - "netconf-node-topology:tcp-only": "false", - "netconf-node-topology:pass-through": {}}]} + "node-id": "ROADMA01", + "netconf-node-topology:username": "admin", + "netconf-node-topology:password": "admin", + "netconf-node-topology:host": "127.0.0.1", + "netconf-node-topology:port": "17821", + "netconf-node-topology:tcp-only": "false", + "netconf-node-topology:pass-through": {}}]} headers = {'content-type': 'application/json'} response = requests.request( - "PUT", url, data=json.dumps(data), headers=headers, - auth=('admin', 'admin')) + "PUT", url, data=json.dumps(data), headers=headers, + auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.created) time.sleep(20) @@ -153,17 +153,17 @@ class TransportOlmTesting(unittest.TestCase): "network-topology/topology/topology-netconf/node/ROADMC01" .format(self.restconf_baseurl)) data = {"node": [{ - "node-id": "ROADMC01", - "netconf-node-topology:username": "admin", - "netconf-node-topology:password": "admin", - "netconf-node-topology:host": "127.0.0.1", - "netconf-node-topology:port": "17823", - "netconf-node-topology:tcp-only": "false", - "netconf-node-topology:pass-through": {}}]} + "node-id": "ROADMC01", + "netconf-node-topology:username": "admin", + "netconf-node-topology:password": "admin", + "netconf-node-topology:host": "127.0.0.1", + "netconf-node-topology:port": "17823", + "netconf-node-topology:tcp-only": "false", + "netconf-node-topology:pass-through": {}}]} headers = {'content-type': 'application/json'} response = requests.request( - "PUT", url, data=json.dumps(data), headers=headers, - auth=('admin', 'admin')) + "PUT", url, data=json.dumps(data), headers=headers, + auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.created) time.sleep(20) @@ -183,8 +183,8 @@ class TransportOlmTesting(unittest.TestCase): } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Xponder Roadm Link created successfully', res["output"]["result"]) @@ -205,8 +205,8 @@ class TransportOlmTesting(unittest.TestCase): } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Roadm Xponder links created successfully', res["output"]["result"]) @@ -227,8 +227,8 @@ class TransportOlmTesting(unittest.TestCase): } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Xponder Roadm Link created successfully', res["output"]["result"]) @@ -249,8 +249,8 @@ class TransportOlmTesting(unittest.TestCase): } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Roadm Xponder links created successfully', res["output"]["result"]) @@ -258,15 +258,15 @@ class TransportOlmTesting(unittest.TestCase): def test_09_create_OTS_ROADMA(self): url = "{}/operations/transportpce-device-renderer:create-ots-oms".format(self.restconf_baseurl) data = { - "input" : { - "node-id" : "ROADMA01", - "logical-connection-point" : "DEG1-TTP-TXRX" + "input": { + "node-id": "ROADMA01", + "logical-connection-point": "DEG1-TTP-TXRX" } } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Interfaces OTS-DEG1-TTP-TXRX - OMS-DEG1-TTP-TXRX successfully created on node ROADMA01', @@ -275,15 +275,15 @@ class TransportOlmTesting(unittest.TestCase): def test_10_create_OTS_ROADMC(self): url = "{}/operations/transportpce-device-renderer:create-ots-oms".format(self.restconf_baseurl) data = { - "input" : { - "node-id" : "ROADMC01", - "logical-connection-point" : "DEG2-TTP-TXRX" + "input": { + "node-id": "ROADMC01", + "logical-connection-point": "DEG2-TTP-TXRX" } } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Interfaces OTS-DEG2-TTP-TXRX - OMS-DEG2-TTP-TXRX successfully created on node ROADMC01', @@ -297,28 +297,28 @@ class TransportOlmTesting(unittest.TestCase): "resource-type": "interface", "granularity": "15min", "resource-identifier": { - "resource-name" : "OTS-DEG1-TTP-TXRX" + "resource-name": "OTS-DEG1-TTP-TXRX" } } } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn({ - "pmparameter-name": "OpticalPowerOutput", - "pmparameter-value": "2.5" - }, res["output"]["measurements"]) + "pmparameter-name": "OpticalPowerOutput", + "pmparameter-value": "2.5" + }, res["output"]["measurements"]) self.assertIn({ - "pmparameter-name": "OpticalReturnLoss", - "pmparameter-value": "49.9" - }, res["output"]["measurements"]) + "pmparameter-name": "OpticalReturnLoss", + "pmparameter-value": "49.9" + }, res["output"]["measurements"]) self.assertIn({ - "pmparameter-name": "OpticalPowerInput", - "pmparameter-value": "3" - }, res["output"]["measurements"]) + "pmparameter-name": "OpticalPowerInput", + "pmparameter-value": "3" + }, res["output"]["measurements"]) def test_12_get_PM_ROADMC(self): url = "{}/operations/transportpce-olm:get-pm".format(self.restconf_baseurl) @@ -328,28 +328,28 @@ class TransportOlmTesting(unittest.TestCase): "resource-type": "interface", "granularity": "15min", "resource-identifier": { - "resource-name" : "OTS-DEG2-TTP-TXRX" + "resource-name": "OTS-DEG2-TTP-TXRX" } } } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn({ - "pmparameter-name": "OpticalPowerOutput", - "pmparameter-value": "18.1" - }, res["output"]["measurements"]) + "pmparameter-name": "OpticalPowerOutput", + "pmparameter-value": "18.1" + }, res["output"]["measurements"]) self.assertIn({ - "pmparameter-name": "OpticalReturnLoss", - "pmparameter-value": "48.8" - }, res["output"]["measurements"]) + "pmparameter-name": "OpticalReturnLoss", + "pmparameter-value": "48.8" + }, res["output"]["measurements"]) self.assertIn({ - "pmparameter-name": "OpticalPowerInput", - "pmparameter-value": "-3.2" - }, res["output"]["measurements"]) + "pmparameter-name": "OpticalPowerInput", + "pmparameter-value": "-3.2" + }, res["output"]["measurements"]) def test_13_calculate_span_loss_base_ROADMA_ROADMC(self): url = "{}/operations/transportpce-olm:calculate-spanloss-base".format(self.restconf_baseurl) @@ -361,16 +361,16 @@ class TransportOlmTesting(unittest.TestCase): } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Success', res["output"]["result"]) self.assertIn({ "spanloss": "6", - "link-id": "ROADMA01-DEG1-DEG1-TTP-TXRXtoROADMC01-DEG2-DEG2-TTP-TXRX" - }, res["output"]["spans"]) + "link-id": "ROADMA01-DEG1-DEG1-TTP-TXRXtoROADMC01-DEG2-DEG2-TTP-TXRX" + }, res["output"]["spans"]) time.sleep(5) def test_14_calculate_span_loss_base_all(self): @@ -382,20 +382,20 @@ class TransportOlmTesting(unittest.TestCase): } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Success', res["output"]["result"]) self.assertIn({ - "spanloss": "15", - "link-id": "ROADMC01-DEG2-DEG2-TTP-TXRXtoROADMA01-DEG1-DEG1-TTP-TXRX" - }, res["output"]["spans"]) + "spanloss": "15", + "link-id": "ROADMC01-DEG2-DEG2-TTP-TXRXtoROADMA01-DEG1-DEG1-TTP-TXRX" + }, res["output"]["spans"]) self.assertIn({ - "spanloss": "6", - "link-id": "ROADMA01-DEG1-DEG1-TTP-TXRXtoROADMC01-DEG2-DEG2-TTP-TXRX" - }, res["output"]["spans"]) + "spanloss": "6", + "link-id": "ROADMA01-DEG1-DEG1-TTP-TXRXtoROADMC01-DEG2-DEG2-TTP-TXRX" + }, res["output"]["spans"]) time.sleep(5) def test_15_get_OTS_DEG1_TTP_TXRX_ROADMA(self): @@ -456,12 +456,12 @@ class TransportOlmTesting(unittest.TestCase): } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"]) - #time.sleep(40) + # time.sleep(40) time.sleep(10) def test_18_servicePath_create_ZToA(self): @@ -498,12 +498,12 @@ class TransportOlmTesting(unittest.TestCase): } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"]) - #time.sleep(40) + # time.sleep(40) time.sleep(10) def test_19_service_power_setup_XPDRA_XPDRC(self): @@ -538,8 +538,8 @@ class TransportOlmTesting(unittest.TestCase): } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Success', res["output"]["result"]) @@ -611,8 +611,8 @@ class TransportOlmTesting(unittest.TestCase): } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Success', res["output"]["result"]) @@ -673,8 +673,8 @@ class TransportOlmTesting(unittest.TestCase): } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Success', res["output"]["result"]) @@ -736,8 +736,8 @@ class TransportOlmTesting(unittest.TestCase): } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Request processed', res["output"]["result"]) @@ -777,8 +777,8 @@ class TransportOlmTesting(unittest.TestCase): } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Request processed', res["output"]["result"]) @@ -802,8 +802,8 @@ class TransportOlmTesting(unittest.TestCase): } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Xponder Roadm Link created successfully', res["output"]["result"]) @@ -824,8 +824,8 @@ class TransportOlmTesting(unittest.TestCase): } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Roadm Xponder links created successfully', res["output"]["result"]) @@ -854,12 +854,12 @@ class TransportOlmTesting(unittest.TestCase): } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Roadm-connection successfully created for nodes', res["output"]["result"]) - #time.sleep(40) + # time.sleep(40) time.sleep(10) def test_34_get_interface_XPDRA_XPDR1_NETWORK2(self): @@ -898,8 +898,8 @@ class TransportOlmTesting(unittest.TestCase): } headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, data=json.dumps(data), - headers=headers, auth=('admin', 'admin')) + "POST", url, data=json.dumps(data), + headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Request processed', res["output"]["result"]) @@ -907,23 +907,23 @@ class TransportOlmTesting(unittest.TestCase): def test_36_xpdrA_device_disconnected(self): url = ("{}/config/network-topology:" - "network-topology/topology/topology-netconf/node/XPDRA01" + "network-topology/topology/topology-netconf/node/XPDRA01" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json'} response = requests.request( - "DELETE", url, headers=headers, - auth=('admin', 'admin')) + "DELETE", url, headers=headers, + auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) time.sleep(10) def test_37_xpdrC_device_disconnected(self): url = ("{}/config/network-topology:" - "network-topology/topology/topology-netconf/node/XPDRC01" + "network-topology/topology/topology-netconf/node/XPDRC01" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json'} response = requests.request( - "DELETE", url, headers=headers, - auth=('admin', 'admin')) + "DELETE", url, headers=headers, + auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) time.sleep(10) @@ -931,7 +931,7 @@ class TransportOlmTesting(unittest.TestCase): url = "{}/operations/transportpce-olm:calculate-spanloss-current".format(self.restconf_baseurl) headers = {'content-type': 'application/json'} response = requests.request( - "POST", url, headers=headers, auth=('admin', 'admin')) + "POST", url, headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertIn('Success', @@ -940,25 +940,26 @@ class TransportOlmTesting(unittest.TestCase): def test_39_rdmA_device_disconnected(self): url = ("{}/config/network-topology:" - "network-topology/topology/topology-netconf/node/ROADMA01" + "network-topology/topology/topology-netconf/node/ROADMA01" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json'} response = requests.request( - "DELETE", url, headers=headers, - auth=('admin', 'admin')) + "DELETE", url, headers=headers, + auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) time.sleep(10) def test_40_rdmC_device_disconnected(self): url = ("{}/config/network-topology:" - "network-topology/topology/topology-netconf/node/ROADMC01" + "network-topology/topology/topology-netconf/node/ROADMC01" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json'} response = requests.request( - "DELETE", url, headers=headers, - auth=('admin', 'admin')) + "DELETE", url, headers=headers, + auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) time.sleep(10) + if __name__ == "__main__": unittest.main(verbosity=2)