diff options
Diffstat (limited to 'functest/opnfv_tests')
-rw-r--r-- | functest/opnfv_tests/openstack/rally/blacklist.txt | 1 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/rally/rally.py | 7 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/refstack_client/refstack_client.py | 49 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/snaps/snaps_utils.py | 13 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/conf_utils.py | 15 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/tempest.py | 46 | ||||
-rw-r--r-- | functest/opnfv_tests/sdn/odl/odl.py | 20 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/cloudify_ims.py | 27 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/cloudify_ims.yaml | 7 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py | 20 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/orchestra_openims.py | 22 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/router/cloudify_vrouter.py | 16 |
12 files changed, 100 insertions, 143 deletions
diff --git a/functest/opnfv_tests/openstack/rally/blacklist.txt b/functest/opnfv_tests/openstack/rally/blacklist.txt index 0623368d..cdb5be66 100644 --- a/functest/opnfv_tests/openstack/rally/blacklist.txt +++ b/functest/opnfv_tests/openstack/rally/blacklist.txt @@ -48,6 +48,7 @@ scenario: # panko in the deployment. This is not currently fulfilled # Ref: https://docs.openstack.org/releasenotes/ceilometer/ocata.html - 'CeilometerEvents..*' + - 'CeilometerTraits..*' functionality: - diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index fdef8bed..2042b2d1 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -42,6 +42,10 @@ class RallyBase(testcase.OSGCTestCase): CONST.__getattribute__('dir_functest_images'), GLANCE_IMAGE_FILENAME) GLANCE_IMAGE_FORMAT = CONST.__getattribute__('openstack_image_disk_format') + GLANCE_IMAGE_EXTRA_PROPERTIES = {} + if hasattr(CONST, 'openstack_extra_properties'): + GLANCE_IMAGE_EXTRA_PROPERTIES = CONST.__getattribute__( + 'openstack_extra_properties') FLAVOR_NAME = "m1.tiny" RALLY_DIR = pkg_resources.resource_filename( @@ -462,7 +466,8 @@ class RallyBase(testcase.OSGCTestCase): self.image_exists, self.image_id = os_utils.get_or_create_image( self.GLANCE_IMAGE_NAME, self.GLANCE_IMAGE_PATH, - self.GLANCE_IMAGE_FORMAT) + self.GLANCE_IMAGE_FORMAT, + self.GLANCE_IMAGE_EXTRA_PROPERTIES) if self.image_id is None: raise Exception("Failed to get or create image '%s'" % self.GLANCE_IMAGE_NAME) diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py index 17e02466..42befe22 100644 --- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py +++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py @@ -1,6 +1,7 @@ #!/usr/bin/env python + # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others. -# matthew.lijun@huawei.com wangwulin@huawei.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 @@ -10,7 +11,6 @@ from __future__ import division - import argparse import logging import os @@ -28,7 +28,9 @@ from functest.opnfv_tests.openstack.refstack_client.tempest_conf \ from functest.opnfv_tests.openstack.tempest import conf_utils from functest.utils.constants import CONST import functest.utils.functest_utils as ft_utils -import functest.utils.openstack_utils as os_utils + +__author__ = ("Matthew Li <matthew.lijun@huawei.com>," + "Linda Wang <wangwulin@huawei.com>") # logging configuration """ LOGGER = logging.getLogger(__name__) @@ -77,7 +79,7 @@ class RefstackClient(testcase.TestCase): """Run default defcore sys command.""" options = ["-v"] if not self.insecure else ["-v", self.insecure] cmd = (["refstack-client", "test", "-c", self.confpath] + - options + ["--test-list", self.defcorelist]) + options + ["--test-list", self.defcorelist]) LOGGER.info("Starting Refstack_defcore test case: '%s'.", cmd) with open(os.path.join(conf_utils.REFSTACK_RESULTS_DIR, @@ -211,45 +213,6 @@ class RefstackClient(testcase.TestCase): return res - def create_snapshot(self): - """ - Run the Tempest cleanup utility to initialize OS state. - For details, see https://docs.openstack.org/tempest/latest/cleanup.html - - :return: TestCase.EX_OK - """ - LOGGER.info("Initializing the saved state of the OpenStack deployment") - - # Make sure that Tempest is configured - if not self.tempestconf: - self.generate_conf() - - try: - os_utils.init_tempest_cleanup( - self.tempestconf.DEPLOYMENT_DIR, 'tempest.conf', - os.path.join(conf_utils.REFSTACK_RESULTS_DIR, - "tempest-cleanup-init.log")) - except Exception as err: - LOGGER.error(str(err)) - return testcase.TestCase.EX_RUN_ERROR - - return super(RefstackClient, self).create_snapshot() - - def clean(self): - """ - Run the Tempest cleanup utility to delete and destroy OS resources. - For details, see https://docs.openstack.org/tempest/latest/cleanup.html - """ - LOGGER.info("Destroying the resources created for tempest") - - os_utils.perform_tempest_cleanup( - self.tempestconf.DEPLOYMENT_DIR, 'tempest.conf', - os.path.join(conf_utils.REFSTACK_RESULTS_DIR, - "tempest-cleanup.log") - ) - - return super(RefstackClient, self).clean() - class RefstackClientParser(object): # pylint: disable=too-few-public-methods """Command line argument parser helper.""" diff --git a/functest/opnfv_tests/openstack/snaps/snaps_utils.py b/functest/opnfv_tests/openstack/snaps/snaps_utils.py index 309f9db1..956b104a 100644 --- a/functest/opnfv_tests/openstack/snaps/snaps_utils.py +++ b/functest/opnfv_tests/openstack/snaps/snaps_utils.py @@ -5,7 +5,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 -from snaps.openstack.utils import neutron_utils +from snaps.openstack.utils import neutron_utils, nova_utils def get_ext_net_name(os_creds): @@ -17,3 +17,14 @@ def get_ext_net_name(os_creds): neutron = neutron_utils.neutron_client(os_creds) ext_nets = neutron_utils.get_external_networks(neutron) return ext_nets[0].name + + +def get_active_compute_cnt(os_creds): + """ + Returns the number of active compute servers + :param: os_creds: an instance of snaps OSCreds object + :return: the number of active compute servers + """ + nova = nova_utils.nova_client(os_creds) + computes = nova_utils.get_availability_zone_hosts(nova, zone_name='nova') + return len(computes) diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py index 2cdc2cf6..4202df62 100644 --- a/functest/opnfv_tests/openstack/tempest/conf_utils.py +++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py @@ -119,18 +119,21 @@ 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): + compute_cnt=None): """ Calls rally verify and updates the generated tempest.conf with given parameters """ conf_file = configure_verifier(deployment_dir) - configure_tempest_update_params(conf_file, image_id, flavor_id) + configure_tempest_update_params(conf_file, image_id, flavor_id, + compute_cnt) def configure_tempest_defcore(deployment_dir, image_id, flavor_id, @@ -186,8 +189,8 @@ def generate_test_accounts_file(tenant_id): yaml.dump(accounts_list, f, default_flow_style=False) -def configure_tempest_update_params(tempest_conf_file, - image_id=None, flavor_id=None): +def configure_tempest_update_params(tempest_conf_file, image_id=None, + flavor_id=None, compute_cnt=1): """ Add/update needed parameters into tempest.conf file """ @@ -210,6 +213,10 @@ def configure_tempest_update_params(tempest_conf_file, config.set('compute', 'flavor_ref', flavor_id) if FLAVOR_ID_ALT is not None: config.set('compute', 'flavor_ref_alt', FLAVOR_ID_ALT) + if compute_cnt > 1: + # enable multinode tests + config.set('compute', 'min_compute_nodes', compute_cnt) + config.set('identity', 'region', 'RegionOne') if os_utils.is_keystone_v3(): auth_version = 'v3' diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index b8a4e9ad..19200142 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -20,10 +20,10 @@ import time import yaml from functest.core import testcase +from functest.opnfv_tests.openstack.snaps import snaps_utils from functest.opnfv_tests.openstack.tempest import conf_utils from functest.utils.constants import CONST import functest.utils.functest_utils as ft_utils -import functest.utils.openstack_utils as os_utils from snaps.openstack import create_flavor from snaps.openstack.create_flavor import FlavorSettings, OpenStackFlavor @@ -234,11 +234,13 @@ class TempestCommon(testcase.TestCase): if not os.path.exists(conf_utils.TEMPEST_RESULTS_DIR): os.makedirs(conf_utils.TEMPEST_RESULTS_DIR) resources = self.resources.create() + compute_cnt = snaps_utils.get_active_compute_cnt( + self.resources.os_creds) conf_utils.configure_tempest( self.DEPLOYMENT_DIR, image_id=resources.get("image_id"), flavor_id=resources.get("flavor_id"), - mode=self.MODE) + compute_cnt=compute_cnt) self.generate_test_list(self.VERIFIER_REPO_DIR) self.apply_tempest_blacklist() self.run_verifier_tests() @@ -253,46 +255,6 @@ class TempestCommon(testcase.TestCase): self.stop_time = time.time() return res - def create_snapshot(self): - """ - Run the Tempest cleanup utility to initialize OS state. - - :return: TestCase.EX_OK - """ - logger.info("Initializing the saved state of the OpenStack deployment") - - if not os.path.exists(conf_utils.TEMPEST_RESULTS_DIR): - os.makedirs(conf_utils.TEMPEST_RESULTS_DIR) - - # Make sure that the verifier is configured - conf_utils.configure_verifier(self.DEPLOYMENT_DIR) - - try: - os_utils.init_tempest_cleanup( - self.DEPLOYMENT_DIR, 'tempest.conf', - os.path.join(conf_utils.TEMPEST_RESULTS_DIR, - "tempest-cleanup-init.log")) - except Exception as err: - logger.error(str(err)) - return testcase.TestCase.EX_RUN_ERROR - - return super(TempestCommon, self).create_snapshot() - - def clean(self): - """ - Run the Tempest cleanup utility to delete and destroy OS resources - created by Tempest. - """ - logger.info("Destroying the resources created for refstack") - - os_utils.perform_tempest_cleanup( - self.DEPLOYMENT_DIR, 'tempest.conf', - os.path.join(conf_utils.TEMPEST_RESULTS_DIR, - "tempest-cleanup.log") - ) - - return super(TempestCommon, self).clean() - class TempestSmokeSerial(TempestCommon): diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py index 841da834..d09532cb 100644 --- a/functest/opnfv_tests/sdn/odl/odl.py +++ b/functest/opnfv_tests/sdn/odl/odl.py @@ -157,7 +157,11 @@ class ODLTests(testcase.TestCase): 'NEUTRON:' + kwargs['neutronip'], 'OS_AUTH_URL:"' + osauthurl + '"', 'OSUSERNAME:"' + kwargs['osusername'] + '"', + ('OSUSERDOMAINNAME:"' + + kwargs['osuserdomainname'] + '"'), 'OSTENANTNAME:"' + kwargs['ostenantname'] + '"', + ('OSPROJECTDOMAINNAME:"' + + kwargs['osprojectdomainname'] + '"'), 'OSPASSWORD:"' + kwargs['ospassword'] + '"', 'ODL_SYSTEM_IP:' + kwargs['odlip'], 'PORT:' + kwargs['odlwebport'], @@ -221,11 +225,16 @@ class ODLTests(testcase.TestCase): if 'INSTALLER_TYPE' in os.environ: installer_type = os.environ['INSTALLER_TYPE'] kwargs['osusername'] = os.environ['OS_USERNAME'] + kwargs['osuserdomainname'] = os.environ.get( + 'OS_USER_DOMAIN_NAME', 'Default') kwargs['ostenantname'] = os.environ['OS_TENANT_NAME'] + kwargs['osprojectdomainname'] = os.environ.get( + 'OS_PROJECT_DOMAIN_NAME', 'Default') kwargs['osauthurl'] = os.environ['OS_AUTH_URL'] kwargs['ospassword'] = os.environ['OS_PASSWORD'] if installer_type == 'fuel': - kwargs['odlwebport'] = '8282' + kwargs['odlwebport'] = '8181' + kwargs['odlrestconfport'] = '8282' elif installer_type == 'apex' or installer_type == 'netvirt': kwargs['odlip'] = os.environ['SDN_CONTROLLER_IP'] kwargs['odlwebport'] = '8081' @@ -262,14 +271,21 @@ class ODLParser(object): # pylint: disable=too-few-public-methods default='127.0.0.1') self.parser.add_argument( '-k', '--osauthurl', help='OS_AUTH_URL as defined by OpenStack', - default='http://127.0.0.1:5000/v2.0') + default='http://127.0.0.1:5000/v3') self.parser.add_argument( '-a', '--osusername', help='Username for OpenStack', default='admin') self.parser.add_argument( + '-f', '--osuserdomainname', help='User domain name for OpenStack', + default='Default') + self.parser.add_argument( '-b', '--ostenantname', help='Tenantname for OpenStack', default='admin') self.parser.add_argument( + '-g', '--osprojectdomainname', + help='Project domain name for OpenStack', + default='Default') + self.parser.add_argument( '-c', '--ospassword', help='Password for OpenStack', default='admin') self.parser.add_argument( diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py index 8ed7f0dd..c8c2c509 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py @@ -24,7 +24,6 @@ import functest.opnfv_tests.vnf.ims.clearwater_ims_base as clearwater_ims_base from functest.utils.constants import CONST import functest.utils.openstack_utils as os_utils -from snaps.openstack.os_credentials import OSCreds from snaps.openstack.create_network import (NetworkSettings, SubnetSettings, OpenStackNetwork) from snaps.openstack.create_security_group import (SecurityGroupSettings, @@ -63,7 +62,6 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): raise Exception("VNF config file not found") self.snaps_creds = '' - self.created_object = [] config_file = os.path.join(self.case_dir, self.config) self.orchestrator = dict( @@ -101,12 +99,19 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): self.__logger.info("Additional pre-configuration steps") - self.snaps_creds = OSCreds( - username=self.creds['username'], - password=self.creds['password'], - auth_url=self.creds['auth_url'], - project_name=self.creds['tenant'], - identity_api_version=int(os_utils.get_keystone_client_version())) + compute_quotas = self.os_project.get_compute_quotas() + network_quotas = self.os_project.get_network_quotas() + + for key, value in ( + self.vnf['requirements']['compute_quotas'].items()): + setattr(compute_quotas, key, value) + + for key, value in ( + self.vnf['requirements']['network_quotas'].items()): + setattr(network_quotas, key, value) + + compute_quotas = self.os_project.update_compute_quotas(compute_quotas) + network_quotas = self.os_project.update_network_quotas(network_quotas) # needs some images self.__logger.info("Upload some OS images if it doesn't exist") @@ -402,12 +407,6 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): self.__logger.warn("Some issue during the undeployment ..") self.__logger.warn("Tenant clean continue ..") - self.__logger.info('Remove the cloudify manager OS object ..') - for creator in reversed(self.created_object): - try: - creator.clean() - except Exception as exc: - self.logger.error('Unexpected error cleaning - %s', exc) super(CloudifyIms, self).clean() @energy.enable_recording diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml b/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml index 280e0a6b..ad7fa70a 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.yaml @@ -21,6 +21,13 @@ vnf: flavor: name: m1.small ram_min: 2048 + compute_quotas: + cores: 50 + instances: 15 + network_quotas: + security_group: 20 + security_group_rule: 100 + port: 50 inputs: image_id: 'ubuntu_14.04' flavor_id: 'm1.small' diff --git a/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py b/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py index 5154dea2..c924a347 100644 --- a/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py +++ b/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py @@ -31,7 +31,6 @@ from snaps.openstack.create_network import ( SubnetSettings, PortSettings) from snaps.openstack.create_router import OpenStackRouter, RouterSettings -from snaps.openstack.os_credentials import OSCreds from snaps.openstack.create_instance import ( VmInstanceSettings, OpenStackVmInstance) @@ -208,15 +207,13 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding): super(ClearwaterImsVnf, self).prepare() self.logger.info("Additional pre-configuration steps") - self.logger.info("creds %s", (self.creds)) - - self.snaps_creds = OSCreds( - username=self.creds['username'], - password=self.creds['password'], - auth_url=self.creds['auth_url'], - project_name=self.creds['tenant'], - identity_api_version=int(os_utils.get_keystone_client_version())) + self.creds = { + "tenant": self.tenant_name, + "username": self.tenant_name, + "password": self.tenant_name, + "auth_url": os_utils.get_credentials()['auth_url'] + } self.prepare_images() self.prepare_flavor() self.prepare_security_groups() @@ -661,8 +658,9 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding): try: neutron_client = os_utils.get_neutron_client(self.creds) self.logger.info("Deleting Open Baton Port...") - port = snaps_utils.neutron_utils.get_port_by_name( - neutron_client, '%s_port' % self.case_name) + port = snaps_utils.neutron_utils.get_port( + neutron_client, + port_name='%s_port' % self.case_name) snaps_utils.neutron_utils.delete_port(neutron_client, port) time.sleep(10) except Exception as exc: diff --git a/functest/opnfv_tests/vnf/ims/orchestra_openims.py b/functest/opnfv_tests/vnf/ims/orchestra_openims.py index 45440704..aae35146 100644 --- a/functest/opnfv_tests/vnf/ims/orchestra_openims.py +++ b/functest/opnfv_tests/vnf/ims/orchestra_openims.py @@ -32,7 +32,6 @@ from snaps.openstack.create_network import ( SubnetSettings, PortSettings) from snaps.openstack.create_router import OpenStackRouter, RouterSettings -from snaps.openstack.os_credentials import OSCreds from snaps.openstack.create_instance import ( VmInstanceSettings, OpenStackVmInstance) from functest.opnfv_tests.openstack.snaps import snaps_utils @@ -198,22 +197,18 @@ class OpenImsVnf(vnf.VnfOnBoarding): self.images = get_config("tenant_images.orchestrator", config_file) self.images.update(get_config("tenant_images.%s" % self.case_name, config_file)) - self.snaps_creds = None def prepare(self): """Prepare testscase (Additional pre-configuration steps).""" super(OpenImsVnf, self).prepare() self.logger.info("Additional pre-configuration steps") - self.logger.info("creds %s", (self.creds)) - - self.snaps_creds = OSCreds( - username=self.creds['username'], - password=self.creds['password'], - auth_url=self.creds['auth_url'], - project_name=self.creds['tenant'], - identity_api_version=int(os_utils.get_keystone_client_version())) - + self.creds = { + "tenant": self.tenant_name, + "username": self.tenant_name, + "password": self.tenant_name, + "auth_url": os_utils.get_credentials()['auth_url'] + } self.prepare_images() self.prepare_flavor() self.prepare_security_groups() @@ -697,8 +692,9 @@ class OpenImsVnf(vnf.VnfOnBoarding): try: neutron_client = os_utils.get_neutron_client(self.creds) self.logger.info("Deleting Open Baton Port...") - port = snaps_utils.neutron_utils.get_port_by_name( - neutron_client, '%s_port' % self.case_name) + port = snaps_utils.neutron_utils.get_port( + neutron_client, + port_name='%s_port' % self.case_name) snaps_utils.neutron_utils.delete_port(neutron_client, port) time.sleep(10) except Exception as exc: diff --git a/functest/opnfv_tests/vnf/router/cloudify_vrouter.py b/functest/opnfv_tests/vnf/router/cloudify_vrouter.py index c3cccb98..edbdb495 100644 --- a/functest/opnfv_tests/vnf/router/cloudify_vrouter.py +++ b/functest/opnfv_tests/vnf/router/cloudify_vrouter.py @@ -25,7 +25,6 @@ import functest.utils.openstack_utils as os_utils from git import Repo -from snaps.openstack.os_credentials import OSCreds from snaps.openstack.create_network import (NetworkSettings, SubnetSettings, OpenStackNetwork) from snaps.openstack.create_security_group import (SecurityGroupSettings, @@ -110,17 +109,10 @@ class CloudifyVrouter(vrouter_base.VrouterOnBoardingBase): self.__logger.info("Additional pre-configuration steps") - self.snaps_creds = OSCreds( - username=self.creds['username'], - password=self.creds['password'], - auth_url=self.creds['auth_url'], - project_name=self.creds['tenant'], - identity_api_version=int(os_utils.get_keystone_client_version())) - - self.util.set_credentials(self.creds["username"], - self.creds["password"], - self.creds["auth_url"], - self.creds["tenant"]) + self.util.set_credentials(self.snaps_creds.username, + self.snaps_creds.password, + self.snaps_creds.auth_url, + self.snaps_creds.project_name) # needs some images self.__logger.info("Upload some OS images if it doesn't exist") |