general:
flavor_extra_specs: {'hw:mem_page_size':'large'}
image_properties: {'hw_mem_page_size':'large'}
- tempest:
- use_custom_flavors: 'True'
+ openstack:
+ flavor_ram: 1024
ovs:
general:
flavor_extra_specs: {'hw:mem_page_size':'large'}
image_properties: {'hw_mem_page_size':'large'}
- tempest:
- use_custom_flavors: 'True'
+ openstack:
+ flavor_ram: 1024
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
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):
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
'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')
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:
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
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,
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,
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
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
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,
# pylint: disable=unused-argument
tempest_resources = tempest.TempestResourcesManager(
os_creds=self.os_creds)
-
- setattr(config.CONF, 'tempest_use_custom_flavors', 'True')
with self.assertRaises(Exception) as context:
tempest_resources.create()
msg = 'Failed to create flavor'
self.assertTrue(msg in context.exception, msg=str(context.exception))
- setattr(config.CONF, 'tempest_use_custom_flavors', 'False')
- with self.assertRaises(Exception) as context:
- tempest_resources.create(use_custom_flavors=True)
- msg = 'Failed to create flavor'
- self.assertTrue(msg in context.exception, msg=str(context.exception))
-
@staticmethod
@mock.patch('functest.opnfv_tests.openstack.tempest.conf_utils'
'.LOGGER.info')
'test_conf_file', res_dir='test_dir')
self.assertTrue(mock_copyfile.called)
- def test_gen_test_accounts_file_def(self):
- with mock.patch("__builtin__.open", mock.mock_open()), \
- mock.patch('functest.opnfv_tests.openstack.tempest.conf_utils.'
- 'yaml.dump') as mock_dump:
- conf_utils.generate_test_accounts_file('test_tenant_id')
- self.assertTrue(mock_dump.called)
-
def _test_missing_param(self, params, image_id, flavor_id):
with mock.patch('functest.opnfv_tests.openstack.tempest.'
'conf_utils.ConfigParser.RawConfigParser.'