From c9fd7ceab29ff755aa8a9ee1bcb6ab958e5e0420 Mon Sep 17 00:00:00 2001 From: Linda Wang Date: Tue, 13 Mar 2018 01:36:40 +0000 Subject: Create 2 images and flavors for tempest tests Also 1. remove the obsolete function: generate_test_accounts_file 2. Use patch mechanism to get config Change-Id: I455ac37de71519bcaf9a51e5f1de1b9bc83b9ba6 Signed-off-by: Linda Wang --- functest/opnfv_tests/openstack/rally/rally.py | 2 +- .../openstack/snaps/snaps_test_runner.py | 8 +---- .../opnfv_tests/openstack/tempest/conf_utils.py | 23 ------------ functest/opnfv_tests/openstack/tempest/tempest.py | 41 +++++++--------------- functest/opnfv_tests/openstack/vping/vping_base.py | 10 ++---- 5 files changed, 18 insertions(+), 66 deletions(-) (limited to 'functest/opnfv_tests/openstack') diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index 1502d5825..5b6a76fe4 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -53,7 +53,7 @@ class RallyBase(testcase.TestCase): GLANCE_IMAGE_FORMAT = getattr(config.CONF, 'openstack_image_disk_format') GLANCE_IMAGE_USERNAME = getattr(config.CONF, 'openstack_image_username') GLANCE_IMAGE_EXTRA_PROPERTIES = getattr( - config.CONF, 'openstack_extra_properties', {}) + config.CONF, 'image_properties', {}) FLAVOR_NAME = getattr(config.CONF, 'rally_flavor_name') FLAVOR_ALT_NAME = getattr(config.CONF, 'rally_flavor_alt_name') FLAVOR_RAM = 512 diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py index c7329f30d..7b111ed1b 100644 --- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py +++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py @@ -12,12 +12,10 @@ import logging -from snaps.openstack import create_flavor from xtesting.core import unit from functest.opnfv_tests.openstack.snaps import snaps_utils from functest.utils import config -from functest.utils import env class SnapsTestRunner(unit.Suite): @@ -45,12 +43,8 @@ class SnapsTestRunner(unit.Suite): getattr(config.CONF, 'snaps_use_floating_ips') == 'True') self.use_keystone = ( getattr(config.CONF, 'snaps_use_keystone') == 'True') - scenario = env.get('DEPLOY_SCENARIO') - - self.flavor_metadata = None - if 'ovs' in scenario or 'fdio' in scenario: - self.flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE + self.flavor_metadata = getattr(config.CONF, 'flavor_extra_specs', None) self.logger.info("Using flavor metadata '%s'", self.flavor_metadata) self.image_metadata = None diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py index 8832a48bf..d6b1eb401 100644 --- a/functest/opnfv_tests/openstack/tempest/conf_utils.py +++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py @@ -39,9 +39,6 @@ TEMPEST_BLACKLIST = pkg_resources.resource_filename( 'functest', 'opnfv_tests/openstack/tempest/custom_tests/blacklist.txt') TEMPEST_CONF_YAML = pkg_resources.resource_filename( 'functest', 'opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml') -TEST_ACCOUNTS_FILE = pkg_resources.resource_filename( - 'functest', - 'opnfv_tests/openstack/tempest/custom_tests/test_accounts.yaml') CI_INSTALLER_TYPE = env.get('INSTALLER_TYPE') @@ -173,26 +170,6 @@ def backup_tempest_config(conf_file, res_dir): os.path.join(res_dir, 'tempest.conf')) -def generate_test_accounts_file(tenant_id): - """ - Add needed tenant and user params into test_accounts.yaml - """ - - LOGGER.debug("Add needed params into test_accounts.yaml...") - accounts_list = [ - { - 'tenant_name': getattr( - config.CONF, 'tempest_identity_tenant_name'), - 'tenant_id': str(tenant_id), - 'username': getattr(config.CONF, 'tempest_identity_user_name'), - 'password': getattr(config.CONF, 'tempest_identity_user_password') - } - ] - - with open(TEST_ACCOUNTS_FILE, "w") as tfile: - yaml.dump(accounts_list, tfile, default_flow_style=False) - - def update_tempest_conf_file(conf_file, rconfig): """Update defined paramters into tempest config file""" with open(TEMPEST_CONF_YAML) as yfile: diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index acab29d85..8d47ddb75 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -24,7 +24,6 @@ from snaps.config.flavor import FlavorConfig from snaps.config.network import NetworkConfig, SubnetConfig from snaps.config.project import ProjectConfig from snaps.config.user import UserConfig -from snaps.openstack import create_flavor from snaps.openstack.create_flavor import OpenStackFlavor from snaps.openstack.tests import openstack_tests from snaps.openstack.utils import deploy_utils @@ -435,10 +434,7 @@ class TempestResourcesManager(object): def _create_flavor(self, name): """Create flavor for tests.""" - scenario = env.get('DEPLOY_SCENARIO') - flavor_metadata = None - if 'ovs' in scenario or 'fdio' in scenario: - flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE + flavor_metadata = getattr(config.CONF, 'flavor_extra_specs', None) flavor_creator = OpenStackFlavor( self.os_creds, FlavorConfig( name=name, @@ -452,8 +448,7 @@ class TempestResourcesManager(object): self.creators.append(flavor_creator) return flavor.id - def create(self, use_custom_images=False, use_custom_flavors=False, - create_project=False): + def create(self, create_project=False): """Create resources for Tempest test suite.""" result = { 'tempest_net_name': None, @@ -475,30 +470,20 @@ class TempestResourcesManager(object): LOGGER.debug("Creating private network for Tempest suite") result['tempest_net_name'] = self._create_network(project_name) - LOGGER.debug("Creating image for Tempest suite") + LOGGER.debug("Creating two images for Tempest suite") image_name = getattr(config.CONF, 'openstack_image_name') + self.guid result['image_id'] = self._create_image(image_name) + image_name = getattr( + config.CONF, 'openstack_image_name_alt') + self.guid + result['image_id_alt'] = self._create_image(image_name) - if use_custom_images: - LOGGER.debug("Creating 2nd image for Tempest suite") - image_name = getattr( - config.CONF, 'openstack_image_name_alt') + self.guid - result['image_id_alt'] = self._create_image(image_name) - - if (getattr(config.CONF, 'tempest_use_custom_flavors') == 'True' or - use_custom_flavors): - LOGGER.info("Creating flavor for Tempest suite") - name = getattr(config.CONF, 'openstack_flavor_name') + self.guid - result['flavor_id'] = self._create_flavor(name) - - if use_custom_flavors: - LOGGER.info("Creating 2nd flavor for Tempest suite") - scenario = env.get('DEPLOY_SCENARIO') - if 'ovs' in scenario or 'fdio' in scenario: - setattr(config.CONF, 'openstack_flavor_ram', 1024) - name = getattr( - config.CONF, 'openstack_flavor_name_alt') + self.guid - result['flavor_id_alt'] = self._create_flavor(name) + LOGGER.info("Creating two flavors for Tempest suite") + name = getattr(config.CONF, 'openstack_flavor_name') + self.guid + result['flavor_id'] = self._create_flavor(name) + + name = getattr( + config.CONF, 'openstack_flavor_name_alt') + self.guid + result['flavor_id_alt'] = self._create_flavor(name) return result diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py index edc78482b..152f69da6 100644 --- a/functest/opnfv_tests/openstack/vping/vping_base.py +++ b/functest/opnfv_tests/openstack/vping/vping_base.py @@ -18,7 +18,6 @@ import uuid from snaps.config.flavor import FlavorConfig from snaps.config.network import NetworkConfig, SubnetConfig from snaps.config.router import RouterConfig -from snaps.openstack import create_flavor from snaps.openstack.create_flavor import OpenStackFlavor from snaps.openstack.tests import openstack_tests from snaps.openstack.utils import deploy_utils @@ -144,12 +143,9 @@ class VPingBase(testcase.TestCase): self.logger.info( "Creating flavor with name: '%s'", self.flavor_name) - scenario = env.get('DEPLOY_SCENARIO') - flavor_metadata = None - flavor_ram = 512 - if 'ovs' in scenario or 'fdio' in scenario: - flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE - flavor_ram = 1024 + flavor_ram = getattr(config.CONF, 'openstack_flavor_ram') + flavor_metadata = getattr(config.CONF, 'flavor_extra_specs', None) + flavor_creator = OpenStackFlavor( self.os_creds, FlavorConfig(name=self.flavor_name, ram=flavor_ram, disk=1, -- cgit 1.2.3-korg