[Issue-Id:RIC-150] Enhancement to it/test repo
[it/test.git] / ric_robot_suite / helm / nanobot / configmap-src / public / testsuites / ete.robot
1 #   Copyright (c) 2019 AT&T Intellectual Property.
2 #   Copyright (c) 2020 HCL Technologies Limited. 
3 #
4 #   Licensed under the Apache License, Version 2.0 (the "License");
5 #   you may not use this file except in compliance with the License.
6 #   You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #   Unless required by applicable law or agreed to in writing, software
11 #   distributed under the License is distributed on an "AS IS" BASIS,
12 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #   See the License for the specific language governing permissions and
14 #   limitations under the License.
15  
16 *** Settings ***
17 Documentation     Executes the End To End Test cases
18 ...
19 Resource         /robot/resources/appmgr_interface.robot
20 Resource         /robot/resources/negative_appmgr_tests.robot
21 Resource         /robot/resources/e2mgr_interface.robot
22 Resource         /robot//resources/dashboard_interface.robot
23 Resource         /robot/resources/global_properties.robot
24 Resource         /robot/resources/ric/ric_utils.robot
25  
26  
27 Library   Collections
28 Library   OperatingSystem
29 Library   RequestsLibrary
30 Library   KubernetesEntity  ${GLOBAL_RICPLT_NAMESPACE}
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         ${checkNosubreq} =        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         ${checkNosubres} =        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         ${checkNoindication} =        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         ${checkNocontrol} =        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     ${ctrl} =  Run Keyword      ${cType}        ${name}
116     Should Be Equal      ${ctrl.status.replicas}          ${ctrl.status.ready_replicas}
117
118 #Before doing this, Deploy E2sim, keep bouncer xapp config-file.json in to shared path and create url
119 #onboard the xapp using onboard link
120
121 Ensure E2Sim is deployed and available
122     [Tags]  etetests  xapptests
123     ${ctrl} =   Run Keyword     deployment      ${Global_RAN_DEPLOYMENT}        ${Global_RAN_NAMESPACE}
124     Should Be Equal      ${ctrl.status.replicas}          ${ctrl.status.ready_replicas}
125  
126 Deploy An XApp
127     [Tags]  etetests  xapptests  intrusive
128     Deploy XApp       ${TEST_XAPPNAME}
129  
130 Retrieve The Deployed XApp
131     [Tags]  etetests  xapptests
132     Get XApp By Name  ${TEST_XAPPNAME}
133  
134 Attempt To Deploy A Duplicate XApp
135     [Tags]  etetests  xapptests  intrusive
136     Deploy Duplicate XApp And Expect Error
137  
138 Attempt To Undeploy An Already Undeployed XApp
139     [Tags]  etetests  xapptests  intrusive
140     Undeploy Nondeployed XApp And Expect Error
141  
142 Attempt To Request A Nonexistent XApp
143     [Tags]  etetests  xapptests  intrusive
144     Request Nonexistent XApp And Expect Error
145  
146
147 # disabled below 3 testcases due to x2 setup related APIs deprecated
148 # webservices interface specification deprecated
149 #Setup RAN Via E2Mgr X2
150 #[Tags]   disabled
151 ##[Tags]   e2setup   x2setup
152 #Run E2Mgr Setup NodeB X2   ${TEST_NODE_B_NAME}    ${TEST_NODE_B_IP}   ${TEST_NODE_B_PORT}
153 #Wait Until Keyword Succeeds   20s   5s   Check NodeB Status    ${TEST_NODE_B_NAME}
154 #Setup RAN Via E2Mgr Endc
155 #[Tags]   disabled
156 ##[Tags]   e2setup   x2setup
157 #Run E2Mgr Setup NodeB Endc   ${TEST_NODE_B_NAME}    ${TEST_NODE_B_IP}   ${TEST_NODE_B_PORT}
158 #Wait Until Keyword Succeeds   20s   5s   Check NodeB Status    ${TEST_NODE_B_NAME}
159 #Get NodeB via E2Mgr
160 #[Tags]   disabled
161 #[Tags]   e2setup   x2setup
162 #Run E2Mgr Get NodeB Request   ${TEST_NODE_B_NAME}
163
164 ###Not tested dashboard related
165 Setup RAN Via Dashboard Endc
166     [Tags]   e2setup_dash
167     Run Dashboard Setup NodeB Endc   ${TEST_NODE_B_NAME}    ${TEST_NODE_B_IP}   ${TEST_NODE_B_PORT}
168     Wait Until Keyword Succeeds   20s   5s   Dashboard Check NodeB Status    ${TEST_NODE_B_NAME}
169  
170 Setup RAN Via Dashboard X2
171     [Tags]   x2setup_dash
172     Run Dashboard Setup NodeB X2    ${TEST_NODE_B_NAME}    ${TEST_NODE_B_IP}   ${TEST_NODE_B_PORT}
173     Wait Until Keyword Succeeds   20s   5s   Dashboard Check NodeB Status    ${TEST_NODE_B_NAME}
174  
175 Get NodeB via Dashboard
176     [Tags]   e2setup_dash   x2setup_dash
177     Run Dashboard Get NodeB Request   ${TEST_NODE_B_NAME}
178  
179 Get All NodeBs via Dashboard
180     [Tags]   e2setup_dash   x2setup_dash    ci_tests
181     Run Dashboard Get All NodeBs Request
182
183
184
185 ##### E2setup Verification using E2MGR API
186 Get All NodeBs Via E2Mgr
187     [Tags]   e2mgrtest   etetests   e2setup   x2setup
188     ${log} =    Run E2Mgr Get All NodeBs Request
189     FOR ${item} IN      @{log.json()}
190         Log To Console  ${item}
191         ${json}=  Set variable    ${item['globalNbId']["plmnId"]}
192         Should Be Equal ${json} ${GLOBAL_PLMNID}
193     END
194
195 Get All E2T Via E2Mgr
196     [Tags]   e2mgrtests   etetests   e2setup   x2setup
197     ${log} =    Run E2Mgr Get All E2T Request
198     Log To Console      ${log}
199
200 Get NodeB Request Via E2Mgr
201     [Tags]   e2mgrtests   etetests   e2setup   x2setup
202     Run E2Mgr Get NodeB Request ${GLOBAL_GNBID}
203
204
205 #######Subscription verification between Bouncer Xapp and E2sim
206 RetriveLog From XAPP
207     [Tags]  etetests  xapptests  intrusive
208     ${podname} =        Run Keyword     RetrievePodsForDeployment       ${GLOBAL_XAPP_DEPLOYMENT}      namespace=ricxapp
209     Log To Console      ${podname}
210     ${ric_xapp_pod1} =  Set Variable    ${podname[0]}
211     Log To Console      ${ric_xapp_pod1}
212     ${log1} =           Run keyword     RetrieveLogForPod       ${ric_xapp_pod1}       namespace=ricxapp
213     ${stringLog}        Convert To String       ${log1}
214     Set Global Variable         ${stringLog}
215     Set Global Variable         ${log1}
216
217 Verifying Subscription Request From Xapp
218    [Tags]  etetests  xapptests
219    Sleep        80
220    Log To Console      "Sending Subscription Message from Xapp"
221    Should Match Regexp   ${stringLog}    Transmitted subscription request
222
223 Verifying Subscription Response From E2sim
224    [Tags]  etetests  xapptests
225     Log To Console      "Received Subscription Message from RAN"
226     Should Match Regexp  ${stringLog}    Received subscription message of type = 12011
227
228 #######RIC Indication and Control flow verification betwwen Bouncer xapp and E2sim
229 Verifying RIC Indication on Xapp
230    [Tags]  etetests  xapptests
231     Log To Console      "Received Indication Message from RAN"
232     Should Match Regexp  ${stringLog}    Received indication message of type = 12050
233
234 Verifying Control message on Xapp
235    [Tags]  etetests  xapptests
236     Log To Console      "Verified Controll message"
237     Should Match Regexp  ${stringLog}   Bouncer Control OK
238
239 Calculating Timestamp for subscription request on Xapp
240    [Tags]  etetests  xapptests
241    ${result_subreq} =   Set Variable    0
242    Set Global Variable  ${result_subreq}
243    FOR  ${item} IN      @{log1}
244         ${itemString}   Convert To String       ${item}
245         ${contains}=    Run Keyword And Return Status   Should Contain  ${itemString}   Transmitted subscription request
246         ${status}=      Run Keyword If  ${contains}     Keyword Check subreq        ${itemString}       ELSE    Keyword Check No subreq
247    END
248    Log To Console       ${result_subreq}
249    Should Match ${result_subreq}        1
250
251 Calculating Timestamp for subscription response on Xapp
252    [Tags]  etetests  xapptests
253    ${result_subres} =   Set Variable    0
254    Set Global Variable  ${result_subres}
255    FOR  ${item} IN      @{log1}
256         ${itemString}   Convert To String       ${item}
257         ${contains}=    Run Keyword And Return Status   Should Contain  ${itemString}   Received subscription message of type = 12011
258         ${status}=      Run Keyword If  ${contains}     Keyword Check subres    ${itemString}   ELSE    Keyword Check No subres
259
260    END
261    Log To Console       ${result_subres}
262    Should Match ${result_subres}        1
263
264
265 Latecncy Check on RoundTripTime Subscription Request and Response
266    [Tags]  etetests  xapptests
267    ${timediff} =        Evaluate        ${timestampval2} - ${timestampval1}
268    Log To Console       ${timediff}
269
270
271 RetriveLog From GNB
272     [Tags]  etetests  xapptests  intrusive
273     ${e2simpodname} =   Run Keyword     RetrievePodsForDeployment       ${Global_RAN_DEPLOYMENT}   namespace=${Global_RAN_NAMESPACE}
274     Log To Console      ${e2simpodname}
275     ${e2sim_pod1} =  Set Variable       ${e2simpodname[0]}
276     Log To Console      ${e2sim_pod1}
277     ${e2sim_log} =      Run keyword     RetrieveLogForPod       ${e2sim_pod1}   namespace=${Global_RAN_NAMESPACE}
278     ${e2simstringLog}        Convert To String       ${e2sim_log}
279     Set Global Variable         ${e2simstringLog}
280     Set Global Variable         ${e2sim_log}
281
282 Calculating Timestamp for Indication Messagae from E2SIM
283    [Tags]  etetests  xapptests
284    ${result_ind1} =     Set Variable    0
285    Set Global Variable  ${result_ind1}
286    @{IndMessgList}=    Create List
287    Set Global Variable  ${IndMessgList}
288    FOR  ${item} IN      @{e2sim_log}
289         ${itemString}   Convert To String       ${item}
290         ${contains}=    Run Keyword And Return Status   Should Contain  ${itemString}   Sent RIC Indication at time
291         ${status}=      Run Keyword If  ${contains}     Keyword Check IndMessage        ${itemString}   ELSE    Keyword Check No IndMsg
292    END
293    Log To Console       ${result_Ind1}
294    Log To Console       ${IndMessgList}
295    Should Match ${result_Ind1}  1
296
297 Calculating Timestamp for Control Messages From Xapp to E2sim
298    [Tags]  etetests  xapptests
299    ${result_ctrl1} =    Set Variable    0
300    Set Global Variable  ${result_ctrl1}
301    @{ContMessgList}=    Create List
302    Set Global Variable  ${ContMessgList}
303    FOR  ${item} IN      @{e2sim_log}
304         ${itemString}   Convert To String       ${item}
305         ${contains}=    Run Keyword And Return Status   Should Contain  ${itemString}   Received RIC Control Msg at time
306         ${status}=      Run Keyword If  ${contains}     Keyword Check ControlMsg        ${itemString}   ELSE    Keyword Check No CtrlMsg
307
308    END
309    Log To Console       ${result_ctrl1}
310    Log To Console       ${ContMessgList}
311    Should Match ${result_ctrl1} 1
312
313
314 Latecncy Check on RoundTripTime Indication message and Control message
315    [Tags]  etetests  xapptests
316    ${index} =   Set Variable    0
317    @{Timediff1}=        Create List
318    FOR  ${item} IN      @{ContMessgList}
319         ${timediff} =        Evaluate        ${ContMessgList}[${index}] - ${IndMessgList}[${index}]
320         Append To List  ${Timediff1}    ${timediff}
321         ${index}=       Evaluate        ${index} + 1
322    END
323    Log To Console       ${Timediff1}
324
325
326 Undeploy The Deployed XApp
327     [Tags]  etetests  xapptests  intrusive
328     Undeploy XApp     ${TEST_XAPPNAME}
329