aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/openstack/snaps
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-02-14 16:02:53 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2018-02-16 10:24:22 +0100
commitd589e4e5345ed82c68d9a011ac89f8cdbefe2ca3 (patch)
tree1ec221f1f95e6abaec9b1465e9e46b76f8777a27 /functest/opnfv_tests/openstack/snaps
parent98e2806cb674d206dea65647c0644dc5b2871b4b (diff)
Get properly env vars or their default values
It defines env.get() as an unique way to get Functest env vars or their default values. It can be considered as a wrapper above os.environ. It enforces backward compatibility via CONST which mustn't be used for that purpose. It should be noted that it also stops using CONST for getting OpenStack env vars. Change-Id: I333dc1afbc0123166a7eaff8b551370098efa341 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/opnfv_tests/openstack/snaps')
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_test_runner.py3
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_utils.py5
2 files changed, 5 insertions, 3 deletions
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
index 9d31f426c..216d9acf6 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 6bc50ad60..59bd063c1 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