From 1666b0e4a2b13f2a2cef13475668edd62fa6c173 Mon Sep 17 00:00:00 2001 From: Martial COULIBALY Date: Wed, 10 Oct 2018 16:27:49 +0200 Subject: [PATCH] Bug correction in topoPortMapping tests Change-Id: I7942014db5149258a7718c653a4e80db2b132f49 Signed-off-by: Martial COULIBALY --- tests/setup.cfg | 1 - tests/tox.ini | 2 +- .../test_topoPortMapping.py | 53 +++++++++---------- 3 files changed, 25 insertions(+), 31 deletions(-) diff --git a/tests/setup.cfg b/tests/setup.cfg index b55072092..f100a50cd 100644 --- a/tests/setup.cfg +++ b/tests/setup.cfg @@ -1,6 +1,5 @@ [metadata] name = tansportpce-tests -version = 0.2 home-page = https://wiki.opendaylight.org/view/TransportPCE:Main [files] diff --git a/tests/tox.ini b/tests/tox.ini index 5ddf755e6..de53fcdfe 100644 --- a/tests/tox.ini +++ b/tests/tox.ini @@ -9,7 +9,7 @@ deps = -r{toxinidir}/test-requirements.txt whitelist_externals = bash commands = - {py27,portmapping,rspn,topology,pce}: bash -c "(cd .. && mvn clean install -DskipTests -Dmaven.javadoc.skip=true)" + {py27,portmapping,topoPortMapping,rspn,topology,pce}: bash -c "(cd .. && mvn clean install -DskipTests -Dmaven.javadoc.skip=true)" {py27,topology,topoPortMapping}: ./buildTesttool.sh {py27,portmapping,rspn}: ./buildHoneynode.sh #py27: nosetests --with-xunit transportpce_tests/ diff --git a/tests/transportpce_tests/test_topoPortMapping.py b/tests/transportpce_tests/test_topoPortMapping.py index 40d07a2ee..fa1ed4db7 100644 --- a/tests/transportpce_tests/test_topoPortMapping.py +++ b/tests/transportpce_tests/test_topoPortMapping.py @@ -163,15 +163,6 @@ class TransportPCEtesting(unittest.TestCase): "DELETE", url, data=json.dumps(data), headers=headers, auth=('admin', 'admin')) self.assertEqual(response.status_code, requests.codes.ok) - #Delete in the clli-network - url = ("{}/config/ietf-network:network/clli-network/node/NodeA" - .format(self.restconf_baseurl)) - data = {} - headers = {'content-type': 'application/json'} - response = requests.request( - "DELETE", url, data=json.dumps(data), headers=headers, - auth=('admin', 'admin')) - self.assertEqual(response.status_code, requests.codes.ok) #Delete in the openroadm-network url = ("{}/config/ietf-network:network/openroadm-network/node/ROADMA" .format(self.restconf_baseurl)) @@ -210,6 +201,8 @@ class TransportPCEtesting(unittest.TestCase): def test_05_compareOpenroadmTopologyPortMapping(self): nbXPDR=1 for p in(1,nbXPDR+1): + if(p > nbXPDR): + break; url_topo = "{}/config/ietf-network:network/openroadm-topology/node/XPDRA-XPDR"+`p` with open('./transportpce_tests/log/topoPortMap.log', 'a') as outfile1: outfile1.write('Config: '+`p`+' : '+url_topo+'\n') @@ -230,26 +223,28 @@ class TransportPCEtesting(unittest.TestCase): response_portMap = requests.request( "GET", url, headers=headers, auth=('admin', 'admin')) self.assertEqual(response_portMap.status_code, requests.codes.ok) - #Verify the tail equipment id of the client - xpdr_client=res_topo['node'][0]['ietf-network-topology:termination-point'][i]["org-openroadm-network-topology:xpdr-client-attributes"]["tail-equipment-id"] - url_map = "{}/config/portmapping:network/nodes/XPDRA/mapping/"+xpdr_client - with open('./transportpce_tests/log/topoPortMap.log', 'a') as outfile1: - outfile1.write('Config: '+`i`+'/'+ `nbTP`+' : '+xpdr_client+'\n') - url = url_map.format(self.restconf_baseurl) - headers = {'content-type': 'application/json'} - response_xpdrClient = requests.request( - "GET", url, headers=headers, auth=('admin', 'admin')) - self.assertEqual(response_xpdrClient.status_code, requests.codes.ok) - #Verify the tail equipment id of the network - xpdr_network=res_topo['node'][0]['ietf-network-topology:termination-point'][i]["org-openroadm-network-topology:xpdr-network-attributes"]["tail-equipment-id"] - url_map = "{}/config/portmapping:network/nodes/XPDRA/mapping/"+xpdr_network - with open('./transportpce_tests/log/topoPortMap.log', 'a') as outfile1: - outfile1.write('Config: '+`i`+'/'+ `nbTP`+' : '+xpdr_network+'\n') - url = url_map.format(self.restconf_baseurl) - headers = {'content-type': 'application/json'} - response_xpdrNetwork = requests.request( - "GET", url, headers=headers, auth=('admin', 'admin')) - self.assertEqual(response_xpdrNetwork.status_code, requests.codes.ok) + if("CLIENT" in tp_id): + #Verify the tail equipment id of the client + xpdr_client=res_topo['node'][0]['ietf-network-topology:termination-point'][i]["org-openroadm-network-topology:xpdr-client-attributes"]["tail-equipment-id"] + url_map = "{}/config/portmapping:network/nodes/XPDRA/mapping/"+xpdr_client + with open('./transportpce_tests/log/topoPortMap.log', 'a') as outfile1: + outfile1.write('Config: '+`i`+'/'+ `nbTP`+' : '+xpdr_client+'\n') + url = url_map.format(self.restconf_baseurl) + headers = {'content-type': 'application/json'} + response_xpdrClient = requests.request( + "GET", url, headers=headers, auth=('admin', 'admin')) + self.assertEqual(response_xpdrClient.status_code, requests.codes.ok) + if("NETWORK" in tp_id): + #Verify the tail equipment id of the network + xpdr_network=res_topo['node'][0]['ietf-network-topology:termination-point'][i]["org-openroadm-network-topology:xpdr-network-attributes"]["tail-equipment-id"] + url_map = "{}/config/portmapping:network/nodes/XPDRA/mapping/"+xpdr_network + with open('./transportpce_tests/log/topoPortMap.log', 'a') as outfile1: + outfile1.write('Config: '+`i`+'/'+ `nbTP`+' : '+xpdr_network+'\n') + url = url_map.format(self.restconf_baseurl) + headers = {'content-type': 'application/json'} + response_xpdrNetwork = requests.request( + "GET", url, headers=headers, auth=('admin', 'admin')) + self.assertEqual(response_xpdrNetwork.status_code, requests.codes.ok) #Disconnect the XPDRA def test_06_disconnect_device(self): -- 2.36.6