diff options
-rw-r--r-- | docker/Dockerfile | 10 | ||||
-rw-r--r-- | docker/Dockerfile.aarch64 | 6 | ||||
-rwxr-xr-x | functest/ci/config_functest.yaml | 1 | ||||
-rw-r--r-- | functest/ci/installer_params.yaml | 16 | ||||
-rwxr-xr-x | functest/ci/prepare_env.py | 31 | ||||
-rwxr-xr-x | functest/ci/testcases.yaml | 15 | ||||
-rw-r--r-- | functest/core/feature_base.py | 10 | ||||
-rw-r--r-- | functest/core/vnf_base.py | 15 | ||||
-rw-r--r-- | functest/opnfv_tests/features/barometer.py | 28 | ||||
-rw-r--r-- | functest/utils/env.py | 2 | ||||
-rwxr-xr-x | functest/utils/functest_logger.py | 2 |
11 files changed, 125 insertions, 11 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile index ca0fb6a7..f59e1f73 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -84,6 +84,7 @@ RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/doctor ${REPO RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/ovno ${REPOS_DIR}/ovno RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/promise ${REPOS_DIR}/promise RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/netready ${REPOS_DIR}/netready +RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/barometer ${REPOS_DIR}/barometer RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/sfc ${REPOS_DIR}/sfc RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/snaps ${REPOS_DIR}/snaps RUN git clone --depth 1 https://gerrit.opnfv.org/gerrit/securityscanning ${REPOS_DIR}/securityscanning @@ -91,7 +92,7 @@ RUN git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng ${REPOS_DIR}/rele # OpenStack repositories RUN git clone --depth 1 -b $OPENSTACK_TAG https://github.com/openstack/networking-bgpvpn ${REPOS_DIR}/bgpvpn -#RUN git clone --depth 1 -b $KINGBIRD_TAG https://github.com/openstack/kingbird.git ${REPOS_DIR}/kingbird +RUN git clone --depth 1 -b $KINGBIRD_TAG https://github.com/openstack/kingbird.git ${REPOS_DIR}/kingbird RUN git clone --depth 1 -b $RALLY_TAG https://github.com/openstack/rally.git ${REPOS_DIR}/rally RUN git clone --depth 1 -b $TEMPEST_TAG https://github.com/openstack/tempest.git ${REPOS_DIR}/tempest @@ -110,6 +111,9 @@ RUN cd ${FUNCTEST_REPO_DIR} \ RUN cd ${RELENG_MODULE_DIR} \ && pip install . +RUN cd ${REPOS_DIR}/barometer \ + && pip install . + RUN find ${FUNCTEST_REPO_DIR} -name "*.py" \ -not -path "*tests/unit*" |xargs grep __main__ |cut -d\: -f 1 |xargs chmod -c 755 \ && find ${FUNCTEST_REPO_DIR} -name "*.sh" |xargs grep \#\! |cut -d\: -f 1 |xargs chmod -c 755 @@ -135,7 +139,9 @@ RUN cd ${REPOS_DIR}/sfc && pip install . RUN cd ${REPOS_DIR}/sdnvpn && pip install . RUN cd ${REPOS_DIR}/bgpvpn && pip install . -#RUN cd ${REPOS_DIR}/kingbird && pip install -e . + +# Kingbird integration +RUN cd ${REPOS_DIR}/kingbird && pip install -e . RUN /bin/bash -c ". /etc/profile.d/rvm.sh \ && cd ${REPOS_VNFS_DIR}/vims-test \ diff --git a/docker/Dockerfile.aarch64 b/docker/Dockerfile.aarch64 index fa04e8c8..bf8e361f 100644 --- a/docker/Dockerfile.aarch64 +++ b/docker/Dockerfile.aarch64 @@ -91,7 +91,7 @@ RUN git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng ${REPOS_DIR}/rele # OpenStack repositories RUN git clone --depth 1 -b $OPENSTACK_TAG https://github.com/openstack/networking-bgpvpn ${REPOS_DIR}/bgpvpn -#RUN git clone --depth 1 -b $KINGBIRD_TAG https://github.com/openstack/kingbird.git ${REPOS_DIR}/kingbird +RUN git clone --depth 1 -b $KINGBIRD_TAG https://github.com/openstack/kingbird.git ${REPOS_DIR}/kingbird RUN git clone --depth 1 -b $RALLY_TAG https://github.com/openstack/rally.git ${REPOS_DIR}/rally RUN git clone --depth 1 -b $TEMPEST_TAG https://github.com/openstack/tempest.git ${REPOS_DIR}/tempest @@ -131,7 +131,9 @@ RUN cd ${REPOS_DIR}/sfc && pip install . RUN cd ${REPOS_DIR}/sdnvpn && pip install . RUN cd ${REPOS_DIR}/bgpvpn && pip install . -#RUN cd ${REPOS_DIR}/kingbird && pip install -e . + +# Kingbird integration +RUN cd ${REPOS_DIR}/kingbird && pip install -e . RUN /bin/bash -c ". /etc/profile.d/rvm.sh \ && cd ${REPOS_VNFS_DIR}/vims-test \ diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml index 8fa4bd34..3bad1b8f 100755 --- a/functest/ci/config_functest.yaml +++ b/functest/ci/config_functest.yaml @@ -21,6 +21,7 @@ general: 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 diff --git a/functest/ci/installer_params.yaml b/functest/ci/installer_params.yaml new file mode 100644 index 00000000..bffa894e --- /dev/null +++ b/functest/ci/installer_params.yaml @@ -0,0 +1,16 @@ +apex: + ip: '' + user: 'stack' + pkey: '/root/.ssh/id_rsa' +#compass: +# ip: '' +# 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..80bcfc7d 100755 --- a/functest/ci/prepare_env.py +++ b/functest/ci/prepare_env.py @@ -21,13 +21,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 """ @@ -278,6 +280,32 @@ 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): + installer_params = ft_utils.get_parameter_from_yaml( + CONST.INSTALLER_TYPE, installer_params_yaml) + + 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 +324,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/testcases.yaml b/functest/ci/testcases.yaml index b1d824f6..a2633fcf 100755 --- a/functest/ci/testcases.yaml +++ b/functest/ci/testcases.yaml @@ -348,6 +348,21 @@ tiers: 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 diff --git a/functest/core/feature_base.py b/functest/core/feature_base.py index fe9a9998..2bd1ec83 100644 --- a/functest/core/feature_base.py +++ b/functest/core/feature_base.py @@ -7,6 +7,7 @@ from functest.utils.constants import CONST class FeatureBase(base.TestcaseBase): + def __init__(self, project='functest', case='', repo='', cmd=''): super(FeatureBase, self).__init__() self.project_name = project @@ -19,7 +20,7 @@ class FeatureBase(base.TestcaseBase): def run(self, **kwargs): self.prepare() self.start_time = time.time() - ret = ft_utils.execute_command(self.cmd, output_file=self.result_file) + ret = self.execute() self.stop_time = time.time() self.post() self.parse_results(ret) @@ -27,6 +28,13 @@ class FeatureBase(base.TestcaseBase): self.logger.info("Test result is stored in '%s'" % self.result_file) return base.TestcaseBase.EX_OK + def execute(self): + ''' + Executer method that can be overwritten + By default it executes a shell command. + ''' + return ft_utils.execute_command(self.cmd, output_file=self.result_file) + def prepare(self, **kwargs): pass diff --git a/functest/core/vnf_base.py b/functest/core/vnf_base.py index 07b64fd0..9438dca1 100644 --- a/functest/core/vnf_base.py +++ b/functest/core/vnf_base.py @@ -111,9 +111,9 @@ class VnfOnBoardingBase(base.TestcaseBase): self.keystone_client = os_utils.get_keystone_client() self.logger.info("Prepare OpenStack plateform(create tenant and user)") - user_id = os_utils.get_user_id(self.keystone_client, - self.creds['username']) - if user_id == '': + admin_user_id = os_utils.get_user_id(self.keystone_client, + self.creds['username']) + if admin_user_id == '': self.step_failure("Failed to get id of " + self.creds['username']) @@ -133,7 +133,7 @@ class VnfOnBoardingBase(base.TestcaseBase): self.logger.error("Failed to get id for %s role" % role_name) self.step_failure("Failed to get role id of " + role_name) - if not os_utils.add_role_user(self.keystone_client, user_id, + if not os_utils.add_role_user(self.keystone_client, admin_user_id, role_id, tenant_id): self.logger.error("Failed to add %s on tenant" % self.creds['username']) @@ -149,6 +149,13 @@ class VnfOnBoardingBase(base.TestcaseBase): self.logger.error("Failed to create %s user" % self.tenant_name) self.step_failure("Failed to create user ") + if not os_utils.add_role_user(self.keystone_client, user_id, + role_id, tenant_id): + self.logger.error("Failed to add %s on tenant" % + self.tenant_name) + self.step_failure("Failed to add %s on tenant" % + self.tenant_name) + self.logger.info("Update OpenStack creds informations") self.admin_creds = self.creds.copy() self.admin_creds.update({ diff --git a/functest/opnfv_tests/features/barometer.py b/functest/opnfv_tests/features/barometer.py new file mode 100644 index 00000000..aec2bce5 --- /dev/null +++ b/functest/opnfv_tests/features/barometer.py @@ -0,0 +1,28 @@ +#!/usr/bin/python +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 + + +import functest.core.feature_base as base +import functest.utils.functest_logger as ft_logger + +from baro_tests import collectd + + +class BarometerCollectd(base.FeatureBase): + ''' + Class for executing barometercollectd testcase. + ''' + + def __init__(self): + super(BarometerCollectd, self).__init__(project='barometer', + case='barometercollectd', + repo='dir_repo_barometer') + self.logger = ft_logger.Logger("BarometerCollectd").getLogger() + + def execute(self): + return collectd.main(self.logger) diff --git a/functest/utils/env.py b/functest/utils/env.py index fa5245fb..7e4df2ea 100644 --- a/functest/utils/env.py +++ b/functest/utils/env.py @@ -3,7 +3,7 @@ import re default_envs = { 'NODE_NAME': 'unknown_pod', - 'CI_DEBUG': 'true', + 'CI_DEBUG': 'false', 'DEPLOY_SCENARIO': 'os-nosdn-nofeature-noha', 'DEPLOY_TYPE': 'virt', 'INSTALLER_TYPE': None, diff --git a/functest/utils/functest_logger.py b/functest/utils/functest_logger.py index 0cba8c52..6dc46ef2 100755 --- a/functest/utils/functest_logger.py +++ b/functest/utils/functest_logger.py @@ -30,9 +30,11 @@ from functest.utils.constants import CONST class Logger: + def __init__(self, logger_name): self.setup_logging() self.logger = logging.getLogger(logger_name) + logging.getLogger("paramiko").setLevel(logging.WARNING) def getLogger(self): return self.logger |