From d3a0606c2cc080482ec9dc0ccbee7f0905bb2391 Mon Sep 17 00:00:00 2001 From: Gilles Thouenon Date: Wed, 17 Jul 2019 12:00:53 +0200 Subject: [PATCH] Update end-to-end functional tests - realign functional tests for device 1.2.1 on the test suite for device 2.2.1 which is more determinist - add oms attributes in rdm2rdm links in topo in order to take into account hard constraints in PCE (change 82557) JIRA: TRNSPRTPCE-109 Change-Id: I92357faa8f6e4d3ed2a38582de3f53cce154a844 Signed-off-by: Gilles Thouenon Co-authored-by: Christophe Betoule --- .../transportpce_tests/1.2.1/test_end2end.py | 447 ++++++++++-------- .../transportpce_tests/2.2.1/test_end2end.py | 224 +++++---- 2 files changed, 401 insertions(+), 270 deletions(-) diff --git a/tests/transportpce_tests/1.2.1/test_end2end.py b/tests/transportpce_tests/1.2.1/test_end2end.py index 388e52c38..994b7707e 100644 --- a/tests/transportpce_tests/1.2.1/test_end2end.py +++ b/tests/transportpce_tests/1.2.1/test_end2end.py @@ -28,6 +28,7 @@ class TransportPCEFulltesting(unittest.TestCase): honeynode_process3 = None honeynode_process4 = None restconf_baseurl = "http://localhost:8181/restconf" + WAITING = 20 #nominal value is 300 #START_IGNORE_XTESTING @@ -38,7 +39,7 @@ class TransportPCEFulltesting(unittest.TestCase): if os.path.isfile(executable): with open('honeynode1.log', 'w') as outfile: cls.honeynode_process1 = subprocess.Popen( - [executable, "17840", "sample_configs/openroadm/2.1/oper-ROADMA-full.xml"], + [executable, "17830", "sample_configs/openroadm/2.1/oper-XPDRA.xml"], stdout=outfile) @classmethod @@ -48,7 +49,7 @@ class TransportPCEFulltesting(unittest.TestCase): if os.path.isfile(executable): with open('honeynode2.log', 'w') as outfile: cls.honeynode_process2 = subprocess.Popen( - [executable, "17831", "sample_configs/openroadm/2.1/oper-XPDRA.xml"], + [executable, "17831", "sample_configs/openroadm/2.1/oper-ROADMA-full.xml"], stdout=outfile) @classmethod @@ -58,7 +59,7 @@ class TransportPCEFulltesting(unittest.TestCase): if os.path.isfile(executable): with open('honeynode3.log', 'w') as outfile: cls.honeynode_process3 = subprocess.Popen( - [executable, "17843", "sample_configs/openroadm/2.1/oper-ROADMC-full.xml"], + [executable, "17833", "sample_configs/openroadm/2.1/oper-ROADMC-full.xml"], stdout=outfile) @classmethod @@ -141,7 +142,7 @@ class TransportPCEFulltesting(unittest.TestCase): "netconf-node-topology:username": "admin", "netconf-node-topology:password": "admin", "netconf-node-topology:host": "127.0.0.1", - "netconf-node-topology:port": "17831", + "netconf-node-topology:port": "17830", "netconf-node-topology:tcp-only": "false", "netconf-node-topology:pass-through": {}}]} headers = {'content-type': 'application/json'} @@ -179,7 +180,7 @@ class TransportPCEFulltesting(unittest.TestCase): "netconf-node-topology:username": "admin", "netconf-node-topology:password": "admin", "netconf-node-topology:host": "127.0.0.1", - "netconf-node-topology:port": "17840", + "netconf-node-topology:port": "17831", "netconf-node-topology:tcp-only": "false", "netconf-node-topology:pass-through": {}}]} headers = {'content-type': 'application/json'} @@ -198,7 +199,7 @@ class TransportPCEFulltesting(unittest.TestCase): "netconf-node-topology:username": "admin", "netconf-node-topology:password": "admin", "netconf-node-topology:host": "127.0.0.1", - "netconf-node-topology:port": "17843", + "netconf-node-topology:port": "17833", "netconf-node-topology:tcp-only": "false", "netconf-node-topology:pass-through": {}}]} headers = {'content-type': 'application/json'} @@ -231,30 +232,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertIn('Xponder Roadm Link created successfully', res["output"]["result"]) time.sleep(2) - def test_06_connect_xprdA_N2_to_roadmA_PP2(self): - url = "{}/operations/transportpce-networkutils:init-xpdr-rdm-links".format(self.restconf_baseurl) - data = { - "networkutils:input": { - "networkutils:links-input": { - "networkutils:xpdr-node": "XPDRA", - "networkutils:xpdr-num": "1", - "networkutils:network-num": "2", - "networkutils:rdm-node": "ROADMA", - "networkutils:srg-num": "1", - "networkutils:termination-point-num": "SRG1-PP2-TXRX" - } - } - } - headers = {'content-type': 'application/json'} - response = requests.request( - "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"]) - time.sleep(2) - - def test_07_connect_roadmA_PP1_to_xpdrA_N1(self): + def test_06_connect_roadmA_PP1_to_xpdrA_N1(self): url = "{}/operations/transportpce-networkutils:init-rdm-xpdr-links".format(self.restconf_baseurl) data = { "networkutils:input": { @@ -277,30 +255,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertIn('Roadm Xponder links created successfully', res["output"]["result"]) time.sleep(2) - def test_08_connect_roadmA_PP2_to_xpdrA_N2(self): - url = "{}/operations/transportpce-networkutils:init-rdm-xpdr-links".format(self.restconf_baseurl) - data = { - "networkutils:input": { - "networkutils:links-input": { - "networkutils:xpdr-node": "XPDRA", - "networkutils:xpdr-num": "1", - "networkutils:network-num": "2", - "networkutils:rdm-node": "ROADMA", - "networkutils:srg-num": "1", - "networkutils:termination-point-num": "SRG1-PP2-TXRX" - } - } - } - headers = {'content-type': 'application/json'} - response = requests.request( - "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"]) - time.sleep(2) - - def test_09_connect_xprdC_N1_to_roadmC_PP1(self): + def test_07_connect_xprdC_N1_to_roadmC_PP1(self): url = "{}/operations/transportpce-networkutils:init-xpdr-rdm-links".format(self.restconf_baseurl) data = { "networkutils:input": { @@ -323,30 +278,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertIn('Xponder Roadm Link created successfully', res["output"]["result"]) time.sleep(2) - def test_10_connect_xprdC_N2_to_roadmC_PP2(self): - url = "{}/operations/transportpce-networkutils:init-xpdr-rdm-links".format(self.restconf_baseurl) - data = { - "networkutils:input": { - "networkutils:links-input": { - "networkutils:xpdr-node": "XPDRC", - "networkutils:xpdr-num": "1", - "networkutils:network-num": "2", - "networkutils:rdm-node": "ROADMC", - "networkutils:srg-num": "1", - "networkutils:termination-point-num": "SRG1-PP2-TXRX" - } - } - } - headers = {'content-type': 'application/json'} - response = requests.request( - "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"]) - time.sleep(2) - - def test_11_connect_roadmC_PP1_to_xpdrC_N1(self): + def test_08_connect_roadmC_PP1_to_xpdrC_N1(self): url = "{}/operations/transportpce-networkutils:init-rdm-xpdr-links".format(self.restconf_baseurl) data = { "networkutils:input": { @@ -369,31 +301,54 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertIn('Roadm Xponder links created successfully', res["output"]["result"]) time.sleep(2) - def test_12_connect_roadmC_PP2_to_xpdrC_N2(self): - url = "{}/operations/transportpce-networkutils:init-rdm-xpdr-links".format(self.restconf_baseurl) - data = { - "networkutils:input": { - "networkutils:links-input": { - "networkutils:xpdr-node": "XPDRC", - "networkutils:xpdr-num": "1", - "networkutils:network-num": "2", - "networkutils:rdm-node": "ROADMC", - "networkutils:srg-num": "1", - "networkutils:termination-point-num": "SRG1-PP2-TXRX" - } - } - } + def test_09_add_omsAttributes_ROADMA_ROADMC(self): + # Config ROADMA-ROADMC oms-attributes + url = ("{}/config/ietf-network:networks/network/openroadm-topology/ietf-network-topology:" + "link/ROADMA-DEG1-DEG1-TTP-TXRXtoROADMC-DEG2-DEG2-TTP-TXRX/org-openroadm-network-topology:" + "OMS-attributes/span" + .format(self.restconf_baseurl)) + data = {"span": { + "clfi": "fiber1", + "auto-spanloss": "true", + "spanloss-base": 11.4, + "spanloss-current": 12, + "engineered-spanloss": 12.2, + "link-concatenation": [{ + "SRLG-Id": 0, + "fiber-type": "smf", + "SRLG-length": 100000, + "pmd": 0.5}]}} headers = {'content-type': 'application/json'} response = requests.request( - "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"]) - time.sleep(2) + "PUT", url, data=json.dumps(data), headers=headers, + auth=('admin', 'admin')) + self.assertEqual(response.status_code, requests.codes.created) + + def test_10_add_omsAttributes_ROADMC_ROADMA(self): + # Config ROADMC-ROADMA oms-attributes + url = ("{}/config/ietf-network:networks/network/openroadm-topology/ietf-network-topology:" + "link/ROADMC-DEG2-DEG2-TTP-TXRXtoROADMA-DEG1-DEG1-TTP-TXRX/org-openroadm-network-topology:" + "OMS-attributes/span" + .format(self.restconf_baseurl)) + data = {"span": { + "clfi": "fiber1", + "auto-spanloss": "true", + "spanloss-base": 11.4, + "spanloss-current": 12, + "engineered-spanloss": 12.2, + "link-concatenation": [{ + "SRLG-Id": 0, + "fiber-type": "smf", + "SRLG-length": 100000, + "pmd": 0.5}]}} + headers = {'content-type': 'application/json'} + response = requests.request( + "PUT", url, data=json.dumps(data), headers=headers, + auth=('admin', 'admin')) + self.assertEqual(response.status_code, requests.codes.created) #test service-create for Eth service from xpdr to xpdr - def test_13_create_eth_service1(self): + def test_11_create_eth_service1(self): url = ("{}/operations/org-openroadm-service:service-create" .format(self.restconf_baseurl)) data = {"input": { @@ -493,9 +448,9 @@ class TransportPCEFulltesting(unittest.TestCase): res = response.json() self.assertIn('PCE calculation in progress', res['output']['configuration-response-common']['response-message']) - time.sleep(300) + time.sleep(self.WAITING) - def test_14_get_eth_service1(self): + def test_12_get_eth_service1(self): url = ("{}/operational/org-openroadm-service:service-list/services/service1" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json', @@ -515,7 +470,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['services'][0]['lifecycle-state'], 'planned') time.sleep(2) - def test_15_check_xc1_ROADMA(self): + def test_13_check_xc1_ROADMA(self): url = ("{}/config/network-topology:network-topology/topology/topology-netconf/" "node/ROADMA/yang-ext:mount/org-openroadm-device:org-openroadm-device/" "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-1" @@ -539,7 +494,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['roadm-connections'][0]['destination']) time.sleep(5) - def test_16_check_xc1_ROADMC(self): + def test_14_check_xc1_ROADMC(self): url = ("{}/config/network-topology:network-topology/topology/topology-netconf/" "node/ROADMC/yang-ext:mount/org-openroadm-device:org-openroadm-device/" "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-1" @@ -563,7 +518,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['roadm-connections'][0]['destination']) time.sleep(5) - def test_17_check_topo_XPDRA(self): + def test_15_check_topo_XPDRA(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/XPDRA-XPDR1" .format(self.restconf_baseurl)) response = requests.request( @@ -572,49 +527,148 @@ class TransportPCEFulltesting(unittest.TestCase): res = response.json() liste_tp = res['node'][0]['ietf-network-topology:termination-point'] for ele in liste_tp: - if ele['tp-id'] == 'XPDR1-CLIENT1': - self.assertEqual({u'index': 1}, ele['org-openroadm-network-topology:xpdr-client-attributes']['wavelength']) if ele['tp-id'] == 'XPDR1-NETWORK1': - self.assertEqual({u'index': 1}, ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength']) - if ele['tp-id'] == 'XPDR1-CLIENT2': + self.assertEqual({u'frequency': 191.35, u'width': 40}, + ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength']) + if ele['tp-id'] == 'XPDR1-CLIENT1' or ele['tp-id'] == 'XPDR1-CLIENT3': self.assertNotIn('wavelength', dict.keys(ele['org-openroadm-network-topology:xpdr-client-attributes'])) if ele['tp-id'] == 'XPDR1-NETWORK2': self.assertNotIn('wavelength', dict.keys(ele['org-openroadm-network-topology:xpdr-network-attributes'])) time.sleep(3) - def test_18_check_topo_ROADMA_SRG1(self): + def test_16_check_topo_ROADMA_SRG1(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/ROADMA-SRG1" .format(self.restconf_baseurl)) response = requests.request( "GET", url1, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() - self.assertNotIn({u'index': 1}, res['node'][0][u'org-openroadm-network-topology:srg-attributes']['available-wavelengths']) + self.assertNotIn({u'index': 1}, + res['node'][0][u'org-openroadm-network-topology:srg-attributes']['available-wavelengths']) liste_tp = res['node'][0]['ietf-network-topology:termination-point'] for ele in liste_tp: if ele['tp-id'] == 'SRG1-PP1-TXRX': - self.assertIn({u'index': 1}, ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) + self.assertIn({u'index': 1, u'frequency': 191.35, u'width': 40}, + ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) if ele['tp-id'] == 'SRG1-PP2-TXRX': self.assertNotIn('used-wavelength', dict.keys(ele)) time.sleep(3) - def test_19_check_topo_ROADMA_DEG1(self): + def test_17_check_topo_ROADMA_DEG1(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/ROADMA-DEG1" .format(self.restconf_baseurl)) response = requests.request( "GET", url1, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() - self.assertNotIn({u'index': 1}, res['node'][0][u'org-openroadm-network-topology:degree-attributes']['available-wavelengths']) + self.assertNotIn({u'index': 1}, + res['node'][0][u'org-openroadm-network-topology:degree-attributes']['available-wavelengths']) liste_tp = res['node'][0]['ietf-network-topology:termination-point'] for ele in liste_tp: if ele['tp-id'] == 'DEG1-CTP-TXRX': - self.assertIn({u'index': 1}, ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths']) + self.assertIn({u'index': 1, u'frequency': 191.35, u'width': 40}, + ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths']) if ele['tp-id'] == 'DEG1-TTP-TXRX': - self.assertIn({u'index': 1}, ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths']) + self.assertIn({u'index': 1, u'frequency': 191.35, u'width': 40}, + ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths']) time.sleep(3) - def test_20_create_eth_service2(self): + def test_18_connect_xprdA_N2_to_roadmA_PP2(self): + url = "{}/operations/transportpce-networkutils:init-xpdr-rdm-links".format(self.restconf_baseurl) + data = { + "networkutils:input": { + "networkutils:links-input": { + "networkutils:xpdr-node": "XPDRA", + "networkutils:xpdr-num": "1", + "networkutils:network-num": "2", + "networkutils:rdm-node": "ROADMA", + "networkutils:srg-num": "1", + "networkutils:termination-point-num": "SRG1-PP2-TXRX" + } + } + } + headers = {'content-type': 'application/json'} + response = requests.request( + "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"]) + time.sleep(2) + + + def test_19_connect_roadmA_PP2_to_xpdrA_N2(self): + url = "{}/operations/transportpce-networkutils:init-rdm-xpdr-links".format(self.restconf_baseurl) + data = { + "networkutils:input": { + "networkutils:links-input": { + "networkutils:xpdr-node": "XPDRA", + "networkutils:xpdr-num": "1", + "networkutils:network-num": "2", + "networkutils:rdm-node": "ROADMA", + "networkutils:srg-num": "1", + "networkutils:termination-point-num": "SRG1-PP2-TXRX" + } + } + } + headers = {'content-type': 'application/json'} + response = requests.request( + "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"]) + time.sleep(2) + + + def test_20_connect_xprdC_N2_to_roadmC_PP2(self): + url = "{}/operations/transportpce-networkutils:init-xpdr-rdm-links".format(self.restconf_baseurl) + data = { + "networkutils:input": { + "networkutils:links-input": { + "networkutils:xpdr-node": "XPDRC", + "networkutils:xpdr-num": "1", + "networkutils:network-num": "2", + "networkutils:rdm-node": "ROADMC", + "networkutils:srg-num": "1", + "networkutils:termination-point-num": "SRG1-PP2-TXRX" + } + } + } + headers = {'content-type': 'application/json'} + response = requests.request( + "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"]) + time.sleep(2) + + + def test_21_connect_roadmC_PP2_to_xpdrC_N2(self): + url = "{}/operations/transportpce-networkutils:init-rdm-xpdr-links".format(self.restconf_baseurl) + data = { + "networkutils:input": { + "networkutils:links-input": { + "networkutils:xpdr-node": "XPDRC", + "networkutils:xpdr-num": "1", + "networkutils:network-num": "2", + "networkutils:rdm-node": "ROADMC", + "networkutils:srg-num": "1", + "networkutils:termination-point-num": "SRG1-PP2-TXRX" + } + } + } + headers = {'content-type': 'application/json'} + response = requests.request( + "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"]) + time.sleep(2) + + def test_22_create_eth_service2(self): url = ("{}/operations/org-openroadm-service:service-create" .format(self.restconf_baseurl)) data = {"input": { @@ -714,9 +768,9 @@ class TransportPCEFulltesting(unittest.TestCase): res = response.json() self.assertIn('PCE calculation in progress', res['output']['configuration-response-common']['response-message']) - time.sleep(300) + time.sleep(self.WAITING) - def test_21_get_eth_service2(self): + def test_23_get_eth_service2(self): url = ("{}/operational/org-openroadm-service:service-list/services/service2" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json', @@ -736,7 +790,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['services'][0]['lifecycle-state'], 'planned') time.sleep(1) - def test_22_check_xc2_ROADMA(self): + def test_24_check_xc2_ROADMA(self): url = ("{}/config/network-topology:network-topology/topology/topology-netconf/" "node/ROADMA/yang-ext:mount/org-openroadm-device:org-openroadm-device/" "roadm-connections/DEG1-TTP-TXRX-SRG1-PP2-TXRX-2" @@ -758,7 +812,7 @@ class TransportPCEFulltesting(unittest.TestCase): {'dst-if': 'SRG1-PP2-TXRX-2'}, res['roadm-connections'][0]['destination']) - def test_23_check_topo_XPDRA(self): + def test_25_check_topo_XPDRA(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/XPDRA-XPDR1" .format(self.restconf_baseurl)) response = requests.request( @@ -767,17 +821,17 @@ class TransportPCEFulltesting(unittest.TestCase): res = response.json() liste_tp = res['node'][0]['ietf-network-topology:termination-point'] for ele in liste_tp: - if ele['tp-id'] == 'XPDR1-CLIENT1': - self.assertEqual({u'index': 1}, ele['org-openroadm-network-topology:xpdr-client-attributes']['wavelength']) if ele['tp-id'] == 'XPDR1-NETWORK1': - self.assertEqual({u'index': 1}, ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength']) - if ele['tp-id'] == 'XPDR1-CLIENT2': - self.assertEqual({u'index': 2}, ele['org-openroadm-network-topology:xpdr-client-attributes']['wavelength']) + self.assertEqual({u'frequency': 191.35, u'width': 40}, + ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength']) if ele['tp-id'] == 'XPDR1-NETWORK2': - self.assertEqual({u'index': 2}, ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength']) + self.assertEqual({u'frequency': 191.4, u'width': 40}, + ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength']) + if ele['tp-id'] == 'XPDR1-CLIENT1' or ele['tp-id'] == 'XPDR1-CLIENT3': + self.assertNotIn('wavelength', dict.keys(ele['org-openroadm-network-topology:xpdr-client-attributes'])) time.sleep(10) - def test_24_check_topo_ROADMA_SRG1(self): + def test_26_check_topo_ROADMA_SRG1(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/ROADMA-SRG1" .format(self.restconf_baseurl)) response = requests.request( @@ -789,17 +843,21 @@ class TransportPCEFulltesting(unittest.TestCase): liste_tp = res['node'][0]['ietf-network-topology:termination-point'] for ele in liste_tp: if ele['tp-id'] == 'SRG1-PP1-TXRX': - self.assertIn({u'index': 1}, ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) - self.assertNotIn({u'index': 2}, ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) + self.assertIn({u'index': 1, u'frequency': 191.35, u'width': 40}, + ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) + self.assertNotIn({u'index': 2, u'frequency': 191.4, u'width': 40}, + ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) if ele['tp-id'] == 'SRG1-PP2-TXRX': - self.assertIn({u'index': 2}, ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) - self.assertNotIn({u'index': 1}, ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) + self.assertIn({u'index': 2, u'frequency': 191.4, u'width': 40}, + ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) + self.assertNotIn({u'index': 1, u'frequency': 191.35, u'width': 40}, + ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) if ele['tp-id'] == 'SRG1-PP3-TXRX': self.assertNotIn('org-openroadm-network-topology:pp-attributes', dict.keys(ele)) time.sleep(10) - def test_25_check_topo_ROADMA_DEG1(self): + def test_27_check_topo_ROADMA_DEG1(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/ROADMA-DEG1" .format(self.restconf_baseurl)) response = requests.request( @@ -811,15 +869,19 @@ class TransportPCEFulltesting(unittest.TestCase): liste_tp = res['node'][0]['ietf-network-topology:termination-point'] for ele in liste_tp: if ele['tp-id'] == 'DEG1-CTP-TXRX': - self.assertIn({u'index': 1}, ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths']) - self.assertIn({u'index': 2}, ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths']) + self.assertIn({u'index': 1, u'frequency': 191.35, u'width': 40}, + ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths']) + self.assertIn({u'index': 2, u'frequency': 191.4, u'width': 40}, + ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths']) if ele['tp-id'] == 'DEG1-TTP-TXRX': - self.assertIn({u'index': 1}, ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths']) - self.assertIn({u'index': 2}, ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths']) + self.assertIn({u'index': 1, u'frequency': 191.35, u'width': 40}, + ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths']) + self.assertIn({u'index': 2, u'frequency': 191.4, u'width': 40}, + ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths']) time.sleep(10) # creation service test on a non-available resource - def test_26_create_eth_service3(self): + def test_28_create_eth_service3(self): url = ("{}/operations/org-openroadm-service:service-create" .format(self.restconf_baseurl)) data = {"input": { @@ -917,14 +979,14 @@ class TransportPCEFulltesting(unittest.TestCase): auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() - self.assertIn('No path available', + self.assertIn('PCE calculation in progress', res['output']['configuration-response-common']['response-message']) - self.assertIn('500', res['output']['configuration-response-common']['response-code']) - time.sleep(300) + self.assertIn('200', res['output']['configuration-response-common']['response-code']) + time.sleep(self.WAITING) # add a test that check the openroadm-service-list still only contains 2 elements - def test_27_delete_eth_service3(self): + def test_29_delete_eth_service3(self): url = ("{}/operations/org-openroadm-service:service-delete" .format(self.restconf_baseurl)) data = {"input": { @@ -951,7 +1013,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertIn('500', res['output']['configuration-response-common']['response-code']) time.sleep(20) - def test_28_delete_eth_service1(self): + def test_30_delete_eth_service1(self): url = ("{}/operations/org-openroadm-service:service-delete" .format(self.restconf_baseurl)) data = {"input": { @@ -977,7 +1039,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['output']['configuration-response-common']['response-message']) time.sleep(20) - def test_29_delete_eth_service2(self): + def test_31_delete_eth_service2(self): url = ("{}/operations/org-openroadm-service:service-delete" .format(self.restconf_baseurl)) data = {"input": { @@ -1003,7 +1065,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['output']['configuration-response-common']['response-message']) time.sleep(20) - def test_30_check_no_xc_ROADMA(self): + def test_32_check_no_xc_ROADMA(self): url = ("{}/config/network-topology:network-topology/topology/topology-netconf/" "node/ROADMA/yang-ext:mount/org-openroadm-device:org-openroadm-device/" .format(self.restconf_baseurl)) @@ -1014,7 +1076,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertNotIn('roadm-connections', dict.keys(res['org-openroadm-device'])) time.sleep(2) - def test_31_check_topo_XPDRA(self): + def test_33_check_topo_XPDRA(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/XPDRA-XPDR1" .format(self.restconf_baseurl)) response = requests.request( @@ -1023,13 +1085,15 @@ class TransportPCEFulltesting(unittest.TestCase): res = response.json() liste_tp = res['node'][0]['ietf-network-topology:termination-point'] for ele in liste_tp: - if ele[u'org-openroadm-network-topology:tp-type'] == 'XPONDER-CLIENT': + if ((ele[u'org-openroadm-network-topology:tp-type'] == 'XPONDER-CLIENT') + and (ele['tp-id'] == 'XPDR1-CLIENT1' or ele['tp-id'] == 'XPDR1-CLIENT3')): self.assertNotIn('wavelength', dict.keys(ele['org-openroadm-network-topology:xpdr-client-attributes'])) - elif ele[u'org-openroadm-network-topology:tp-type'] == 'XPONDER-NETWORK': + elif ((ele[u'org-openroadm-network-topology:tp-type'] == 'XPONDER-NETWORK') + and (ele['tp-id'] == 'XPDR1-CLIENT1' or ele['tp-id'] == 'XPDR1-CLIENT3')): self.assertNotIn('wavelength', dict.keys(ele['org-openroadm-network-topology:xpdr-network-attributes'])) time.sleep(10) - def test_32_check_topo_ROADMA_SRG1(self): + def test_34_check_topo_ROADMA_SRG1(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/ROADMA-SRG1" .format(self.restconf_baseurl)) response = requests.request( @@ -1040,15 +1104,13 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertIn({u'index': 2}, res['node'][0][u'org-openroadm-network-topology:srg-attributes']['available-wavelengths']) liste_tp = res['node'][0]['ietf-network-topology:termination-point'] for ele in liste_tp: - if ele['tp-id'] == 'SRG1-PP1-TXRX': - self.assertEqual({}, ele['org-openroadm-network-topology:pp-attributes']) - elif ele['tp-id'] == 'SRG1-PP2-TXRX': - self.assertEqual({}, ele['org-openroadm-network-topology:pp-attributes']) + if ele['tp-id'] == 'SRG1-PP1-TXRX' or ele['tp-id'] == 'SRG1-PP1-TXRX': + self.assertNotIn('org-openroadm-network-topology:pp-attributes', dict.keys(ele)) else: self.assertNotIn('org-openroadm-network-topology:pp-attributes', dict.keys(ele)) time.sleep(10) - def test_33_check_topo_ROADMA_DEG1(self): + def test_35_check_topo_ROADMA_DEG1(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/ROADMA-DEG1" .format(self.restconf_baseurl)) response = requests.request( @@ -1060,14 +1122,14 @@ class TransportPCEFulltesting(unittest.TestCase): liste_tp = res['node'][0]['ietf-network-topology:termination-point'] for ele in liste_tp: if ele['tp-id'] == 'DEG1-CTP-TXRX': - self.assertEqual({}, ele['org-openroadm-network-topology:ctp-attributes']) + self.assertNotIn('org-openroadm-network-topology:ctp-attributes', dict.keys(ele)) if ele['tp-id'] == 'DEG1-TTP-TXRX': - self.assertEqual({}, ele['org-openroadm-network-topology:tx-ttp-attributes']) + self.assertNotIn('org-openroadm-network-topology:tx-ttp-attributes', dict.keys(ele)) time.sleep(10) # test service-create for Optical Channel (OC) service from srg-pp to srg-pp - def test_34_create_oc_service1(self): + def test_36_create_oc_service1(self): url = ("{}/operations/org-openroadm-service:service-create" .format(self.restconf_baseurl)) data = {"input": { @@ -1167,9 +1229,9 @@ class TransportPCEFulltesting(unittest.TestCase): res = response.json() self.assertIn('PCE calculation in progress', res['output']['configuration-response-common']['response-message']) - time.sleep(300) + time.sleep(self.WAITING) - def test_35_get_oc_service1(self): + def test_37_get_oc_service1(self): url = ("{}/operational/org-openroadm-service:service-list/services/service1" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json', @@ -1189,7 +1251,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['services'][0]['lifecycle-state'], 'planned') time.sleep(1) - def test_36_check_xc1_ROADMA(self): + def test_38_check_xc1_ROADMA(self): url = ("{}/config/network-topology:network-topology/topology/topology-netconf/" "node/ROADMA/yang-ext:mount/org-openroadm-device:org-openroadm-device/" "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-1" @@ -1213,7 +1275,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['roadm-connections'][0]['destination']) time.sleep(7) - def test_37_check_xc1_ROADMC(self): + def test_39_check_xc1_ROADMC(self): url = ("{}/config/network-topology:network-topology/topology/topology-netconf/" "node/ROADMC/yang-ext:mount/org-openroadm-device:org-openroadm-device/" "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-1" @@ -1237,7 +1299,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['roadm-connections'][0]['destination']) time.sleep(7) - def test_38_create_oc_service2(self): + def test_40_create_oc_service2(self): url = ("{}/operations/org-openroadm-service:service-create" .format(self.restconf_baseurl)) data = {"input": { @@ -1337,9 +1399,9 @@ class TransportPCEFulltesting(unittest.TestCase): res = response.json() self.assertIn('PCE calculation in progress', res['output']['configuration-response-common']['response-message']) - time.sleep(300) + time.sleep(self.WAITING) - def test_39_get_oc_service2(self): + def test_41_get_oc_service2(self): url = ("{}/operational/org-openroadm-service:service-list/services/service2" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json', @@ -1359,7 +1421,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['services'][0]['lifecycle-state'], 'planned') time.sleep(2) - def test_40_check_xc2_ROADMA(self): + def test_42_check_xc2_ROADMA(self): url = ("{}/config/network-topology:network-topology/topology/topology-netconf/" "node/ROADMA/yang-ext:mount/org-openroadm-device:org-openroadm-device/" "roadm-connections/SRG1-PP2-TXRX-DEG1-TTP-TXRX-2" @@ -1383,13 +1445,13 @@ class TransportPCEFulltesting(unittest.TestCase): res['roadm-connections'][0]['destination']) time.sleep(2) - def test_41_check_topo_ROADMA(self): - self.test_24_check_topo_ROADMA_SRG1() - self.test_25_check_topo_ROADMA_DEG1() + def test_43_check_topo_ROADMA(self): + self.test_26_check_topo_ROADMA_SRG1() + self.test_27_check_topo_ROADMA_DEG1() time.sleep(3) - def test_42_delete_oc_service1(self): + def test_44_delete_oc_service1(self): url = ("{}/operations/org-openroadm-service:service-delete" .format(self.restconf_baseurl)) data = {"input": { @@ -1415,7 +1477,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['output']['configuration-response-common']['response-message']) time.sleep(20) - def test_43_delete_oc_service2(self): + def test_45_delete_oc_service2(self): url = ("{}/operations/org-openroadm-service:service-delete" .format(self.restconf_baseurl)) data = {"input": { @@ -1441,7 +1503,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['output']['configuration-response-common']['response-message']) time.sleep(20) - def test_44_get_no_oc_services(self): + def test_46_get_no_oc_services(self): print ("start test") url = ("{}/operational/org-openroadm-service:service-list" .format(self.restconf_baseurl)) @@ -1449,12 +1511,15 @@ class TransportPCEFulltesting(unittest.TestCase): "Accept": "application/json"} response = requests.request( "GET", url, headers=headers, auth=('admin', 'admin')) - self.assertEqual(response.status_code, requests.codes.ok) + self.assertEqual(response.status_code, requests.codes.not_found) res = response.json() - self.assertEqual({u'service-list': {}}, res) + self.assertIn( + {"error-type":"application", "error-tag":"data-missing", + "error-message":"Request could not be completed because the relevant data model content does not exist"}, + res['errors']['error']) time.sleep(1) - def test_45_get_no_xc_ROADMA(self): + def test_47_get_no_xc_ROADMA(self): url = ("{}/config/network-topology:network-topology/topology/topology-netconf" "/node/ROADMA/yang-ext:mount/org-openroadm-device:org-openroadm-device/" .format(self.restconf_baseurl)) @@ -1467,23 +1532,23 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertNotIn(['roadm-connections'][0], res['org-openroadm-device']) time.sleep(1) - def test_46_check_topo_ROADMA(self): - self.test_32_check_topo_ROADMA_SRG1() - self.test_33_check_topo_ROADMA_DEG1() + def test_48_check_topo_ROADMA(self): + self.test_34_check_topo_ROADMA_SRG1() + self.test_35_check_topo_ROADMA_DEG1() - def test_47_loop_create_eth_service(self): + def test_49_loop_create_eth_service(self): for i in range(1,6): print ("trial number {}".format(i)) print("eth service creation") - self.test_13_create_eth_service1() + self.test_11_create_eth_service1() print ("check xc in ROADMA") - self.test_15_check_xc1_ROADMA() + self.test_13_check_xc1_ROADMA() print ("check xc in ROADMC") - self.test_16_check_xc1_ROADMC() + self.test_14_check_xc1_ROADMC() print ("eth service deletion\n") - self.test_28_delete_eth_service1() + self.test_30_delete_eth_service1() - def test_48_loop_create_oc_service(self): + def test_50_loop_create_oc_service(self): url = ("{}/operational/org-openroadm-service:service-list/services/service1" .format(self.restconf_baseurl)) response = requests.request("GET", url, auth=('admin', 'admin')) @@ -1510,16 +1575,16 @@ class TransportPCEFulltesting(unittest.TestCase): for i in range(1,6): print ("trial number {}".format(i)) print("oc service creation") - self.test_34_create_oc_service1() + self.test_36_create_oc_service1() print ("check xc in ROADMA") - self.test_36_check_xc1_ROADMA() + self.test_38_check_xc1_ROADMA() print ("check xc in ROADMC") - self.test_37_check_xc1_ROADMC() + self.test_39_check_xc1_ROADMC() print ("oc service deletion\n") - self.test_42_delete_oc_service1() + self.test_44_delete_oc_service1() - def test_49_disconnect_XPDRA(self): + def test_51_disconnect_XPDRA(self): url = ("{}/config/network-topology:" "network-topology/topology/topology-netconf/node/XPDRA" .format(self.restconf_baseurl)) @@ -1530,7 +1595,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertEqual(response.status_code, requests.codes.ok) time.sleep(10) - def test_50_disconnect_XPDRC(self): + def test_52_disconnect_XPDRC(self): url = ("{}/config/network-topology:" "network-topology/topology/topology-netconf/node/XPDRC" .format(self.restconf_baseurl)) @@ -1541,7 +1606,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertEqual(response.status_code, requests.codes.ok) time.sleep(10) - def test_51_disconnect_ROADMA(self): + def test_53_disconnect_ROADMA(self): url = ("{}/config/network-topology:" "network-topology/topology/topology-netconf/node/ROADMA" .format(self.restconf_baseurl)) @@ -1552,7 +1617,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertEqual(response.status_code, requests.codes.ok) time.sleep(10) - def test_52_disconnect_ROADMC(self): + def test_54_disconnect_ROADMC(self): url = ("{}/config/network-topology:" "network-topology/topology/topology-netconf/node/ROADMC" .format(self.restconf_baseurl)) @@ -1565,4 +1630,4 @@ class TransportPCEFulltesting(unittest.TestCase): if __name__ == "__main__": - unittest.main(verbosity=2) + unittest.main(verbosity=2) \ No newline at end of file diff --git a/tests/transportpce_tests/2.2.1/test_end2end.py b/tests/transportpce_tests/2.2.1/test_end2end.py index 89dfb82aa..8eae4a8a3 100644 --- a/tests/transportpce_tests/2.2.1/test_end2end.py +++ b/tests/transportpce_tests/2.2.1/test_end2end.py @@ -303,9 +303,55 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertIn('Roadm Xponder links created successfully', res["output"]["result"]) time.sleep(2) + def test_09_add_omsAttributes_ROADMA_ROADMC(self): + # Config ROADMA-ROADMC oms-attributes + url = ("{}/config/ietf-network:networks/network/openroadm-topology/ietf-network-topology:" + "link/ROADM-A1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG1-DEG1-TTP-TXRX/org-openroadm-network-topology:" + "OMS-attributes/span" + .format(self.restconf_baseurl)) + data = {"span": { + "clfi": "fiber1", + "auto-spanloss": "true", + "spanloss-base": 11.4, + "spanloss-current": 12, + "engineered-spanloss": 12.2, + "link-concatenation": [{ + "SRLG-Id": 0, + "fiber-type": "smf", + "SRLG-length": 100000, + "pmd": 0.5}]}} + headers = {'content-type': 'application/json'} + response = requests.request( + "PUT", url, data=json.dumps(data), headers=headers, + auth=('admin', 'admin')) + self.assertEqual(response.status_code, requests.codes.created) + + def test_10_add_omsAttributes_ROADMC_ROADMA(self): + # Config ROADMC-ROADMA oms-attributes + url = ("{}/config/ietf-network:networks/network/openroadm-topology/ietf-network-topology:" + "link/ROADM-C1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG2-DEG2-TTP-TXRX/org-openroadm-network-topology:" + "OMS-attributes/span" + .format(self.restconf_baseurl)) + data = {"span": { + "clfi": "fiber1", + "auto-spanloss": "true", + "spanloss-base": 11.4, + "spanloss-current": 12, + "engineered-spanloss": 12.2, + "link-concatenation": [{ + "SRLG-Id": 0, + "fiber-type": "smf", + "SRLG-length": 100000, + "pmd": 0.5}]}} + headers = {'content-type': 'application/json'} + response = requests.request( + "PUT", url, data=json.dumps(data), headers=headers, + auth=('admin', 'admin')) + self.assertEqual(response.status_code, requests.codes.created) + #test service-create for Eth service from xpdr to xpdr - def test_09_create_eth_service1(self): + def test_11_create_eth_service1(self): url = ("{}/operations/org-openroadm-service:service-create" .format(self.restconf_baseurl)) data = {"input": { @@ -407,7 +453,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['output']['configuration-response-common']['response-message']) time.sleep(self.WAITING) - def test_10_get_eth_service1(self): + def test_12_get_eth_service1(self): url = ("{}/operational/org-openroadm-service:service-list/services/service1" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json', @@ -417,8 +463,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertEqual(response.status_code, requests.codes.ok) res = response.json() self.assertEqual( - res['services'][0]['administrative-state'], - 'inService') + res['services'][0]['administrative-state'], 'inService') self.assertEqual( res['services'][0]['service-name'], 'service1') self.assertEqual( @@ -427,7 +472,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['services'][0]['lifecycle-state'], 'planned') time.sleep(2) - def test_11_check_xc1_ROADMA(self): + def test_13_check_xc1_ROADMA(self): url = ("{}/config/network-topology:network-topology/topology/topology-netconf/" "node/ROADM-A1/yang-ext:mount/org-openroadm-device:org-openroadm-device/" "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-1" @@ -450,7 +495,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['roadm-connections'][0]['destination']) time.sleep(5) - def test_12_check_xc1_ROADMC(self): + def test_14_check_xc1_ROADMC(self): url = ("{}/config/network-topology:network-topology/topology/topology-netconf/" "node/ROADM-C1/yang-ext:mount/org-openroadm-device:org-openroadm-device/" "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-1" @@ -473,7 +518,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['roadm-connections'][0]['destination']) time.sleep(5) - def test_13_check_topo_XPDRA(self): + def test_15_check_topo_XPDRA(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/XPDR-A1-XPDR1" .format(self.restconf_baseurl)) response = requests.request( @@ -483,8 +528,8 @@ class TransportPCEFulltesting(unittest.TestCase): liste_tp = res['node'][0]['ietf-network-topology:termination-point'] for ele in liste_tp: if ele['tp-id'] == 'XPDR1-NETWORK1': - self.assertEqual({u'frequency': 196.099999999999994315658113919198513031005859375, - u'width': 1528.76999999999998181010596454143524169921875}, + self.assertEqual({u'frequency': 191.35, + u'width': 40}, ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength']) if ele['tp-id'] == 'XPDR1-CLIENT2' or ele['tp-id'] == 'XPDR1-CLIENT1': self.assertNotIn('wavelength', dict.keys(ele['org-openroadm-network-topology:xpdr-client-attributes'])) @@ -492,39 +537,47 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertNotIn('wavelength', dict.keys(ele['org-openroadm-network-topology:xpdr-network-attributes'])) time.sleep(3) - def test_14_check_topo_ROADMA_SRG1(self): + def test_16_check_topo_ROADMA_SRG1(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/ROADM-A1-SRG1" .format(self.restconf_baseurl)) response = requests.request( "GET", url1, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() - self.assertNotIn({u'index': 1}, res['node'][0][u'org-openroadm-network-topology:srg-attributes']['available-wavelengths']) + self.assertNotIn({u'index': 1}, + res['node'][0][u'org-openroadm-network-topology:srg-attributes']['available-wavelengths']) liste_tp = res['node'][0]['ietf-network-topology:termination-point'] for ele in liste_tp: if ele['tp-id'] == 'SRG1-PP1-TXRX': - self.assertIn({u'index': 1}, ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) + self.assertIn({u'index': 1, u'frequency': 191.35, + u'width': 40}, + ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) if ele['tp-id'] == 'SRG1-PP2-TXRX': self.assertNotIn('used-wavelength', dict.keys(ele)) time.sleep(3) - def test_15_check_topo_ROADMA_DEG1(self): + def test_17_check_topo_ROADMA_DEG1(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/ROADM-A1-DEG2" .format(self.restconf_baseurl)) response = requests.request( "GET", url1, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) res = response.json() - self.assertNotIn({u'index': 1}, res['node'][0][u'org-openroadm-network-topology:degree-attributes']['available-wavelengths']) + self.assertNotIn({u'index': 1}, + res['node'][0][u'org-openroadm-network-topology:degree-attributes']['available-wavelengths']) liste_tp = res['node'][0]['ietf-network-topology:termination-point'] for ele in liste_tp: if ele['tp-id'] == 'DEG2-CTP-TXRX': - self.assertIn({u'index': 1}, ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths']) + self.assertIn({u'index': 1, u'frequency': 191.35, + u'width': 40}, + ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths']) if ele['tp-id'] == 'DEG2-TTP-TXRX': - self.assertIn({u'index': 1}, ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths']) + self.assertIn({u'index': 1, u'frequency': 191.35, + u'width': 40}, + ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths']) time.sleep(3) - def test_16_connect_xprdA_N2_to_roadmA_PP2(self): + def test_18_connect_xprdA_N2_to_roadmA_PP2(self): url = "{}/operations/transportpce-networkutils:init-xpdr-rdm-links".format(self.restconf_baseurl) data = { "networkutils:input": { @@ -547,7 +600,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertIn('Xponder Roadm Link created successfully', res["output"]["result"]) time.sleep(2) - def test_17_connect_roadmA_PP2_to_xpdrA_N2(self): + def test_19_connect_roadmA_PP2_to_xpdrA_N2(self): url = "{}/operations/transportpce-networkutils:init-rdm-xpdr-links".format(self.restconf_baseurl) data = { "networkutils:input": { @@ -570,7 +623,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertIn('Roadm Xponder links created successfully', res["output"]["result"]) time.sleep(2) - def test_18_connect_xprdC_N2_to_roadmC_PP2(self): + def test_20_connect_xprdC_N2_to_roadmC_PP2(self): url = "{}/operations/transportpce-networkutils:init-xpdr-rdm-links".format(self.restconf_baseurl) data = { "networkutils:input": { @@ -593,7 +646,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertIn('Xponder Roadm Link created successfully', res["output"]["result"]) time.sleep(2) - def test_19_connect_roadmC_PP2_to_xpdrC_N2(self): + def test_21_connect_roadmC_PP2_to_xpdrC_N2(self): url = "{}/operations/transportpce-networkutils:init-rdm-xpdr-links".format(self.restconf_baseurl) data = { "networkutils:input": { @@ -616,7 +669,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertIn('Roadm Xponder links created successfully', res["output"]["result"]) time.sleep(2) - def test_20_create_eth_service2(self): + def test_22_create_eth_service2(self): url = ("{}/operations/org-openroadm-service:service-create" .format(self.restconf_baseurl)) data = {"input": { @@ -718,7 +771,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['output']['configuration-response-common']['response-message']) time.sleep(self.WAITING) - def test_21_get_eth_service2(self): + def test_23_get_eth_service2(self): url = ("{}/operational/org-openroadm-service:service-list/services/service2" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json', @@ -738,7 +791,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['services'][0]['lifecycle-state'], 'planned') time.sleep(1) - def test_22_check_xc2_ROADMA(self): + def test_24_check_xc2_ROADMA(self): url = ("{}/config/network-topology:network-topology/topology/topology-netconf/" "node/ROADM-A1/yang-ext:mount/org-openroadm-device:org-openroadm-device/" "roadm-connections/DEG2-TTP-TXRX-SRG1-PP2-TXRX-2" @@ -759,7 +812,7 @@ class TransportPCEFulltesting(unittest.TestCase): {'dst-if': 'SRG1-PP2-TXRX-nmc-2'}, res['roadm-connections'][0]['destination']) - def test_23_check_topo_XPDRA(self): + def test_25_check_topo_XPDRA(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/XPDR-A1-XPDR1" .format(self.restconf_baseurl)) response = requests.request( @@ -769,18 +822,18 @@ class TransportPCEFulltesting(unittest.TestCase): liste_tp = res['node'][0]['ietf-network-topology:termination-point'] for ele in liste_tp: if ele['tp-id'] == 'XPDR1-NETWORK1': - self.assertEqual({u'frequency': 196.099999999999994315658113919198513031005859375, - u'width': 1528.76999999999998181010596454143524169921875}, + self.assertEqual({u'frequency': 191.35, + u'width': 40}, ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength']) if ele['tp-id'] == 'XPDR1-NETWORK2': - self.assertEqual({u'frequency': 196.04999999999998, - u'width': 1529.16}, + self.assertEqual({u'frequency': 191.4, + u'width': 40}, ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength']) if ele['tp-id'] == 'XPDR1-CLIENT1' or ele['tp-id'] == 'XPDR1-CLIENT2': self.assertNotIn('wavelength', dict.keys(ele['org-openroadm-network-topology:xpdr-client-attributes'])) time.sleep(10) - def test_24_check_topo_ROADMA_SRG1(self): + def test_26_check_topo_ROADMA_SRG1(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/ROADM-A1-SRG1" .format(self.restconf_baseurl)) response = requests.request( @@ -792,17 +845,24 @@ class TransportPCEFulltesting(unittest.TestCase): liste_tp = res['node'][0]['ietf-network-topology:termination-point'] for ele in liste_tp: if ele['tp-id'] == 'SRG1-PP1-TXRX': - self.assertIn({u'index': 1}, ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) - self.assertNotIn({u'index': 2}, ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) + self.assertIn({u'index': 1, u'frequency': 191.35, + u'width': 40}, + ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) + self.assertNotIn({u'index': 2, u'frequency': 191.4, + u'width': 40}, + ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) if ele['tp-id'] == 'SRG1-PP2-TXRX': - self.assertIn({u'index': 2}, ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) - self.assertNotIn({u'index': 1}, ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) + self.assertIn({u'index': 2, u'frequency': 191.4, u'width': 40}, + ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) + self.assertNotIn({u'index': 1, u'frequency': 191.35, + u'width': 40}, + ele['org-openroadm-network-topology:pp-attributes']['used-wavelength']) if ele['tp-id'] == 'SRG1-PP3-TXRX': self.assertNotIn('org-openroadm-network-topology:pp-attributes', dict.keys(ele)) time.sleep(10) - def test_25_check_topo_ROADMA_DEG2(self): + def test_27_check_topo_ROADMA_DEG2(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/ROADM-A1-DEG2" .format(self.restconf_baseurl)) response = requests.request( @@ -814,15 +874,21 @@ class TransportPCEFulltesting(unittest.TestCase): liste_tp = res['node'][0]['ietf-network-topology:termination-point'] for ele in liste_tp: if ele['tp-id'] == 'DEG2-CTP-TXRX': - self.assertIn({u'index': 1}, ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths']) - self.assertIn({u'index': 2}, ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths']) + self.assertIn({u'index': 1, u'frequency': 191.35, + u'width': 40}, + ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths']) + self.assertIn({u'index': 2, u'frequency': 191.4, u'width': 40}, + ele['org-openroadm-network-topology:ctp-attributes']['used-wavelengths']) if ele['tp-id'] == 'DEG2-TTP-TXRX': - self.assertIn({u'index': 1}, ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths']) - self.assertIn({u'index': 2}, ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths']) + self.assertIn({u'index': 1, u'frequency': 191.35, + u'width': 40}, + ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths']) + self.assertIn({u'index': 2, u'frequency': 191.4, u'width': 40}, + ele['org-openroadm-network-topology:tx-ttp-attributes']['used-wavelengths']) time.sleep(10) # creation service test on a non-available resource - def test_26_create_eth_service3(self): + def test_28_create_eth_service3(self): url = ("{}/operations/org-openroadm-service:service-create" .format(self.restconf_baseurl)) data = {"input": { @@ -927,7 +993,7 @@ class TransportPCEFulltesting(unittest.TestCase): # add a test that check the openroadm-service-list still only contains 2 elements - def test_27_delete_eth_service3(self): + def test_29_delete_eth_service3(self): url = ("{}/operations/org-openroadm-service:service-delete" .format(self.restconf_baseurl)) data = {"input": { @@ -954,7 +1020,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertIn('500', res['output']['configuration-response-common']['response-code']) time.sleep(20) - def test_28_delete_eth_service1(self): + def test_30_delete_eth_service1(self): url = ("{}/operations/org-openroadm-service:service-delete" .format(self.restconf_baseurl)) data = {"input": { @@ -980,7 +1046,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['output']['configuration-response-common']['response-message']) time.sleep(20) - def test_29_delete_eth_service2(self): + def test_31_delete_eth_service2(self): url = ("{}/operations/org-openroadm-service:service-delete" .format(self.restconf_baseurl)) data = {"input": { @@ -1006,7 +1072,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['output']['configuration-response-common']['response-message']) time.sleep(20) - def test_30_check_no_xc_ROADMA(self): + def test_32_check_no_xc_ROADMA(self): url = ("{}/config/network-topology:network-topology/topology/topology-netconf/" "node/ROADM-A1/yang-ext:mount/org-openroadm-device:org-openroadm-device/" .format(self.restconf_baseurl)) @@ -1017,7 +1083,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertNotIn('roadm-connections', dict.keys(res['org-openroadm-device'])) time.sleep(2) - def test_31_check_topo_XPDRA(self): + def test_33_check_topo_XPDRA(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/XPDR-A1-XPDR1" .format(self.restconf_baseurl)) response = requests.request( @@ -1032,7 +1098,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertNotIn('wavelength', dict.keys(ele['org-openroadm-network-topology:xpdr-network-attributes'])) time.sleep(10) - def test_32_check_topo_ROADMA_SRG1(self): + def test_34_check_topo_ROADMA_SRG1(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/ROADM-A1-SRG1" .format(self.restconf_baseurl)) response = requests.request( @@ -1049,7 +1115,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertNotIn('org-openroadm-network-topology:pp-attributes', dict.keys(ele)) time.sleep(10) - def test_33_check_topo_ROADMA_DEG2(self): + def test_35_check_topo_ROADMA_DEG2(self): url1 = ("{}/config/ietf-network:networks/network/openroadm-topology/node/ROADM-A1-DEG2" .format(self.restconf_baseurl)) response = requests.request( @@ -1061,14 +1127,14 @@ class TransportPCEFulltesting(unittest.TestCase): liste_tp = res['node'][0]['ietf-network-topology:termination-point'] for ele in liste_tp: if ele['tp-id'] == 'DEG2-CTP-TXRX': - self.assertNotIn('org-openroadm-network-topology:pp-attributes', dict.keys(ele)) + self.assertNotIn('org-openroadm-network-topology:ctp-attributes', dict.keys(ele)) if ele['tp-id'] == 'DEG2-TTP-TXRX': - self.assertNotIn('org-openroadm-network-topology:pp-attributes', dict.keys(ele)) + self.assertNotIn('org-openroadm-network-topology:tx-ttp-attributes', dict.keys(ele)) time.sleep(10) # test service-create for Optical Channel (OC) service from srg-pp to srg-pp - def test_34_create_oc_service1(self): + def test_36_create_oc_service1(self): url = ("{}/operations/org-openroadm-service:service-create" .format(self.restconf_baseurl)) data = {"input": { @@ -1170,7 +1236,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['output']['configuration-response-common']['response-message']) time.sleep(self.WAITING) - def test_35_get_oc_service1(self): + def test_37_get_oc_service1(self): url = ("{}/operational/org-openroadm-service:service-list/services/service1" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json', @@ -1190,7 +1256,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['services'][0]['lifecycle-state'], 'planned') time.sleep(1) - def test_36_check_xc1_ROADMA(self): + def test_38_check_xc1_ROADMA(self): url = ("{}/config/network-topology:network-topology/topology/topology-netconf/" "node/ROADM-A1/yang-ext:mount/org-openroadm-device:org-openroadm-device/" "roadm-connections/SRG1-PP1-TXRX-DEG2-TTP-TXRX-1" @@ -1213,7 +1279,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['roadm-connections'][0]['destination']) time.sleep(7) - def test_37_check_xc1_ROADMC(self): + def test_39_check_xc1_ROADMC(self): url = ("{}/config/network-topology:network-topology/topology/topology-netconf/" "node/ROADM-C1/yang-ext:mount/org-openroadm-device:org-openroadm-device/" "roadm-connections/SRG1-PP1-TXRX-DEG1-TTP-TXRX-1" @@ -1236,7 +1302,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['roadm-connections'][0]['destination']) time.sleep(7) - def test_38_create_oc_service2(self): + def test_40_create_oc_service2(self): url = ("{}/operations/org-openroadm-service:service-create" .format(self.restconf_baseurl)) data = {"input": { @@ -1338,7 +1404,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['output']['configuration-response-common']['response-message']) time.sleep(self.WAITING) - def test_39_get_oc_service2(self): + def test_41_get_oc_service2(self): url = ("{}/operational/org-openroadm-service:service-list/services/service2" .format(self.restconf_baseurl)) headers = {'content-type': 'application/json', @@ -1358,7 +1424,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['services'][0]['lifecycle-state'], 'planned') time.sleep(2) - def test_40_check_xc2_ROADMA(self): + def test_42_check_xc2_ROADMA(self): url = ("{}/config/network-topology:network-topology/topology/topology-netconf/" "node/ROADM-A1/yang-ext:mount/org-openroadm-device:org-openroadm-device/" "roadm-connections/SRG1-PP2-TXRX-DEG2-TTP-TXRX-2" @@ -1381,13 +1447,13 @@ class TransportPCEFulltesting(unittest.TestCase): res['roadm-connections'][0]['destination']) time.sleep(2) - def test_41_check_topo_ROADMA(self): - self.test_24_check_topo_ROADMA_SRG1() - self.test_25_check_topo_ROADMA_DEG2() + def test_43_check_topo_ROADMA(self): + self.test_26_check_topo_ROADMA_SRG1() + self.test_27_check_topo_ROADMA_DEG2() time.sleep(3) - def test_42_delete_oc_service1(self): + def test_44_delete_oc_service1(self): url = ("{}/operations/org-openroadm-service:service-delete" .format(self.restconf_baseurl)) data = {"input": { @@ -1413,7 +1479,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['output']['configuration-response-common']['response-message']) time.sleep(20) - def test_43_delete_oc_service2(self): + def test_45_delete_oc_service2(self): url = ("{}/operations/org-openroadm-service:service-delete" .format(self.restconf_baseurl)) data = {"input": { @@ -1439,7 +1505,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['output']['configuration-response-common']['response-message']) time.sleep(20) - def test_44_get_no_oc_services(self): + def test_46_get_no_oc_services(self): print ("start test") url = ("{}/operational/org-openroadm-service:service-list" .format(self.restconf_baseurl)) @@ -1455,7 +1521,7 @@ class TransportPCEFulltesting(unittest.TestCase): res['errors']['error']) time.sleep(1) - def test_45_get_no_xc_ROADMA(self): + def test_47_get_no_xc_ROADMA(self): url = ("{}/config/network-topology:network-topology/topology/topology-netconf" "/node/ROADM-A1/yang-ext:mount/org-openroadm-device:org-openroadm-device/" .format(self.restconf_baseurl)) @@ -1468,25 +1534,25 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertNotIn(['roadm-connections'][0], res['org-openroadm-device']) time.sleep(1) - def test_46_check_topo_ROADMA(self): - self.test_32_check_topo_ROADMA_SRG1() - self.test_33_check_topo_ROADMA_DEG2() + def test_48_check_topo_ROADMA(self): + self.test_34_check_topo_ROADMA_SRG1() + self.test_35_check_topo_ROADMA_DEG2() @unittest.expectedFailure - def test_47_loop_create_eth_service(self): + def test_49_loop_create_eth_service(self): for i in range(1,6): print ("trial number {}".format(i)) print("eth service creation") - self.test_09_create_eth_service1() + self.test_11_create_eth_service1() print ("check xc in ROADM-A1") - self.test_11_check_xc1_ROADMA() + self.test_13_check_xc1_ROADMA() print ("check xc in ROADM-C1") - self.test_12_check_xc1_ROADMC() + self.test_14_check_xc1_ROADMC() print ("eth service deletion\n") - self.test_28_delete_eth_service1() + self.test_30_delete_eth_service1() @unittest.expectedFailure - def test_48_loop_create_oc_service(self): + def test_50_loop_create_oc_service(self): url = ("{}/operational/org-openroadm-service:service-list/services/service1" .format(self.restconf_baseurl)) response = requests.request("GET", url, auth=('admin', 'admin')) @@ -1513,16 +1579,16 @@ class TransportPCEFulltesting(unittest.TestCase): for i in range(1,6): print ("trial number {}".format(i)) print("oc service creation") - self.test_34_create_oc_service1() + self.test_36_create_oc_service1() print ("check xc in ROADM-A1") - self.test_36_check_xc1_ROADMA() + self.test_38_check_xc1_ROADMA() print ("check xc in ROADM-C1") - self.test_37_check_xc1_ROADMC() + self.test_39_check_xc1_ROADMC() print ("oc service deletion\n") - self.test_42_delete_oc_service1() + self.test_44_delete_oc_service1() - def test_49_disconnect_XPDRA(self): + def test_51_disconnect_XPDRA(self): url = ("{}/config/network-topology:" "network-topology/topology/topology-netconf/node/XPDR-A1" .format(self.restconf_baseurl)) @@ -1533,7 +1599,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertEqual(response.status_code, requests.codes.ok) time.sleep(10) - def test_50_disconnect_XPDRC(self): + def test_52_disconnect_XPDRC(self): url = ("{}/config/network-topology:" "network-topology/topology/topology-netconf/node/XPDR-C1" .format(self.restconf_baseurl)) @@ -1544,7 +1610,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertEqual(response.status_code, requests.codes.ok) time.sleep(10) - def test_51_disconnect_ROADMA(self): + def test_53_disconnect_ROADMA(self): url = ("{}/config/network-topology:" "network-topology/topology/topology-netconf/node/ROADM-A1" .format(self.restconf_baseurl)) @@ -1555,7 +1621,7 @@ class TransportPCEFulltesting(unittest.TestCase): self.assertEqual(response.status_code, requests.codes.ok) time.sleep(10) - def test_52_disconnect_ROADMC(self): + def test_54_disconnect_ROADMC(self): url = ("{}/config/network-topology:" "network-topology/topology/topology-netconf/node/ROADM-C1" .format(self.restconf_baseurl)) -- 2.36.6