aboutsummaryrefslogtreecommitdiffstats
path: root/robot/resources/openstack/openstack_common.robot
diff options
context:
space:
mode:
authorDR695H <dr695h@att.com>2017-02-17 18:44:24 -0500
committerDR695H <dr695h@att.com>2017-02-17 18:44:41 -0500
commitccff30b6e325f359879595998e83bbfe6624c851 (patch)
treec98f950f33baa71d21b091b6b10ca3ffb7700467 /robot/resources/openstack/openstack_common.robot
parent234c2226d8cb3368a7af3d280a5ec280782bed63 (diff)
Initial checkin of EopenECOMP testsuite
Change-Id: I64a2b6d8cf66169829866b73b3d26a4ff59b0a42 Signed-off-by: DR695H <dr695h@att.com>
Diffstat (limited to 'robot/resources/openstack/openstack_common.robot')
-rw-r--r--robot/resources/openstack/openstack_common.robot50
1 files changed, 50 insertions, 0 deletions
diff --git a/robot/resources/openstack/openstack_common.robot b/robot/resources/openstack/openstack_common.robot
new file mode 100644
index 00000000..6a53ab63
--- /dev/null
+++ b/robot/resources/openstack/openstack_common.robot
@@ -0,0 +1,50 @@
+*** Settings ***
+Documentation The private interface for interacting with Openstack. It handles low level stuff like managing the authtoken and Openstack required fields
+
+Library OpenstackLibrary
+Library RequestsLibrary
+Library UUID
+Resource ../global_properties.robot
+
+*** Keywords ***
+Internal Get Openstack
+ [Documentation] Runs an Openstack Get Request and returns the response
+ [Arguments] ${alias} ${service_type} ${region} ${url_ext} ${data_path}=
+ Log Internal Get Openstack values alias=${alias} service_type=${service_type} region=${region} url_ext=${url_ext} data_path=${data_path}
+ ${url}= Get Openstack Service Url ${alias} ${service_type} ${region}
+ ${uuid}= Generate UUID
+ ${session_alias}= Catenate openstack-${uuid}
+ ${session}= Create Session ${session_alias} ${url}${url_ext} verify=True
+ ${token}= Get Openstack Token ${alias}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} X-Auth-Token=${token}
+ ${resp}= Get Request ${session_alias} ${data_path} headers=${headers}
+ Log Received response from openstack ${resp.text}
+ [Return] ${resp}
+
+Internal Post Openstack
+ [Documentation] Runs an Openstack Post Response and returns the response
+ [Arguments] ${alias} ${service_type} ${region} ${url_ext} ${data_path}= ${data}=
+ Log Internal Post Openstack values alias=${alias} service_type=${service_type} region=${region} url_ext=${url_ext} data_path=${data_path}
+ ${url}= Get Openstack Service Url ${alias} ${service_type} ${region}
+ ${uuid}= Generate UUID
+ ${session_alias}= Catenate openstack-${uuid}
+ ${session}= Create Session ${session_alias} ${url}${url_ext} verify=True
+ ${token}= Get Openstack Token ${alias}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} X-Auth-Token=${token}
+ ${resp}= Post Request ${session_alias} ${data_path} data=${data} headers=${headers}
+ Log Received response from openstack ${resp.text}
+ [Return] ${resp}
+
+Internal Delete Openstack
+ [Documentation] Runs an Openstack Delete Request and returns the response
+ [Arguments] ${alias} ${service_type} ${region} ${url_ext} ${data_path}=
+ Log Internal Post Openstack values alias=${alias} service_type=${service_type} region=${region} url_ext=${url_ext} data_path=${data_path}
+ ${url}= Get Openstack Service Url ${alias} ${service_type} ${region}
+ ${uuid}= Generate UUID
+ ${session_alias}= Catenate openstack-${uuid}
+ ${session}= Create Session ${session_alias} ${url}${url_ext} verify=True
+ ${token}= Get Openstack Token ${alias}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} X-Auth-Token=${token}
+ ${resp}= Delete Request ${session_alias} ${data_path} headers=${headers}
+ Log Received response from openstack ${resp.text}
+ [Return] ${resp} \ No newline at end of file