+def get_credentials_for_rally():
+ creds = get_credentials("keystone")
+ admin_keys = ['username', 'tenant_name', 'password']
+ endpoint_types = [('internalURL', 'internal'),
+ ('publicURL', 'public'), ('adminURL', 'admin')]
+ if 'endpoint_type' in creds.keys():
+ for k, v in endpoint_types:
+ if creds['endpoint_type'] == k:
+ creds['endpoint_type'] = v
+ rally_conf = {"type": "ExistingCloud", "admin": {}}
+ for key in creds:
+ if key in admin_keys:
+ rally_conf['admin'][key] = creds[key]
+ else:
+ rally_conf[key] = creds[key]
+ return rally_conf
+
+
+# *********************************************
+# CLIENTS
+# *********************************************
+def get_keystone_client():
+ creds_keystone = get_credentials("keystone")
+ return keystoneclient.Client(**creds_keystone)
+
+
+def get_nova_client():
+ creds_nova = get_credentials("nova")
+ return novaclient.Client('2', **creds_nova)
+
+
+def get_cinder_client():
+ creds_cinder = get_credentials("cinder")
+ creds_cinder.update({
+ "service_type": "volume"
+ })
+ return cinderclient.Client('2', **creds_cinder)
+
+
+def get_neutron_client():
+ creds_neutron = get_credentials("neutron")
+ return neutronclient.Client(**creds_neutron)
+
+
+def get_glance_client():
+ keystone_client = get_keystone_client()
+ glance_endpoint_type = 'publicURL'
+ os_endpoint_type = os.getenv('OS_ENDPOINT_TYPE')
+ if os_endpoint_type is not None:
+ glance_endpoint_type = os_endpoint_type
+ glance_endpoint = keystone_client.service_catalog.url_for(
+ service_type='image', endpoint_type=glance_endpoint_type)
+ return glanceclient.Client(1, glance_endpoint,
+ token=keystone_client.auth_token)
+