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 00:03:53 +0100
commit625dde8e972f2586e986a46225ce87ebd3823b79 (patch)
treea2772d34ccaef8e3191251bcbf9dcbb19c35902e /testcases/functest_utils.py
parentc102fcb9bbaf2ba691bcc22ca6969fff48211826 (diff)
Added vPing2 using SCP and SSH instead of nova userdata
Change-Id: I194f88a4d213e5ad2225241420a9254878f4f7f4 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
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 baab415d9..d9f43a79e 100644
--- a/testcases/functest_utils.py
+++ b/testcases/functest_utils.py
@@ -116,6 +116,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:
@@ -124,6 +133,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:
@@ -226,6 +242,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:
@@ -322,6 +347,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,