Brian Freeman | adaa237 | 2018-10-24 12:25:22 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Create Cloud Config |
| 3 | |
| 4 | Resource ../json_templater.robot |
| 5 | Resource ../so_interface.robot |
| 6 | Library OperatingSystem |
| 7 | Library Collections |
| 8 | |
| 9 | |
| 10 | *** Variables *** |
| 11 | ${CLOUD_CONFIG_PATH} /cloudSite |
| 12 | |
| 13 | ${SYSTEM USER} robot-ete |
| 14 | ${SO_ADD_CLOUD_CONFIG}= robot/assets/templates/so/create_cloud_config.template |
| 15 | |
| 16 | *** Keywords *** |
| 17 | Create Cloud Configuration |
| 18 | [Documentation] Creates a cloud configuration in SO, so it knows how to talk to an openstack cloud |
| 19 | [Arguments] ${site_name} ${region_id} ${clli} ${identity_id} ${identity_url} ${mso_id} ${mso_pass} ${admin_tenant} ${member_role} ${identity_server_type} ${authentication_type} |
| 20 | ${arguments}= Create Dictionary site_name=${site_name} region_id=${region_id} clli=${clli} identity_id=${identity_id} identity_url=${identity_url} mso_id=${mso_id} mso_pass=${mso_pass} admin_tenant=${admin_tenant} member_role=${member_role} identity_server_type=${identity_server_type} authentication_type=${authentication_type} |
| 21 | ${data}= Fill JSON Template File ${SO_ADD_CLOUD_CONFIG} ${arguments} |
| 22 | ${get_resp}= Run SO Catalog Post request ${CLOUD_CONFIG_PATH}/${site_name} ${data} |
| 23 | |
| 24 | ${get_resp}= Run Keyword If '${get_resp.status_code}'=='404' Update Cloud Configuration ${site_name} ${region_id} ${clli} ${identity_id} ${identity_url} ${mso_id} ${mso_pass} ${admin_tenant} ${member_role} ${identity_server_type} ${authentication_type} |
| 25 | Should Be Equal As Strings ${get_resp.status_code} 200 |
| 26 | |
| 27 | Update Cloud Configuration |
| 28 | [Documentation] Updates a cloud configuration in SO |
| 29 | [Arguments] ${site_name} ${region_id} ${clli} ${identity_id} ${identity_url} ${mso_id} ${mso_pass} ${admin_tenant} ${member_role} ${identity_server_type} ${authentication_type} |
| 30 | ${arguments}= Create Dictionary site_name=${site_name} region_id=${region_id} clli=${clli} identity_id=${identity_id} identity_url=${identity_url} mso_id=${mso_id} mso_pass=${mso_pass} admin_tenant=${admin_tenant} member_role=${member_role} identity_server_type=${identity_server_type} authentication_type=${authentication_type} |
| 31 | ${data}= Fill JSON Template File ${SO_ADD_CLOUD_CONFIG} ${arguments} |
| 32 | ${get_resp}= Run SO Catalog Put request ${CLOUD_CONFIG_PATH}/${site_name} ${data} |
| 33 | Should Be Equal As Strings ${get_resp.status_code} 200 |
| 34 | [Return] ${get_resp} |
| 35 | |
| 36 | Get Cloud Configuration |
| 37 | [Documentation] Gets cloud configuration in SO |
| 38 | [Arguments] ${site_name} |
| 39 | ${get_resp}= Run MSO Catalog Get request ${CLOUD_CONFIG_PATH}/${site_name} |
| 40 | Should Be Equal As Strings ${get_resp.status_code} 200 |
| 41 | |
| 42 | |