diff options
author | jose.lausuch <jose.lausuch@ericsson.com> | 2016-05-04 11:47:40 +0200 |
---|---|---|
committer | jose.lausuch <jose.lausuch@ericsson.com> | 2016-05-04 14:35:07 +0200 |
commit | 6790e17eb7c1a3eaaccfe97ac90932e3c15eea6d (patch) | |
tree | 06697206e1323dd3acdce742a2e1e5d5bb4b232f /testcases | |
parent | 7ad2ce42a2bc2c8dc17fbc9423da71a95fed4d87 (diff) |
Refactor improvements
JIRA: FUNCTEST-190
- Deleted unnecessary old scripts
- Fixed healtcheck logging
- Moved config_functest.yaml to /ci/
- Created env var CONFIG_FUNCTEST_YAML pointing to that new location
- Modified all scripts which open config_functest.yaml using the new env var
Change-Id: Ic4f0e40a70c02ac08287a1d621956f602bdee177
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'testcases')
-rw-r--r-- | testcases/Controllers/ODL/CI/odlreport2db.py | 3 | ||||
-rw-r--r-- | testcases/Controllers/ONOS/Teston/CI/onosfunctest.py | 2 | ||||
-rwxr-xr-x | testcases/VIM/OpenStack/CI/libraries/healthcheck.sh | 94 | ||||
-rwxr-xr-x | testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py | 2 | ||||
-rw-r--r-- | testcases/VIM/OpenStack/CI/libraries/run_tempest.py | 2 | ||||
-rwxr-xr-x | testcases/config_functest.py | 334 | ||||
-rw-r--r-- | testcases/config_functest.yaml | 241 | ||||
-rw-r--r-- | testcases/features/doctor.py | 3 | ||||
-rw-r--r-- | testcases/features/promise.py | 2 | ||||
-rw-r--r-- | testcases/vIMS/CI/vIMS.py | 2 | ||||
-rw-r--r-- | testcases/vPing/CI/libraries/vPing_ssh.py | 2 | ||||
-rw-r--r-- | testcases/vPing/CI/libraries/vPing_userdata.py | 2 |
12 files changed, 77 insertions, 612 deletions
diff --git a/testcases/Controllers/ODL/CI/odlreport2db.py b/testcases/Controllers/ODL/CI/odlreport2db.py index 9a87deac..50c8b096 100644 --- a/testcases/Controllers/ODL/CI/odlreport2db.py +++ b/testcases/Controllers/ODL/CI/odlreport2db.py @@ -23,6 +23,7 @@ import getopt import json +import os import sys import xmltodict import yaml @@ -116,7 +117,7 @@ def main(argv): json.dumps(data, indent=4, separators=(',', ': ')) # Only used from container, we can set up absolute path - with open("/home/opnfv/functest/conf/config_functest.yaml") as f: + with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: functest_yaml = yaml.safe_load(f) f.close() diff --git a/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py b/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py index b9ddbf78..1e278e6a 100644 --- a/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py +++ b/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py @@ -30,7 +30,7 @@ args = parser.parse_args() """ logging configuration """ logger = ft_logger.Logger("onos").getLogger() -with open("/home/opnfv/functest/conf/config_functest.yaml") as f: +with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: functest_yaml = yaml.safe_load(f) f.close() diff --git a/testcases/VIM/OpenStack/CI/libraries/healthcheck.sh b/testcases/VIM/OpenStack/CI/libraries/healthcheck.sh index 9d3559b2..611c100c 100755 --- a/testcases/VIM/OpenStack/CI/libraries/healthcheck.sh +++ b/testcases/VIM/OpenStack/CI/libraries/healthcheck.sh @@ -16,14 +16,31 @@ set -e +#Redirect all the output (stdout) to a log file and show only possible errors. +LOG_FILE=/home/opnfv/functest/results/healthcheck.log +echo "">$LOG_FILE +exec 1<>$LOG_FILE + +info () { + echo -e "$(date '+%Y-%m-%d %H:%M:%S,%3N') - healtcheck - INFO - " "$*" | tee -a $LOG_FILE 1>&2 +} + +debug () { + if [[ "${CI_DEBUG,,}" == "true" ]]; then + echo -e "$(date '+%Y-%m-%d %H:%M:%S,%3N') - healtcheck - DEBUG - " "$*" | tee -a $LOG_FILE 1>&2 + fi +} + +error () { + echo -e "$(date '+%Y-%m-%d %H:%M:%S,%3N') - healtcheck - ERROR - " "$*" | tee -a $LOG_FILE 1>&2 + exit 1 +} + if [ -z $OS_AUTH_URL ]; then echo "Source credentials first." exit 1 fi -#Redirect all the output (stdout) to a log file and show only possible errors. -LOG_FILE=/home/opnfv/functest/results/healthcheck.log -exec 1<>$LOG_FILE echo "Using following credentials:" env | grep OS @@ -62,10 +79,10 @@ function wait_for_ip() { timeout=60 while [[ ${timeout} > 0 ]]; do if [[ $(nova console-log $1|grep "No lease, failing") ]]; then - echo "ERROR: The instance $1 couldn't get an IP from the DHCP agent." | tee -a $LOG_FILE 1>&2 + error "The instance $1 couldn't get an IP from the DHCP agent." | tee -a $LOG_FILE 1>&2 exit 1 elif [[ $(nova console-log $1|grep "^Lease"|grep "obtained") ]]; then - echo "The instance $1 got an IP successfully from the DHCP agent." + debug "The instance $1 got an IP successfully from the DHCP agent." | tee -a $LOG_FILE 1>&2 break fi let timeout=timeout-1 @@ -75,39 +92,47 @@ function wait_for_ip() { ################################# -echo "Testing Keystone API..." | tee -a $LOG_FILE 1>&2 +info "Testing Keystone API..." | tee -a $LOG_FILE 1>&2 ################################# openstack project create ${project_1} +debug "project '${project_1}' created." openstack project create ${project_2} - +debug "project '${project_2}' created." openstack user create ${user_1} --project ${project_1} +debug "user '${user_1}' created in project ${project_1}." openstack user create ${user_2} --project ${project_1} +debug "user '${user_2}' created in project ${project_1}." openstack user create ${user_3} --project ${project_1} +debug "user '${user_3}' created in project ${project_1}." openstack user create ${user_4} --project ${project_2} +debug "user '${user_4}' created in project ${project_2}." openstack user create ${user_5} --project ${project_2} +debug "user '${user_5}' created in project ${project_2}." openstack user create ${user_6} --project ${project_2} - -echo "...OK" | tee -a $LOG_FILE 1>&2 +debug "user '${user_6}' created in project ${project_2}." +info "...Keystone OK!" ################################# -echo "Testing Glance API..." | tee -a $LOG_FILE 1>&2 +info "Testing Glance API..." ################################# image=/home/opnfv/functest/data/cirros-0.3.4-x86_64-disk.img glance image-create --name ${image_1} --disk-format qcow2 --container-format bare < ${image} +debug "image '${image_1}' created." glance image-create --name ${image_2} --disk-format qcow2 --container-format bare < ${image} - -echo "...OK" | tee -a $LOG_FILE 1>&2 +debug "image '${image_2}' created." +info "... Glance OK!" ################################# -echo "Testing Cinder API..." | tee -a $LOG_FILE 1>&2 +info "Testing Cinder API..." ################################# cinder create --display_name ${volume_1} 1 +debug "volume '${volume_1}' created." cinder create --display_name ${volume_2} 10 - -echo "...OK" | tee -a $LOG_FILE 1>&2 +debug "volume '${volume_2}' created." +info "...Cinder OK!" ################################# -echo "Testing Neutron API..." | tee -a $LOG_FILE 1>&2 +info "Testing Neutron API..." ################################# network_ids=($(neutron net-list|grep -v "+"|grep -v name|awk '{print $2}')) @@ -115,56 +140,69 @@ for id in ${network_ids[@]}; do [[ $(neutron net-show ${id}|grep 'router:external'|grep -i "true") != "" ]] && ext_net_id=${id} done if [[ "${ext_net_id}" == "" ]]; then - echo "ERROR: No external network found. Exiting Health Check..." | tee -a $LOG_FILE 1>&2 + error "No external network found. Exiting Health Check..." exit 1 else - echo "External network found. ${ext_net_id}" + info "External network found. ${ext_net_id}" fi -echo "1. Create Networks..." +info "1. Create Networks..." neutron net-create ${net_1} +debug "net '${net_1}' created." neutron net-create ${net_2} +debug "net '${net_2}' created." net1_id=$(neutron net-list | grep ${net_1} | awk '{print $2}') net2_id=$(neutron net-list | grep ${net_2} | awk '{print $2}') -echo "2. Create subnets..." +info "2. Create subnets..." neutron subnet-create --name ${subnet_1} --allocation-pool start=10.6.0.2,end=10.6.0.253 --gateway 10.6.0.254 ${net_1} 10.6.0.0/24 +debug "subnet '${subnet_1}' created." neutron subnet-create --name ${subnet_2} --allocation-pool start=10.7.0.2,end=10.7.0.253 --gateway 10.7.0.254 ${net_2} 10.7.0.0/24 +debug "subnet '${subnet_2}' created." -echo "4. Create Routers..." +info "4. Create Routers..." neutron router-create ${router_1} +debug "router '${router_1}' created." neutron router-create ${router_2} +debug "router '${router_2}' created." neutron router-gateway-set ${router_1} ${ext_net_id} +debug "router '${router_1}' gateway set to ${ext_net_id}." neutron router-gateway-set ${router_2} ${ext_net_id} +debug "router '${router_2}' gateway set to ${ext_net_id}." neutron router-interface-add ${router_1} ${subnet_1} +debug "router '${router_1}' interface added ${subnet_1}." neutron router-interface-add ${router_2} ${subnet_2} +debug "router '${router_2}' interface added ${subnet_2}." -echo "...OK" | tee -a $LOG_FILE 1>&2 +info "...Neutron OK!" ################################# -echo "Testing Nova API..." | tee -a $LOG_FILE 1>&2 +info "Testing Nova API..." ################################# nova boot --flavor 2 --image ${image_1} --nic net-id=${net1_id} ${instance_1} +debug "nova instance '${instance_1}' booted on ${net_1}." nova boot --flavor 2 --image ${image_1} --nic net-id=${net1_id} ${instance_2} +debug "nova instance '${instance_2}' booted on ${net_1}." nova boot --flavor 2 --image ${image_2} --nic net-id=${net2_id} ${instance_3} +debug "nova instance '${instance_3}' booted on ${net_2}." nova boot --flavor 2 --image ${image_2} --nic net-id=${net2_id} ${instance_4} +debug "nova instance '${instance_4}' booted on ${net_2}." vm1_id=$(nova list | grep ${instance_1} | awk '{print $2}') vm2_id=$(nova list | grep ${instance_2} | awk '{print $2}') vm3_id=$(nova list | grep ${instance_3} | awk '{print $2}') vm4_id=$(nova list | grep ${instance_4} | awk '{print $2}') +info "...Nova OK!" -echo "...OK" | tee -a $LOG_FILE 1>&2 - -echo "Checking if instances get an IP from DHCP..." | tee -a $LOG_FILE 1>&2 - +info "Checking if instances get an IP from DHCP..." wait_for_ip ${instance_1} "10.6" wait_for_ip ${instance_2} "10.6" wait_for_ip ${instance_3} "10.7" wait_for_ip ${instance_4} "10.7" +info "...DHCP OK!" -echo "Health check passed!" | tee -a $LOG_FILE 1>&2 +info "Health check passed!" exit 0 diff --git a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py index 26e6b8c1..6aa6ee06 100755 --- a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py +++ b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py @@ -82,7 +82,7 @@ if not os.path.exists(REPO_PATH): exit(-1) -with open("/home/opnfv/functest/conf/config_functest.yaml") as f: +with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: functest_yaml = yaml.safe_load(f) f.close() diff --git a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py index 3afbbffa..d29869a0 100644 --- a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py +++ b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py @@ -61,7 +61,7 @@ logger = ft_logger.Logger("run_tempest").getLogger() REPO_PATH = os.environ['repos_dir'] + '/functest/' -with open("/home/opnfv/functest/conf/config_functest.yaml") as f: +with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: functest_yaml = yaml.safe_load(f) f.close() TEST_DB = functest_yaml.get("results").get("test_db_url") diff --git a/testcases/config_functest.py b/testcases/config_functest.py deleted file mode 100755 index 649d4f7e..00000000 --- a/testcases/config_functest.py +++ /dev/null @@ -1,334 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (c) 2015 Ericsson -# jose.lausuch@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -# -import argparse -import logging -import os -import shutil -import subprocess -import sys -import yaml - -from neutronclient.v2_0 import client as neutronclient - -import functest.utils.functest_utils as functest_utils -import functest.utils.openstack_utils as openstack_utils - - -actions = ['start', 'check', 'clean'] -parser = argparse.ArgumentParser() -parser.add_argument("action", help="Possible actions are: " - "'{d[0]}|{d[1]}|{d[2]}' ".format(d=actions)) -parser.add_argument("-d", "--debug", help="Debug mode", action="store_true") -parser.add_argument("-f", "--force", help="Force", action="store_true") -args = parser.parse_args() - - -""" logging configuration """ -logger = logging.getLogger('config_functest') -logger.setLevel(logging.DEBUG) - -ch = logging.StreamHandler() -if args.debug: - ch.setLevel(logging.DEBUG) -else: - ch.setLevel(logging.INFO) - -formatter = logging.Formatter('%(asctime)s - %(name)s - ' - '%(levelname)s - %(message)s') -ch.setFormatter(formatter) -logger.addHandler(ch) - -REPOS_DIR = os.environ['repos_dir'] -FUNCTEST_REPO = REPOS_DIR + '/functest/' -if not os.path.exists(FUNCTEST_REPO): - logger.error("Functest repository directory not found '%s'" - % FUNCTEST_REPO) - exit(-1) -sys.path.append(FUNCTEST_REPO + "testcases/") - -with open("/home/opnfv/functest/conf/config_functest.yaml") as f: - functest_yaml = yaml.safe_load(f) -f.close() - - -""" global variables """ -# Directories -RALLY_DIR = FUNCTEST_REPO + functest_yaml.get("general").get( - "directories").get("dir_rally") -RALLY_REPO_DIR = functest_yaml.get("general").get( - "directories").get("dir_repo_rally") -RALLY_INSTALLATION_DIR = functest_yaml.get("general").get( - "directories").get("dir_rally_inst") -RALLY_RESULT_DIR = functest_yaml.get("general").get( - "directories").get("dir_rally_res") -TEMPEST_REPO_DIR = functest_yaml.get("general").get( - "directories").get("dir_repo_tempest") -VPING_DIR = FUNCTEST_REPO + functest_yaml.get("general").get( - "directories").get("dir_vping") -ODL_DIR = FUNCTEST_REPO + functest_yaml.get("general").get( - "directories").get("dir_odl") -DATA_DIR = functest_yaml.get("general").get( - "directories").get("dir_functest_data") - -# Tempest/Rally configuration details -DEPLOYMENT_MAME = functest_yaml.get("rally").get("deployment_name") - -# Image (cirros) -IMAGE_FILE_NAME = functest_yaml.get("general").get("openstack").get( - "image_file_name") -IMAGE_PATH = DATA_DIR + "/" + IMAGE_FILE_NAME - -# NEUTRON Private Network parameters -NEUTRON_PRIVATE_NET_NAME = functest_yaml.get("general").get( - "openstack").get("neutron_private_net_name") -NEUTRON_PRIVATE_SUBNET_NAME = functest_yaml.get("general").get( - "openstack").get("neutron_private_subnet_name") -NEUTRON_PRIVATE_SUBNET_CIDR = functest_yaml.get("general").get( - "openstack").get("neutron_private_subnet_cidr") -NEUTRON_ROUTER_NAME = functest_yaml.get("general").get( - "openstack").get("neutron_router_name") - -creds_neutron = openstack_utils.get_credentials("neutron") -neutron_client = neutronclient.Client(**creds_neutron) - - -def action_start(): - """ - Start the functest environment installation - """ - if not functest_utils.check_internet_connectivity(): - logger.info("No Internet connectivity. " - "This may affect some test case suites.") - - if action_check(): - logger.info("Functest environment already installed. Nothing to do.") - exit(0) - - else: - # Clean in case there are left overs - logger.debug("Cleaning possible functest environment leftovers.") - action_clean() - logger.info("Starting installation of functest environment") - - private_net = openstack_utils.get_private_net(neutron_client) - if private_net is None: - # If there is no private network in the deployment we create one - if not create_private_neutron_net(neutron_client): - logger.error("There has been a problem while " - "creating the functest network.") - action_clean() - exit(-1) - else: - logger.info("Private network '%s' already existing in " - "the deployment." % private_net['name']) - - logger.info("Installing Rally...") - if not install_rally(): - logger.error("There has been a problem while installing Rally.") - action_clean() - exit(-1) - - # Create result folder under functest if necessary - if not os.path.exists(RALLY_RESULT_DIR): - os.makedirs(RALLY_RESULT_DIR) - - try: - logger.info("CI: Generate the list of executable tests.") - runnable_test = functest_utils.generateTestcaseList(functest_yaml) - logger.info("List of runnable tests generated: %s" % runnable_test) - except: - logger.error("Impossible to generate the list of runnable tests") - - exit(0) - - -def action_check(): - """ - Check if the functest environment is properly installed - """ - errors_all = False - logger.info("Checking current functest configuration...") - - logger.debug("Checking script directories...") - - dirs = [RALLY_DIR, RALLY_INSTALLATION_DIR, VPING_DIR, ODL_DIR] - for dir in dirs: - if not os.path.exists(dir): - logger.debug(" %s NOT found" % dir) - errors_all = True - else: - logger.debug(" %s found" % dir) - - logger.debug("Checking Rally deployment...") - if not check_rally(): - logger.debug(" Rally deployment NOT installed.") - errors_all = True - - logger.debug("Checking Image...") - if not os.path.isfile(IMAGE_PATH): - logger.debug(" Image file '%s' NOT found." % IMAGE_PATH) - errors_all = True - else: - logger.debug(" Image file found in %s" % IMAGE_PATH) - - # TODO: check OLD environment setup - return not errors_all - - -def action_clean(): - """ - Clean the existing functest environment - """ - logger.info("Removing current functest environment...") - if os.path.exists(RALLY_INSTALLATION_DIR): - logger.debug("Removing Rally installation directory %s" - % RALLY_INSTALLATION_DIR) - shutil.rmtree(RALLY_INSTALLATION_DIR, ignore_errors=True) - - if os.path.exists(RALLY_RESULT_DIR): - logger.debug("Removing Result directory") - shutil.rmtree(RALLY_RESULT_DIR, ignore_errors=True) - - logger.info("Functest environment clean!") - - -def install_rally(): - if check_rally(): - logger.info("Rally is already installed.") - else: - logger.debug("Creating Rally environment...") - cmd = "rally deployment create --fromenv --name=" + DEPLOYMENT_MAME - functest_utils.execute_command(cmd, logger) - - logger.debug("Installing tempest from existing repo...") - cmd = ("rally verify install --source " + TEMPEST_REPO_DIR + - " --system-wide") - functest_utils.execute_command(cmd, logger) - - cmd = "rally deployment check" - functest_utils.execute_command(cmd, logger) - # TODO: check that everything is 'Available' and warn if not - - cmd = "rally show images" - functest_utils.execute_command(cmd, logger) - - cmd = "rally show flavors" - functest_utils.execute_command(cmd, logger) - - return True - - -def check_rally(): - """ - Check if Rally is installed and properly configured - """ - if os.path.exists(RALLY_INSTALLATION_DIR): - logger.debug(" Rally installation directory found in %s" - % RALLY_INSTALLATION_DIR) - FNULL = open(os.devnull, 'w') - cmd = "rally deployment list | grep " + DEPLOYMENT_MAME - logger.debug(' Executing command : {}'.format(cmd)) - p = subprocess.Popen(cmd, shell=True, - stdout=subprocess.PIPE, stderr=FNULL) - # if the command does not exist or there is no deployment - line = p.stdout.readline() - if line == "": - logger.debug(" Rally deployment NOT found") - return False - logger.debug(" Rally deployment found") - return True - else: - return False - - -def create_private_neutron_net(neutron): - neutron.format = 'json' - logger.info("Creating network '%s'..." % NEUTRON_PRIVATE_NET_NAME) - network_id = openstack_utils.create_neutron_net( - neutron, NEUTRON_PRIVATE_NET_NAME) - - if not network_id: - return False - logger.debug("Network '%s' created successfully." % network_id) - - logger.info("Updating network '%s' with shared=True..." - % NEUTRON_PRIVATE_NET_NAME) - if openstack_utils.update_neutron_net(neutron, network_id, shared=True): - logger.debug("Network '%s' updated successfully." % network_id) - else: - logger.info("Updating neutron network '%s' failed" % network_id) - - logger.info("Creating Subnet....") - subnet_id = openstack_utils.create_neutron_subnet( - neutron, NEUTRON_PRIVATE_SUBNET_NAME, NEUTRON_PRIVATE_SUBNET_CIDR, - network_id) - if not subnet_id: - return False - logger.debug("Subnet '%s' created successfully." % subnet_id) - logger.info("Creating Router...") - router_id = openstack_utils.create_neutron_router(neutron, - NEUTRON_ROUTER_NAME) - - if not router_id: - return False - - logger.debug("Router '%s' created successfully." % router_id) - logger.info("Adding router to subnet...") - - result = openstack_utils.add_interface_router(neutron, - router_id, - subnet_id) - - if not result: - return False - - logger.debug("Interface added successfully.") - return True - - -def main(): - if not (args.action in actions): - logger.error('argument not valid') - exit(-1) - - if not openstack_utils.check_credentials(): - logger.error("Please source the openrc credentials and " - "run the script again.") - # TODO: source the credentials in this script - exit(-1) - - if args.action == "start": - action_start() - - if args.action == "check": - if action_check(): - logger.info("Functest environment correctly installed") - else: - logger.info("Functest environment not found or faulty") - - if args.action == "clean": - if args.force: - action_clean() - else: - while True: - print("Are you sure? [y|n]") - answer = raw_input("") - if answer == "y": - action_clean() - break - elif answer == "n": - break - else: - print("Invalid option.") - exit(0) - - -if __name__ == '__main__': - main() diff --git a/testcases/config_functest.yaml b/testcases/config_functest.yaml deleted file mode 100644 index e463df20..00000000 --- a/testcases/config_functest.yaml +++ /dev/null @@ -1,241 +0,0 @@ -general: - directories: - # Relative to the path where the repo is cloned: - dir_vping: testcases/vPing/CI/libraries/ - dir_odl: testcases/Controllers/ODL/CI/ - dir_rally: testcases/VIM/OpenStack/CI/libraries/ - dir_rally_scn: testcases/VIM/OpenStack/CI/rally_cert/ - dir_tempest_cases: testcases/VIM/OpenStack/CI/custom_tests/ - dir_vIMS: testcases/vIMS/CI/ - dir_onos: testcases/Controllers/ONOS/Teston/CI/ - - # Absolute path - dir_repos: /home/opnfv/repos - dir_repo_functest: /home/opnfv/repos/functest - dir_repo_rally: /home/opnfv/repos/rally - dir_repo_tempest: /home/opnfv/repos/tempest - dir_repo_releng: /home/opnfv/repos/releng - dir_repo_vims_test: /home/opnfv/repos/vims-test - dir_repo_bgpvpn: /home/opnfv/repos/bgpvpn - dir_repo_onos: /home/opnfv/repos/onos - dir_repo_promise: /home/opnfv/repos/promise - dir_repo_doctor: /home/opnfv/repos/doctor - dir_repo_ovno: /home/opnfv/repos/ovno - dir_functest: /home/opnfv/functest - dir_results: /home/opnfv/functest/results - dir_functest_conf: /home/opnfv/functest/conf - dir_rally_res: /home/opnfv/functest/results/rally/ - dir_functest_data: /home/opnfv/functest/data - dir_vIMS_data: /home/opnfv/functest/data/vIMS - dir_rally_inst: /home/opnfv/.rally - - openstack: - image_name: functest-img - image_file_name: cirros-0.3.4-x86_64-disk.img - image_disk_format: qcow2 - - # Private network for functest. Will be created by config_functest.py - neutron_private_net_name: functest-net - neutron_private_subnet_name: functest-subnet - neutron_private_subnet_cidr: 192.168.120.0/24 - neutron_private_subnet_start: 192.168.120.2 - neutron_private_subnet_end: 192.168.120.254 - neutron_private_subnet_gateway: 192.168.120.254 - neutron_router_name: functest-router - -vping: - ping_timeout: 200 - vm_flavor: m1.small # adapt to your environment - vm_name_1: opnfv-vping-1 - vm_name_2: opnfv-vping-2 - image_name: functest-vping - vping_private_net_name: vping-net - vping_private_subnet_name: vping-subnet - vping_private_subnet_cidr: 192.168.130.0/24 - vping_router_name: vping-router - vping_sg_name: vPing-sg - vping_sg_descr: Security group for vPing test case - -tempest: - identity: - tenant_name: tempest - tenant_description: Tenant for Tempest test suite - user_name: tempest - user_password: tempest - input-scenario: - ssh_user_regex: '[["^.*[Cc]irros.*$", "cirros"], ["^.*[Tt]est[VvMm].*$", "cirros"], ["^.*rally_verify.*$", "cirros"]]' - -rally: - deployment_name: opnfv-rally - -vIMS: - general: - tenant_name: vIMS - tenant_description: vIMS Functionality Testing - images: - ubuntu: - image_url: 'http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img' - image_name: ubuntu_14.04 - centos: - image_url: 'http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1510.qcow2' - image_name: centos_7 - cloudify: - blueprint: - url: https://github.com/boucherv-orange/cloudify-manager-blueprints.git - branch: "3.3-build" - requierments: - ram_min: 3000 - os_image: centos_7 - inputs: - keystone_username: "" - keystone_password: "" - keystone_tenant_name: "" - keystone_url: "" - manager_public_key_name: 'manager-kp' - agent_public_key_name: 'agent-kp' - image_id: "" - flavor_id: "3" - external_network_name: "" - ssh_user: centos - agents_user: ubuntu - clearwater: - blueprint: - file_name: 'openstack-blueprint.yaml' - name: "clearwater-opnfv" - destination_folder: "opnfv-cloudify-clearwater" - url: 'https://github.com/Orange-OpenSource/opnfv-cloudify-clearwater.git' - branch: "stable" - deployment-name: 'clearwater-opnfv' - requierments: - ram_min: 1700 - os_image: ubuntu_14.04 - inputs: - image_id: '' - flavor_id: '' - agent_user: 'ubuntu' - external_network_name: '' - public_domain: clearwater.opnfv -ONOS: - general: - onosbench_username: 'root' - onosbench_password: 'root' - onoscli_username: 'root' - onoscli_password: 'root' - runtimeout: 300 - environment: - OCT: '10.20.0.1' - OC1: '10.20.0.7' - OC2: '10.20.0.7' - OC3: '10.20.0.7' - OCN: '10.20.0.4' - OCN2: '10.20.0.5' - installer_master: '10.20.0.2' - installer_master_username: 'root' - installer_master_password: 'r00tme' - -promise: - general: - tenant_name: promise - tenant_description: promise Functionality Testing - user_name: promiser - user_pwd: test - image_name: promise-img - flavor_name: promise-flavor - flavor_vcpus: 1 - flavor_ram: 512 - flavor_disk: 0 - -results: - test_db_url: http://testresults.opnfv.org/testapi - -# to be maintained... -# the execution order is important as some tests may be more destructive than others -# and if vPing is failing is usually not needed to continue... -test_exec_priority: - 1: healthcheck - 2: vping_ssh - 3: vping_userdata - 4: tempest - 5: odl - 6: onos - 7: ovno - 8: doctor - 9: promise - 10: odl-vpnservice - 11: bgpvpn - #11: openstack-neutron-bgpvpn-api-extension-tests - 12: vims - 13: rally - - -######################################################################## -# This part lists the dependencies of the tests -# -# it is used to manage the complexity of the possible combinations -# -# 17 projects have been declared for Brahmaputra (D Milestone) -# 89 testcases are associated with these 17 projects -# -# in B-Release, Functest deals with 6 companion projects: -# - congress -# - doctor -# - ovno -# - policyTest -# - promise -# - sdnvpn -# -# constraints may be declared at the testcase or the test project level -# -# By default we consider that all the tests can be run on any configuration -# -# we defined 2 constraints -# - installer (e.g. my test can be run only with installer Compass) -# possible values: apex, compass, fuel, joid -# -# - the scenario: it described a specif installation -# os-<controller>-<nfvfeature>-<mode>[-<extrastuff>] -# With parameters: -# controller=(nosdn|odl_l3|odl_l2|onos|ocl) -# No odl_l3 today -# nfvfeature=(kvm|ovs|dpdk|nofeature) -# '_' list separated. -# mode=(ha|noha) -# extrastuff=(none) -# Optional field - Not used today# -# -# ref:https://gerrit.opnfv.org/gerrit/#/c/6323/7/jjb/joid/joid-deploy.sh (L72-82) -# e.g my test is only possible with OVS 2.3.2 on odl -# -# in functest, we indicate the regex pattern to be checked towards the scenario -# e.g. odl-vpn_service-tests can be run if and only if -# - installer is fuel -# - scenario contains the name ovs and odl -# -####################################################################### -test-dependencies: - doctor: - installer: 'apex' - functest: - vims: - scenario: '(ocl)|(nosdn)|^(os-odl)((?!bgpvpn).)*$' - healthcheck: - vping_ssh: - scenario: '^((?!bgpvpn).)*$' - vping_userdata: - tempest: - rally: - odl: - scenario: 'odl' - onos: - scenario: 'onos' - promise: - installer: '(fuel)|(joid)' - ovno: - scenario: 'ocl' - policy-test: - scenario: 'odl' - sdnvpn: - bgpvpn: - installer: '(fuel)|(apex)' - scenario: 'bgpvpn' - # this execute the tempest tests of networking-bgpvpn diff --git a/testcases/features/doctor.py b/testcases/features/doctor.py index e270f7e9..ac68430a 100644 --- a/testcases/features/doctor.py +++ b/testcases/features/doctor.py @@ -14,13 +14,14 @@ # # +import os import time import yaml import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as functest_utils -with open('/home/opnfv/functest/conf/config_functest.yaml') as f: +with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: functest_yaml = yaml.safe_load(f) dirs = functest_yaml.get('general').get('directories') diff --git a/testcases/features/promise.py b/testcases/features/promise.py index 804cd665..f10e054c 100644 --- a/testcases/features/promise.py +++ b/testcases/features/promise.py @@ -33,7 +33,7 @@ parser.add_argument("-r", "--report", action="store_true") args = parser.parse_args() -with open('/home/opnfv/functest/conf/config_functest.yaml') as f: +with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: functest_yaml = yaml.safe_load(f) dirs = functest_yaml.get('general').get('directories') diff --git a/testcases/vIMS/CI/vIMS.py b/testcases/vIMS/CI/vIMS.py index f8849433..2430af1a 100644 --- a/testcases/vIMS/CI/vIMS.py +++ b/testcases/vIMS/CI/vIMS.py @@ -55,7 +55,7 @@ if not os.path.exists(REPO_PATH): logger.error("Functest repository directory not found '%s'" % REPO_PATH) exit(-1) -with open("/home/opnfv/functest/conf/config_functest.yaml") as f: +with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: functest_yaml = yaml.safe_load(f) f.close() diff --git a/testcases/vPing/CI/libraries/vPing_ssh.py b/testcases/vPing/CI/libraries/vPing_ssh.py index 23b3d46f..bd0b9b29 100644 --- a/testcases/vPing/CI/libraries/vPing_ssh.py +++ b/testcases/vPing/CI/libraries/vPing_ssh.py @@ -54,7 +54,7 @@ if not os.path.exists(REPO_PATH): logger.error("Functest repository directory not found '%s'" % REPO_PATH) exit(-1) -with open("/home/opnfv/functest/conf/config_functest.yaml") as f: +with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: functest_yaml = yaml.safe_load(f) f.close() diff --git a/testcases/vPing/CI/libraries/vPing_userdata.py b/testcases/vPing/CI/libraries/vPing_userdata.py index 3e69ddfe..473c1f82 100644 --- a/testcases/vPing/CI/libraries/vPing_userdata.py +++ b/testcases/vPing/CI/libraries/vPing_userdata.py @@ -50,7 +50,7 @@ if not os.path.exists(REPO_PATH): logger.error("Functest repository directory not found '%s'" % REPO_PATH) exit(-1) -with open("/home/opnfv/functest/conf/config_functest.yaml") as f: +with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: functest_yaml = yaml.safe_load(f) f.close() |