aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functest/opnfv_tests/openstack/tempest/conf_utils.py14
-rw-r--r--functest/tests/unit/openstack/tempest/test_conf_utils.py13
-rw-r--r--functest/utils/openstack_utils.py43
3 files changed, 7 insertions, 63 deletions
diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py
index a361c506..b4026def 100644
--- a/functest/opnfv_tests/openstack/tempest/conf_utils.py
+++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py
@@ -8,7 +8,6 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
import ConfigParser
-import json
import logging
import fileinput
import os
@@ -20,7 +19,6 @@ import yaml
from functest.utils.constants import CONST
import functest.utils.functest_utils as ft_utils
-import functest.utils.openstack_utils as os_utils
IMAGE_ID_ALT = None
@@ -80,11 +78,7 @@ def create_rally_deployment():
% CONST.__getattribute__('rally_deployment_name')),
verbose=False)
- rally_conf = os_utils.get_credentials_for_rally()
- with open('rally_conf.json', 'w') as fp:
- json.dump(rally_conf, fp)
- cmd = ("rally deployment create "
- "--file=rally_conf.json --name={0}"
+ cmd = ("rally deployment create --fromenv --name={0}"
.format(CONST.__getattribute__('rally_deployment_name')))
error_msg = "Problem while creating Rally deployment"
ft_utils.execute_command_raise(cmd, error_msg=error_msg)
@@ -279,7 +273,9 @@ def configure_tempest_update_params(tempest_conf_file, image_id=None,
config.set('compute-feature-enabled', 'live_migration', True)
config.set('identity', 'region', 'RegionOne')
- if os_utils.is_keystone_v3():
+ identity_api_version = os.getenv(
+ "OS_IDENTITY_API_VERSION", os.getenv("IDENTITY_API_VERSION"))
+ if (identity_api_version == '3'):
auth_version = 'v3'
else:
auth_version = 'v2'
@@ -292,7 +288,7 @@ def configure_tempest_update_params(tempest_conf_file, image_id=None,
if CONST.__getattribute__('OS_ENDPOINT_TYPE') is not None:
sections = config.sections()
- if os_utils.is_keystone_v3():
+ if (identity_api_version == '3'):
config.set('identity', 'v3_endpoint_type',
CONST.__getattribute__('OS_ENDPOINT_TYPE'))
if 'identity-feature-enabled' not in sections:
diff --git a/functest/tests/unit/openstack/tempest/test_conf_utils.py b/functest/tests/unit/openstack/tempest/test_conf_utils.py
index f20a7e93..6edbbf5d 100644
--- a/functest/tests/unit/openstack/tempest/test_conf_utils.py
+++ b/functest/tests/unit/openstack/tempest/test_conf_utils.py
@@ -88,21 +88,12 @@ class OSTempestConfUtilsTesting(unittest.TestCase):
msg = 'Failed to create flavor'
self.assertTrue(msg in context.exception, msg=str(context.exception))
- def _get_rally_creds(self):
- return {"type": "ExistingCloud",
- "admin": {"username": 'test_user_name',
- "password": 'test_password',
- "tenant": 'test_tenant'}}
-
- @mock.patch('functest.utils.openstack_utils.get_credentials_for_rally')
@mock.patch('functest.opnfv_tests.openstack.tempest.conf_utils'
'.logger.info')
@mock.patch('functest.utils.functest_utils.execute_command_raise')
@mock.patch('functest.utils.functest_utils.execute_command')
def test_create_rally_deployment(self, mock_exec, mock_exec_raise,
- mock_logger_info, mock_os_utils):
-
- mock_os_utils.return_value = self._get_rally_creds()
+ mock_logger_info):
conf_utils.create_rally_deployment()
@@ -112,7 +103,7 @@ class OSTempestConfUtilsTesting(unittest.TestCase):
mock_logger_info.assert_any_call("Creating Rally environment...")
mock_exec.assert_any_call(cmd, error_msg=error_msg, verbose=False)
- cmd = "rally deployment create --file=rally_conf.json --name="
+ cmd = "rally deployment create --fromenv --name="
cmd += CONST.__getattribute__('rally_deployment_name')
error_msg = "Problem while creating Rally deployment"
mock_exec_raise.assert_any_call(cmd, error_msg=error_msg)
diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py
index ef32a7e6..b479198d 100644
--- a/functest/utils/openstack_utils.py
+++ b/functest/utils/openstack_utils.py
@@ -129,49 +129,6 @@ def source_credentials(rc_file):
os.environ[key] = value
-def get_credentials_for_rally():
- creds = get_credentials()
- env_cred_dict = get_env_cred_dict()
- rally_conf = {"admin": {}}
- for key in creds:
- if key == 'auth_url':
- rally_conf[key] = creds[key]
- else:
- rally_conf['admin'][key] = creds[key]
-
- endpoint_types = [('internalURL', 'internal'),
- ('publicURL', 'public'), ('adminURL', 'admin')]
-
- endpoint_type = get_endpoint_type_from_env()
- if endpoint_type is not None:
- cred_key = env_cred_dict.get('OS_ENDPOINT_TYPE')
- for k, v in endpoint_types:
- if endpoint_type == v:
- rally_conf[cred_key] = v
-
- region_name = os.getenv('OS_REGION_NAME')
- if region_name is not None:
- cred_key = env_cred_dict.get('OS_REGION_NAME')
- rally_conf[cred_key] = region_name
-
- cred_key = env_cred_dict.get('OS_CACERT')
- rally_conf[cred_key] = os.getenv('OS_CACERT', '')
-
- insecure_key = env_cred_dict.get('OS_INSECURE')
- rally_conf[insecure_key] = os.getenv('OS_INSECURE', '').lower() == 'true'
- rally_conf = {"openstack": rally_conf}
-
- return rally_conf
-
-
-def get_endpoint_type_from_env():
- endpoint_type = os.environ.get("OS_ENDPOINT_TYPE",
- os.environ.get("OS_INTERFACE"))
- if endpoint_type and "URL" in endpoint_type:
- endpoint_type = endpoint_type.replace("URL", "")
- return endpoint_type
-
-
def get_session_auth(other_creds={}):
loader = loading.get_plugin_loader('password')
creds = get_credentials(other_creds)