diff options
Diffstat (limited to 'functest/utils')
-rw-r--r-- | functest/utils/functest_utils.py | 19 | ||||
-rwxr-xr-x | functest/utils/openstack_utils.py | 35 |
2 files changed, 32 insertions, 22 deletions
diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py index a25967b6..8f816cdf 100644 --- a/functest/utils/functest_utils.py +++ b/functest/utils/functest_utils.py @@ -418,25 +418,8 @@ def merge_dicts(dict1, dict2): yield (k, dict2[k]) -def check_test_result(test_name, ret, start_time, stop_time): - def get_criteria_value(): - return get_criteria_by_test(test_name).split('==')[1].strip() - - status = 'FAIL' - if str(ret) == get_criteria_value(): - status = 'PASS' - - details = { - 'timestart': start_time, - 'duration': round(stop_time - start_time, 1), - 'status': status, - } - - return status, details - - def get_testcases_file_dir(): - return "/home/opnfv/repos/functest/functest/ci/testcases.yaml" + return get_functest_config('general.functest.testcases_yaml') def get_functest_yaml(): diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py index 6f0c5fba..15dc87c3 100755 --- a/functest/utils/openstack_utils.py +++ b/functest/utils/openstack_utils.py @@ -56,8 +56,19 @@ def get_credentials(service): """ creds = {} + keystone_api_version = os.getenv('OS_IDENTITY_API_VERSION') + if (keystone_api_version is None or + keystone_api_version == '2'): + keystone_v3 = False + tenant_env = 'OS_TENANT_NAME' + tenant = 'tenant_name' + else: + keystone_v3 = True + tenant_env = 'OS_PROJECT_NAME' + tenant = 'project_name' + # Check that the env vars exists: - envvars = ('OS_USERNAME', 'OS_PASSWORD', 'OS_AUTH_URL', 'OS_TENANT_NAME') + envvars = ('OS_USERNAME', 'OS_PASSWORD', 'OS_AUTH_URL', tenant_env) for envvar in envvars: if os.getenv(envvar) is None: raise MissingEnvVar(envvar) @@ -69,7 +80,6 @@ def get_credentials(service): tenant = "project_id" else: password = "password" - tenant = "tenant_name" # The most common way to pass these info to the script is to do it through # environment variables. @@ -77,8 +87,18 @@ def get_credentials(service): "username": os.environ.get("OS_USERNAME"), password: os.environ.get("OS_PASSWORD"), "auth_url": os.environ.get("OS_AUTH_URL"), - tenant: os.environ.get("OS_TENANT_NAME") + tenant: os.environ.get(tenant_env) }) + if keystone_v3: + if os.getenv('OS_USER_DOMAIN_NAME') is not None: + creds.update({ + "user_domain_name": os.getenv('OS_USER_DOMAIN_NAME') + }) + if os.getenv('OS_PROJECT_DOMAIN_NAME') is not None: + creds.update({ + "project_domain_name": os.getenv('OS_PROJECT_DOMAIN_NAME') + }) + if os.getenv('OS_ENDPOINT_TYPE') is not None: creds.update({ "endpoint_type": os.environ.get("OS_ENDPOINT_TYPE") @@ -113,7 +133,14 @@ def source_credentials(rc_file): def get_credentials_for_rally(): creds = get_credentials("keystone") - admin_keys = ['username', 'tenant_name', 'password'] + keystone_api_version = os.getenv('OS_IDENTITY_API_VERSION') + if (keystone_api_version is None or + keystone_api_version == '2'): + admin_keys = ['username', 'tenant_name', 'password'] + else: + admin_keys = ['username', 'password', 'user_domain_name', + 'project_name', 'project_domain_name'] + endpoint_types = [('internalURL', 'internal'), ('publicURL', 'public'), ('adminURL', 'admin')] if 'endpoint_type' in creds.keys(): |