diff options
Diffstat (limited to 'functest/ci')
-rw-r--r-- | functest/ci/config_aarch64_patch.yaml | 8 | ||||
-rwxr-xr-x | functest/ci/exec_test.sh | 148 | ||||
-rwxr-xr-x | functest/ci/run_tests.py | 23 | ||||
-rwxr-xr-x | functest/ci/testcases.yaml | 34 | ||||
-rwxr-xr-x | functest/ci/tier_builder.py | 1 | ||||
-rwxr-xr-x | functest/ci/tier_handler.py | 13 |
6 files changed, 57 insertions, 170 deletions
diff --git a/functest/ci/config_aarch64_patch.yaml b/functest/ci/config_aarch64_patch.yaml index 9a345e3f..b43b5a76 100644 --- a/functest/ci/config_aarch64_patch.yaml +++ b/functest/ci/config_aarch64_patch.yaml @@ -5,10 +5,10 @@ os: image_file_name: cirros-d161201-aarch64-disk.img image_password: gocubsgo - snaps_simple_healthcheck: - disk_image: /home/opnfv/functest/data/cirros-d161201-aarch64-disk.img - kernel_image: /home/opnfv/functest/data/cirros-d161201-aarch64-kernel - ramdisk_image: /home/opnfv/functest/data/cirros-d161201-aarch64-initramfs + snaps_health_check: + disk_url: http://download.cirros-cloud.net/daily/20161201/cirros-d161201-aarch64-disk.img + kernel_url: http://download.cirros-cloud.net/daily/20161201/cirros-d161201-aarch64-kernel + ramdisk_url: http://download.cirros-cloud.net/daily/20161201/cirros-d161201-aarch64-initramfs extra_properties: os_command_line: root=/dev/vdb1 rw rootwait console=tty0 console=ttyS0 console=ttyAMA0 hw_video_model: vga diff --git a/functest/ci/exec_test.sh b/functest/ci/exec_test.sh deleted file mode 100755 index 6f776101..00000000 --- a/functest/ci/exec_test.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/bash - -# -# Author: Jose Lausuch (jose.lausuch@ericsson.com) -# Morgan Richomme (morgan.richomme@orange.com) -# Installs the Functest framework within the Docker container -# and run the tests automatically -# -# -# 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 -# - -usage="Script to trigger the tests automatically. - -usage: - bash $(basename "$0") [-h|--help] [-t <test_name>] - -where: - -h|--help show this help text - -r|--report push results to database (false by default) - -s|--serial run Tempest tests in one thread - -t|--test run specific test case - <test_name>" - - -report="" -serial=false - -# Get the list of runnable tests -# Check if we are in CI mode -debug="" -if [[ "${CI_DEBUG,,}" == "true" ]];then - debug="--debug" -fi - -FUNCTEST_REPO_DIR=${REPOS_DIR}/functest -FUNCTEST_TEST_DIR=${REPOS_DIR}/functest/functest/opnfv_tests -FUNCTEST_CONF_DIR=/home/opnfv/functest/conf - -export PYTHONUNBUFFERED=1 - -function odl_tests(){ - keystone_ip=$(openstack catalog show identity |grep publicURL| cut -f3 -d"/" | cut -f1 -d":") - neutron_ip=$(openstack catalog show network | grep publicURL | cut -f3 -d"/" | cut -f1 -d":") - odl_ip=${neutron_ip} - odl_port=8080 - odl_restport=8181 - if [ "$INSTALLER_TYPE" == "fuel" ]; then - odl_port=8282 - elif [ "$INSTALLER_TYPE" == "apex" ]; then - odl_ip=$SDN_CONTROLLER_IP - odl_port=8081 - odl_restport=8081 - elif [ "$INSTALLER_TYPE" == "netvirt" ]; then - odl_ip=$SDN_CONTROLLER_IP - odl_port=8081 - odl_restport=8081 - elif [ "$INSTALLER_TYPE" == "joid" ]; then - odl_ip=$SDN_CONTROLLER - elif [ "$INSTALLER_TYPE" == "compass" ]; then - odl_port=8181 - else - odl_ip=$SDN_CONTROLLER_IP - fi -} - - - -function run_test(){ - test_name=$1 - serial_flag="" - if [ $serial == "true" ]; then - serial_flag="-s" - fi - - case $test_name in - "healthcheck") - ${FUNCTEST_TEST_DIR}/openstack/healthcheck/healthcheck.sh - ;; - "odl") - odl_tests - [[ "$report" == "-r" ]] && args=-p - ${FUNCTEST_TEST_DIR}/sdn/odl/odl.py \ - --keystoneip $keystone_ip \ - --neutronip $neutron_ip \ - --odlip $odl_ip \ - --odlrestconfport $odl_restport \ - --odlwebport $odl_port \ - --ospassword ${OS_PASSWORD} \ - --ostenantname ${OS_TENANT_NAME} \ - --osusername ${OS_USERNAME} \ - ${args} - ;; - "ovno") - # suite under rewritting for colorado - # no need to run anything until refactoring done - # ${REPOS_DIR}/ovno/Testcases/RunTests.sh - ;; - *) - echo "The test case '${test_name}' does not exist." - exit 1 - esac - - if [[ $? != 0 ]]; then exit 1 - else exit 0 - fi -} - - -# Parse parameters -while [[ $# > 0 ]] - do - key="$1" - case $key in - -h|--help) - echo "$usage" - exit 0 - shift - ;; - -r|--report) - report="-r" - ;; - -s|--serial) - serial=true - ;; - -t|--test|--tests) - TEST="$2" - shift - ;; - *) - echo "unknown option $1 $2" - exit 1 - ;; - esac - shift # past argument or value -done - - -# Source credentials -echo "Sourcing Credentials ${creds} to run the test.." -source ${creds} - - -# Run test -run_test $TEST diff --git a/functest/ci/run_tests.py b/functest/ci/run_tests.py index 4193e48f..4a47ba57 100755 --- a/functest/ci/run_tests.py +++ b/functest/ci/run_tests.py @@ -31,13 +31,6 @@ from functest.utils.constants import CONST logger = ft_logger.Logger("run_tests").getLogger() -""" global variables """ -EXEC_SCRIPT = ("%s/functest/ci/exec_test.sh" % CONST.dir_repo_functest) - -# This will be the return code of this script. If any of the tests fails, -# this variable will change to Result.EX_ERROR - - class Result(enum.Enum): EX_OK = os.EX_OK EX_ERROR = -1 @@ -114,7 +107,7 @@ def update_test_info(test_name, result, duration): "duration": duration}) -def get_run_dict_if_defined(testname): +def get_run_dict(testname): try: dict = ft_utils.get_dict_by_test(testname) if not dict: @@ -138,7 +131,7 @@ def run_test(test, tier_name, testcases=None): logger.debug("\n%s" % test) source_rc_file() - if GlobalVariables.CLEAN_FLAG: + if test.needs_clean() and GlobalVariables.CLEAN_FLAG: generate_os_snapshot() flags = (" -t %s" % (test_name)) @@ -146,12 +139,13 @@ def run_test(test, tier_name, testcases=None): flags += " -r" result = testcase_base.TestcaseBase.EX_RUN_ERROR - run_dict = get_run_dict_if_defined(test_name) + run_dict = get_run_dict(test_name) if run_dict: try: module = importlib.import_module(run_dict['module']) cls = getattr(module, run_dict['class']) test_case = cls() + try: kwargs = run_dict['args'] result = test_case.run(**kwargs) @@ -168,14 +162,11 @@ def run_test(test, tier_name, testcases=None): logger.exception("Cannot get class {}".format( run_dict['class'])) else: - cmd = ("%s%s" % (EXEC_SCRIPT, flags)) - logger.info("Executing command {} because {} " - "doesn't implement the new framework".format( - cmd, test_name)) - result = ft_utils.execute_command(cmd) + raise Exception("Cannot import the class for the test case.") - if GlobalVariables.CLEAN_FLAG: + if test.needs_clean() and GlobalVariables.CLEAN_FLAG: cleanup() + end = datetime.datetime.now() duration = (end - start).seconds duration_str = ("%02d:%02d" % divmod(duration, 60)) diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml index 77cd1ae6..1a1d0f4b 100755 --- a/functest/ci/testcases.yaml +++ b/functest/ci/testcases.yaml @@ -11,6 +11,7 @@ tiers: name: snaps_health_check criteria: 'status == "PASS"' blocking: true + clean_flag: false description: >- This test case creates executes the SimpleHealthCheck Python test class which creates an, image, flavor, network, @@ -26,6 +27,7 @@ tiers: name: connection_check criteria: 'status == "PASS"' blocking: true + clean_flag: false description: >- This test case verifies the retrieval of OpenStack clients: Keystone, Glance, Neutron and Nova and may perform some @@ -44,6 +46,7 @@ tiers: name: api_check criteria: 'status == "PASS"' blocking: true + clean_flag: false description: >- This test case verifies the retrieval of OpenStack clients: Keystone, Glance, Neutron and Nova and may perform some @@ -68,6 +71,7 @@ tiers: name: vping_ssh criteria: 'status == "PASS"' blocking: true + clean_flag: true description: >- This test case verifies: 1) SSH to an instance using floating IPs over the public network. 2) Connectivity between 2 instances @@ -83,6 +87,7 @@ tiers: name: vping_userdata criteria: 'status == "PASS"' blocking: true + clean_flag: true description: >- This test case verifies: 1) Boot a VM with given userdata. 2) Connectivity between 2 instances over a private network. @@ -97,6 +102,7 @@ tiers: name: tempest_smoke_serial criteria: 'success_rate == 100%' blocking: false + clean_flag: false description: >- This test case runs the smoke subset of the OpenStack Tempest suite. The list of test cases is generated by @@ -113,6 +119,7 @@ tiers: name: rally_sanity criteria: 'success_rate == 100%' blocking: false + clean_flag: false description: >- This test case runs a sub group of tests of the OpenStack Rally suite in smoke mode. @@ -127,6 +134,7 @@ tiers: name: odl criteria: 'success_rate == 100%' blocking: true + clean_flag: false description: >- Test Suite for the OpenDaylight SDN Controller. It integrates some test suites from upstream using @@ -146,6 +154,7 @@ tiers: name: odl_netvirt criteria: 'success_rate == 100%' blocking: true + clean_flag: false description: >- Test Suite for the OpenDaylight SDN Controller when the NetVirt features are installed. It integrates @@ -167,6 +176,7 @@ tiers: name: onos criteria: 'status == "PASS"' blocking: true + clean_flag: true description: >- Test Suite for the ONOS SDN Controller. It integrates some test suites from upstream using TestON as the test @@ -182,6 +192,7 @@ tiers: name: snaps_smoke criteria: 'status == "PASS"' blocking: false + clean_flag: false description: >- This test case contains tests that setup and destroy environments with VMs with and without Floating IPs @@ -210,6 +221,7 @@ tiers: name: promise criteria: 'success_rate == 100%' blocking: false + clean_flag: true description: >- Test suite from Promise project. dependencies: @@ -223,6 +235,7 @@ tiers: name: doctor criteria: 'status == "PASS"' blocking: false + clean_flag: true description: >- Test suite from Doctor project. dependencies: @@ -236,6 +249,7 @@ tiers: name: bgpvpn criteria: 'status == "PASS"' blocking: false + clean_flag: true description: >- Test suite from SDNVPN project. dependencies: @@ -249,6 +263,7 @@ tiers: name: security_scan criteria: 'status == "PASS"' blocking: false + clean_flag: true description: >- Simple Security Scan dependencies: @@ -261,6 +276,7 @@ tiers: # name: copper # criteria: 'status == "PASS"' # blocking: false +# clean_flag: true # description: >- # Test suite for policy management based on OpenStack Congress # dependencies: @@ -273,6 +289,7 @@ tiers: name: multisite criteria: 'success_rate == 100%' blocking: false + clean_flag: false description: >- Test suite from kingbird dependencies: @@ -285,6 +302,7 @@ tiers: name: odl-sfc criteria: 'status == "PASS"' blocking: false + clean_flag: true description: >- Test suite for odl-sfc to test two chains and two SFs dependencies: @@ -297,6 +315,7 @@ tiers: name: onos_sfc criteria: 'status == "PASS"' blocking: true + clean_flag: true description: >- Test Suite for onos-sfc to test sfc function. dependencies: @@ -309,6 +328,7 @@ tiers: name: parser criteria: 'ret == 0' blocking: false + clean_flag: true description: >- Test suite from Parser project. dependencies: @@ -321,6 +341,7 @@ tiers: name: domino criteria: 'status == "PASS"' blocking: false + clean_flag: true description: >- Test suite from Domino project. dependencies: @@ -333,6 +354,7 @@ tiers: name: orchestra criteria: 'ret == 0' blocking: false + clean_flag: true description: >- Test OpenBaton (Orchestra) stack dependencies: @@ -345,6 +367,7 @@ tiers: name: netready criteria: 'status == "PASS"' blocking: false + clean_flag: true description: >- Test suite from Netready project. dependencies: @@ -357,6 +380,7 @@ tiers: name: barometer criteria: 'status == "PASS"' blocking: false + clean_flag: true description: >- Test suite for the Barometer project. Separate tests verify the proper configuration and functionality of the following @@ -379,6 +403,7 @@ tiers: # name: tempest_full_parallel # criteria: 'success_rate >= 80%' # blocking: false +# clean_flag: false # description: >- # The list of test cases is generated by # Tempest automatically and depends on the parameters of @@ -393,6 +418,7 @@ tiers: name: tempest_defcore criteria: 'success_rate == 100%' blocking: false + clean_flag: false description: >- This is the set of Tempest test cases created by OpenStack Interop Working Group for certification purposes. @@ -406,6 +432,7 @@ tiers: name: tempest_custom criteria: 'success_rate == 100%' blocking: false + clean_flag: false description: >- The test case allows running a customized list of tempest test cases defined in a file under @@ -422,6 +449,7 @@ tiers: # name: rally_full # criteria: 'success_rate >= 90%' # blocking: false +# clean_flag: false # description: >- # This test case runs the full suite of scenarios of the OpenStack # Rally suite using several threads and iterations. @@ -443,6 +471,7 @@ tiers: name: cloudify_ims criteria: 'status == "PASS"' blocking: false + clean_flag: true description: >- This test case deploys an OpenSource vIMS solution from Clearwater using the Cloudify orchestrator. It also runs some signaling traffic. @@ -456,6 +485,7 @@ tiers: name: aaa criteria: 'ret == 0' blocking: false + clean_flag: true description: >- Test suite from Parser project. dependencies: @@ -469,6 +499,7 @@ tiers: name: juju_epc criteria: 'ret == 0' blocking: false + clean_flag: true description: >- Test suite from OAI project, vEPC deployed with Juju. dependencies: @@ -482,6 +513,7 @@ tiers: name: orchestra_ims criteria: 'ret == 0' blocking: false + clean_flag: true description: >- VNF deployment with OpenBaton (Orchestra) dependencies: @@ -495,6 +527,7 @@ tiers: name: opera_ims criteria: 'ret == 0' blocking: false + clean_flag: true description: >- Evolution of vIMS dependencies: @@ -508,6 +541,7 @@ tiers: name: vyos_vrouter criteria: 'status == "PASS"' blocking: false + clean_flag: true description: >- This test case is vRouter testing. dependencies: diff --git a/functest/ci/tier_builder.py b/functest/ci/tier_builder.py index dae7c73e..f4c6f70f 100755 --- a/functest/ci/tier_builder.py +++ b/functest/ci/tier_builder.py @@ -50,6 +50,7 @@ class TierBuilder(object): dependency=dep, criteria=dic_testcase['criteria'], blocking=dic_testcase['blocking'], + clean_flag=dic_testcase['clean_flag'], description=dic_testcase['description']) if testcase.is_compatible(self.ci_installer, self.ci_scenario): tier.add_test(testcase) diff --git a/functest/ci/tier_handler.py b/functest/ci/tier_handler.py index 127986bf..6b4864b5 100755 --- a/functest/ci/tier_handler.py +++ b/functest/ci/tier_handler.py @@ -104,12 +104,18 @@ class Tier(object): class TestCase(object): - def __init__(self, name, dependency, criteria, blocking, description=""): + def __init__(self, name, + dependency, + criteria, + blocking, + clean_flag, + description=""): self.name = name self.dependency = dependency - self.description = description self.criteria = criteria self.blocking = blocking + self.clean_flag = clean_flag + self.description = description @staticmethod def is_none(item): @@ -138,6 +144,9 @@ class TestCase(object): def is_blocking(self): return self.blocking + def needs_clean(self): + return self.clean_flag + def __str__(self): lines = split_text(self.description, LINE_LENGTH - 6) |