aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/functest_utils.py
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-02-11 16:26:20 +0100
committerjose.lausuch <jose.lausuch@ericsson.com>2016-02-16 21:35:25 +0100
commit12c1b110e91b2c062b378561f3fb271fe0626aec (patch)
tree14a3da8a4839d57e8a7fa1913f60cd92b2fac950 /testcases/functest_utils.py
parent84199df6dfa9c53eafff8171d18e9638f4e9d602 (diff)
Create vPing instances with dynamic ports created by nova/neutron
Also, - check if the used network is already created to not create it again - check if the image already exists to not create it again - check if the sec group already exists to not create it again Change-Id: I243619a1538444d836fdda84a86b834668aaf456 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
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 94a4fa8a5..838e72634 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,