Add External API/NBI Robot healthcheck tests
Issue-ID: INT-465
Change-Id: Idd8e13864525d094a01c7a51098bce80720a032d
Signed-off-by: mrichomme <morgan.richomme@orange.com>
diff --git a/robot/resources/nbi_interface.robot b/robot/resources/nbi_interface.robot
new file mode 100644
index 0000000..076ecd2
--- /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}
diff --git a/robot/testsuites/health-check.robot b/robot/testsuites/health-check.robot
index 2091b59..eefbd49 100644
--- a/robot/testsuites/health-check.robot
+++ b/robot/testsuites/health-check.robot
@@ -1,8 +1,8 @@
*** Settings ***
Test Timeout 1 minute
-Documentation Testing ecomp components are available via calls.
+Documentation Testing ecomp components are available via calls.
...
-... Testing ecomp components are available via calls.
+... Testing ecomp components are available via calls.
Resource ../resources/dcae_interface.robot
Resource ../resources/sdngc_interface.robot
@@ -19,6 +19,7 @@
Resource ../resources/clamp_interface.robot
Resource ../resources/music/music_interface.robot
Resource ../resources/test_templates/model_test_template.robot
+Resource ../resources/nbi_interface.robot
*** Test Cases ***
@@ -104,7 +105,7 @@
Basic VFC jujuvnfmdriver API Health Check
[Tags] health 3rdparty
- Run MSB Get Request /api/jujuvnfmdriver/v1/swagger.json
+ Run MSB Get Request /api/jujuvnfmdriver/v1/swagger.json
Basic VFC multivimproxy API Health Check
[Tags] health 3rdparty
@@ -165,9 +166,13 @@
Portal Login Tests
[Tags] healthlogin
- Run Portal Login Tests
+ Run Portal Login Tests
Portal Application Access Tests
[Tags] healthportalapp
[Timeout] 180
Run Portal Application Access Tests
+
+Basic NBI Health Check
+ [Tags] externalapi
+ Run NBI Health Check