aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/functest_utils.py
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-01-19 11:53:39 +0100
committerJose Lausuch <jose.lausuch@ericsson.com>2016-01-20 09:41:21 +0000
commita7930e2b4ef5a9dc715d5dae00232c338d9313a7 (patch)
treeb3fe8b2bb0ac525ed059eb97a401239676d49c69 /testcases/functest_utils.py
parent0ae68c03b9669a2b413110e20f96a562f9542b91 (diff)
Added vPing2 using SCP and SSH instead of nova userdata
Change-Id: I194f88a4d213e5ad2225241420a9254878f4f7f4 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com> (cherry picked from commit 625dde8e972f2586e986a46225ce87ebd3823b79)
Diffstat (limited to 'testcases/functest_utils.py')
-rw-r--r--testcases/functest_utils.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/testcases/functest_utils.py b/testcases/functest_utils.py
index ef0b8afd2..e76ef991b 100644
--- a/testcases/functest_utils.py
+++ b/testcases/functest_utils.py
@@ -117,6 +117,15 @@ def delete_instance(nova_client, instance_id):
print "Error:", sys.exc_info()[0]
return False
+def create_floating_ip(neutron_client):
+ extnet_id = get_external_net_id(neutron_client)
+ props = {'floating_network_id': extnet_id}
+ try:
+ ip_json = neutron_client.create_floatingip({'floatingip': props})
+ floating_ip = ip_json['floatingip']['floating_ip_address']
+ except:
+ return None
+ return floating_ip
def get_floating_ips(nova_client):
try:
@@ -125,6 +134,13 @@ def get_floating_ips(nova_client):
except:
return None
+def add_floating_ip(nova_client, server_id, floatingip_id):
+ try:
+ nova_client.servers.add_floating_ip(server_id,floatingip_id)
+ return True
+ except:
+ print "Error:", sys.exc_info()[0]
+ return None
def delete_floating_ip(nova_client, floatingip_id):
try:
@@ -227,6 +243,15 @@ def remove_interface_router(neutron_client, router_id, subnet_id):
print "Error:", sys.exc_info()[0]
return False
+def add_gateway_router(neutron_client, router_id):
+ ext_net_id = get_external_net_id(neutron_client)
+ router_dict = {'network_id': ext_net_id}
+ try:
+ neutron_client.add_gateway_router(router_id,router_dict)
+ return True
+ except:
+ print "Error:", sys.exc_info()[0]
+ return False
def remove_gateway_router(neutron_client, router_id):
try:
@@ -323,6 +348,13 @@ def get_external_net(neutron_client):
return False
+def get_external_net_id(neutron_client):
+ for network in neutron_client.list_networks()['networks']:
+ if network['router:external']:
+ return network['id']
+ return False
+
+
def update_sg_quota(neutron_client, tenant_id, sg_quota, sg_rule_quota):
json_body = {"quota": {
"security_group": sg_quota,