aboutsummaryrefslogtreecommitdiffstats
path: root/tests/so/orchestration/resources/aai/aai_interface.robot
diff options
context:
space:
mode:
authorMnushkin, Dmitry (dm4252) <dm4252@att.com>2019-09-06 15:03:01 -0500
committerMnushkin, Dmitry (dm4252) <dm4252@att.com>2019-09-06 15:03:01 -0500
commit6f09e1be817c52ce3685f94a938ee3180525aad9 (patch)
treec39529bca5093bf21a2386776244cd9fc09247c5 /tests/so/orchestration/resources/aai/aai_interface.robot
parent8e8379fc709b077fcb2ab3035dd22e2a2a46ed53 (diff)
Add orchestration project to SO integration testing repository
Add orchestration project containing robot setup for testing Create and Delete Service Instance that will utilize requests directed to simulator (SIM) Container and AAI image Issue-ID: SO-2264 Signed-off-by: Mnushkin, Dmitry (dm4252) <dm4252@att.com>;;; Change-Id: Iac4ac97fcbe5e73712486547d4a5046387751e5b
Diffstat (limited to 'tests/so/orchestration/resources/aai/aai_interface.robot')
-rw-r--r--tests/so/orchestration/resources/aai/aai_interface.robot91
1 files changed, 91 insertions, 0 deletions
diff --git a/tests/so/orchestration/resources/aai/aai_interface.robot b/tests/so/orchestration/resources/aai/aai_interface.robot
new file mode 100644
index 00000000..67e828d2
--- /dev/null
+++ b/tests/so/orchestration/resources/aai/aai_interface.robot
@@ -0,0 +1,91 @@
+*** Settings ***
+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
+Library RequestsLibrary
+Library UUID
+Library HTTPUtils
+Resource ../global_properties.robot
+
+*** Variables ***
+${AAI_HEALTH_PATH} /aai/util/echo?action=long
+${VERSIONED_INDEX_PATH} /aai/v14
+${AAI_FRONTEND_ENDPOINT} ${GLOBAL_AAI_SERVER_PROTOCOL}://${GLOBAL_INJECTED_AAI1_IP_ADDR}:${GLOBAL_AAI_SERVER_PORT}
+
+*** Keywords ***
+Run A&AI Health Check
+ [Documentation] Runs an A&AI health check
+ :FOR ${i} IN RANGE 20
+ \ ${resp}= Run A&AI Get Request ${AAI_HEALTH_PATH}
+ \ Log Received response from so ${resp.json()}
+ \ Log Received response from so status ${resp.status_code}
+ \ ${exit_loop}= Evaluate ${resp.status_code} == 200
+ \ Exit For Loop If ${exit_loop}
+ \ Sleep 15s
+
+Run A&AI Get Request
+ [Documentation] Runs an A&AI get request
+ [Arguments] ${data_path}
+ Disable Warnings
+ Create Session aai ${AAI_FRONTEND_ENDPOINT}
+ ${uuid}= Generate UUID
+ ${headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Accept=application/json Content-Type=application/json X-TransactionId=Test X-FromAppId=SO
+ ${resp}= Get Request aai ${data_path} headers=${headers}
+ Log Received response from aai ${resp.text}
+ [Return] ${resp}
+
+Run A&AI Put Request
+ [Documentation] Runs an A&AI put request
+ [Arguments] ${data_path} ${data}
+ Disable Warnings
+ Create Session aai ${AAI_FRONTEND_ENDPOINT}
+ ${uuid}= Generate UUID
+ ${headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Accept=application/json Content-Type=application/json X-TransactionId=Test X-FromAppId=SO
+ ${resp}= Put Request aai ${data_path} data=${data} headers=${headers}
+ Log Received response from aai ${resp.text}
+ [Return] ${resp}
+
+Run A&AI Post Request
+ [Documentation] Runs an A&AI Post request
+ [Arguments] ${data_path} ${data}
+ Disable Warnings
+ Create Session aai ${AAI_FRONTEND_ENDPOINT}
+ ${uuid}= Generate UUID
+ ${headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
+ ${resp}= Post Request aai ${data_path} data=${data} headers=${headers}
+ Log Received response from aai ${resp.text}
+ [Return] ${resp}
+
+Run A&AI Patch Request
+ [Documentation] Runs an A&AI Post request
+ [Arguments] ${data_path} ${data}
+ Disable Warnings
+ Log ${data}
+ Create Session aai ${AAI_FRONTEND_ENDPOINT}
+ ${uuid}= Generate UUID
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/merge-patch+json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} X-HTTP-Method-Override=PATCH
+ ${resp}= Post Request aai ${data_path} data=${data} headers=${headers}
+ Log Received response from aai ${resp.text}
+ [Return] ${resp}
+
+Run A&AI Delete Request
+ [Documentation] Runs an A&AI delete request
+ [Arguments] ${data_path} ${resource_version}
+ Disable Warnings
+ Create Session aai ${AAI_FRONTEND_ENDPOINT}
+ ${uuid}= Generate UUID
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
+ ${resp}= Delete Request aai ${data_path}?resource-version=${resource_version} headers=${headers}
+ Log Received response from aai ${resp.text}
+ [Return] ${resp}
+
+Delete A&AI Entity
+ [Documentation] Deletes an entity in A&AI
+ [Arguments] ${uri}
+ ${get_resp}= Run A&AI Get Request ${VERSIONED_INDEX PATH}${uri}
+ Run Keyword If '${get_resp.status_code}' == '200' Delete A&AI Entity Exists ${uri} ${get_resp.json()['resource-version']}
+
+Delete A&AI Entity Exists
+ [Documentation] Deletes an A&AI entity
+ [Arguments] ${uri} ${resource_version_id}
+ ${put_resp}= Run A&AI Delete Request ${VERSIONED_INDEX PATH}${uri} ${resource_version_id}
+ Should Be Equal As Strings ${put_resp.status_code} 204
+