summaryrefslogtreecommitdiffstats
path: root/testcases
diff options
context:
space:
mode:
Diffstat (limited to 'testcases')
-rw-r--r--testcases/Controllers/ODL/CI/odlreport2db.py1
-rw-r--r--testcases/Controllers/ONOS/Teston/CI/onosfunctest.py1
-rw-r--r--testcases/features/doctor.py2
-rw-r--r--testcases/functest_utils.py94
-rw-r--r--testcases/vIMS/CI/vIMS.py3
-rw-r--r--testcases/vPing/CI/libraries/vPing_ssh.py1
-rw-r--r--testcases/vPing/CI/libraries/vPing_userdata.py1
7 files changed, 50 insertions, 53 deletions
diff --git a/testcases/Controllers/ODL/CI/odlreport2db.py b/testcases/Controllers/ODL/CI/odlreport2db.py
index 1538f79cf..47067963a 100644
--- a/testcases/Controllers/ODL/CI/odlreport2db.py
+++ b/testcases/Controllers/ODL/CI/odlreport2db.py
@@ -130,6 +130,7 @@ def main(argv):
# -p opnfv-jump-2
# -s os-odl_l2-ha
functest_utils.push_results_to_db(database,
+ "functest",
data['case_name'],
None,
data['pod_name'],
diff --git a/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py b/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
index bf031cb47..dc45088b3 100644
--- a/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
+++ b/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
@@ -182,6 +182,7 @@ def main():
pod_name = functest_utils.get_pod_name(logger)
result = GetResult()
functest_utils.push_results_to_db(TEST_DB,
+ "functest",
"ONOS",
logger, pod_name, scenario,
payload=result)
diff --git a/testcases/features/doctor.py b/testcases/features/doctor.py
index 8eb85a808..5669a9900 100644
--- a/testcases/features/doctor.py
+++ b/testcases/features/doctor.py
@@ -71,7 +71,7 @@ def main():
'd': details,
})
functest_utils.push_results_to_db(TEST_DB_URL,
- 'doctor-notification',
+ 'doctor','doctor-notification',
logger, pod_name, scenario,
details)
diff --git a/testcases/functest_utils.py b/testcases/functest_utils.py
index 57ec1863f..94a4fa8a5 100644
--- a/testcases/functest_utils.py
+++ b/testcases/functest_utils.py
@@ -18,7 +18,6 @@ import socket
import subprocess
import sys
import urllib2
-import yaml
from git import Repo
@@ -39,6 +38,7 @@ def check_credentials():
env_vars = ['OS_AUTH_URL', 'OS_USERNAME', 'OS_PASSWORD', 'OS_TENANT_NAME']
return all(map(lambda v: v in os.environ and os.environ[v], env_vars))
+
def get_credentials(service):
"""Returns a creds dictionary filled with the following keys:
* username
@@ -70,7 +70,6 @@ def get_credentials(service):
return creds
-
#*********************************************
# NOVA
#*********************************************
@@ -134,10 +133,10 @@ def get_floating_ips(nova_client):
def create_flavor(nova_client, flavor_name, ram, disk, vcpus):
try:
- flavor = nova_client.flavors.create(flavor_name,ram,vcpus,disk)
+ flavor = nova_client.flavors.create(flavor_name, ram, vcpus, disk)
except Exception, e:
print "Error [create_flavor(nova_client, '%s', '%s', '%s', "\
- "'%s')]:" %(flavor_name,ram, disk, vcpus), e
+ "'%s')]:" % (flavor_name, ram, disk, vcpus), e
return None
return flavor.id
@@ -156,7 +155,7 @@ def create_floating_ip(neutron_client):
def add_floating_ip(nova_client, server_id, floatingip_id):
try:
- nova_client.servers.add_floating_ip(server_id,floatingip_id)
+ nova_client.servers.add_floating_ip(server_id, floatingip_id)
return True
except Exception, e:
print "Error [add_floating_ip(nova_client, '%s', '%s')]:" % \
@@ -182,8 +181,6 @@ def delete_floating_ip(nova_client, floatingip_id):
return False
-
-
#*********************************************
# NEUTRON
#*********************************************
@@ -274,7 +271,7 @@ def create_neutron_subnet(neutron_client, name, cidr, net_id):
return subnet['subnets'][0]['id']
except Exception, e:
print "Error [create_neutron_subnet(neutron_client, '%s', '%s', "\
- "'%s')]:" %(name,cidr, net_id), e
+ "'%s')]:" % (name, cidr, net_id), e
return False
@@ -300,7 +297,7 @@ def create_neutron_port(neutron_client, name, network_id, ip):
return port['port']['id']
except Exception, e:
print "Error [create_neutron_port(neutron_client, '%s', '%s', "\
- "'%s')]:" %(name,network_id, ip), e
+ "'%s')]:" % (name, network_id, ip), e
return False
@@ -311,7 +308,7 @@ def update_neutron_net(neutron_client, network_id, shared=False):
return True
except Exception, e:
print "Error [update_neutron_net(neutron_client, '%s', '%s')]:" % \
- (network_id,str(shared)), e
+ (network_id, str(shared)), e
return False
@@ -325,7 +322,7 @@ def update_neutron_port(neutron_client, port_id, device_owner):
return port['port']['id']
except Exception, e:
print "Error [update_neutron_port(neutron_client, '%s', '%s')]:" % \
- (port_id,device_owner), e
+ (port_id, device_owner), e
return False
@@ -336,14 +333,15 @@ def add_interface_router(neutron_client, router_id, subnet_id):
return True
except Exception, e:
print "Error [add_interface_router(neutron_client, '%s', '%s')]:" % \
- (router_id,subnet_id), e
+ (router_id, subnet_id), e
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)
+ neutron_client.add_gateway_router(router_id, router_dict)
return True
except Exception, e:
print "Error [add_gateway_router(neutron_client, '%s')]:" % router_id, e
@@ -396,7 +394,7 @@ def remove_interface_router(neutron_client, router_id, subnet_id):
return True
except Exception, e:
print "Error [remove_interface_router(neutron_client, '%s', '%s')]:" % \
- (router_id,subnet_id), e
+ (router_id, subnet_id), e
return False
@@ -409,7 +407,6 @@ def remove_gateway_router(neutron_client, router_id):
return False
-
#*********************************************
# SEC GROUPS
#*********************************************
@@ -424,44 +421,43 @@ def get_security_groups(neutron_client):
def create_security_group(neutron_client, sg_name, sg_description):
- json_body= {'security_group' : { 'name' : sg_name, \
- 'description' : sg_description }}
+ json_body = {'security_group': {'name': sg_name,
+ 'description': sg_description}}
try:
secgroup = neutron_client.create_security_group(json_body)
return secgroup['security_group']
except Exception, e:
print "Error [create_security_group(neutron_client, '%s', '%s')]:" % \
- (sg_name,sg_description), e
+ (sg_name, sg_description), e
return False
def create_secgroup_rule(neutron_client, sg_id, direction, protocol,
- port_range_min = None, port_range_max = None):
- if port_range_min == None and port_range_max == None:
- json_body = { 'security_group_rule' : \
- { 'direction' : direction, \
- 'security_group_id' : sg_id, \
- 'protocol' : protocol } }
- elif port_range_min != None and port_range_max != None:
- json_body = { 'security_group_rule' : \
- { 'direction' : direction, \
- 'security_group_id' : sg_id, \
- 'port_range_min': port_range_min, \
- 'port_range_max' : port_range_max, \
- 'protocol' : protocol } }
+ port_range_min=None, port_range_max=None):
+ if port_range_min is None and port_range_max is None:
+ json_body = {'security_group_rule': {'direction': direction,
+ 'security_group_id': sg_id,
+ 'protocol': protocol}}
+ elif port_range_min is not None and port_range_max is not None:
+ json_body = {'security_group_rule': {'direction': direction,
+ 'security_group_id': sg_id,
+ 'port_range_min': port_range_min,
+ 'port_range_max': port_range_max,
+ 'protocol': protocol}}
else:
print "Error [create_secgroup_rule(neutron_client, '%s', '%s', "\
- "'%s', '%s', '%s', '%s')]:" %(neutron_client, sg_id, direction, \
- port_range_min, port_range_max, protocol),\
- " Invalid values for port_range_min, port_range_max"
+ "'%s', '%s', '%s', '%s')]:" % (neutron_client, sg_id, direction, \
+ port_range_min, port_range_max, protocol),\
+ " Invalid values for port_range_min, port_range_max"
return False
try:
neutron_client.create_security_group_rule(json_body)
return True
except Exception, e:
print "Error [create_secgroup_rule(neutron_client, '%s', '%s', "\
- "'%s', '%s', '%s', '%s')]:" %(neutron_client, sg_id, direction, \
- port_range_min, port_range_max, protocol), e
+ "'%s', '%s', '%s', '%s')]:" % (neutron_client, sg_id, direction,
+ port_range_min, port_range_max,
+ protocol), e
return False
@@ -487,7 +483,7 @@ def update_sg_quota(neutron_client, tenant_id, sg_quota, sg_rule_quota):
return True
except Exception, e:
print "Error [update_sg_quota(neutron_client, '%s', '%s', "\
- "'%s')]:" %(tenant_id, sg_quota, sg_rule_quota), e
+ "'%s')]:" % (tenant_id, sg_quota, sg_rule_quota), e
return False
@@ -500,8 +496,6 @@ def delete_security_group(neutron_client, secgroup_id):
return False
-
-
#*********************************************
# GLANCE
#*********************************************
@@ -538,7 +532,7 @@ def create_glance_image(glance_client, image_name, file_path, public=True):
return image.id
except Exception, e:
print "Error [create_glance_image(glance_client, '%s', '%s', "\
- "'%s')]:" %(image_name, file_path, str(public)), e
+ "'%s')]:" % (image_name, file_path, str(public)), e
return False
@@ -551,7 +545,6 @@ def delete_glance_image(nova_client, image_id):
return False
-
#*********************************************
# CINDER
#*********************************************
@@ -594,11 +587,11 @@ def update_cinder_quota(cinder_client, tenant_id, vols_quota,
try:
quotas_default = cinder_client.quotas.update(tenant_id,
- **quotas_values)
+ **quotas_values)
return True
except Exception, e:
print "Error [update_cinder_quota(cinder_client, '%s', '%s', '%s'" \
- "'%s')]:" %(tenant_id, vols_quota, snapshots_quota, gigabytes_quota), e
+ "'%s')]:" % (tenant_id, vols_quota, snapshots_quota, gigabytes_quota), e
return False
@@ -628,7 +621,6 @@ def delete_volume_type(cinder_client, volume_type):
return False
-
#*********************************************
# KEYSTONE
#*********************************************
@@ -701,7 +693,7 @@ def create_user(keystone_client, user_name, user_password,
return user.id
except Exception, e:
print "Error [create_user(keystone_client, '%s', '%s', '%s'" \
- "'%s')]:" %(user_name, user_password, user_email, tenant_id), e
+ "'%s')]:" % (user_name, user_password, user_email, tenant_id), e
return False
@@ -711,7 +703,7 @@ def add_role_user(keystone_client, user_id, role_id, tenant_id):
return True
except Exception, e:
print "Error [add_role_user(keystone_client, '%s', '%s'" \
- "'%s')]:" %(user_id, role_id, tenant_id), e
+ "'%s')]:" % (user_id, role_id, tenant_id), e
return False
@@ -827,14 +819,14 @@ def get_pod_name(logger=None):
return "unknown-pod"
-def push_results_to_db(db_url, case_name, logger, pod_name,
+def push_results_to_db(db_url, project, case_name, logger, pod_name,
version, payload):
"""
POST results to the Result target DB
"""
url = db_url + "/results"
installer = get_installer_type(logger)
- params = {"project_name": "functest", "case_name": case_name,
+ params = {"project_name": project, "case_name": case_name,
"pod_name": pod_name, "installer": installer,
"version": version, "details": payload}
@@ -845,8 +837,8 @@ def push_results_to_db(db_url, case_name, logger, pod_name,
logger.debug(r)
return True
except Exception, e:
- print "Error [push_results_to_db('%s', '%s', '%s', '%s', '%s')]:" \
- % (db_url, case_name, pod_name, version, payload), e
+ print "Error [push_results_to_db('%s', '%s', '%s', '%s', '%s', '%s')]:" \
+ % (db_url, project, case_name, pod_name, version, payload), e
return False
@@ -861,7 +853,7 @@ def get_resolvconf_ns():
ip = re.search(r"\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b", line)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if ip:
- result = sock.connect_ex((ip.group(),53))
+ result = sock.connect_ex((ip.group(), 53))
if result == 0:
nameservers.append(ip.group())
line = rconf.readline()
diff --git a/testcases/vIMS/CI/vIMS.py b/testcases/vIMS/CI/vIMS.py
index c50334936..84ef7dafc 100644
--- a/testcases/vIMS/CI/vIMS.py
+++ b/testcases/vIMS/CI/vIMS.py
@@ -137,7 +137,8 @@ def push_results():
scenario = functest_utils.get_scenario(logger)
pod_name = functest_utils.get_pod_name(logger)
- functest_utils.push_results_to_db(db_url=DB_URL, case_name="vIMS",
+ functest_utils.push_results_to_db(db_url=DB_URL, "functest",
+ case_name="vIMS",
logger=logger, pod_name=pod_name,
version=scenario,
payload=RESULTS)
diff --git a/testcases/vPing/CI/libraries/vPing_ssh.py b/testcases/vPing/CI/libraries/vPing_ssh.py
index d8b50f7e9..3050aad57 100644
--- a/testcases/vPing/CI/libraries/vPing_ssh.py
+++ b/testcases/vPing/CI/libraries/vPing_ssh.py
@@ -294,6 +294,7 @@ def push_results(start_time_ts, duration, test_status):
scenario = functest_utils.get_scenario(logger)
pod_name = functest_utils.get_pod_name(logger)
functest_utils.push_results_to_db(TEST_DB,
+ "functest",
"vPing",
logger, pod_name, scenario,
payload={'timestart': start_time_ts,
diff --git a/testcases/vPing/CI/libraries/vPing_userdata.py b/testcases/vPing/CI/libraries/vPing_userdata.py
index c81a1fddb..90562969b 100644
--- a/testcases/vPing/CI/libraries/vPing_userdata.py
+++ b/testcases/vPing/CI/libraries/vPing_userdata.py
@@ -282,6 +282,7 @@ def push_results(start_time_ts, duration, test_status):
scenario = functest_utils.get_scenario(logger)
pod_name = functest_utils.get_pod_name(logger)
functest_utils.push_results_to_db(TEST_DB,
+ "functest",
"vPing_userdata",
logger, pod_name, scenario,
payload={'timestart': start_time_ts,