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 |
jf9860 | 0f7f265 | 2017-02-22 14:44:06 -0500 | [diff] [blame] | 10 | ${VERSIONED_INDEX_PATH} /aai/v8 |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 11 | |
| 12 | *** Keywords *** |
| 13 | Run A&AI Health Check |
| 14 | [Documentation] Runs an A&AI health check |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame^] | 15 | ${resp}= Run A&AI Get Request ${AAI_HEALTH_PATH} |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 16 | Should Be Equal As Strings ${resp.status_code} 200 |
| 17 | |
| 18 | Run A&AI Get Request |
| 19 | [Documentation] Runs an A&AI get request |
| 20 | [Arguments] ${data_path} |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame^] | 21 | Disable Warnings |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 22 | ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD} |
| 23 | ${session}= Create Session aai ${GLOBAL_AAI_SERVER_URL} auth=${auth} |
| 24 | ${uuid}= Generate UUID |
| 25 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 26 | ${resp}= Get Request aai ${data_path} headers=${headers} |
| 27 | Log Received response from aai ${resp.text} |
| 28 | [Return] ${resp} |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame^] | 29 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 30 | Run A&AI Put Request |
| 31 | [Documentation] Runs an A&AI put request |
| 32 | [Arguments] ${data_path} ${data} |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame^] | 33 | Disable Warnings |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 34 | ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD} |
| 35 | ${session}= Create Session aai ${GLOBAL_AAI_SERVER_URL} auth=${auth} |
| 36 | ${uuid}= Generate UUID |
| 37 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 38 | ${resp}= Put Request aai ${data_path} data=${data} headers=${headers} |
| 39 | Log Received response from aai ${resp.text} |
| 40 | [Return] ${resp} |
| 41 | |
| 42 | Run A&AI Post Request |
| 43 | [Documentation] Runs an A&AI Post request |
| 44 | [Arguments] ${data_path} ${data} |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame^] | 45 | Disable Warnings |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 46 | ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD} |
| 47 | ${session}= Create Session aai ${GLOBAL_AAI_SERVER_URL} auth=${auth} |
| 48 | ${uuid}= Generate UUID |
| 49 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 50 | ${resp}= Post Request aai ${data_path} data=${data} headers=${headers} |
| 51 | Log Received response from aai ${resp.text} |
| 52 | [Return] ${resp} |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame^] | 53 | |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 54 | Run A&AI Delete Request |
| 55 | [Documentation] Runs an A&AI delete request |
| 56 | [Arguments] ${data_path} ${resource_version} |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame^] | 57 | Disable Warnings |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 58 | ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD} |
| 59 | ${session}= Create Session aai ${GLOBAL_AAI_SERVER_URL} auth=${auth} |
| 60 | ${uuid}= Generate UUID |
| 61 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 62 | ${resp}= Delete Request aai ${data_path}?resource-version=${resource_version} headers=${headers} |
| 63 | Log Received response from aai ${resp.text} |
jf9860 | 0f7f265 | 2017-02-22 14:44:06 -0500 | [diff] [blame] | 64 | [Return] ${resp} |
| 65 | |
| 66 | Delete A&AI Entity |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame^] | 67 | [Documentation] Deletes an entity in A&AI |
jf9860 | 0f7f265 | 2017-02-22 14:44:06 -0500 | [diff] [blame] | 68 | [Arguments] ${uri} |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame^] | 69 | ${get_resp}= Run A&AI Get Request ${VERSIONED_INDEX PATH}${uri} |
jf9860 | 0f7f265 | 2017-02-22 14:44:06 -0500 | [diff] [blame] | 70 | Run Keyword If '${get_resp.status_code}' == '200' Delete A&AI Entity Exists ${uri} ${get_resp.json()['resource-version']} |
| 71 | |
| 72 | Delete A&AI Entity Exists |
| 73 | [Documentation] Deletes an A&AI entity |
Jerry Flood | fe22bf1 | 2017-04-21 16:53:10 -0400 | [diff] [blame^] | 74 | [Arguments] ${uri} ${resource_version_id} |
jf9860 | 0f7f265 | 2017-02-22 14:44:06 -0500 | [diff] [blame] | 75 | ${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^] | 76 | Should Be Equal As Strings ${put_resp.status_code} 204 |
jf9860 | 0f7f265 | 2017-02-22 14:44:06 -0500 | [diff] [blame] | 77 | |