Issue-ID: RIC-149
[it/test.git] / ric_robot_suite / helm / nanobot / configmap-src / public / resources / 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
5 Library        String
6 Library        Collections
7 Library        XML
8 Library        RequestsLibrary
9 Library        UUID
10 Library        Process
11 Library        OperatingSystem
12
13
14
15 Resource          /robot/resources/global_properties.robot
16 Resource          /robot/resources/json_templater.robot
17 Resource          /robot/resources/ric/ric_utils.robot
18
19 Library           KubernetesEntity  ${GLOBAL_RICPLT_NAMESPACE}
20
21 *** Variables ***
22 ${RTMGR_BASE_PATH}    /ric/v1/health/alive
23
24
25
26
27 *** Keywords ***
28 Run RtMgr Health Check
29      [Documentation]    Runs RtMgr Health check
30      ${data_path}=    Set Variable    ${RTMGR_BASE_PATH}
31      ${resp}=    Run Keyword    Run RtMgr Get Request    ${data_path}
32
33
34 Run RtMgr Get Request
35      [Documentation]    Runs RtMgr Get request
36      [Arguments]    ${data_path}
37      ${auth}=    Create List  ${GLOBAL_INJECTED_RTMGR_USER}    ${GLOBAL_INJECTED_RTMGR_PASSWORD}
38      ${c} =      Get From Dictionary  ${GLOBAL_RICPLT_COMPONENTS}  rtmgr
39      Log To Console     ${c}
40      ${ctrl}  ${rtmgr1} =  Split String         ${c}       |
41      ${name} =   Run Keyword    RetrievePodsForDeployment       ${rtmgr1}
42      ${name1} =  Set Variable   ${name[0]}
43      ${cType} =  Set Variable    Pod
44      ${ctl} =   Run Keyword     ${ctype}        ${name1}
45      ${podIP} =  Set Variable   ${ctl.status.pod_ip}
46      ${RTMGR_ENDPOINT}= Set Variable    ${GLOBAL_RTMGR_SERVER_PROTOCOL}://${podIP}:${GLOBAL_RTMGR_SERVER_HTTP_PORT}
47      ${session}=    Create Session      rtmgr      ${RTMGR_ENDPOINT}   auth=${auth}
48      ${uuid}=    Generate UUID
49      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
50      ${resp}=   Get Request     rtmgr    ${data_path}     headers=${headers}
51      Log    Received response from RtMgr ${resp.text}
52      Should Be Equal As Strings        ${resp.status_code}     200
53      [Return]    ${resp}