mrichomme | 547e311 | 2018-04-13 16:44:04 +0200 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation The main interface for interacting with External API/NBI |
| 3 | Library RequestsLibrary |
DR695H | 910097e | 2019-05-08 13:55:32 -0400 | [diff] [blame] | 4 | Library Collections |
mrichomme | 547e311 | 2018-04-13 16:44:04 +0200 | [diff] [blame] | 5 | |
| 6 | Resource global_properties.robot |
| 7 | |
| 8 | *** Variables *** |
mrichomme | 45fc539 | 2019-05-14 09:45:12 +0200 | [diff] [blame] | 9 | ${NBI_HEALTH_CHECK_PATH} /nbi/api/v4/status |
mrichomme | 547e311 | 2018-04-13 16:44:04 +0200 | [diff] [blame] | 10 | ${NBI_ENDPOINT} ${GLOBAL_NBI_SERVER_PROTOCOL}://${GLOBAL_INJECTED_NBI_IP_ADDR}:${GLOBAL_NBI_SERVER_PORT} |
| 11 | |
| 12 | |
| 13 | *** Keywords *** |
| 14 | Run NBI Health Check |
| 15 | [Documentation] Runs NBI Health check |
| 16 | ${resp}= Run NBI Get Request ${NBI_HEALTH_CHECK_PATH} |
| 17 | Should Be Equal As Integers ${resp.status_code} 200 |
| 18 | |
| 19 | Run NBI Get Request |
| 20 | [Documentation] Runs NBI Get request |
| 21 | [Arguments] ${data_path} |
| 22 | ${session}= Create Session session ${NBI_ENDPOINT} |
| 23 | ${resp}= Get Request session ${data_path} |
| 24 | Should Be Equal As Integers ${resp.status_code} 200 |
| 25 | Log Received response from NBI ${resp.text} |
| 26 | ${json}= Set Variable ${resp.json()} |
| 27 | ${status}= Get From Dictionary ${json} status |
| 28 | Should Be Equal ${status} ok |
| 29 | [Return] ${resp} |