diff options
author | DR695H <dr695h@att.com> | 2017-02-17 18:44:24 -0500 |
---|---|---|
committer | DR695H <dr695h@att.com> | 2017-02-17 18:44:41 -0500 |
commit | ccff30b6e325f359879595998e83bbfe6624c851 (patch) | |
tree | c98f950f33baa71d21b091b6b10ca3ffb7700467 /robot/resources/openstack/cinder_interface.robot | |
parent | 234c2226d8cb3368a7af3d280a5ec280782bed63 (diff) |
Initial checkin of EopenECOMP testsuite
Change-Id: I64a2b6d8cf66169829866b73b3d26a4ff59b0a42
Signed-off-by: DR695H <dr695h@att.com>
Diffstat (limited to 'robot/resources/openstack/cinder_interface.robot')
-rw-r--r-- | robot/resources/openstack/cinder_interface.robot | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/robot/resources/openstack/cinder_interface.robot b/robot/resources/openstack/cinder_interface.robot new file mode 100644 index 00000000..ee1a253b --- /dev/null +++ b/robot/resources/openstack/cinder_interface.robot @@ -0,0 +1,50 @@ +*** Settings *** +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 OperatingSystem +Resource ../global_properties.robot +Resource ../json_templater.robot +Resource openstack_common.robot + + +*** Variables *** +${OPENSTACK_CINDER_API_VERSION} /v1 +${OPENSTACK_CINDER_TYPES_PATH} /types +${OPENSTACK_CINDER_VOLUMES_PATH} /volumes +${OPENSTACK_CINDER_VOLUMES_ADD_BODY_FILE} robot/assets/templates/cinder_add_volume.template +${OPENSTACK_CINDER_VOLUMES_TYPE} SSD +${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} + [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} + [Return] ${resp.json()} + +Add Openstack Volume + [Documentation] Runs an Openstack Request to add a volume and returns that volume id of the created volume + [Arguments] ${alias} ${name} ${size} + ${data_template}= OperatingSystem.Get File ${OPENSTACK_CINDER_VOLUMES_ADD_BODY_FILE} + ${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} + 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} + ${status_string}= Convert To String ${resp.status_code} + Should Match Regexp ${status_string} ^(204|200|404)$ + [Return] ${resp.text}
\ No newline at end of file |