summaryrefslogtreecommitdiffstats
path: root/functest/utils
diff options
context:
space:
mode:
Diffstat (limited to 'functest/utils')
-rw-r--r--functest/utils/functest_constants.py20
-rwxr-xr-xfunctest/utils/openstack_utils.py40
2 files changed, 35 insertions, 25 deletions
diff --git a/functest/utils/functest_constants.py b/functest/utils/functest_constants.py
index 3cdcad67a..ac9d77c87 100644
--- a/functest/utils/functest_constants.py
+++ b/functest/utils/functest_constants.py
@@ -61,7 +61,7 @@ def get_value(functest_config_key, env_variable):
return constant
-HOME = get_value('general.dir.dir_home', 'HOME')
+HOME = get_value('general.dir.home', 'HOME')
REPOS_DIR = get_value('general.dir.repos', 'REPOS_DIR')
FUNCTEST_BASE_DIR = get_value('general.dir.functest',
'FUNCTEST_BASE_DIR')
@@ -222,24 +222,24 @@ DOCTOR_REPO_DIR = get_value('general.dir.dir_repo_doctor',
'DOCTOR_REPO_DIR')
COPPER_REPO_DIR = get_value('general.dir.repo_copper',
'COPPER_REPO_DIR')
-EXAMPLE_INSTANCE_NAME = get_value('example.example_vm_name',
+EXAMPLE_INSTANCE_NAME = get_value('example.vm_name',
'EXAMPLE_INSTANCE_NAME')
-EXAMPLE_FLAVOR = get_value('example.example_flavor', 'EXAMPLE_FLAVOR')
-EXAMPLE_IMAGE_NAME = get_value('example.example_image_name',
+EXAMPLE_FLAVOR = get_value('example.flavor', 'EXAMPLE_FLAVOR')
+EXAMPLE_IMAGE_NAME = get_value('example.image_name',
'EXAMPLE_IMAGE_NAME')
-EXAMPLE_PRIVATE_NET_NAME = get_value('example.example_private_net_name',
+EXAMPLE_PRIVATE_NET_NAME = get_value('example.private_net_name',
'EXAMPLE_PRIVATE_NET_NAME')
EXAMPLE_PRIVATE_SUBNET_NAME = get_value(
- 'example.example_private_subnet_name',
+ 'example.private_subnet_name',
'EXAMPLE_PRIVATE_SUBNET_NAME')
EXAMPLE_PRIVATE_SUBNET_CIDR = get_value(
- 'example.example_private_subnet_cidr',
+ 'example.private_subnet_cidr',
'EXAMPLE_PRIVATE_SUBNET_CIDR')
-EXAMPLE_ROUTER_NAME = get_value('example.example_router_name',
+EXAMPLE_ROUTER_NAME = get_value('example.router_name',
'EXAMPLE_ROUTER_NAME')
-EXAMPLE_SECGROUP_NAME = get_value('example.example_sg_name',
+EXAMPLE_SECGROUP_NAME = get_value('example.sg_name',
'EXAMPLE_SECGROUP_NAME')
-EXAMPLE_SECGROUP_DESCR = get_value('example.example_sg_descr',
+EXAMPLE_SECGROUP_DESCR = get_value('example.sg_desc',
'EXAMPLE_SECGROUP_DESCR')
VIMS_DATA_DIR = get_value('general.dir.dir_vIMS_data',
'VIMS_DATA_DIR')
diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py
index ec784121b..38a30cb33 100755
--- a/functest/utils/openstack_utils.py
+++ b/functest/utils/openstack_utils.py
@@ -86,7 +86,7 @@ def get_env_cred_dict():
return env_cred_dict
-def get_credentials():
+def get_credentials(other_creds={}):
"""Returns a creds dictionary filled with parsed from env
"""
creds = {}
@@ -99,6 +99,16 @@ def get_credentials():
else:
creds_key = env_cred_dict.get(envvar)
creds.update({creds_key: os.getenv(envvar)})
+
+ if 'tenant' in other_creds.keys():
+ if is_keystone_v3():
+ tenant = 'project_name'
+ else:
+ tenant = 'tenant_name'
+ other_creds[tenant] = other_creds.pop('tenant')
+
+ creds.update(other_creds)
+
return creds
@@ -138,9 +148,9 @@ def get_credentials_for_rally():
return rally_conf
-def get_session_auth():
+def get_session_auth(other_creds={}):
loader = loading.get_plugin_loader('password')
- creds = get_credentials()
+ creds = get_credentials(other_creds)
auth = loader.load_from_options(**creds)
return auth
@@ -152,8 +162,8 @@ def get_endpoint(service_type, endpoint_type='publicURL'):
endpoint_type=endpoint_type)
-def get_session():
- auth = get_session_auth()
+def get_session(other_creds={}):
+ auth = get_session_auth(other_creds)
return session.Session(auth=auth)
@@ -169,8 +179,8 @@ def get_keystone_client_version():
return DEFAULT_API_VERSION
-def get_keystone_client():
- sess = get_session()
+def get_keystone_client(other_creds={}):
+ sess = get_session(other_creds)
return keystoneclient.Client(get_keystone_client_version(), session=sess)
@@ -183,8 +193,8 @@ def get_nova_client_version():
return DEFAULT_API_VERSION
-def get_nova_client():
- sess = get_session()
+def get_nova_client(other_creds={}):
+ sess = get_session(other_creds)
return novaclient.Client(get_nova_client_version(), session=sess)
@@ -197,8 +207,8 @@ def get_cinder_client_version():
return DEFAULT_API_VERSION
-def get_cinder_client():
- sess = get_session()
+def get_cinder_client(other_creds={}):
+ sess = get_session(other_creds)
return cinderclient.Client(get_cinder_client_version(), session=sess)
@@ -211,8 +221,8 @@ def get_neutron_client_version():
return DEFAULT_API_VERSION
-def get_neutron_client():
- sess = get_session()
+def get_neutron_client(other_creds={}):
+ sess = get_session(other_creds)
return neutronclient.Client(get_neutron_client_version(), session=sess)
@@ -224,8 +234,8 @@ def get_glance_client_version():
return DEFAULT_API_VERSION
-def get_glance_client():
- sess = get_session()
+def get_glance_client(other_creds={}):
+ sess = get_session(other_creds)
return glanceclient.Client(get_glance_client_version(), session=sess)