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 |
| 4 | |
| 5 | Resource global_properties.robot |
| 6 | |
| 7 | *** Variables *** |
| 8 | ${NBI_HEALTH_CHECK_PATH} /nbi/api/v1/status |
| 9 | ${NBI_ENDPOINT} ${GLOBAL_NBI_SERVER_PROTOCOL}://${GLOBAL_INJECTED_NBI_IP_ADDR}:${GLOBAL_NBI_SERVER_PORT} |
| 10 | |
| 11 | |
| 12 | *** Keywords *** |
| 13 | Run 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 | |
| 18 | Run 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} |