summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-08-28 23:49:16 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2018-08-29 11:17:46 +0200
commit53f29de06005a4c70c9a3816cddb98cf87c88757 (patch)
tree979d9aae6b0c7027b26bf8ef8e6fd1c303ab9a5b
parent59e08c4315426edc1a50f2d476403becced765e9 (diff)
Support pre-Provisioned credentials
If USE_DYNAMIC_CREDENTIALS = False, Functest is expected for /home/opnfv/functest/data/accounts.yaml which contains the set of pre-existing credentials to use for testing [1]. It also sets admin_domain_scope and default_credentials_domain_name. [1] https://docs.openstack.org/tempest/latest/configuration.html Change-Id: Ie7b81f0c56049260ca99b8e3a6d58cb8a2660659 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 7e0f65a25f1c83c90051e13e4aa5333aaaa8c6d5)
-rw-r--r--functest/opnfv_tests/openstack/tempest/conf_utils.py13
-rw-r--r--functest/opnfv_tests/openstack/tempest/tempest.py3
-rw-r--r--functest/utils/env.py3
3 files changed, 16 insertions, 3 deletions
diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py
index e86f9d21a..3a7c3dad0 100644
--- a/functest/opnfv_tests/openstack/tempest/conf_utils.py
+++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py
@@ -12,6 +12,7 @@
from __future__ import print_function
+import json
import logging
import fileinput
import os
@@ -185,7 +186,8 @@ def update_tempest_conf_file(conf_file, rconfig):
def configure_tempest_update_params(
tempest_conf_file, network_name=None, image_id=None, flavor_id=None,
- compute_cnt=1, image_alt_id=None, flavor_alt_id=None):
+ compute_cnt=1, image_alt_id=None, flavor_alt_id=None,
+ domain_name="Default"):
# pylint: disable=too-many-branches, too-many-arguments
"""
Add/update needed parameters into tempest.conf file
@@ -210,6 +212,8 @@ def configure_tempest_update_params(
if os.environ.get('OS_REGION_NAME'):
rconfig.set('identity', 'region', os.environ.get('OS_REGION_NAME'))
identity_api_version = os.environ.get("OS_IDENTITY_API_VERSION", '3')
+ rconfig.set('auth', 'admin_domain_scope', True)
+ rconfig.set('auth', 'default_credentials_domain_name', domain_name)
if identity_api_version == '3':
auth_version = 'v3'
rconfig.set('identity-feature-enabled', 'api_v2', False)
@@ -217,6 +221,13 @@ def configure_tempest_update_params(
auth_version = 'v2'
if env.get("NEW_USER_ROLE").lower() != "member":
rconfig.set('auth', 'tempest_roles', env.get("NEW_USER_ROLE"))
+ if not json.loads(env.get("USE_DYNAMIC_CREDENTIALS").lower()):
+ rconfig.set('auth', 'use_dynamic_credentials', False)
+ account_file = os.path.join(
+ getattr(config.CONF, 'dir_functest_data'), 'accounts.yaml')
+ assert os.path.exists(
+ account_file), "{} doesn't exist".format(account_file)
+ rconfig.set('auth', 'test_accounts_file', account_file)
rconfig.set('identity', 'auth_version', auth_version)
rconfig.set(
'validation', 'ssh_timeout',
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py
index aaa2d3d3e..934e6c6ef 100644
--- a/functest/opnfv_tests/openstack/tempest/tempest.py
+++ b/functest/opnfv_tests/openstack/tempest/tempest.py
@@ -298,7 +298,8 @@ class TempestCommon(singlevm.VmReady1):
flavor_id=self.flavor.id,
compute_cnt=compute_cnt,
image_alt_id=self.image_alt.id,
- flavor_alt_id=self.flavor_alt.id)
+ flavor_alt_id=self.flavor_alt.id,
+ domain_name=self.cloud.auth.get("project_domain_name", "Default"))
self.backup_tempest_config(self.conf_file, self.res_dir)
def run(self, **kwargs):
diff --git a/functest/utils/env.py b/functest/utils/env.py
index b5ff965fe..29ff6a825 100644
--- a/functest/utils/env.py
+++ b/functest/utils/env.py
@@ -29,7 +29,8 @@ INPUTS = {
'ENERGY_RECORDER_API_PASSWORD': env.INPUTS['ENERGY_RECORDER_API_PASSWORD'],
'VOLUME_DEVICE_NAME': 'vdb',
'NAMESERVER': '8.8.8.8',
- 'NEW_USER_ROLE': 'Member'
+ 'NEW_USER_ROLE': 'Member',
+ 'USE_DYNAMIC_CREDENTIALS': 'True'
}