aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/sdn/odl/odl.py
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/sdn/odl/odl.py
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/sdn/odl/odl.py')
-rw-r--r--functest/opnfv_tests/sdn/odl/odl.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py
index 4c33c495..705f39da 100644
--- a/functest/opnfv_tests/sdn/odl/odl.py
+++ b/functest/opnfv_tests/sdn/odl/odl.py
@@ -31,6 +31,7 @@ from snaps.openstack.utils import keystone_utils
from functest.core import robotframework
from functest.opnfv_tests.openstack.snaps import snaps_utils
from functest.utils import constants
+from functest.utils import env
__author__ = "Cedric Ollivier <cedric.ollivier@orange.com>"
@@ -165,9 +166,7 @@ class ODLTests(robotframework.RobotFramework):
kwargs['odlrestconfport'] = '8181'
kwargs['odlusername'] = 'admin'
kwargs['odlpassword'] = 'admin'
- installer_type = None
- if 'INSTALLER_TYPE' in os.environ:
- installer_type = os.environ['INSTALLER_TYPE']
+ installer_type = env.get('INSTALLER_TYPE')
kwargs['osusername'] = os.environ['OS_USERNAME']
kwargs['osuserdomainname'] = os.environ.get(
'OS_USER_DOMAIN_NAME', 'Default')
@@ -180,17 +179,17 @@ class ODLTests(robotframework.RobotFramework):
kwargs['odlwebport'] = '8181'
kwargs['odlrestconfport'] = '8282'
elif installer_type == 'apex' or installer_type == 'netvirt':
- kwargs['odlip'] = os.environ['SDN_CONTROLLER_IP']
+ kwargs['odlip'] = env.get('SDN_CONTROLLER_IP')
kwargs['odlwebport'] = '8081'
kwargs['odlrestconfport'] = '8081'
elif installer_type == 'compass':
kwargs['odlrestconfport'] = '8080'
elif installer_type == 'daisy':
- kwargs['odlip'] = os.environ['SDN_CONTROLLER_IP']
+ kwargs['odlip'] = env.get('SDN_CONTROLLER_IP')
kwargs['odlwebport'] = '8181'
kwargs['odlrestconfport'] = '8087'
else:
- kwargs['odlip'] = os.environ['SDN_CONTROLLER_IP']
+ kwargs['odlip'] = env.get('SDN_CONTROLLER_IP')
except KeyError as ex:
self.__logger.error("Cannot run ODL testcases. "
"Please check env var: "