aboutsummaryrefslogtreecommitdiffstats
path: root/robot/resources/openstack
diff options
context:
space:
mode:
authorjf9860 <jf9860@att.com>2017-03-09 15:28:42 -0500
committerjf9860 <jf9860@att.com>2017-03-09 15:29:18 -0500
commit99c6329d9b5f5f83a38eb309181200b80d153949 (patch)
treeb7e51225ba0ac869f4c63d0d456b6bdd90550b6d /robot/resources/openstack
parentca5693c162ed0d019b416b5784c0ee8eaf653abf (diff)
TEST-4 Re-factor openstack region variable
Change-Id: Iad9ef0555dbbd921e261bfa2a63806100bcf7c83 Signed-off-by: jf9860 <jf9860@att.com>
Diffstat (limited to 'robot/resources/openstack')
-rw-r--r--robot/resources/openstack/cinder_interface.robot18
-rw-r--r--robot/resources/openstack/heat_interface.robot57
-rw-r--r--robot/resources/openstack/keystone_interface.robot22
-rw-r--r--robot/resources/openstack/neutron_interface.robot49
-rw-r--r--robot/resources/openstack/nova_interface.robot54
-rw-r--r--robot/resources/openstack/openstack_common.robot46
6 files changed, 140 insertions, 106 deletions
diff --git a/robot/resources/openstack/cinder_interface.robot b/robot/resources/openstack/cinder_interface.robot
index ee1a253b..1b720359 100644
--- a/robot/resources/openstack/cinder_interface.robot
+++ b/robot/resources/openstack/cinder_interface.robot
@@ -2,7 +2,7 @@
Documentation The main interface for interacting with Openstack. It handles low level stuff like managing the authtoken and Openstack required fields
Library OpenstackLibrary
Library RequestsLibrary
-Library UUID
+Library UUID
Library OperatingSystem
Resource ../global_properties.robot
Resource ../json_templater.robot
@@ -20,14 +20,14 @@ ${OPENSTACK_CINDER_AVAILABILITY_ZONE} nova
*** Keywords ***
Get Openstack Volume Types
[Documentation] Returns the openstack volume types information
- [Arguments] ${alias}
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_CINDER_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_CINDER_TYPES_PATH}
+ [Arguments] ${alias}
+ ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_CINDER_SERVICE_TYPE} ${OPENSTACK_CINDER_TYPES_PATH}
[Return] ${resp.json()}
-
+
Get Openstack Volume
[Documentation] Returns the openstack volume information for the passed in volume id
[Arguments] ${alias} ${volume_id}
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_CINDER_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_CINDER_VOLUMES_PATH} /${volume_id}
+ ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_CINDER_SERVICE_TYPE} ${OPENSTACK_CINDER_VOLUMES_PATH} /${volume_id}
[Return] ${resp.json()}
Add Openstack Volume
@@ -37,14 +37,14 @@ Add Openstack Volume
${uuid}= Generate UUID
${arguments}= Create Dictionary name=${name} description=${GLOBAL_APPLICATION_ID}${uuid} size=${size} type=${OPENSTACK_CINDER_VOLUMES_TYPE} availability_zone=${OPENSTACK_CINDER_AVAILABILITY_ZONE}
${data}= Fill JSON Template ${data_template} ${arguments}
- ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_CINDER_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_CINDER_VOLUMES_PATH} data_path= data=${data}
+ ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_CINDER_SERVICE_TYPE} ${OPENSTACK_CINDER_VOLUMES_PATH} data_path= data=${data}
Should Be Equal As Strings 200 ${resp.status_code}
[Return] ${resp.json()['volume']['id']}
-
+
Delete Openstack Volume
[Documentation] Runs an Openstack Request to delete a volume
[Arguments] ${alias} ${volume_id}
- ${resp}= Internal Delete Openstack ${alias} ${GLOBAL_OPENSTACK_CINDER_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_CINDER_VOLUMES_PATH} /${volume_id}
+ ${resp}= Internal Delete Openstack ${alias} ${GLOBAL_OPENSTACK_CINDER_SERVICE_TYPE} ${OPENSTACK_CINDER_VOLUMES_PATH} /${volume_id}
${status_string}= Convert To String ${resp.status_code}
- Should Match Regexp ${status_string} ^(204|200|404)$
+ Should Match Regexp ${status_string} ^(204|200|404)$
[Return] ${resp.text} \ No newline at end of file
diff --git a/robot/resources/openstack/heat_interface.robot b/robot/resources/openstack/heat_interface.robot
index 74c7aac8..32f3fdee 100644
--- a/robot/resources/openstack/heat_interface.robot
+++ b/robot/resources/openstack/heat_interface.robot
@@ -1,8 +1,8 @@
*** Settings ***
-Documentation The interface for interacting with Openstack Heat API.
+Documentation The interface for interacting with Openstack Heat API.
Library OpenstackLibrary
Library RequestsLibrary
-Library UUID
+Library UUID
Library OperatingSystem
Library HEATUtils
Library StringTemplater
@@ -12,7 +12,7 @@ Resource ../json_templater.robot
Resource openstack_common.robot
*** Variables ***
-${OPENSTACK_HEAT_API_VERSION} /v1
+${OPENSTACK_HEAT_API_VERSION} /v1
${OPENSTACK_HEAT_STACK_PATH} /stacks
${OPENSTACK_HEAT_ADD_STACK_TEMPLATE} robot/assets/templates/heat_add_stack.template
@@ -21,19 +21,19 @@ ${OPENSTACK_HEAT_ADD_STACK_TEMPLATE} robot/assets/templates/heat_add_stack.te
Get Openstack Stacks
[Documentation] Returns the openstack stacks info
[Arguments] ${alias}
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_HEAT_STACK_PATH}
+ ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} ${OPENSTACK_HEAT_STACK_PATH}
[Return] ${resp.json()}
-
+
Get Openstack Stack
[Documentation] Returns the openstack stacks info for the given stack name
- [Arguments] ${alias} ${stack_name}
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_HEAT_STACK_PATH} /${stack_name}
+ [Arguments] ${alias} ${stack_name}
+ ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} ${OPENSTACK_HEAT_STACK_PATH} /${stack_name}
[Return] ${resp.json()}
-
+
Create Openstack Stack
[Documentation] Takes an openstack heat yaml and returns the created stack
[Arguments] ${alias} ${request}
- ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_HEAT_STACK_PATH} data_path= data=${request}
+ ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} ${OPENSTACK_HEAT_STACK_PATH} data_path= data=${request}
[Return] ${resp.json()}
Make Add Stack Request
@@ -44,50 +44,49 @@ Make Add Stack Request
${dict}= Create Dictionary template=${templatedata} parameters=${envdata} stack_name=${name}
${resp}= OperatingSystem.Get File ${OPENSTACK_HEAT_ADD_STACK_TEMPLATE}
${request}= Template String ${resp} ${dict}
- Log $request
+ Log $request
[Return] ${request}
Delete Openstack Stack
[Documentation] Deletes and Openstack Stack for the passed name and id
- [Arguments] ${alias} ${stack_name} ${stack_id}
+ [Arguments] ${alias} ${stack_name} ${stack_id}
${data_path}= Catenate /${stack_name}/${stack_id}
- ${resp}= Internal Delete Openstack ${alias} ${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_HEAT_STACK_PATH} data_path=${data_path}
+ ${resp}= Internal Delete Openstack ${alias} ${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} ${OPENSTACK_HEAT_STACK_PATH} data_path=${data_path}
Should Be Equal As Strings 204 ${resp.status_code}
[Return] ${resp}
Get Stack Details
- [Documentation] Gets all of the information necessary for tearing down an existing Openstack Stack
- [Arguments] ${alias} ${stack_name}
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_HEAT_STACK_PATH} /${stack_name}
- ${result}= Stack Info Parse ${resp.json()}
+ [Documentation] Gets all of the information necessary for tearing down an existing Openstack Stack
+ [Arguments] ${alias} ${stack_name}
+ ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} ${OPENSTACK_HEAT_STACK_PATH} /${stack_name}
+ ${result}= Stack Info Parse ${resp.json()}
[Return] ${result}
Get Stack Template
- [Documentation] Gets all of the template information of an existing Openstack Stack
- [Arguments] ${alias} ${stack_name} ${stack_id}
+ [Documentation] Gets all of the template information of an existing Openstack Stack
+ [Arguments] ${alias} ${stack_name} ${stack_id}
${data_path}= Catenate /${stack_name}/${stack_id}/template
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_HEAT_STACK_PATH} ${data_path}
+ ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} ${OPENSTACK_HEAT_STACK_PATH} ${data_path}
${template}= Catenate ${resp.json()}
[Return] ${template}
-
+
Get Stack Resources
- [Documentation] Gets all of the resources of an existing Openstack Stack
- [Arguments] ${alias} ${stack_name} ${stack_id}
+ [Documentation] Gets all of the resources of an existing Openstack Stack
+ [Arguments] ${alias} ${stack_name} ${stack_id}
${data_path}= Catenate /${stack_name}/${stack_id}/resources
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_HEAT_STACK_PATH} ${data_path}
+ ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} ${OPENSTACK_HEAT_STACK_PATH} ${data_path}
[Return] ${resp.json()}
-
+
Wait for Stack to Be Deployed
[Arguments] ${alias} ${stack_name} ${timeout}=600s
- ${stack_info}= Wait Until Keyword Succeeds ${timeout} 30 sec Get Deployed Stack ${alias} ${stack_name}
+ ${stack_info}= Wait Until Keyword Succeeds ${timeout} 30 sec Get Deployed Stack ${alias} ${stack_name}
${status}= Get From Dictionary ${stack_info} stack_status
Should Be Equal ${status} CREATE_COMPLETE
[Return] ${stack_info}
-
+
Get Deployed Stack
- [Arguments] ${alias} ${stack_name}
+ [Arguments] ${alias} ${stack_name}
${stack_info}= Get Stack Details ${alias} ${stack_name}
${status}= Get From Dictionary ${stack_info} stack_status
Should Not Be Equal ${status} CREATE_IN_PROGRESS
- [Return] ${stack_info}
- \ No newline at end of file
+ [Return] ${stack_info}
diff --git a/robot/resources/openstack/keystone_interface.robot b/robot/resources/openstack/keystone_interface.robot
index 928efbdd..6c48e120 100644
--- a/robot/resources/openstack/keystone_interface.robot
+++ b/robot/resources/openstack/keystone_interface.robot
@@ -2,7 +2,8 @@
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 UUID
+Library UUID
+Library Collections
Library OperatingSystem
Resource ../global_properties.robot
Resource ../json_templater.robot
@@ -28,22 +29,27 @@ Run Openstack Auth Request
${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}
- Save Openstack Auth ${alias} ${resp.text}
+ Save Openstack Auth ${alias} ${resp.text}
Log Received response from keystone ${resp.text}
-
+
Get Openstack Tenants
[Documentation] Returns all the openstack tenant info
[Arguments] ${alias}
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_KEYSTONE_SERVICE_TYPE} region= url_ext=${OPENSTACK_KEYSTONE_TENANT_PATH} data_path=
+ ${resp}= Internal Get Openstack With Region ${alias} ${GLOBAL_OPENSTACK_KEYSTONE_SERVICE_TYPE} region= url_ext=${OPENSTACK_KEYSTONE_TENANT_PATH} data_path=
[Return] ${resp.json()}
-
+
Get Openstack Tenant
[Documentation] Returns the openstack tenant info for the specified tenantid
[Arguments] ${alias} ${tenant_id}
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_KEYSTONE_SERVICE_TYPE} region= url_ext=${OPENSTACK_KEYSTONE_TENANT_PATH} data_path=/${tenant_id}
+ ${resp}= Internal Get Openstack With Region ${alias} ${GLOBAL_OPENSTACK_KEYSTONE_SERVICE_TYPE} region= url_ext=${OPENSTACK_KEYSTONE_TENANT_PATH} data_path=/${tenant_id}
[Return] ${resp.json()}
-
+
Set Openstack Credentials
[Arguments] ${username} ${password}
- Return From Keyword If '${username}' != '' ${username} ${password}
+ Return From Keyword If '${username}' != '' ${username} ${password}
+ ${user} ${pass}= Get Openstack Credentials
+ [Return] ${user} ${pass}
+
+Get Openstack Credentials
+ Dictionary Should Contain Key ${GLOBAL_VM_PROPERTIES} openstack_username
[Return] ${GLOBAL_VM_PROPERTIES['openstack_username']} ${GLOBAL_VM_PROPERTIES['openstack_password']} \ No newline at end of file
diff --git a/robot/resources/openstack/neutron_interface.robot b/robot/resources/openstack/neutron_interface.robot
index a88a9436..bdb64b98 100644
--- a/robot/resources/openstack/neutron_interface.robot
+++ b/robot/resources/openstack/neutron_interface.robot
@@ -2,7 +2,7 @@
Documentation The main interface for interacting with Openstack. It handles low level stuff like managing the authtoken and Openstack required fields
Library OpenstackLibrary
Library RequestsLibrary
-Library UUID
+Library UUID
Library OperatingSystem
Library Collections
Resource ../global_properties.robot
@@ -21,25 +21,25 @@ ${OPENSTACK_NEUTRON_PORT_PATH} /ports
Get Openstack Network
[Documentation] Runs an Openstack Request and returns the network info
[Arguments] ${alias} ${network_id}
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NEUTRON_NETWORK_PATH} /${network_id}
+ ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${OPENSTACK_NEUTRON_NETWORK_PATH} /${network_id}
[Return] ${resp.json()}
Get Openstack Networks
[Documentation] Runs an Openstack Request and returns the network info
- [Arguments] ${alias}
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NEUTRON_NETWORK_PATH}
+ [Arguments] ${alias}
+ ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${OPENSTACK_NEUTRON_NETWORK_PATH}
[Return] ${resp.json()}
Get Openstack Subnets
[Documentation] Runs an Openstack Request and returns the network info
- [Arguments] ${alias}
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NEUTRON_SUBNET_PATH}
+ [Arguments] ${alias}
+ ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${OPENSTACK_NEUTRON_SUBNET_PATH}
[Return] ${resp.json()}
Get Openstack Ports
[Documentation] Runs an Openstack Request and returns the network info
- [Arguments] ${alias}
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NEUTRON_PORT_PATH}
+ [Arguments] ${alias}
+ ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${OPENSTACK_NEUTRON_PORT_PATH}
[Return] ${resp.json()}
Add Openstack Network
@@ -48,28 +48,28 @@ Add Openstack Network
${data_template}= OperatingSystem.Get File ${OPENSTACK_NEUTRON_NETWORK_ADD_BODY_FILE}
${arguments}= Create Dictionary name=${name}
${data}= Fill JSON Template ${data_template} ${arguments}
- ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NEUTRON_NETWORK_PATH} data_path= data=${data}
+ ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${OPENSTACK_NEUTRON_NETWORK_PATH} data_path= data=${data}
Should Be Equal As Strings 201 ${resp.status_code}
[Return] ${resp.json()['network']['id']}
Delete Openstack Network
[Documentation] Runs an Openstack Request to delete a network
[Arguments] ${alias} ${network_id}
- ${resp}= Internal Delete Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NEUTRON_NETWORK_PATH} /${network_id}
+ ${resp}= Internal Delete Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${OPENSTACK_NEUTRON_NETWORK_PATH} /${network_id}
${status_string}= Convert To String ${resp.status_code}
- Should Match Regexp ${status_string} ^(204|200)$
+ Should Match Regexp ${status_string} ^(204|200)$
[Return] ${resp.text}
Add Openstack Network With Subnet If Not Exists
[Documentation] Runs an Openstack Request to add a network and returns that network id of the created network
[Arguments] ${alias} ${name} ${cidr}
${network}= Get Openstack Subnet By Name ${alias} ${name} ${cidr}
- ${pass} ${v}= Run Keyword and Ignore Error Dictionary Should Contain Key ${network} id
+ ${pass} ${v}= Run Keyword and Ignore Error Dictionary Should Contain Key ${network} id
Run Keyword If '${pass}' == 'FAIL' Add Openstack Network With Subnet ${alias} ${name} ${cidr}
${network}= Get Openstack Subnet By Name ${alias} ${name} ${cidr}
${network_id}= Get From Dictionary ${network} id
[Return] ${network_id}
-
+
Add Openstack Network With Subnet
[Documentation] Runs an Openstack Request to add a network and returns that network id of the created network
@@ -78,25 +78,25 @@ Add Openstack Network With Subnet
${data_template}= OperatingSystem.Get File ${OPENSTACK_NEUTRON_SUBNET_ADD_BODY_FILE}
${arguments}= Create Dictionary network_id=${network_id} cidr=${cidr} subnet_name=${name}
${data}= Fill JSON Template ${data_template} ${arguments}
- ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NEUTRON_SUBNET_PATH} data_path= data=${data}
+ ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${OPENSTACK_NEUTRON_SUBNET_PATH} data_path= data=${data}
Should Be Equal As Strings 201 ${resp.status_code}
[Return] ${network_id}
-
+
Get Openstack Subnet By Name
[Documentation] Retrieve the subnet from openstack by it's name.
[Arguments] ${alias} ${network_name} ${network_cidr}
${resp}= Get Openstack Subnets ${alias}
@{list}= Get From Dictionary ${resp} subnets
- ${returnnet}= Set Variable
+ ${returnnet}= Set Variable
:for ${net} in @{list}
\ ${name}= Get From Dictionary ${net} name
\ ${cidr}= Get From Dictionary ${net} cidr
\ ${returnnet}= Set Variable ${net}
- \ Exit For Loop If '${name}'=='${network_name}' and '${cidr}'=='${network_cidr}'
+ \ Exit For Loop If '${name}'=='${network_name}' and '${cidr}'=='${network_cidr}'
\ ${returnnet}= Create DIctionary
[Return] ${returnnet}
-Get Openstack IP By Name
+Get Openstack IP By Name
[Arguments] ${alias} ${network_name} ${cidr} ${ip}
${ports}= Get Openstack Ports For Subnet ${alias} ${network_name} ${cidr}
Log ${ports}
@@ -115,15 +115,14 @@ Get Openstack Ports For Subnet
Get Openstack Port By Id
[Arguments] ${alias} ${port_id}
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NEUTRON_PORT_PATH}/${port_id}
+ ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${OPENSTACK_NEUTRON_PORT_PATH}/${port_id}
[Return] ${resp}
-
+
Delete Openstack Port
- [Arguments] ${alias} ${port_id}
- ${resp}= Internal Delete Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NEUTRON_PORT_PATH} /${port_id}
+ [Arguments] ${alias} ${port_id}
+ ${resp}= Internal Delete Openstack ${alias} ${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} ${OPENSTACK_NEUTRON_PORT_PATH} /${port_id}
${status_string}= Convert To String ${resp.status_code}
- Should Match Regexp ${status_string} ^(204|200)$
+ Should Match Regexp ${status_string} ^(204|200)$
[Return] ${resp.text}
-
- \ No newline at end of file
+
diff --git a/robot/resources/openstack/nova_interface.robot b/robot/resources/openstack/nova_interface.robot
index efee279a..b36d09f1 100644
--- a/robot/resources/openstack/nova_interface.robot
+++ b/robot/resources/openstack/nova_interface.robot
@@ -3,7 +3,7 @@ Documentation The main interface for interacting with Openstack. It handles
Library OpenstackLibrary
Library RequestsLibrary
Library JSONUtils
-Library UUID
+Library UUID
Library OperatingSystem
Library Collections
Resource ../global_properties.robot
@@ -26,7 +26,7 @@ ${OPENSTACK_NOVA_SERVER_ADD_BODY_FILE} robot/assets/templates/nova_add_server
Get Openstack Keypair
[Documentation] Runs an Openstack Request and returns the keypair info
[Arguments] ${alias} ${keypair_name}
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NOVA_KEYPAIR_PATH} /${keypair_name}
+ ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${OPENSTACK_NOVA_KEYPAIR_PATH} /${keypair_name}
[Return] ${resp.json()}
Add Openstack Keypair
@@ -36,58 +36,58 @@ Add Openstack Keypair
${ssh_key}= OperatingSystem.Get File ${OPENSTACK_NOVA_KEYPAIR_SSH_KEY}
${arguments}= Create Dictionary name=${name} publickey=${ssh_key}
${data}= Fill JSON Template ${data_template} ${arguments}
- ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NOVA_KEYPAIR_PATH} data_path= data=${data}
+ ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${OPENSTACK_NOVA_KEYPAIR_PATH} data_path= data=${data}
Should Be Equal As Strings 200 ${resp.status_code}
[Return] ${resp.json()['keypair']['name']}
Delete Openstack Keypair
[Documentation] Runs an Openstack Request to delete a keypair
[Arguments] ${alias} ${keypair_name}
- ${resp}= Internal Delete Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NOVA_KEYPAIR_PATH} /${keypair_name}
+ ${resp}= Internal Delete Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${OPENSTACK_NOVA_KEYPAIR_PATH} /${keypair_name}
${status_string}= Convert To String ${resp.status_code}
- Should Match Regexp ${status_string} ^(204|202|200)$
+ Should Match Regexp ${status_string} ^(204|202|200)$
[Return] ${resp.text}
Get Openstack Servers
[Documentation] Returns the list of servers as a dictionary by name
[Arguments] ${alias}
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NOVA_SERVERS_PATH} /detail
+ ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${OPENSTACK_NOVA_SERVERS_PATH} /detail
Log Returned from Internal Get Openstack
${by_name}= Make List Into Dict ${resp.json()['servers']} name
Log got it
[Return] ${by_name}
-
+
Get Openstack Server By Id
[Documentation] Returns the openstack stacks info for the given stack name
- [Arguments] ${alias} ${server_id}
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NOVA_SERVERS_PATH} /${server_id}
+ [Arguments] ${alias} ${server_id}
+ ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${OPENSTACK_NOVA_SERVERS_PATH} /${server_id}
[Return] ${resp}
-
+
Get Openstack Flavors
[Documentation] Runs an Openstack Request and returns the flavor list
[Arguments] ${alias}
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NOVA_FLAVORS_PATH}
+ ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${OPENSTACK_NOVA_FLAVORS_PATH}
[Return] ${resp.json()}
Get Openstack Images
[Documentation] Runs an Openstack Request and returns the flavor list
[Arguments] ${alias}
- ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NOVA_IMAGES_PATH}
+ ${resp}= Internal Get Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${OPENSTACK_NOVA_IMAGES_PATH}
[Return] ${resp.json()}
Reboot Server
[Documentation] Requests a reboot of the passed server id
- [Arguments] ${alias} ${server_id}
- ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NOVA_SERVERS_PATH} /${server_id}/action ${OPENSTACK_NOVA_SERVERS_REBOOT_BODY}
+ [Arguments] ${alias} ${server_id}
+ ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${OPENSTACK_NOVA_SERVERS_PATH} /${server_id}/action ${OPENSTACK_NOVA_SERVERS_REBOOT_BODY}
[Return] ${resp}
Add Server
[Documentation] Adds a server for the passed if
[Arguments] ${alias} ${name} ${imageRef} ${flavorRef}
${dict}= Create Dictionary name=${name} imageRef=${imageRef} flavorRef=${flavorRef}
- ${data}= Fill JSON Template File ${OPENSTACK_NOVA_SERVER_ADD_BODY_FILE} ${dict}
- ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NOVA_SERVERS_PATH} data_path= data=${data}
+ ${data}= Fill JSON Template File ${OPENSTACK_NOVA_SERVER_ADD_BODY_FILE} ${dict}
+ ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${OPENSTACK_NOVA_SERVERS_PATH} data_path= data=${data}
[Return] ${resp}
Add Server For Image Name
@@ -100,28 +100,28 @@ Add Server For Image Name
${imageRef}= Get Id For Name ${images} ${imageName}
${flavorRef}= Get Id For Name ${flavors} ${flavorName}
${dict}= Create Dictionary name=${name} imageRef=${imageRef} flavorRef=${flavorRef}
- ${data}= Fill JSON Template File ${OPENSTACK_NOVA_SERVER_ADD_BODY_FILE} ${dict}
- ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NOVA_SERVERS_PATH} data_path= data=${data}
+ ${data}= Fill JSON Template File ${OPENSTACK_NOVA_SERVER_ADD_BODY_FILE} ${dict}
+ ${resp}= Internal Post Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${OPENSTACK_NOVA_SERVERS_PATH} data_path= data=${data}
${status_string}= Convert To String ${resp.status_code}
Should Match Regexp ${status_string} ^(202)$
[Return] ${resp.json()}
Wait for Server to Be Active
[Arguments] ${alias} ${server_id} ${timeout}=300s
- ${server_info}= Wait Until Keyword Succeeds ${timeout} 10 sec Get Active Server ${alias} ${server_id}
+ ${server_info}= Wait Until Keyword Succeeds ${timeout} 10 sec Get Active Server ${alias} ${server_id}
${status}= Get From Dictionary ${server_info} status
Should Be Equal ${status} ACTIVE
[Return] ${server_info}
Get Active Server
- [Arguments] ${alias} ${server_id}
+ [Arguments] ${alias} ${server_id}
${resp}= Get Openstack Server By Id ${alias} ${server_id}
Should Be Equal As Strings ${resp.status_code} 200
- ${server_info}= Set Variable ${resp.json()}
+ ${server_info}= Set Variable ${resp.json()}
${server_info}= Get From Dictionary ${server_info} server
${status}= Get From Dictionary ${server_info} status
Should Not Be Equal ${status} BUILD
- [Return] ${server_info}
+ [Return] ${server_info}
Wait for Server to Be Deleted
[Arguments] ${alias} ${server_id}
@@ -135,15 +135,15 @@ Get Deleted Server
Delete Server
[Documentation] Runs an Openstack Request to delete a keypair
[Arguments] ${alias} ${server_id}
- ${resp}= Internal Delete Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${GLOBAL_OPENSTACK_SERVICE_REGION} ${OPENSTACK_NOVA_SERVERS_PATH} /${server_id}
+ ${resp}= Internal Delete Openstack ${alias} ${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} ${OPENSTACK_NOVA_SERVERS_PATH} /${server_id}
${status_string}= Convert To String ${resp.status_code}
- Should Match Regexp ${status_string} ^(204)$
+ Should Match Regexp ${status_string} ^(204)$
[Return] ${resp.text}
Get Id For Name
[Arguments] ${list} ${name}
:for ${item} in @{list}
- \ ${id}= Get From Dictionary ${item} id
+ \ ${id}= Get From Dictionary ${item} id
\ ${n}= Get From Dictionary ${item} name
- \ Return from Keyword If '${n}' == '${name}' ${id}
- [Return] None
+ \ Return from Keyword If '${n}' == '${name}' ${id}
+ [Return] None
diff --git a/robot/resources/openstack/openstack_common.robot b/robot/resources/openstack/openstack_common.robot
index 6a53ab63..ef370c66 100644
--- a/robot/resources/openstack/openstack_common.robot
+++ b/robot/resources/openstack/openstack_common.robot
@@ -1,34 +1,47 @@
*** Settings ***
Documentation The private interface for interacting with Openstack. It handles low level stuff like managing the authtoken and Openstack required fields
+Library Collections
Library OpenstackLibrary
Library RequestsLibrary
-Library UUID
+Library UUID
Resource ../global_properties.robot
+*** Variables ***
+#**************** Test Case Variables ******************
+${OPENSTACK_SERVICE_REGION}
+
*** Keywords ***
Internal Get Openstack
[Documentation] Runs an Openstack Get Request and returns the response
- [Arguments] ${alias} ${service_type} ${region} ${url_ext} ${data_path}=
+ [Arguments] ${alias} ${service_type} ${url_ext} ${data_path}=
+ ${region}= Get Openstack Region
+ ${resp}= Internal Get Openstack With Region ${alias} ${service_type} ${region} ${url_ext} ${data_path}
+ [Return] ${resp}
+
+Internal Get Openstack With Region
+ [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
+ ${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}
+ 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}=
+ [Arguments] ${alias} ${service_type} ${url_ext} ${data_path}= ${data}=
+ ${region}= Get Openstack Region
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
+ ${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}
@@ -37,7 +50,8 @@ Internal Post Openstack
Internal Delete Openstack
[Documentation] Runs an Openstack Delete Request and returns the response
- [Arguments] ${alias} ${service_type} ${region} ${url_ext} ${data_path}=
+ [Arguments] ${alias} ${service_type} ${url_ext} ${data_path}=
+ ${region}= Get Openstack Region
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
@@ -47,4 +61,20 @@ Internal Delete Openstack
${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
+ [Return] ${resp}
+
+Get Openstack Region
+ [Documentation] Returns the current openstack region test variable
+ ... Defaults to the openstack region of the Robot VM
+ Return From Keyword If len('${OPENSTACK_SERVICE_REGION}') > 0 ${OPENSTACK_SERVICE_REGION}
+ Dictionary Should Contain Key ${GLOBAL_VM_PROPERTIES} region
+ Set Test Variable ${OPENSTACK_SERVICE_REGION} ${GLOBAL_VM_PROPERTIES['region']}
+ Log Setting OPENSTACK_SERVICE_REGION=${OPENSTACK_SERVICE_REGION}
+ [Return] ${OPENSTACK_SERVICE_REGION}
+
+Set Openstack Region Test Variable
+ [Documentation] Sets the openstack service region of the current test case
+ ... To be used to override the service region of the Robot VM (default)
+ [Arguments] ${openstack_service_region}
+ Set Test Variable ${OPENSTACK_SERVICE_REGION} ${openstack_service_region}
+