diff options
author | jose.lausuch <jose.lausuch@ericsson.com> | 2016-02-11 16:26:20 +0100 |
---|---|---|
committer | Jose Lausuch <jose.lausuch@ericsson.com> | 2016-02-16 21:05:42 +0000 |
commit | f469d0ae28ebe40e8ec407dd3119f630d0cfb74b (patch) | |
tree | 3a67334559aac9a80311c16fe0588064d4f3b016 /testcases/functest_utils.py | |
parent | bcf423b3f3d295e714fbce1d0073dbbeb07b894f (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>
(cherry picked from commit 12c1b110e91b2c062b378561f3fb271fe0626aec)
Diffstat (limited to 'testcases/functest_utils.py')
-rw-r--r-- | testcases/functest_utils.py | 29 |
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, |