blob: 434518097e3b88a1c83a851361366352379d3112 [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001*** Settings ***
2Documentation The main interface for interacting with A&AI. It handles low level stuff like managing the http request library and A&AI required fields
3Library RequestsLibrary
4Library UUID
5Resource ../global_properties.robot
6
7*** Variables ***
8${AAI_HEALTH_PATH} /aai/util/echo?action=long
9
10*** Keywords ***
11Run A&AI Health Check
12 [Documentation] Runs an A&AI health check
13 ${resp}= Run A&AI Get Request ${AAI_HEALTH_PATH}
14 Should Be Equal As Strings ${resp.status_code} 200
15
16Run A&AI Get Request
17 [Documentation] Runs an A&AI get request
18 [Arguments] ${data_path}
19 ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD}
20 ${session}= Create Session aai ${GLOBAL_AAI_SERVER_URL} auth=${auth}
21 ${uuid}= Generate UUID
22 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
23 ${resp}= Get Request aai ${data_path} headers=${headers}
24 Log Received response from aai ${resp.text}
25 [Return] ${resp}
26
27Run A&AI Put Request
28 [Documentation] Runs an A&AI put request
29 [Arguments] ${data_path} ${data}
30 ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD}
31 ${session}= Create Session aai ${GLOBAL_AAI_SERVER_URL} auth=${auth}
32 ${uuid}= Generate UUID
33 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
34 ${resp}= Put Request aai ${data_path} data=${data} headers=${headers}
35 Log Received response from aai ${resp.text}
36 [Return] ${resp}
37
38Run A&AI Post Request
39 [Documentation] Runs an A&AI Post request
40 [Arguments] ${data_path} ${data}
41 ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD}
42 ${session}= Create Session aai ${GLOBAL_AAI_SERVER_URL} auth=${auth}
43 ${uuid}= Generate UUID
44 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
45 ${resp}= Post Request aai ${data_path} data=${data} headers=${headers}
46 Log Received response from aai ${resp.text}
47 [Return] ${resp}
48
49Run A&AI Delete Request
50 [Documentation] Runs an A&AI delete request
51 [Arguments] ${data_path} ${resource_version}
52 ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD}
53 ${session}= Create Session aai ${GLOBAL_AAI_SERVER_URL} auth=${auth}
54 ${uuid}= Generate UUID
55 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
56 ${resp}= Delete Request aai ${data_path}?resource-version=${resource_version} headers=${headers}
57 Log Received response from aai ${resp.text}
58 [Return] ${resp}