summaryrefslogtreecommitdiffstats
path: root/robot/resources/nbi_interface.robot
diff options
context:
space:
mode:
authormrichomme <morgan.richomme@orange.com>2018-04-13 16:44:04 +0200
committermrichomme <morgan.richomme@orange.com>2018-04-13 17:06:21 +0200
commit547e311ef5fc4e20d12160af390e84696de6f613 (patch)
treeb3d061c1ae45a4bf124e33b93593b2ef4f8e9bbb /robot/resources/nbi_interface.robot
parentce07d413432206b550c7df2df30f5b3d57ac2c7a (diff)
Add External API/NBI Robot healthcheck tests
Issue-ID: INT-465 Change-Id: Idd8e13864525d094a01c7a51098bce80720a032d Signed-off-by: mrichomme <morgan.richomme@orange.com>
Diffstat (limited to 'robot/resources/nbi_interface.robot')
-rw-r--r--robot/resources/nbi_interface.robot28
1 files changed, 28 insertions, 0 deletions
diff --git a/robot/resources/nbi_interface.robot b/robot/resources/nbi_interface.robot
new file mode 100644
index 00000000..076ecd20
--- /dev/null
+++ b/robot/resources/nbi_interface.robot
@@ -0,0 +1,28 @@
+*** Settings ***
+Documentation The main interface for interacting with External API/NBI
+Library RequestsLibrary
+
+Resource global_properties.robot
+
+*** Variables ***
+${NBI_HEALTH_CHECK_PATH} /nbi/api/v1/status
+${NBI_ENDPOINT} ${GLOBAL_NBI_SERVER_PROTOCOL}://${GLOBAL_INJECTED_NBI_IP_ADDR}:${GLOBAL_NBI_SERVER_PORT}
+
+
+*** Keywords ***
+Run NBI Health Check
+ [Documentation] Runs NBI Health check
+ ${resp}= Run NBI Get Request ${NBI_HEALTH_CHECK_PATH}
+ Should Be Equal As Integers ${resp.status_code} 200
+
+Run NBI Get Request
+ [Documentation] Runs NBI Get request
+ [Arguments] ${data_path}
+ ${session}= Create Session session ${NBI_ENDPOINT}
+ ${resp}= Get Request session ${data_path}
+ Should Be Equal As Integers ${resp.status_code} 200
+ Log Received response from NBI ${resp.text}
+ ${json}= Set Variable ${resp.json()}
+ ${status}= Get From Dictionary ${json} status
+ Should Be Equal ${status} ok
+ [Return] ${resp}