blob: 9d5313ded2c11514fb33ab6168c060e14f5f3969 [file] [log] [blame]
mrichomme547e3112018-04-13 16:44:04 +02001*** Settings ***
2Documentation The main interface for interacting with External API/NBI
3Library RequestsLibrary
4
5Resource global_properties.robot
6
7*** Variables ***
Matthieu Geerebaert01725a82018-09-05 17:19:12 +02008${NBI_HEALTH_CHECK_PATH} /nbi/api/v3/status
mrichomme547e3112018-04-13 16:44:04 +02009${NBI_ENDPOINT} ${GLOBAL_NBI_SERVER_PROTOCOL}://${GLOBAL_INJECTED_NBI_IP_ADDR}:${GLOBAL_NBI_SERVER_PORT}
10
11
12*** Keywords ***
13Run NBI Health Check
14 [Documentation] Runs NBI Health check
15 ${resp}= Run NBI Get Request ${NBI_HEALTH_CHECK_PATH}
16 Should Be Equal As Integers ${resp.status_code} 200
17
18Run NBI Get Request
19 [Documentation] Runs NBI Get request
20 [Arguments] ${data_path}
21 ${session}= Create Session session ${NBI_ENDPOINT}
22 ${resp}= Get Request session ${data_path}
23 Should Be Equal As Integers ${resp.status_code} 200
24 Log Received response from NBI ${resp.text}
25 ${json}= Set Variable ${resp.json()}
26 ${status}= Get From Dictionary ${json} status
27 Should Be Equal ${status} ok
28 [Return] ${resp}