Handle injected keystone URL and expose heatbridge

Issue: TEST-68
Change-Id: Id0194b99b5a85d9e3d26043420b7655591d13c23
Signed-off-by: Jerry Flood <jf9860@att.com>
diff --git a/robot/resources/global_properties.robot b/robot/resources/global_properties.robot
index 701a325..6d82042 100644
--- a/robot/resources/global_properties.robot
+++ b/robot/resources/global_properties.robot
@@ -19,7 +19,7 @@
 ${GLOBAL_OPENSTACK_GLANCE_SERVICE_TYPE}    image
 ${GLOBAL_OPENSTACK_KEYSTONE_SERVICE_TYPE}    identity
 ${GLOBAL_OPENSTACK_STACK_DEPLOYMENT_TIMEOUT}    600s
-${GLOBAL_AAI_CLOUD_OWNER}    Rackspace
+${GLOBAL_AAI_CLOUD_OWNER}    CloudOwner
 ${GLOBAL_BUILD_NUMBER}    0
 ${GLOBAL_VID_UI_TIMEOUT_SHORT}    20s
 ${GLOBAL_VID_UI_TIMEOUT_MEDIUM}    60s
diff --git a/robot/resources/heatbridge.robot b/robot/resources/heatbridge.robot
index c96ee41..515ae39 100644
--- a/robot/resources/heatbridge.robot
+++ b/robot/resources/heatbridge.robot
@@ -38,7 +38,8 @@
     ${stack_id}=    Get From Dictionary    ${stack_info}    id
     ${tenant_id}=   Get From Dictionary    ${stack_info}    OS::project_id
     ${vnf_id}=    Get From Dictionary    ${stack_info}    vnf_id
-    ${openstack_identity_url}=    Catenate    ${GLOBAL_INJECTED_KEYSTONE}/v2.0
+    ${url}   ${path}=   Get Keystone Url And Path
+    ${openstack_identity_url}=    Catenate    ${url}${path}
     ${region}=   Get Openstack Region
     ${user}   ${pass}=   Get Openstack Credentials
     Init Bridge    ${openstack_identity_url}    ${user}    ${pass}    ${tenant_id}    ${region}   ${GLOBAL_AAI_CLOUD_OWNER}
diff --git a/robot/resources/openstack/keystone_interface.robot b/robot/resources/openstack/keystone_interface.robot
index 3c3de90..e51e3db 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 @@
     [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 @@
 
 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
diff --git a/robot/testsuites/demo.robot b/robot/testsuites/demo.robot
index c5ada09..4c99f45 100644
--- a/robot/testsuites/demo.robot
+++ b/robot/testsuites/demo.robot
@@ -2,13 +2,18 @@
 Documentation	  Executes the VNF Orchestration Test cases including setup and teardown
 ...
 Library   Collections
-Library    DatabaseLibrary
+Library    HTTPUtils
 Resource         ../resources/demo_preload.robot
 *** Variables ***
 
 ${VNF_NAME}       DemoVNF
 ${MODULE_NAME}    DemoModuleName
 
+${HB_STACK}
+${HB_SERVICE_INSTANCE_ID}
+${HB_SERVICE}
+
+
 *** Test Cases ***
 Initialize Customer And Models
     [Tags]   InitDemo
@@ -43,3 +48,9 @@
     Delete VNF
     [Teardown]   Teardown VNF
 
+Run Heatbridge
+    [Documentation]
+    ...    Try to run heatbridge
+    [Tags]   heatbridge
+    Execute Heatbridge   ${HB_STACK}   ${HB_SERVICE_INSTANCE_ID}    ${HB_SERVICE}
+