aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/VIM/OpenStack/CI/libraries
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2015-12-18 10:09:22 +0100
committerjose.lausuch <jose.lausuch@ericsson.com>2015-12-18 10:16:57 +0100
commita7e744ed870eddb1c1628f22fde85f9652fa6dc8 (patch)
treea3ee74f5035c4f64071c9470f3cc8b4200a3f75c /testcases/VIM/OpenStack/CI/libraries
parent4e9512420f4bc2533eca3e52e9862cf59e2fa9be (diff)
Adding more robust check to delete a port in clean_openstack.
Change-Id: I87ec537cde0b8ef8fd8d11aa327e93087f2125c4 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'testcases/VIM/OpenStack/CI/libraries')
-rw-r--r--testcases/VIM/OpenStack/CI/libraries/clean_openstack.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py
index b92c55a4e..6516c7db3 100644
--- a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py
+++ b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py
@@ -171,19 +171,28 @@ def remove_networks(neutron_client):
logger.debug("There are no ports in the deployment. ")
return
+ #debug information (to be removed when it works many times in a row)
+ print ports
+
for port in ports:
if port['network_id'] in network_ids:
port_id = port['id']
try:
subnet_id = port['fixed_ips'][0]['subnet_id']
except:
- logger.info(" > ERROR: Error removing port %s." % port_id)
+ logger.info(" > WARNING: Port %s does not contain 'fixed_ips'" % port_id)
print port
- print ports
- continue
router_id = port['device_id']
- if port['device_owner'] == 'network:router_interface':
+ if len(port['fixed_ips']) == 0 and router_id == '':
+ logger.debug("Removing port %s ..." % port_id)
+ if functest_utils.delete_neutron_port(neutron_client, port_id):
+ logger.debug(" > Done!")
+ else:
+ logger.info(" > ERROR: There has been a problem removing the "
+ "port %s ..." %port_id)
+
+ elif port['device_owner'] == 'network:router_interface':
logger.debug("Detaching port %s (subnet %s) from router %s ..."
% (port_id,subnet_id,router_id))
if functest_utils.remove_interface_router(neutron_client,