DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation The main interface for interacting with A&AI. It handles low level stuff like managing the http request library and A&AI required fields |
| 3 | Library RequestsLibrary |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame] | 4 | Library UUID |
| 5 | Library HTTPUtils |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 6 | Resource ../global_properties.robot |
| 7 | |
| 8 | *** Variables *** |
| 9 | ${AAI_HEALTH_PATH} /aai/util/echo?action=long |
Jerry Flood | 8a6b0b5 | 2017-11-12 15:44:21 -0500 | [diff] [blame] | 10 | ${VERSIONED_INDEX_PATH} /aai/v11 |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 11 | ${AAI_FRONTEND_ENDPOINT} ${GLOBAL_AAI_SERVER_PROTOCOL}://${GLOBAL_INJECTED_AAI1_IP_ADDR}:${GLOBAL_AAI_SERVER_PORT} |
| 12 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 13 | |
| 14 | *** Keywords *** |
| 15 | Run A&AI Health Check |
| 16 | [Documentation] Runs an A&AI health check |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame] | 17 | ${resp}= Run A&AI Get Request ${AAI_HEALTH_PATH} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 18 | Should Be Equal As Strings ${resp.status_code} 200 |
| 19 | |
| 20 | Run A&AI Get Request |
| 21 | [Documentation] Runs an A&AI get request |
| 22 | [Arguments] ${data_path} |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame] | 23 | Disable Warnings |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 24 | ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD} |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 25 | ${session}= Create Session aai ${AAI_FRONTEND_ENDPOINT} auth=${auth} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 26 | ${uuid}= Generate UUID |
| 27 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 28 | ${resp}= Get Request aai ${data_path} headers=${headers} |
| 29 | Log Received response from aai ${resp.text} |
| 30 | [Return] ${resp} |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame] | 31 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 32 | Run A&AI Put Request |
| 33 | [Documentation] Runs an A&AI put request |
| 34 | [Arguments] ${data_path} ${data} |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame] | 35 | Disable Warnings |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 36 | ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD} |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 37 | ${session}= Create Session aai ${AAI_FRONTEND_ENDPOINT} auth=${auth} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 38 | ${uuid}= Generate UUID |
| 39 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 40 | ${resp}= Put Request aai ${data_path} data=${data} headers=${headers} |
| 41 | Log Received response from aai ${resp.text} |
| 42 | [Return] ${resp} |
| 43 | |
| 44 | Run A&AI Post Request |
| 45 | [Documentation] Runs an A&AI Post request |
| 46 | [Arguments] ${data_path} ${data} |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame] | 47 | Disable Warnings |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 48 | ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD} |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 49 | ${session}= Create Session aai ${AAI_FRONTEND_ENDPOINT} auth=${auth} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 50 | ${uuid}= Generate UUID |
| 51 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 52 | ${resp}= Post Request aai ${data_path} data=${data} headers=${headers} |
| 53 | Log Received response from aai ${resp.text} |
| 54 | [Return] ${resp} |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame] | 55 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 56 | Run A&AI Delete Request |
| 57 | [Documentation] Runs an A&AI delete request |
| 58 | [Arguments] ${data_path} ${resource_version} |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame] | 59 | Disable Warnings |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 60 | ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD} |
DR695H | bf5a3a3 | 2017-06-30 13:09:57 -0400 | [diff] [blame] | 61 | ${session}= Create Session aai ${AAI_FRONTEND_ENDPOINT} auth=${auth} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 62 | ${uuid}= Generate UUID |
| 63 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 64 | ${resp}= Delete Request aai ${data_path}?resource-version=${resource_version} headers=${headers} |
| 65 | Log Received response from aai ${resp.text} |
jf9860 | 0f7f265 | 2017-02-22 14:44:06 -0500 | [diff] [blame] | 66 | [Return] ${resp} |
| 67 | |
| 68 | Delete A&AI Entity |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame] | 69 | [Documentation] Deletes an entity in A&AI |
jf9860 | 0f7f265 | 2017-02-22 14:44:06 -0500 | [diff] [blame] | 70 | [Arguments] ${uri} |
Keong Lim | 3a5d947 | 2019-03-04 17:15:06 +1100 | [diff] [blame] | 71 | ${get_resp}= Run A&AI Get Request ${VERSIONED_INDEX_PATH}${uri} |
jf9860 | 0f7f265 | 2017-02-22 14:44:06 -0500 | [diff] [blame] | 72 | Run Keyword If '${get_resp.status_code}' == '200' Delete A&AI Entity Exists ${uri} ${get_resp.json()['resource-version']} |
| 73 | |
| 74 | Delete A&AI Entity Exists |
| 75 | [Documentation] Deletes an A&AI entity |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame] | 76 | [Arguments] ${uri} ${resource_version_id} |
Keong Lim | 3a5d947 | 2019-03-04 17:15:06 +1100 | [diff] [blame] | 77 | ${put_resp}= Run A&AI Delete Request ${VERSIONED_INDEX_PATH}${uri} ${resource_version_id} |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame] | 78 | Should Be Equal As Strings ${put_resp.status_code} 204 |
jf9860 | 0f7f265 | 2017-02-22 14:44:06 -0500 | [diff] [blame] | 79 | |