summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xfunctest/ci/check_os.sh24
-rw-r--r--functest/opnfv_tests/openstack/tempest/conf_utils.py9
-rw-r--r--functest/tests/unit/utils/test_openstack_utils.py50
-rw-r--r--functest/utils/openstack_utils.py16
4 files changed, 58 insertions, 41 deletions
diff --git a/functest/ci/check_os.sh b/functest/ci/check_os.sh
index 83f9f476d..ce0bc20c6 100755
--- a/functest/ci/check_os.sh
+++ b/functest/ci/check_os.sh
@@ -86,30 +86,6 @@ if [ $RETVAL -ne 0 ]; then
fi
echo " ...OK"
-adminURL=$(openstack catalog show identity |awk '/admin/ {print $4}')
-if [ -z ${adminURL} ]; then
- echo "ERROR: Cannot determine the admin URL."
- openstack catalog show identity
- exit 1
-fi
-adminIP=$(echo $adminURL|sed 's/^.*http.*\:\/\///'|sed 's/.[^:]*$//')
-adminPort=$(echo $adminURL|grep -Po '(?<=:)\d+')
-https_enabled=$(echo $adminURL | grep 'https')
-if [[ -n $https_enabled ]]; then
- echo ">>Verifying SSL connectivity to the admin endpoint $adminIP:$adminPort..."
- verify_SSL_connectivity $adminIP $adminPort
-else
- echo ">>Verifying connectivity to the admin endpoint $adminIP:$adminPort..."
- verify_connectivity $adminIP $adminPort
-fi
-RETVAL=$?
-if [ $RETVAL -ne 0 ]; then
- echo "ERROR: Cannot talk to the admin endpoint $adminIP:$adminPort ."
- echo "$adminURL"
- exit 1
-fi
-echo " ...OK"
-
echo "Checking Required OpenStack services:"
for service in $MANDATORY_SERVICES; do
diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py
index 0f3384650..54f7428ca 100644
--- a/functest/opnfv_tests/openstack/tempest/conf_utils.py
+++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py
@@ -279,12 +279,20 @@ def configure_tempest_update_params(tempest_conf_file,
config.set('identity', 'tenant_name', CONST.tempest_identity_tenant_name)
config.set('identity', 'username', CONST.tempest_identity_user_name)
config.set('identity', 'password', CONST.tempest_identity_user_password)
+ config.set('identity', 'region', 'RegionOne')
config.set(
'validation', 'ssh_timeout', CONST.tempest_validation_ssh_timeout)
config.set('object-storage', 'operator_role',
CONST.tempest_object_storage_operator_role)
if CONST.OS_ENDPOINT_TYPE is not None:
+ sections = config.sections()
+ if os_utils.is_keystone_v3():
+ config.set('identity', 'v3_endpoint_type', CONST.OS_ENDPOINT_TYPE)
+ if 'identity-feature-enabled' not in sections:
+ config.add_section('identity-feature-enabled')
+ config.set('identity-feature-enabled', 'api_v2', False)
+ config.set('identity-feature-enabled', 'api_v2_admin', False)
services_list = ['compute',
'volume',
'image',
@@ -292,7 +300,6 @@ def configure_tempest_update_params(tempest_conf_file,
'data-processing',
'object-storage',
'orchestration']
- sections = config.sections()
for service in services_list:
if service not in sections:
config.add_section(service)
diff --git a/functest/tests/unit/utils/test_openstack_utils.py b/functest/tests/unit/utils/test_openstack_utils.py
index 7f3995d03..a7df264c9 100644
--- a/functest/tests/unit/utils/test_openstack_utils.py
+++ b/functest/tests/unit/utils/test_openstack_utils.py
@@ -418,21 +418,45 @@ class OSUtilsTesting(unittest.TestCase):
mock_logger_info.assert_called_once_with("OS_IDENTITY_API_VERSION is "
"set in env as '%s'", '3')
- def test_get_keystone_client(self):
+ @mock.patch('functest.utils.openstack_utils.get_session')
+ @mock.patch('functest.utils.openstack_utils.keystoneclient.Client')
+ @mock.patch('functest.utils.openstack_utils.get_keystone_client_version',
+ return_value='3')
+ @mock.patch('functest.utils.openstack_utils.os.getenv',
+ return_value='public')
+ def test_get_keystone_client_with_interface(self, mock_os_getenv,
+ mock_keystoneclient_version,
+ mock_key_client,
+ mock_get_session):
mock_keystone_obj = mock.Mock()
mock_session_obj = mock.Mock()
- with mock.patch('functest.utils.openstack_utils'
- '.get_keystone_client_version', return_value='3'), \
- mock.patch('functest.utils.openstack_utils'
- '.keystoneclient.Client',
- return_value=mock_keystone_obj) \
- as mock_key_client, \
- mock.patch('functest.utils.openstack_utils.get_session',
- return_value=mock_session_obj):
- self.assertEqual(openstack_utils.get_keystone_client(),
- mock_keystone_obj)
- mock_key_client.assert_called_once_with('3',
- session=mock_session_obj)
+ mock_key_client.return_value = mock_keystone_obj
+ mock_get_session.return_value = mock_session_obj
+ self.assertEqual(openstack_utils.get_keystone_client(),
+ mock_keystone_obj)
+ mock_key_client.assert_called_once_with('3',
+ session=mock_session_obj,
+ interface='public')
+
+ @mock.patch('functest.utils.openstack_utils.get_session')
+ @mock.patch('functest.utils.openstack_utils.keystoneclient.Client')
+ @mock.patch('functest.utils.openstack_utils.get_keystone_client_version',
+ return_value='3')
+ @mock.patch('functest.utils.openstack_utils.os.getenv',
+ return_value='admin')
+ def test_get_keystone_client_no_interface(self, mock_os_getenv,
+ mock_keystoneclient_version,
+ mock_key_client,
+ mock_get_session):
+ mock_keystone_obj = mock.Mock()
+ mock_session_obj = mock.Mock()
+ mock_key_client.return_value = mock_keystone_obj
+ mock_get_session.return_value = mock_session_obj
+ self.assertEqual(openstack_utils.get_keystone_client(),
+ mock_keystone_obj)
+ mock_key_client.assert_called_once_with('3',
+ session=mock_session_obj,
+ interface='admin')
@mock.patch('functest.utils.openstack_utils.os.getenv',
return_value=None)
diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py
index 1d7ea8e8a..7e00a269c 100644
--- a/functest/utils/openstack_utils.py
+++ b/functest/utils/openstack_utils.py
@@ -138,11 +138,11 @@ def get_credentials_for_rally():
endpoint_types = [('internalURL', 'internal'),
('publicURL', 'public'), ('adminURL', 'admin')]
- endpoint_type = os.getenv('OS_ENDPOINT_TYPE')
+ 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 == k:
+ if endpoint_type == v:
rally_conf[cred_key] = v
region_name = os.getenv('OS_REGION_NAME')
@@ -157,6 +157,14 @@ def get_credentials_for_rally():
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)
@@ -197,7 +205,9 @@ def get_keystone_client_version():
def get_keystone_client(other_creds={}):
sess = get_session(other_creds)
- return keystoneclient.Client(get_keystone_client_version(), session=sess)
+ return keystoneclient.Client(get_keystone_client_version(),
+ session=sess,
+ interface=os.getenv('OS_INTERFACE', 'admin'))
def get_nova_client_version():