diff options
Diffstat (limited to 'functest')
-rwxr-xr-x | functest/ci/config_functest.yaml | 1 | ||||
-rwxr-xr-x | functest/ci/testcases.yaml | 20 | ||||
-rw-r--r-- | functest/core/vnf_base.py | 14 | ||||
-rw-r--r-- | functest/opnfv_tests/features/netready.py | 22 | ||||
-rwxr-xr-x | functest/opnfv_tests/features/security_scan.py | 2 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/conf_utils.py | 45 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/tempest.py | 6 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/cloudify_ims.py | 13 | ||||
-rwxr-xr-x | functest/utils/functest_logger.py | 58 | ||||
-rw-r--r-- | functest/utils/functest_utils.py | 2 | ||||
-rw-r--r-- | functest/utils/openstack_tacker.py | 13 |
11 files changed, 114 insertions, 82 deletions
diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml index d0442cf9..8fa4bd34 100755 --- a/functest/ci/config_functest.yaml +++ b/functest/ci/config_functest.yaml @@ -20,6 +20,7 @@ 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_doctor: /home/opnfv/repos/doctor repo_copper: /home/opnfv/repos/copper dir_repo_ovno: /home/opnfv/repos/ovno diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml index 4d02fe78..77bd0152 100755 --- a/functest/ci/testcases.yaml +++ b/functest/ci/testcases.yaml @@ -336,6 +336,18 @@ 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: components order: 3 @@ -375,7 +387,7 @@ tiers: - name: vnf order: 4 - ci_loop: 'weekly' + ci_loop: '(daily)|(weekly)' description : >- Collection of VNF test cases. testcases: @@ -388,7 +400,7 @@ tiers: using the Cloudify orchestrator. It also runs some signaling traffic. dependencies: installer: '' - scenario: '(ocl)|(nosdn)|^(os-odl)((?!bgpvpn).)*$' + scenario: 'nosdn-nofeature' run: module: 'functest.opnfv_tests.vnf.ims.cloudify_ims' class: 'ImsVnf' @@ -399,8 +411,8 @@ tiers: description: >- Test suite from Parser project. dependencies: - installer: '' - scenario: '' + installer: 'unknown' + scenario: 'unknown' run: module: 'functest.opnfv_tests.vnf.aaa.aaa' class: 'AaaVnf' diff --git a/functest/core/vnf_base.py b/functest/core/vnf_base.py index 44b4ae04..07b64fd0 100644 --- a/functest/core/vnf_base.py +++ b/functest/core/vnf_base.py @@ -67,8 +67,8 @@ class VnfOnBoardingBase(base.TestcaseBase): res_orchestrator['result']) self.details['orchestrator']['duration'] = round( orchestrator_ready_time - self.start_time, 1) - except: - self.logger.warn("Problem with the Orchestrator") + except Exception: + self.logger.warn("Problem with the Orchestrator", exc_info=True) # Deploy VNF try: @@ -150,12 +150,14 @@ class VnfOnBoardingBase(base.TestcaseBase): self.step_failure("Failed to create user ") self.logger.info("Update OpenStack creds informations") - self.creds.update({ - "tenant": self.tenant_name, + self.admin_creds = self.creds.copy() + self.admin_creds.update({ + "tenant": self.tenant_name }) - self.neutron_client = os_utils.get_neutron_client(self.creds) - self.nova_client = os_utils.get_nova_client(self.creds) + self.neutron_client = os_utils.get_neutron_client(self.admin_creds) + self.nova_client = os_utils.get_nova_client(self.admin_creds) self.creds.update({ + "tenant": self.tenant_name, "username": self.tenant_name, "password": self.tenant_name, }) diff --git a/functest/opnfv_tests/features/netready.py b/functest/opnfv_tests/features/netready.py new file mode 100644 index 00000000..dec2a23c --- /dev/null +++ b/functest/opnfv_tests/features/netready.py @@ -0,0 +1,22 @@ +#!/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 + + +class GluonVping(base.FeatureBase): + + def __init__(self): + super(GluonVping, self).__init__(project='netready', + case='gluon_vping', + repo='dir_repo_netready') + dir_netready_functest = '{}/test/functest'.format(self.repo) + self.cmd = ('cd %s && python ./gluon-test-suite.py' % + dir_netready_functest) diff --git a/functest/opnfv_tests/features/security_scan.py b/functest/opnfv_tests/features/security_scan.py index bcae516b..2db44175 100755 --- a/functest/opnfv_tests/features/security_scan.py +++ b/functest/opnfv_tests/features/security_scan.py @@ -14,7 +14,7 @@ from functest.utils.constants import CONST class SecurityScan(base.FeatureBase): def __init__(self): - super(SecurityScan, self).__init__(project='security_scan', + super(SecurityScan, self).__init__(project='securityscanning', case='security_scan', repo='dir_repo_securityscan') self.cmd = ('bash {0} && ' diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py index 028b085c..893fff8c 100644 --- a/functest/opnfv_tests/openstack/tempest/conf_utils.py +++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py @@ -106,7 +106,19 @@ def get_verifier_deployment_dir(verifier_id, deployment_id): 'for-deployment-{}'.format(deployment_id)) -def configure_tempest(deployment_dir, IMAGE_ID=None, FLAVOR_ID=None): +def backup_tempest_config(conf_file): + """ + Copy config file to tempest results directory + """ + if not os.path.exists(TEMPEST_RESULTS_DIR): + os.makedirs(TEMPEST_RESULTS_DIR) + + shutil.copyfile(conf_file, + os.path.join(TEMPEST_RESULTS_DIR, 'tempest.conf')) + + +def configure_tempest(deployment_dir, IMAGE_ID=None, FLAVOR_ID=None, + MODE=None): """ Calls rally verify and updates the generated tempest.conf with given parameters @@ -114,6 +126,8 @@ def configure_tempest(deployment_dir, IMAGE_ID=None, FLAVOR_ID=None): conf_file = configure_verifier(deployment_dir) configure_tempest_update_params(conf_file, IMAGE_ID, FLAVOR_ID) + if MODE == 'feature_multisite': + configure_tempest_multisite_params(conf_file) def configure_tempest_update_params(tempest_conf_file, @@ -164,12 +178,7 @@ def configure_tempest_update_params(tempest_conf_file, with open(tempest_conf_file, 'wb') as config_file: config.write(config_file) - # Copy tempest.conf to /home/opnfv/functest/results/tempest/ - if not os.path.exists(TEMPEST_RESULTS_DIR): - os.makedirs(TEMPEST_RESULTS_DIR) - - shutil.copyfile(tempest_conf_file, - os.path.join(TEMPEST_RESULTS_DIR, 'tempest.conf')) + backup_tempest_config(tempest_conf_file) def configure_verifier(deployment_dir): @@ -196,25 +205,11 @@ def configure_verifier(deployment_dir): return tempest_conf_file -def configure_tempest_multisite(deployment_dir): +def configure_tempest_multisite_params(tempest_conf_file): """ - Add/update needed parameters into tempest.conf file generated by Rally + Add/update multisite parameters into tempest.conf file generated by Rally """ - logger.debug("configure the tempest") - configure_tempest(deployment_dir) - - logger.debug("Finding tempest.conf file...") - tempest_conf_old = os.path.join(deployment_dir, 'tempest.conf') - if not os.path.isfile(tempest_conf_old): - raise Exception("Tempest configuration file %s NOT found." - % tempest_conf_old) - - # Copy tempest.conf to /home/opnfv/functest/results/tempest/ - cur_path = os.path.split(os.path.realpath(__file__))[0] - tempest_conf_file = os.path.join(cur_path, 'tempest_multisite.conf') - shutil.copyfile(tempest_conf_old, tempest_conf_file) - - logger.debug("Updating selected tempest.conf parameters...") + logger.debug("Updating multisite tempest.conf parameters...") config = ConfigParser.RawConfigParser() config.read(tempest_conf_file) @@ -279,3 +274,5 @@ def configure_tempest_multisite(deployment_dir): config.set('kingbird', 'api_version', kingbird_api_version) with open(tempest_conf_file, 'wb') as config_file: config.write(config_file) + + backup_tempest_config(tempest_conf_file) diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index 13d9e4e6..f925336d 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -113,7 +113,7 @@ class TempestCommon(testcase_base.TestcaseBase): if self.MODE == 'smoke': testr_mode = "smoke" elif self.MODE == 'feature_multisite': - testr_mode = " | grep -i kingbird " + testr_mode = "'[Kk]ingbird'" elif self.MODE == 'full': testr_mode = "" else: @@ -272,7 +272,8 @@ class TempestCommon(testcase_base.TestcaseBase): self.create_tempest_resources() conf_utils.configure_tempest(self.DEPLOYMENT_DIR, self.IMAGE_ID, - self.FLAVOR_ID) + self.FLAVOR_ID, + self.MODE) self.generate_test_list(self.VERIFIER_REPO_DIR) self.apply_tempest_blacklist() self.run_verifier_tests() @@ -319,7 +320,6 @@ class TempestMultisite(TempestCommon): self.case_name = "multisite" self.MODE = "feature_multisite" self.OPTION = "--concurrency 1" - conf_utils.configure_tempest_multisite(self.DEPLOYMENT_DIR) class TempestCustom(TempestCommon): diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py index e2508c22..e354563e 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py @@ -68,10 +68,10 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): def deploy_orchestrator(self, **kwargs): self.logger.info("Additional pre-configuration steps") - self.neutron_client = os_utils.get_neutron_client(self.creds) - self.glance_client = os_utils.get_glance_client(self.creds) - self.keystone_client = os_utils.get_keystone_client(self.creds) - self.nova_client = os_utils.get_nova_client(self.creds) + self.neutron_client = os_utils.get_neutron_client(self.admin_creds) + self.glance_client = os_utils.get_glance_client(self.admin_creds) + self.keystone_client = os_utils.get_keystone_client(self.admin_creds) + self.nova_client = os_utils.get_nova_client(self.admin_creds) # needs some images self.logger.info("Upload some OS images if it doesn't exist") @@ -176,11 +176,6 @@ class ImsVnf(vnf_base.VnfOnBoardingBase): cfy.set_nameservers(ns) self.logger.debug("Resolvconf set") - if 'compute' in self.nova_client.client.services_url: - cfy.set_nova_url(self.nova_client.client.services_url['compute']) - if self.neutron_client.httpclient.endpoint_url is not None: - cfy.set_neutron_url(self.neutron_client.httpclient.endpoint_url) - self.logger.info("Prepare virtualenv for cloudify-cli") cmd = "chmod +x " + self.case_dir + "create_venv.sh" ft_utils.execute_command(cmd) diff --git a/functest/utils/functest_logger.py b/functest/utils/functest_logger.py index f09f56be..0cba8c52 100755 --- a/functest/utils/functest_logger.py +++ b/functest/utils/functest_logger.py @@ -28,42 +28,36 @@ import json from functest.utils.constants import CONST -logger = logging.getLogger(__name__) - - -def is_debug(): - if CONST.CI_DEBUG and CONST.CI_DEBUG.lower() == "true": - return True - return False - - -def setup_logging(default_path=CONST.dir_functest_logging_cfg, - default_level=logging.INFO, - env_key='LOG_CFG'): - path = default_path - value = os.getenv(env_key, None) - if value: - path = value - if os.path.exists(path): - with open(path, 'rt') as f: - config = json.load(f) - if (config['handlers'] and - config['handlers']['console']): - stream_level = logging.INFO - if is_debug(): - stream_level = logging.DEBUG - config['handlers']['console']['level'] = stream_level - logging.config.dictConfig(config) - else: - logging.basicConfig(level=default_level) - - -setup_logging() - class Logger: def __init__(self, logger_name): + self.setup_logging() self.logger = logging.getLogger(logger_name) def getLogger(self): return self.logger + + def is_debug(self): + if CONST.CI_DEBUG and CONST.CI_DEBUG.lower() == "true": + return True + return False + + def setup_logging(self, default_path=CONST.dir_functest_logging_cfg, + default_level=logging.INFO, + env_key='LOG_CFG'): + path = default_path + value = os.getenv(env_key, None) + if value: + path = value + if os.path.exists(path): + with open(path, 'rt') as f: + config = json.load(f) + if (config['handlers'] and + config['handlers']['console']): + stream_level = logging.INFO + if self.is_debug(): + stream_level = logging.DEBUG + config['handlers']['console']['level'] = stream_level + logging.config.dictConfig(config) + else: + logging.basicConfig(level=default_level) diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py index 12d8e902..b2c36cff 100644 --- a/functest/utils/functest_utils.py +++ b/functest/utils/functest_utils.py @@ -270,7 +270,7 @@ def get_resolvconf_ns(): while line: ip = re.search(r"\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b", line) if ip: - resolver.nameservers = [str(ip)] + resolver.nameservers = [ip.group(0)] try: result = resolver.query('opnfv.org')[0] if result != "": diff --git a/functest/utils/openstack_tacker.py b/functest/utils/openstack_tacker.py index c7ac89af..d745f105 100644 --- a/functest/utils/openstack_tacker.py +++ b/functest/utils/openstack_tacker.py @@ -108,7 +108,8 @@ def list_vnfs(tacker_client, verbose=False): return None -def create_vnf(tacker_client, vnf_name, vnfd_id=None, vnfd_name=None): +def create_vnf(tacker_client, vnf_name, vnfd_id=None, + vnfd_name=None, param_file=None): try: vnf_body = { 'vnf': { @@ -116,6 +117,11 @@ def create_vnf(tacker_client, vnf_name, vnfd_id=None, vnfd_name=None): 'name': vnf_name } } + if param_file is not None: + params = None + with open(param_file) as f: + params = f.read() + vnf_body['vnf']['attributes']['param_values'] = params if vnfd_id is not None: vnf_body['vnf']['vnfd_id'] = vnfd_id else: @@ -189,7 +195,8 @@ def list_sfcs(tacker_client, verbose=False): def create_sfc(tacker_client, sfc_name, chain_vnf_ids=None, - chain_vnf_names=None): + chain_vnf_names=None, + symmetrical=False): try: sfc_body = { 'sfc': { @@ -198,6 +205,8 @@ def create_sfc(tacker_client, sfc_name, 'chain': [] } } + if symmetrical: + sfc_body['sfc']['symmetrical'] = True if chain_vnf_ids is not None: sfc_body['sfc']['chain'] = chain_vnf_ids else: |