Add initial codes
[it/test.git] / ric_robot_suite / robot / resources / rtmgr / rtmgr_interface.robot
1 *** Settings ***
2 Documentation     The main interface for interacting with Routing Manager (RtMgr) . It handles low level stuff like managing the http request library and RtMgr required fields
3
4 Library           RequestsLibrary
5 Library           UUID
6
7 Resource          ../global_properties.robot
8 Resource          ../json_templater.robot
9
10 *** Variables ***
11 ${RTMGR_BASE_PATH}        /v1
12 ${RTMGR_ENDPOINT}     ${GLOBAL_RTMGR_SERVER_PROTOCOL}://${GLOBAL_INJECTED_RTMGR_IP_ADDR}:${GLOBAL_RTMGR_SERVER_PORT}
13
14
15 *** Keywords ***
16 Run RtMgr Health Check
17      [Documentation]    Runs RtMgr Health check
18      ${data_path}=    Set Variable    ${RTMGR_BASE_PATH}/health
19      ${resp}=    Run Keyword    Run RtMgr Get Request    ${data_path}
20
21
22 Run RtMgr Get Request
23      [Documentation]    Runs RtMgr Get request
24      [Arguments]    ${data_path}
25      ${auth}=  Create List  ${GLOBAL_INJECTED_RTMGR_USER}    ${GLOBAL_INJECTED_RTMGR_PASSWORD}
26      ${session}=    Create Session      rtmgr      ${RTMGR_ENDPOINT}   auth=${auth}
27      ${uuid}=    Generate UUID
28      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    
29      ${resp}=   Get Request     rtmgr    ${data_path}     headers=${headers}
30      Log    Received response from RtMgr ${resp.text}
31      Should Be Equal As Strings        ${resp.status_code}     200
32      [Return]    ${resp}