aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/openstack
diff options
context:
space:
mode:
Diffstat (limited to 'functest/opnfv_tests/openstack')
-rw-r--r--functest/opnfv_tests/openstack/rally/rally.py5
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_test_runner.py3
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_utils.py5
-rw-r--r--functest/opnfv_tests/openstack/tempest/conf_utils.py22
-rw-r--r--functest/opnfv_tests/openstack/tempest/tempest.py9
-rw-r--r--functest/opnfv_tests/openstack/vping/vping_base.py3
6 files changed, 26 insertions, 21 deletions
diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py
index 2632fd39..add0f243 100644
--- a/functest/opnfv_tests/openstack/rally/rally.py
+++ b/functest/opnfv_tests/openstack/rally/rally.py
@@ -29,6 +29,7 @@ from functest.energy import energy
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
from snaps.config.flavor import FlavorConfig
from snaps.config.image import ImageConfig
@@ -218,8 +219,8 @@ class RallyBase(testcase.TestCase):
with open(RallyBase.BLACKLIST_FILE, 'r') as black_list_file:
black_list_yaml = yaml.safe_load(black_list_file)
- installer_type = os.getenv('INSTALLER_TYPE', None)
- deploy_scenario = os.getenv('DEPLOY_SCENARIO', None)
+ installer_type = env.get('INSTALLER_TYPE')
+ deploy_scenario = env.get('DEPLOY_SCENARIO')
if (bool(installer_type) and bool(deploy_scenario) and
'scenario' in black_list_yaml.keys()):
for item in black_list_yaml['scenario']:
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
index 9d31f426..216d9acf 100644
--- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
+++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
@@ -15,6 +15,7 @@ import logging
from functest.core import unit
from functest.opnfv_tests.openstack.snaps import snaps_utils
from functest.utils.constants import CONST
+from functest.utils import env
from snaps.openstack import create_flavor
@@ -44,7 +45,7 @@ class SnapsTestRunner(unit.Suite):
CONST.__getattribute__('snaps_use_floating_ips') == 'True')
self.use_keystone = (
CONST.__getattribute__('snaps_use_keystone') == 'True')
- scenario = CONST.__getattribute__('DEPLOY_SCENARIO')
+ scenario = env.get('DEPLOY_SCENARIO')
self.flavor_metadata = None
if 'ovs' in scenario or 'fdio' in scenario:
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_utils.py b/functest/opnfv_tests/openstack/snaps/snaps_utils.py
index 6bc50ad6..59bd063c 100644
--- a/functest/opnfv_tests/openstack/snaps/snaps_utils.py
+++ b/functest/opnfv_tests/openstack/snaps/snaps_utils.py
@@ -10,6 +10,7 @@
"""Some common utils wrapping snaps functions """
from functest.utils.constants import CONST
+from functest.utils import env
from snaps.openstack.tests import openstack_tests
from snaps.openstack.utils import neutron_utils, nova_utils
@@ -24,8 +25,8 @@ def get_ext_net_name(os_creds):
"""
neutron = neutron_utils.neutron_client(os_creds)
ext_nets = neutron_utils.get_external_networks(neutron)
- if hasattr(CONST, 'EXTERNAL_NETWORK'):
- extnet_config = CONST.__getattribute__('EXTERNAL_NETWORK')
+ if env.get('EXTERNAL_NETWORK'):
+ extnet_config = env.get('EXTERNAL_NETWORK')
for ext_net in ext_nets:
if ext_net.name == extnet_config:
return extnet_config
diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py
index f128784c..09471fa5 100644
--- a/functest/opnfv_tests/openstack/tempest/conf_utils.py
+++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py
@@ -14,13 +14,14 @@ import ConfigParser
import logging
import fileinput
import os
-import pkg_resources
import shutil
import subprocess
+import pkg_resources
import yaml
from functest.utils.constants import CONST
+from functest.utils import env
import functest.utils.functest_utils as ft_utils
@@ -51,7 +52,7 @@ TEST_ACCOUNTS_FILE = pkg_resources.resource_filename(
'functest',
'opnfv_tests/openstack/tempest/custom_tests/test_accounts.yaml')
-CI_INSTALLER_TYPE = CONST.__getattribute__('INSTALLER_TYPE')
+CI_INSTALLER_TYPE = env.get('INSTALLER_TYPE')
""" logging configuration """
LOGGER = logging.getLogger(__name__)
@@ -60,7 +61,7 @@ LOGGER = logging.getLogger(__name__)
def create_rally_deployment():
"""Create new rally deployment"""
# set the architecture to default
- pod_arch = os.getenv("POD_ARCH", None)
+ pod_arch = env.get("POD_ARCH")
arch_filter = ['aarch64']
if pod_arch and pod_arch in arch_filter:
@@ -294,10 +295,9 @@ def configure_tempest_update_params(tempest_conf_file, network_name=None,
config.set('compute', 'min_compute_nodes', compute_cnt)
config.set('compute-feature-enabled', 'live_migration', True)
- config.set('identity', 'region',
- CONST.__getattribute__('OS_REGION_NAME'))
- identity_api_version = os.getenv(
- "OS_IDENTITY_API_VERSION", os.getenv("IDENTITY_API_VERSION"))
+ config.set('identity', 'region', os.environ.get('OS_REGION_NAME'))
+ identity_api_version = os.environ.get(
+ "OS_IDENTITY_API_VERSION", os.environ.get("IDENTITY_API_VERSION"))
if identity_api_version == '3':
auth_version = 'v3'
config.set('identity-feature-enabled', 'api_v2', False)
@@ -310,11 +310,11 @@ def configure_tempest_update_params(tempest_conf_file, network_name=None,
config.set('object-storage', 'operator_role',
CONST.__getattribute__('tempest_object_storage_operator_role'))
- if CONST.__getattribute__('OS_ENDPOINT_TYPE') is not None:
+ if os.environ.get('OS_ENDPOINT_TYPE') is not None:
config.set('identity', 'v3_endpoint_type',
- CONST.__getattribute__('OS_ENDPOINT_TYPE'))
+ os.environ.get('OS_ENDPOINT_TYPE'))
- if CONST.__getattribute__('OS_ENDPOINT_TYPE') is not None:
+ if os.environ.get('OS_ENDPOINT_TYPE') is not None:
sections = config.sections()
services_list = ['compute',
'volume',
@@ -327,7 +327,7 @@ def configure_tempest_update_params(tempest_conf_file, network_name=None,
if service not in sections:
config.add_section(service)
config.set(service, 'endpoint_type',
- CONST.__getattribute__('OS_ENDPOINT_TYPE'))
+ os.environ.get('OS_ENDPOINT_TYPE'))
LOGGER.debug('Add/Update required params defined in tempest_conf.yaml '
'into tempest.conf file')
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py
index 56705fc0..c19c8d9d 100644
--- a/functest/opnfv_tests/openstack/tempest/tempest.py
+++ b/functest/opnfv_tests/openstack/tempest/tempest.py
@@ -26,6 +26,7 @@ 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
@@ -128,8 +129,8 @@ class TempestCommon(testcase.TestCase):
result_file = open(conf_utils.TEMPEST_LIST, 'w')
black_tests = []
try:
- installer_type = CONST.__getattribute__('INSTALLER_TYPE')
- deploy_scenario = CONST.__getattribute__('DEPLOY_SCENARIO')
+ installer_type = env.get('INSTALLER_TYPE')
+ deploy_scenario = env.get('DEPLOY_SCENARIO')
if bool(installer_type) * bool(deploy_scenario):
# if INSTALLER_TYPE and DEPLOY_SCENARIO are set we read the
# file
@@ -405,7 +406,7 @@ class TempestResourcesManager(object):
def _create_flavor(self, name):
"""Create flavor for tests."""
- scenario = CONST.__getattribute__('DEPLOY_SCENARIO')
+ scenario = env.get('DEPLOY_SCENARIO')
flavor_metadata = None
if 'ovs' in scenario or 'fdio' in scenario:
flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE
@@ -463,7 +464,7 @@ class TempestResourcesManager(object):
if use_custom_flavors:
LOGGER.info("Creating 2nd flavor for Tempest suite")
- scenario = CONST.__getattribute__('DEPLOY_SCENARIO')
+ scenario = env.get('DEPLOY_SCENARIO')
if 'ovs' in scenario or 'fdio' in scenario:
CONST.__setattr__('openstack_flavor_ram', 1024)
name = CONST.__getattribute__(
diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py
index 7170101f..fae5db2d 100644
--- a/functest/opnfv_tests/openstack/vping/vping_base.py
+++ b/functest/opnfv_tests/openstack/vping/vping_base.py
@@ -18,6 +18,7 @@ import uuid
from functest.core import testcase
from functest.opnfv_tests.openstack.snaps import snaps_utils
from functest.utils.constants import CONST
+from functest.utils import env
from snaps.config.flavor import FlavorConfig
from snaps.config.network import NetworkConfig, SubnetConfig
@@ -135,7 +136,7 @@ class VPingBase(testcase.TestCase):
self.logger.info(
"Creating flavor with name: '%s'", self.flavor_name)
- scenario = getattr(CONST, 'DEPLOY_SCENARIO')
+ scenario = env.get('DEPLOY_SCENARIO')
flavor_metadata = None
flavor_ram = 512
if 'ovs' in scenario or 'fdio' in scenario: