aboutsummaryrefslogtreecommitdiffstats
path: root/robot/resources/openstack
diff options
context:
space:
mode:
authorJerry Flood <jf9860@att.com>2017-10-27 08:37:37 -0400
committerJerry Flood <jf9860@att.com>2017-10-27 08:39:48 -0400
commit596db38841448d97493334c9fb0d996e3e14210e (patch)
tree06b3548f6615e909d887624f19089ed3f9a542d5 /robot/resources/openstack
parent7762dd08e9c6c3d8b7fa689ddc913b3ebd5847c9 (diff)
Handle injected keystone URL and expose heatbridge
Issue: TEST-68 Change-Id: Id0194b99b5a85d9e3d26043420b7655591d13c23 Signed-off-by: Jerry Flood <jf9860@att.com>
Diffstat (limited to 'robot/resources/openstack')
-rw-r--r--robot/resources/openstack/keystone_interface.robot15
1 files changed, 13 insertions, 2 deletions
diff --git a/robot/resources/openstack/keystone_interface.robot b/robot/resources/openstack/keystone_interface.robot
index 3c3de90c..e51e3db8 100644
--- a/robot/resources/openstack/keystone_interface.robot
+++ b/robot/resources/openstack/keystone_interface.robot
@@ -2,6 +2,7 @@
Documentation The main interface for interacting with Openstack Keystone API. It handles low level stuff like managing the authtoken and Openstack required fields
Library OpenstackLibrary
Library RequestsLibrary
+Library HTTPUtils
Library UUID
Library Collections
Library OperatingSystem
@@ -20,12 +21,13 @@ Run Openstack Auth Request
[Documentation] Runs an Openstack Auth Request and returns the token and service catalog. you need to include the token in future request's x-auth-token headers. Service catalog describes what can be called
[Arguments] ${alias} ${username}= ${password}=
${username} ${password}= Set Openstack Credentials ${username} ${password}
- ${session}= Create Session keystone ${GLOBAL_INJECTED_KEYSTONE} verify=True
+ ${url} ${path}= Get Keystone Url And Path
+ ${session}= Create Session keystone ${url} verify=True
${uuid}= Generate UUID
${data_template}= OperatingSystem.Get File ${OPENSTACK_KEYSTONE_AUTH_BODY_FILE}
${arguments}= Create Dictionary username=${username} password=${password} tenantId=${GLOBAL_INJECTED_OPENSTACK_TENANT_ID}
${data}= Fill JSON Template ${data_template} ${arguments}
- ${data_path}= Catenate ${OPENSTACK_KEYSTONE_API_VERSION}${OPENSTACK_KEYSTONE_AUTH_PATH}
+ ${data_path}= Catenate ${path}${OPENSTACK_KEYSTONE_AUTH_PATH}
${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
Log Sending authenticate post request ${data_path} with headers ${headers} and data ${data}
${resp}= Post Request keystone ${data_path} data=${data} headers=${headers}
@@ -53,3 +55,12 @@ Set Openstack Credentials
Get Openstack Credentials
[Return] ${GLOBAL_INJECTED_OPENSTACK_USERNAME} ${GLOBAL_INJECTED_OPENSTACK_PASSWORD}
+
+Get Keystone Url And Path
+ [Documentation] Handle arbitrary keystone identiit url. Add v2.0 if not present.
+ ${pieces}= URL Parse ${GLOBAL_INJECTED_KEYSTONE}
+ ${url}= Catenate ${pieces.scheme}://${pieces.netloc}
+ ${version}= Evaluate ''
+ ${version}= Set Variable If '${OPENSTACK_KEYSTONE_API_VERSION}' not in '${pieces.path}' ${OPENSTACK_KEYSTONE_API_VERSION} ${version}
+ ${path}= Catenate ${pieces.path}${version}
+ [Return] ${url} ${path} \ No newline at end of file