summaryrefslogtreecommitdiffstats
path: root/robot/resources/openstack/neutron_interface.robot
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/neutron_interface.robot
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/neutron_interface.robot')
-rw-r--r--robot/resources/openstack/neutron_interface.robot49
1 files changed, 24 insertions, 25 deletions
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
+