aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/functest_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'testcases/functest_utils.py')
-rw-r--r--testcases/functest_utils.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/testcases/functest_utils.py b/testcases/functest_utils.py
index 94a4fa8a..838e7263 100644
--- a/testcases/functest_utils.py
+++ b/testcases/functest_utils.py
@@ -218,6 +218,26 @@ def get_network_id(neutron_client, network_name):
return id
+def get_subnet_id(neutron_client, subnet_name):
+ subnets = neutron_client.list_subnets()['subnets']
+ id = ''
+ for s in subnets:
+ if s['name'] == subnet_name:
+ id = s['id']
+ break
+ return id
+
+
+def get_router_id(neutron_client, router_name):
+ routers = neutron_client.list_routers()['routers']
+ id = ''
+ for r in routers:
+ if r['name'] == router_name:
+ id = r['id']
+ break
+ return id
+
+
def get_private_net(neutron_client):
# Checks if there is an existing shared private network
networks = neutron_client.list_networks()['networks']
@@ -419,6 +439,15 @@ def get_security_groups(neutron_client):
print "Error [get_security_groups(neutron_client)]:", e
return None
+def get_security_group_id(neutron_client, sg_name):
+ security_groups = get_security_groups(neutron_client)
+ id = ''
+ for sg in security_groups:
+ if sg['name'] == sg_name:
+ id = sg['id']
+ break
+ return id
+
def create_security_group(neutron_client, sg_name, sg_description):
json_body = {'security_group': {'name': sg_name,