diff options
Diffstat (limited to 'functest/ci')
-rwxr-xr-x | functest/ci/check_os.sh | 63 | ||||
-rwxr-xr-x | functest/ci/config_functest.yaml | 5 | ||||
-rw-r--r-- | functest/ci/installer_params.yaml | 16 | ||||
-rwxr-xr-x | functest/ci/prepare_env.py | 89 | ||||
-rwxr-xr-x | functest/ci/run_tests.py | 2 | ||||
-rwxr-xr-x | functest/ci/testcases.yaml | 103 | ||||
-rwxr-xr-x | functest/ci/tier_builder.py | 2 | ||||
-rwxr-xr-x | functest/ci/tier_handler.py | 6 |
8 files changed, 200 insertions, 86 deletions
diff --git a/functest/ci/check_os.sh b/functest/ci/check_os.sh index b875a173..2c5c021c 100755 --- a/functest/ci/check_os.sh +++ b/functest/ci/check_os.sh @@ -6,6 +6,16 @@ # jose.lausuch@ericsson.com # +declare -A service_cmd_array +service_cmd_array['nova']='openstack server list' +service_cmd_array['neutron']='openstack network list' +service_cmd_array['keystone']='openstack endpoint list' +service_cmd_array['cinder']='openstack volume list' +service_cmd_array['glance']='openstack image list' + +MANDATORY_SERVICES='nova neutron keystone glance' +OPTIONAL_SERVICES='cinder' + verify_connectivity() { for i in $(seq 0 9); do if echo "test" | nc -v -w 10 $1 $2 &>/dev/null; then @@ -16,6 +26,34 @@ verify_connectivity() { return 1 } +check_service() { + local service cmd + service=$1 + cmd=${service_cmd_array[$service]} + if [ -z "$2" ]; then + required='false' + else + required=$2 + fi + echo ">>Checking ${service} service..." + if ! openstack service list | grep -i ${service} > /dev/null; then + if [ "$required" == 'false' ]; then + echo "WARN: Optional Service ${service} is not enabled!" + return + else + echo "ERROR: Required Service ${service} is not enabled!" + exit 1 + fi + fi + $cmd &>/dev/null + result=$? + if [ $result -ne 0 ]; then + echo "ERROR: Failed execution $cmd. The $service does not seem to be working." + exit 1 + else + echo " ...OK" + fi +} if [ -z $OS_AUTH_URL ];then echo "ERROR: OS_AUTH_URL environment variable missing... Have you sourced the OpenStack credentials?" @@ -56,25 +94,16 @@ fi echo " ...OK" -echo "Checking OpenStack basic services:" -commands=('openstack endpoint list' 'openstack server list' 'openstack network list' \ - 'openstack image list' 'openstack volume list') -for cmd in "${commands[@]}" -do - service=$(echo $cmd | awk '{print $1, $2}') - echo ">>Checking $service service..." - $cmd &>/dev/null - result=$? - if [ $result -ne 0 ]; - then - echo "ERROR: Failed execution $cmd. The $service does not seem to be working." - exit 1 - else - echo " ...OK" - fi +echo "Checking Required OpenStack services:" +for service in $MANDATORY_SERVICES; do + check_service $service "true" done +echo "Required OpenStack services are OK." -echo "OpenStack services are OK." +echo "Checking Optional OpenStack services:" +for service in $OPTIONAL_SERVICES; do + check_service $service +done echo "Checking External network..." networks=($(neutron net-list -F id | tail -n +4 | head -n -1 | awk '{print $2}')) diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml index b5ce6c13..489c395f 100755 --- a/functest/ci/config_functest.yaml +++ b/functest/ci/config_functest.yaml @@ -20,6 +20,8 @@ general: repo_sfc: /home/opnfv/repos/sfc dir_repo_onos: /home/opnfv/repos/onos repo_promise: /home/opnfv/repos/promise + repo_netready: /home/opnfv/repos/netready + repo_barometer: /home/opnfv/repos/barometer repo_doctor: /home/opnfv/repos/doctor repo_copper: /home/opnfv/repos/copper dir_repo_ovno: /home/opnfv/repos/ovno @@ -44,6 +46,8 @@ general: image_name: Cirros-0.3.4 image_file_name: cirros-0.3.4-x86_64-disk.img image_disk_format: qcow2 + image_username: cirros + image_password: cubswin:) flavor_name: opnfv_flavor flavor_ram: 512 @@ -130,6 +134,7 @@ vnf: orchestra_ims: tenant_name: orchestra_ims tenant_description: ims deployed with openbaton + config: orchestra_ims.yaml opera_ims: tenant_name: opera_ims tenant_description: ims deployed with open-o diff --git a/functest/ci/installer_params.yaml b/functest/ci/installer_params.yaml new file mode 100644 index 00000000..26aff9bb --- /dev/null +++ b/functest/ci/installer_params.yaml @@ -0,0 +1,16 @@ +apex: + ip: '' + user: 'stack' + pkey: '/root/.ssh/id_rsa' +# compass: +# ip: '192.168.200.2' +# user: 'root' +# password: 'root' +fuel: + ip: '10.20.0.2' + user: 'root' + password: 'r00tme' +# joid: +# ip: '' +# user: '' +# password: '' diff --git a/functest/ci/prepare_env.py b/functest/ci/prepare_env.py index 6b24fe08..5a9f99cb 100755 --- a/functest/ci/prepare_env.py +++ b/functest/ci/prepare_env.py @@ -1,18 +1,11 @@ #!/usr/bin/env python # -# Author: Jose Lausuch (jose.lausuch@ericsson.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 # - import argparse import json import os @@ -21,13 +14,15 @@ import subprocess import sys import yaml -from opnfv.utils import constants as opnfv_constants import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as ft_utils import functest.utils.openstack_utils as os_utils from functest.utils.constants import CONST +from opnfv.utils import constants as opnfv_constants +from opnfv.deployment import factory + actions = ['start', 'check'] """ logging configuration """ @@ -42,7 +37,7 @@ with open(CONFIG_PATCH_PATH) as f: functest_patch_yaml = yaml.safe_load(f) -class PrepareEnvParser(): +class PrepareEnvParser(object): def __init__(self): self.parser = argparse.ArgumentParser() @@ -222,20 +217,19 @@ def install_rally(): "Deployment %s does not exist." % CONST.rally_deployment_name), verbose=False) + rally_conf = os_utils.get_credentials_for_rally() with open('rally_conf.json', 'w') as fp: json.dump(rally_conf, fp) cmd = ("rally deployment create " - "--file=rally_conf.json --name={}" + "--file=rally_conf.json --name={0}" .format(CONST.rally_deployment_name)) - ft_utils.execute_command(cmd, - error_msg=("Problem while creating " - "Rally deployment")) + error_msg = "Problem while creating Rally deployment" + ft_utils.execute_command_raise(cmd, error_msg=error_msg) cmd = "rally deployment check" - ft_utils.execute_command(cmd, - error_msg=("OpenStack not responding or " - "faulty Rally deployment.")) + error_msg = "OpenStack not responding or faulty Rally deployment." + ft_utils.execute_command_raise(cmd, error_msg=error_msg) cmd = "rally deployment list" ft_utils.execute_command(cmd, @@ -250,19 +244,30 @@ def install_rally(): def install_tempest(): logger.info("Installing tempest from existing repo...") - cmd = ("rally verify create-verifier --source {0} " - "--name {1} --type tempest" - .format(CONST.dir_repo_tempest, CONST.tempest_deployment_name)) - ft_utils.execute_command(cmd, - error_msg="Problem while installing Tempest.") + cmd = ("rally verify list-verifiers | " + "grep '{0}' | wc -l".format(CONST.tempest_deployment_name)) + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) + while p.poll() is None: + line = p.stdout.readline().rstrip() + if str(line) == '0': + logger.debug("Tempest %s does not exist" % + CONST.tempest_deployment_name) + cmd = ("rally verify create-verifier --source {0} " + "--name {1} --type tempest" + .format(CONST.dir_repo_tempest, + CONST.tempest_deployment_name)) + error_msg = "Problem while installing Tempest." + ft_utils.execute_command_raise(cmd, error_msg=error_msg) def create_flavor(): - os_utils.get_or_create_flavor('m1.tiny', - '512', - '1', - '1', - public=True) + _, flavor_id = os_utils.get_or_create_flavor('m1.tiny', + '512', + '1', + '1', + public=True) + if flavor_id is None: + raise Exception('Failed to create flavor') def check_environment(): @@ -278,6 +283,37 @@ def check_environment(): logger.info("Functest environment is installed.") +def print_deployment_info(): + installer_params_yaml = os.path.join(CONST.dir_repo_functest, + 'functest/ci/installer_params.yaml') + if (CONST.INSTALLER_IP and CONST.INSTALLER_TYPE and + CONST.INSTALLER_TYPE in opnfv_constants.INSTALLERS): + try: + installer_params = ft_utils.get_parameter_from_yaml( + CONST.INSTALLER_TYPE, installer_params_yaml) + except ValueError as e: + logger.debug('Printing deployment info is not supported for %s' % + CONST.INSTALLER_TYPE) + logger.debug(e) + else: + user = installer_params.get('user', None) + password = installer_params.get('password', None) + pkey = installer_params.get('pkey', None) + + try: + handler = factory.Factory.get_handler( + installer=CONST.INSTALLER_TYPE, + installer_ip=CONST.INSTALLER_IP, + installer_user=user, + installer_pwd=password, + pkey_file=pkey) + if handler: + logger.info('\n\nDeployment information:\n%s' % + handler.get_deployment_info()) + except Exception as e: + logger.debug("Cannot get deployment information. %s" % e) + + def main(**kwargs): try: if not (kwargs['action'] in actions): @@ -296,6 +332,7 @@ def main(**kwargs): with open(CONST.env_active, "w") as env_file: env_file.write("1") check_environment() + print_deployment_info() elif kwargs['action'] == "check": check_environment() except Exception as e: diff --git a/functest/ci/run_tests.py b/functest/ci/run_tests.py index 93518de0..f920e70d 100755 --- a/functest/ci/run_tests.py +++ b/functest/ci/run_tests.py @@ -48,7 +48,7 @@ class BlockingTestFailed(Exception): pass -class RunTestsParser(): +class RunTestsParser(object): def __init__(self): self.parser = argparse.ArgumentParser() diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml index 4458fdd5..be12ac76 100755 --- a/functest/ci/testcases.yaml +++ b/functest/ci/testcases.yaml @@ -8,26 +8,14 @@ tiers: operations in the VIM. testcases: - - name: healthcheck - criteria: 'status == "PASS"' - blocking: true - description: >- - This test case verifies the basic OpenStack services like - Keystone, Glance, Cinder, Neutron and Nova. - - dependencies: - installer: '' - scenario: '^((?!lxd).)*$' - - name: snaps_health_check criteria: 'status == "PASS"' - blocking: false + blocking: true description: >- This test case creates executes the SimpleHealthCheck Python test class which creates an, image, flavor, network, and Cirros VM instance and observes the console output to validate the single port obtains the correct IP address. - dependencies: installer: '' scenario: '^((?!lxd).)*$' @@ -336,41 +324,80 @@ tiers: run: module: 'functest.opnfv_tests.features.orchestrator.orchestra' class: 'OpenbatonOrchestrator' + - + name: netready + criteria: 'status == "PASS"' + blocking: false + description: >- + Test suite from Netready project. + dependencies: + installer: 'apex' + scenario: 'gluon' + run: + module: 'functest.opnfv_tests.features.netready' + class: 'GluonVping' + - + name: barometer + criteria: 'status == "PASS"' + blocking: false + description: >- + Test suite for the Barometer project. Separate tests verify the + proper configuration and functionality of the following + collectd plugins Ceilometer, Hugepages, Memory RAS (mcelog), + and OVS Events + dependencies: + installer: 'fuel' + scenario: 'kvm_ovs_dpdk_bar' + run: + module: 'functest.opnfv_tests.features.barometer' + class: 'BarometerCollectd' - name: components order: 3 - ci_loop: 'weekly' + ci_loop: 'daily' description : >- Extensive testing of OpenStack API. testcases: +# - +# name: tempest_full_parallel +# criteria: 'success_rate >= 80%' +# blocking: false +# description: >- +# The list of test cases is generated by +# Tempest automatically and depends on the parameters of +# the OpenStack deplopyment. +# dependencies: +# installer: '^((?!netvirt).)*$' +# scenario: '' +# run: +# module: 'functest.opnfv_tests.openstack.tempest.tempest' +# class: 'TempestFullParallel' - - name: tempest_full_parallel - criteria: 'success_rate >= 80%' + name: tempest_defcore + criteria: 'success_rate == 100%' blocking: false description: >- - The list of test cases is generated by - Tempest automatically and depends on the parameters of - the OpenStack deplopyment. + This is the set of Tempest test cases created by OpenStack + Interop Working Group for certification purposes. dependencies: - installer: '^((?!netvirt).)*$' - scenario: '' + installer: '' + scenario: 'nosdn-nofeature-ha' run: module: 'functest.opnfv_tests.openstack.tempest.tempest' - class: 'TempestFullParallel' - - - - name: rally_full - criteria: 'success_rate >= 90%' - blocking: false - description: >- - This test case runs the full suite of scenarios of the OpenStack - Rally suite using several threads and iterations. - dependencies: - installer: '^((?!netvirt).)*$' - scenario: '' - run: - module: 'functest.opnfv_tests.openstack.rally.rally' - class: 'RallyFull' + class: 'TempestDefcore' +# - +# name: rally_full +# criteria: 'success_rate >= 90%' +# blocking: false +# description: >- +# This test case runs the full suite of scenarios of the OpenStack +# Rally suite using several threads and iterations. +# dependencies: +# installer: '^((?!netvirt).)*$' +# scenario: '' +# run: +# module: 'functest.opnfv_tests.openstack.rally.rally' +# class: 'RallyFull' - name: vnf @@ -425,8 +452,8 @@ tiers: description: >- VNF deployment with OpenBaton (Orchestra) dependencies: - installer: 'unknown' - scenario: 'unknown' + installer: '' + scenario: '' run: module: 'functest.opnfv_tests.vnf.ims.orchestra_ims' class: 'ImsVnf' diff --git a/functest/ci/tier_builder.py b/functest/ci/tier_builder.py index e1c3e49e..dae7c73e 100755 --- a/functest/ci/tier_builder.py +++ b/functest/ci/tier_builder.py @@ -11,7 +11,7 @@ import tier_handler as th import yaml -class TierBuilder: +class TierBuilder(object): def __init__(self, ci_installer, ci_scenario, testcases_file): self.ci_installer = ci_installer diff --git a/functest/ci/tier_handler.py b/functest/ci/tier_handler.py index 1eadfba5..127986bf 100755 --- a/functest/ci/tier_handler.py +++ b/functest/ci/tier_handler.py @@ -28,7 +28,7 @@ def split_text(text, max_len): return lines -class Tier: +class Tier(object): def __init__(self, name, order, ci_loop, description=""): self.tests_array = [] @@ -102,7 +102,7 @@ class Tier: return out -class TestCase: +class TestCase(object): def __init__(self, name, dependency, criteria, blocking, description=""): self.name = name @@ -160,7 +160,7 @@ class TestCase: return out -class Dependency: +class Dependency(object): def __init__(self, installer, scenario): self.installer = installer |