Issue-ID: RIC-149
[it/test.git] / ric_robot_suite / helm / nanobot / configmap-src / public / resources / dashboard_interface.robot
1 *** Settings ***
2 Documentation     The main interface for interacting with RIC E2 Manager (Dashboard) . It handles low level stuff like managing the http request library and E2Mgr required fields
3 Library           RequestsLibrary
4 Library           UUID
5
6 Resource          /robot/resources/global_properties.robot
7 Resource          /robot/resources/json_templater.robot
8
9 *** Variables ***
10 ${DASH_E2MGR_BASE_PATH}        /e2mgr/v1/nodeb   #/nodeb  /nodeb/setup
11 ${DASH_E2MGR_BASE_VERSION}        /e2mgr/v1
12 ${DASH_ENDPOINT}     ${GLOBAL_DASH_SERVER_PROTOCOL}://${GLOBAL_INJECTED_DASH_IP_ADDR}:${GLOBAL_DASH_SERVER_PORT}
13 ${E2MGR_SETUP_NODEB_TEMPLATE}     robot/assets/templates/e2mgr_setup_nodeb.template
14
15
16 *** Keywords ***
17 Run Dashboard Health Check
18      [Documentation]    Runs Dashboard Health check
19      # need to confirm Dashboard Health Check URL
20      ${data_path}=    Set Variable    /v1/health
21      ${resp}=    Run Keyword    Run Dashboard Get Request    ${data_path}
22
23 Dashboard Check NodeB Status
24      [Documentation]    Check NodeB Status
25      [Arguments]      ${ran_name}
26      ${resp}=  Run Keyword   Run Dashboard Get NodeB Request    ${ran_name}
27      Should Be Equal As Strings        ${resp.json()['connectionStatus']}     CONNECTED
28
29 Run Dashboard Get NodeB Request
30      [Documentation]    Runs Dashboard Get NodeB Request
31      [Arguments]      ${ran_name}
32      ${data_path}=    Set Variable    ${DASH_E2MGR_BASE_PATH}/${ran_name}
33      ${resp}=    Run Keyword    Run Dashboard Get Request    ${data_path}
34      Should Be Equal As Strings        ${resp.status_code}     200
35      [Return]    ${resp}
36
37 Run Dashboard Get All NodeBs Request
38      [Documentation]    Runs Dashboard Get All NodeBs Request
39      ${data_path}=    Set Variable    ${DASH_E2MGR_BASE_VERSION}/nodeb-ids
40      ${resp}=    Run Keyword    Run Dashboard Get Request    ${data_path}
41
42 Run Dashboard Setup NodeB X2
43      [documentation]     Setup X2 NodeB via E2 Manager
44      [Arguments]      ${ran_name}  ${ran_ip}   ${ran_port}
45      ${data_path}=    Set Variable    ${DASH_E2MGR_BASE_PATH}/x2-setup
46      ${dict}=    Create Dictionary    ran_name=${ran_name}    ran_ip=${ran_ip}   ran_port=${ran_port}
47      ${data}=   Fill JSON Template File    ${E2MGR_SETUP_NODEB_TEMPLATE}    ${dict}
48      ${auth}=  Create List  ${GLOBAL_INJECTED_DASH_USER}    ${GLOBAL_INJECTED_DASH_PASSWORD}
49      ${session}=    Create Session      e2mgr      ${DASH_ENDPOINT}   auth=${auth}
50      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
51      ${resp}=   Post Request     e2mgr     ${data_path}     data=${data}   headers=${headers}
52      Log    Received response from Dashboard ${resp.text}
53      Should Be Equal As Strings        ${resp.status_code}     200
54      [Return]    ${resp}
55
56 Run Dashboard Setup NodeB Endc
57      [documentation]     Setup Endc NodeB via E2 Manager
58      [Arguments]      ${ran_name}  ${ran_ip}   ${ran_port}
59      ${data_path}=    Set Variable    ${DASH_E2MGR_BASE_PATH}/endc-setup
60      ${dict}=    Create Dictionary    ran_name=${ran_name}    ran_ip=${ran_ip}   ran_port=${ran_port}
61      ${data}=   Fill JSON Template File    ${E2MGR_SETUP_NODEB_TEMPLATE}    ${dict}
62      ${auth}=  Create List  ${GLOBAL_INJECTED_DASH_USER}    ${GLOBAL_INJECTED_DASH_PASSWORD}
63      ${session}=    Create Session      e2mgr      ${DASH_ENDPOINT}   auth=${auth}
64      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
65      ${resp}=   Post Request     e2mgr     ${data_path}     data=${data}   headers=${headers}
66      Log    Received response from Dashboard ${resp.text}
67      Should Be Equal As Strings        ${resp.status_code}     200
68      [Return]    ${resp}
69
70 Run Dashboard Delete NodeB
71      [documentation]     Delete NodeB via E2 Manager
72      [Arguments]      ${ran_name}
73      ${data_path}=    Set Variable    ${DASH_E2MGR_BASE_PATH}/${ran_name}
74      ${resp}=    Run Dashboard Delete Request    ${data_path}
75      Should Be Equal As Strings        ${resp.status_code}     200
76
77
78 Run Dashboard Get Request
79      [Documentation]    Runs Dashboard Get Request
80      [Arguments]    ${data_path}
81      ${auth}=  Create List  ${GLOBAL_INJECTED_DASH_USER}    ${GLOBAL_INJECTED_DASH_PASSWORD}
82      ${session}=    Create Session      e2mgr      ${DASH_ENDPOINT}   auth=${auth}
83      ${uuid}=    Generate UUID
84      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
85      ${resp}=   Get Request     e2mgr     ${data_path}     headers=${headers}
86      Log    Received response from Dashboard ${resp.text}
87      Should Be Equal As Strings        ${resp.status_code}     200
88      [Return]    ${resp}
89
90 Run Dashboard Delete Request
91      [Documentation]    Runs Dashboard Delete Request
92      [Arguments]    ${data_path}
93      ${auth}=  Create List  ${GLOBAL_INJECTED_DASH_USER}    ${GLOBAL_INJECTED_DASH_PASSWORD}
94      ${session}=    Create Session      e2mgr      ${DASH_ENDPOINT}   auth=${auth}
95      ${uuid}=    Generate UUID
96      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
97      ${resp}=   Delete Request     e2mgr     ${data_path}     headers=${headers}
98      Log    Received response from Dashboard ${resp.text}
99      Should Be Equal As Strings        ${resp.status_code}     200
100      [Return]    ${resp}
101
102