From 675652f37c57fe61900d2ac5735b0be9b6269252 Mon Sep 17 00:00:00 2001 From: Viktor Tikkanen Date: Mon, 28 Dec 2015 14:06:45 +0200 Subject: Support for removing hanging ports Sometimes we have situations when all the routers are deleted but there are still ports with network:router_gateway device owner. Such ports can be deleted only after clearing the device owner information. update_neutron_port() function is added into functest_utils.py and taken into use in clean_openstack.py. Change-Id: I1c9ba2ac499edecec99849b5e895be0248ffd84f Signed-off-by: Viktor Tikkanen --- testcases/functest_utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'testcases/functest_utils.py') diff --git a/testcases/functest_utils.py b/testcases/functest_utils.py index 875060835..00a7b3054 100644 --- a/testcases/functest_utils.py +++ b/testcases/functest_utils.py @@ -235,6 +235,19 @@ def create_neutron_port(neutron_client, name, network_id, ip): return False +def update_neutron_port(neutron_client, port_id, device_owner): + json_body = {'port': { + 'device_owner': device_owner, + }} + try: + port = neutron_client.update_port(port=port_id, + body=json_body) + return port['port']['id'] + except: + print "Error:", sys.exc_info()[0] + return False + + def delete_neutron_port(neutron_client, port_id): try: neutron_client.delete_port(port_id) -- cgit 1.2.3-korg