4d3cb00319316e2be0baac9ff17fc5cb0408e933
[it/test.git] / ric_robot_suite / helm / nanobot / configmap-src / public / testsuites / kpimonxapp.robot
1 #   Copyright (c) 2019 AT&T Intellectual Property.
2 #
3 #   Licensed under the Apache License, Version 2.0 (the "License");
4 #   you may not use this file except in compliance with the License.
5 #   You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 #   Unless required by applicable law or agreed to in writing, software
10 #   distributed under the License is distributed on an "AS IS" BASIS,
11 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #   See the License for the specific language governing permissions and
13 #   limitations under the License.
14
15 *** Settings ***
16 Documentation     Executes the End To End Test cases
17 ...
18 Resource         /robot/resources/appmgr_interface.robot
19 Resource         /robot/resources/negative_appmgr_tests.robot
20 Resource         /robot/resources/e2mgr_interface.robot
21 Resource         /robot//resources/dashboard_interface.robot
22 Resource         /robot/resources/global_properties.robot
23 Resource         /robot/resources/ric/ric_utils.robot
24 Resource         /robot/resources/e2term_interface.robot
25
26 Library   Collections
27 Library   OperatingSystem
28 Library   RequestsLibrary
29 Library   KubernetesEntity  ricplt
30 Library   SDLWrapper    False
31 Library   String
32
33 *** Variables ***
34 ${TEST_XAPPNAME}      ${GLOBAL_TEST_XAPP}
35 ${TEST_NODE_B_NAME}   ${GLOBAL_TEST_NODEB_NAME}
36 ${TEST_NODE_B_IP}     ${GLOBAL_TEST_NODEB_ADDRESS}
37 ${TEST_NODE_B_PORT}   ${GLOBAL_TEST_NODEB_PORT}
38 #${ricxapp_POD_NAME}   ${GLOBAL_XAPP_NAMESPACE}-${GLOBAL_XAPP}
39 ${TEST_XAPP_ONBOARDER}  ${GLOBAL_TEST_XAPP_ONBOARDER}
40
41 *** Keywords ***
42 Keyword Check subreq
43         [Arguments]     ${linematch}
44         ${result_subreq} =      Set variable    1
45         Set Global Variable     ${result_subreq}
46         ${messages} =       Split String     ${linematch}     ,
47         Log To Console      ${messages}
48         ${ts} =             Get From List    ${messages}     0
49         Log To Console      ${ts}
50         ${timestamp1} =      Split String    ${ts}    :
51         ${timestampval1} =   Get From List   ${timestamp1}   1
52         Log To Console       ${timestampval1}
53         Set Global Variable     ${timestampval1}
54
55 Keyword Check No subreq
56         ${aaa} =        Set Variable    1
57
58
59 Keyword Check subres
60         [Arguments]     ${linematch}
61         ${result_subres} =      Set variable    1
62         Set Global Variable     ${result_subres}
63         ${messages1} =      Split String     ${linematch}     ,
64         Log To Console      ${messages1}
65         ${ts1} =            Get From List    ${messages1}    0
66         Log To Console      ${ts1}
67         ${timestamp2} =      Split String    ${ts1}   :
68         ${timestampval2} =   Get From List   ${timestamp2}   1
69         Log To Console       ${timestampval2}
70         Set Global Variable     ${timestampval2}
71
72 Keyword Check No subres
73         ${aaa} =        Set Variable    1
74
75
76 Keyword Check IndMessage
77         [Arguments]     ${linematch}
78         ${result_Ind1} =        Set Variable    1
79         Set Global Variable     ${result_Ind1}
80         ${messages} =       Split String     ${linematch}       :
81         Log To Console      ${messages}
82         ${timestampval_ind1} =             Get From List    ${messages}     1
83         Log To Console       ${timestampval_ind1}
84         Set Global Variable     ${timestampval_ind1}
85         Append To List    ${IndMessgList}    ${timestampval_ind1}
86
87 Keyword Check No IndMsg
88         ${aaa} =        Set Variable    1
89
90 Keyword Check ControlMsg
91         [Arguments]     ${linematch}
92         ${result_ctrl1} =       Set Variable    1
93         Set Global Variable     ${result_ctrl1}
94         ${messages1} =      Split String     ${linematch}       :
95         Log To Console      ${messages1}
96         ${timestampval_ctrl1} =            Get From List    ${messages1}    1
97         Log To Console       ${timestampval_ctrl1}
98         Set Global Variable     ${timestampval_ctrl1}
99         Append To List    ${ContMessgList}    ${timestampval_ctrl1}
100
101 Keyword Check No CtrlMsg
102         ${aaa} =        Set Variable    1
103
104
105 *** Test Cases ***
106 Test XApp Manager Health
107     [Tags]  etetests  xapptests
108     Run AppMgr Health Check
109
110
111 Ensure RIC Xapp Onboarder is deployed and available
112     [Tags]  etetests  xapptests
113     ${controllerName} = Set Variable    ${GLOBAL_TEST_XAPP_ONBOARDER}
114     ${cType}  ${name} = Split String  ${controllerName} |
115     Log To Console      ${cType}
116     ${ctrl} =  Run Keyword      ${cType}        ${name}
117     Should Be Equal      ${ctrl.status.replicas}          ${ctrl.status.ready_replicas}
118
119
120 Get All NodeBs Via E2Mgr
121     [Tags]   e2mgrtest   etetests   e2setup   x2setup
122     ${log} =    Run E2Mgr Get All NodeBs Request
123     FOR ${item} IN      @{log.json()}
124         Log To Console  ${item}
125         ${json}=  Set variable    ${item['globalNbId']["plmnId"]}
126         Should Be Equal ${json} ${GLOBAL_PLMNID}
127     END
128
129 Get All E2T Via E2Mgr
130     [Tags]   e2mgrtests   etetests   e2setup   x2setup
131     ${log} =    Run E2Mgr Get All E2T Request
132     Log To Console      ${log}
133
134 Get NodeB Request Via E2Mgr
135     [Tags]   e2mgrtests   etetests   e2setup   x2setup
136     Run E2Mgr Get NodeB Request ${GLOBAL_GNBID}
137
138
139 RetriveLog From XAPP
140     [Tags]  etetests  xapptests  intrusive
141     ${podname} =        Run Keyword     RetrievePodsForDeployment      ${GLOBAL_XAPPKPIMON_DEPLOYMENT}  namespace=${GLOBAL_XAPP_NAMESPACE}
142     Log To Console      ${podname}
143     ${ric_xapp_pod1} =  Set Variable    ${podname[0]}
144     Log To Console      ${ric_xapp_pod1}
145     ${log1} =           Run keyword     RetrieveLogForPod       ${ric_xapp_pod1}       namespace=${GLOBAL_XAPP_NAMESPACE}
146     ${stringLog}        Convert To String       ${log1}
147     Set Global Variable         ${stringLog}
148     Set Global Variable         ${log1}
149
150 Verifying Subscription Request From Xapp
151    [Tags]  etetests  xapptests
152    #Sleep       90000
153     Log To Console      "Sending Subscription Message from Xapp"
154     Should Match Regexp ${stringLog}    The RMR message to be sent is 12010
155
156 Verifying Subscription Response From E2sim
157    [Tags]  etetests  xapptests
158     Log To Console      "Received Subscription Message from RAN"
159     Should Match Regexp ${stringLog}    Received message type: 12011
160
161 Verifying Ric Indication on Xapp
162    [Tags]  etetests  xapptests
163     #Sleep      20000
164     Log To Console      "Received Indication Message from RAN"
165     Should Match Regexp ${stringLog}    Received message type: 12050
166
167 Verifying ueid from dbass by using sdl
168    [Tags]  etetests  xapptests
169    Log To Console       "Verifying Healthcheck of dbass"
170    ${log} =     Run Keyword     healthcheck
171    Log To Console       ${log}
172    Log To Console       "Received ueid from dbass from sdl"
173    ${Allueid} = Run Keyword     find and get    kpimon  {TS-UE-metrics} false
174    Log To Console       ${Allueid}
175    Log To Console       "############ printing the ueid's ###########"
176    Log To Console       ${Allueid.keys()}
177    ${ueid_check} =      Set Variable    0
178    ${ueid} =    Set Variable    ${None}
179    FOR  ${key}  IN      @{Allueid.keys()}
180         ${ueid_check} = Set Variable    1
181         ${ueid} =       Run Keyword     get     kpimon  ${key}  false
182         Log To Console  ${key}
183         Log To Console  "--------------ueid---------------"
184         Log To Console  ${ueid}
185
186    END
187    Should Not Be Equal  ${ueid} ${None}
188    Should Match ${ueid_check}   1
189
190 Verifying cellid from dbass by using sdl
191    [Tags]  etetests  xapptests
192    Log To Console       "Verifying Healthcheck of dbass"
193    ${log} =     Run Keyword     healthcheck
194    Log To Console       ${log}
195    Log To Console       "Received cellid from dbass from sdl"
196    ${Allcellid} =       Run Keyword     find and get    kpimon  {TS-cell-metrics}       false
197    Log To Console       ${Allcellid}
198    Log To Console       "############ printing the cellid's ###########"
199    Log To Console       ${Allcellid.keys()}
200    ${cellid_check} =    Set Variable    0
201    ${cellid} =  Set Variable    ${None}
202    FOR  ${key}  IN      @{Allcellid.keys()}
203         ${cellid_check} =       Set Variable    1
204         ${cellid} =       Run Keyword     get     kpimon  ${key}  false
205         Log To Console  ${key}
206         Log To Console  "--------------cellid---------------"
207         Log To Console  ${cellid}
208    END
209    Should Not Be Equal  ${cellid}       ${None}
210    Should Match ${cellid_check} 1