aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/functest_utils.py
diff options
context:
space:
mode:
authorViktor Tikkanen <viktor.tikkanen@nokia.com>2015-12-28 14:06:45 +0200
committerViktor Tikkanen <viktor.tikkanen@nokia.com>2015-12-28 14:10:15 +0200
commit675652f37c57fe61900d2ac5735b0be9b6269252 (patch)
tree91ae9fce0f3b892403e3f62966abe93a4db1e44b /testcases/functest_utils.py
parentabe4c7197f4c04e39757889e8b4db496569aef9f (diff)
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 <viktor.tikkanen@nokia.com>
Diffstat (limited to 'testcases/functest_utils.py')
-rw-r--r--testcases/functest_utils.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/testcases/functest_utils.py b/testcases/functest_utils.py
index 87506083..00a7b305 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)