import time
import uuid
-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
-from functest.utils import env
-import functest.utils.functest_utils as ft_utils
-
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
+from xtesting.core import testcase
+import yaml
+from functest.opnfv_tests.openstack.snaps import snaps_utils
+from functest.opnfv_tests.openstack.tempest import conf_utils
+from functest.utils import config
+from functest.utils import env
+from functest.utils import functest_utils
LOGGER = logging.getLogger(__name__)
def generate_test_list(self, verifier_repo_dir):
"""Generate test list based on the test mode."""
LOGGER.debug("Generating test case list...")
- if self.mode == 'defcore':
- shutil.copyfile(
- conf_utils.TEMPEST_DEFCORE, conf_utils.TEMPEST_RAW_LIST)
- elif self.mode == 'custom':
+ if self.mode == 'custom':
if os.path.isfile(conf_utils.TEMPEST_CUSTOM):
shutil.copyfile(
conf_utils.TEMPEST_CUSTOM, conf_utils.TEMPEST_RAW_LIST)
"cd -;".format(verifier_repo_dir,
testr_mode,
conf_utils.TEMPEST_RAW_LIST))
- ft_utils.execute_command(cmd)
+ functest_utils.execute_command(cmd)
def apply_tempest_blacklist(self):
"""Exclude blacklisted test cases."""
self.os_creds = kwargs.get('os_creds') or snaps_utils.get_credentials()
self.guid = '-' + str(uuid.uuid4())
self.creators = list()
- self.cirros_image_config = getattr(CONST, 'snaps_images_cirros', None)
+ self.cirros_image_config = getattr(
+ config.CONF, 'snaps_images_cirros', None)
def _create_project(self):
"""Create project for tests."""
project_creator = deploy_utils.create_project(
self.os_creds, ProjectConfig(
name=getattr(
- CONST, 'tempest_identity_tenant_name') + self.guid,
+ config.CONF, 'tempest_identity_tenant_name') + self.guid,
description=getattr(
- CONST, 'tempest_identity_tenant_description')))
+ config.CONF, 'tempest_identity_tenant_description')))
if project_creator is None or project_creator.get_project() is None:
raise Exception("Failed to create tenant")
self.creators.append(project_creator)
user_creator = deploy_utils.create_user(
self.os_creds, UserConfig(
name=getattr(
- CONST, 'tempest_identity_user_name') + self.guid,
+ config.CONF, 'tempest_identity_user_name') + self.guid,
password=getattr(
- CONST, 'tempest_identity_user_password'),
+ config.CONF, 'tempest_identity_user_password'),
project_name=getattr(
- CONST, 'tempest_identity_tenant_name') + self.guid))
+ config.CONF, 'tempest_identity_tenant_name') + self.guid))
if user_creator is None or user_creator.get_user() is None:
raise Exception("Failed to create user")
self.creators.append(user_creator)
tempest_segmentation_id = None
tempest_network_type = getattr(
- CONST, 'tempest_network_type', None)
+ config.CONF, 'tempest_network_type', None)
tempest_physical_network = getattr(
- CONST, 'tempest_physical_network', None)
+ config.CONF, 'tempest_physical_network', None)
tempest_segmentation_id = getattr(
- CONST, 'tempest_segmentation_id', None)
+ config.CONF, 'tempest_segmentation_id', None)
tempest_net_name = getattr(
- CONST, 'tempest_private_net_name') + self.guid
+ config.CONF, 'tempest_private_net_name') + self.guid
network_creator = deploy_utils.create_network(
self.os_creds, NetworkConfig(
segmentation_id=tempest_segmentation_id,
subnet_settings=[SubnetConfig(
name=getattr(
- CONST, 'tempest_private_subnet_name') + self.guid,
+ config.CONF,
+ 'tempest_private_subnet_name') + self.guid,
project_name=project_name,
cidr=getattr(
- CONST, 'tempest_private_subnet_cidr'))]))
+ config.CONF, 'tempest_private_subnet_cidr'))]))
if network_creator is None or network_creator.get_network() is None:
raise Exception("Failed to create private network")
self.creators.append(network_creator)
flavor_creator = OpenStackFlavor(
self.os_creds, FlavorConfig(
name=name,
- ram=getattr(CONST, 'openstack_flavor_ram'),
- disk=getattr(CONST, 'openstack_flavor_disk'),
- vcpus=getattr(CONST, 'openstack_flavor_vcpus'),
+ ram=getattr(config.CONF, 'openstack_flavor_ram'),
+ disk=getattr(config.CONF, 'openstack_flavor_disk'),
+ vcpus=getattr(config.CONF, 'openstack_flavor_vcpus'),
metadata=flavor_metadata))
flavor = flavor_creator.create()
if flavor is None:
if create_project:
LOGGER.debug("Creating project and user for Tempest suite")
project_name = getattr(
- CONST, 'tempest_identity_tenant_name') + self.guid
+ config.CONF, 'tempest_identity_tenant_name') + self.guid
result['project_id'] = self._create_project()
result['user_id'] = self._create_user()
result['tenant_id'] = result['project_id'] # for compatibility
result['tempest_net_name'] = self._create_network(project_name)
LOGGER.debug("Creating image for Tempest suite")
- image_name = getattr(CONST, 'openstack_image_name') + self.guid
+ image_name = getattr(config.CONF, 'openstack_image_name') + self.guid
result['image_id'] = self._create_image(image_name)
if use_custom_images:
LOGGER.debug("Creating 2nd image for Tempest suite")
- image_name = getattr(CONST, 'openstack_image_name_alt') + self.guid
+ image_name = getattr(
+ config.CONF, 'openstack_image_name_alt') + self.guid
result['image_id_alt'] = self._create_image(image_name)
- if (getattr(CONST, 'tempest_use_custom_flavors') == 'True' or
+ if (getattr(config.CONF, 'tempest_use_custom_flavors') == 'True' or
use_custom_flavors):
LOGGER.info("Creating flavor for Tempest suite")
- name = getattr(CONST, 'openstack_flavor_name') + self.guid
+ 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(CONST, 'openstack_flavor_ram', 1024)
- name = getattr(CONST, 'openstack_flavor_name_alt') + self.guid
+ 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)
return result