8cece2b157702becf61f7a95af3ec4a7438a4863
[it/test.git] / ric_robot_suite / helm / nanobot / configmap-src / public / testsuites / Subscription_Duplication_Scen2.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 Resource         /robot/resources/submgr_interface.robot
26 #Resource         /robot/testsuites/bouncer_dms_cli.robot
27 #Resource         /opt/ric/robot/bouncer_dms_cli.robot
28
29 Library   Process 
30 Library   Collections
31 Library   OperatingSystem
32 Library   RequestsLibrary
33 Library   KubernetesEntity  ricplt
34 Library   String
35
36 *** Variables ***
37 ${TEST_XAPPNAME}      ${GLOBAL_TEST_XAPP}
38 ${TEST_NODE_B_NAME}   ${GLOBAL_TEST_NODEB_NAME}
39 ${TEST_NODE_B_IP}     ${GLOBAL_TEST_NODEB_ADDRESS}
40 ${TEST_NODE_B_PORT}   ${GLOBAL_TEST_NODEB_PORT}
41 ${ricxapp_POD_NAME}   ${GLOBAL_XAPP_NAMESPACE}-${GLOBAL_XAPP}
42 ${TEST_XAPP_ONBOARDER}  ${GLOBAL_TEST_XAPP_ONBOARDER}
43
44 *** Keywords ***
45 Keyword Check subreq    
46         [Arguments]     ${linematch}
47         ${result_subreq} =      Set variable    1
48         Set Global Variable     ${result_subreq}
49         ${messages} =       Split String     ${linematch}     ,
50         Log To Console      ${messages}
51         ${ts} =             Get From List    ${messages}     0
52         Log To Console      ${ts}
53         ${timestamp1} =      Split String    ${ts}    :
54         ${timestampval1} =   Get From List   ${timestamp1}   1
55         Log To Console       ${timestampval1}
56         Set Global Variable     ${timestampval1}
57
58 Keyword Check No subreq
59         ${checkNosubreq} =      Set Variable    1
60        
61
62 Keyword Check subres
63         [Arguments]     ${linematch}
64         ${result_subres} =      Set variable    1
65         Set Global Variable     ${result_subres}
66         ${messages1} =      Split String     ${linematch}     ,
67         Log To Console      ${messages1}
68         ${ts1} =            Get From List    ${messages1}    0
69         Log To Console      ${ts1}
70         ${timestamp2} =      Split String    ${ts1}   :
71         ${timestampval2} =   Get From List   ${timestamp2}   1
72         Log To Console       ${timestampval2}
73         Set Global Variable     ${timestampval2}
74
75 Keyword Check No subres
76         ${checkNosubres} =      Set Variable    1
77         
78
79 Keyword Check IndMessage
80         [Arguments]     ${linematch}
81         ${result_Ind1} =        Set Variable    1
82         Set Global Variable     ${result_Ind1}
83         ${messages} =       Split String     ${linematch}       :
84         Log To Console      ${messages}
85         ${timestampval_ind1} =             Get From List    ${messages}     1
86         Log To Console       ${timestampval_ind1}
87         Set Global Variable     ${timestampval_ind1}
88         Append To List    ${IndMessgList}    ${timestampval_ind1}
89
90 Keyword Check No IndMsg
91         ${checkNoindication} =  Set Variable    1
92
93 Keyword Check ControlMsg
94         [Arguments]     ${linematch}
95         ${result_ctrl1} =       Set Variable    1
96         Set Global Variable     ${result_ctrl1}
97         ${messages1} =      Split String     ${linematch}       :
98         Log To Console      ${messages1}
99         ${timestampval_ctrl1} =            Get From List    ${messages1}    1
100         Log To Console       ${timestampval_ctrl1}
101         Set Global Variable     ${timestampval_ctrl1}
102         Append To List    ${ContMessgList}    ${timestampval_ctrl1}
103
104 Keyword Check No CtrlMsg
105         ${checkNocontrol} =     Set Variable    1
106         
107
108 *** Test Cases ***
109 Test XApp Manager Health
110     [Tags]  etetests  xapptests
111     Run AppMgr Health Check
112
113
114 Ensure RIC Xapp Onboarder is deployed and available
115     [Tags]  etetests  xapptests
116     ${controllerName} = Set Variable    ${GLOBAL_TEST_XAPP_ONBOARDER}
117     ${cType}  ${name} = Split String  ${controllerName} |
118     Log To Console      ${cType}
119     ${ctrl} =  Run Keyword      ${cType}        ${name}
120     Should Be Equal      ${ctrl.status.replicas}          ${ctrl.status.ready_replicas}
121
122 Ensure E2Sim is deployed and available
123     [Tags]  etetests  xapptests
124     ${ctrl} =   Run Keyword     deployment      ${Global_RAN_DEPLOYMENT}        ${Global_RAN_NAMESPACE}
125     Should Be Equal      ${ctrl.status.replicas}          ${ctrl.status.ready_replicas}
126
127 Attempt To Undeploy An Already Undeployed XApp
128     [Tags]  etetests  xapptests  intrusive
129     Undeploy Nondeployed XApp And Expect Error
130
131 Attempt To Request A Nonexistent XApp
132     [Tags]  etetests  xapptests  intrusive
133     Request Nonexistent XApp And Expect Error
134
135 #Verify plmnid via E2mgr
136 Get All NodeBs Via E2Mgr
137     [Tags]   e2mgrtest   etetests   e2setup   x2setup 
138     ${log} =    Run E2Mgr Get All NodeBs Request
139     FOR ${item} IN      @{log.json()}
140         Log To Console  ${item}
141         ${json}=  Set variable    ${item['globalNbId']["plmnId"]}
142         Log To Console  ${json}
143         #Should Be Equal        ${json} ${GLOBAL_PLMNID}
144         Exit For Loop If        "${json}" == "${GLOBAL_PLMNID}" 
145         Log     ${json}
146     END
147
148 Get All E2T Via E2Mgr
149     [Tags]   e2mgrtests   etetests   e2setup   x2setup
150     ${log} =    Run E2Mgr Get All E2T Request
151     Log To Console      ${log}
152
153 #Verify gnbid via E2mgr
154 Get All NodeBs Via E2Mgr
155     [Tags]   e2mgrtest   etetests   e2setup   x2setup
156     ${log} =    Run E2Mgr Get All NodeBs Request
157     FOR ${item} IN      @{log.json()}
158         Log To Console  ${item}
159         ${json}=  Set variable    ${item['inventoryName']}
160         Log To Console  ${json}
161          Exit For Loop If        "${json}" == "${GLOBAL_GNBID}"
162         Log     ${json}
163     END
164
165 RetriveLog From XAPP
166     [Tags]  etetests  xapptests  intrusive
167     ${podname} =        Run Keyword     RetrievePodsForDeployment       ${GLOBAL_XAPP_DEPLOYMENT}      namespace=ricxapp
168     Log To Console      ${podname}
169     ${ric_xapp_pod1} =  Set Variable    ${podname[0]}
170     Log To Console      ${ric_xapp_pod1}
171     ${log1} =           Run keyword     RetrieveLogForPod       ${ric_xapp_pod1}       namespace=ricxapp
172     ${stringLog}        Convert To String       ${log1}
173     Set Global Variable         ${stringLog}
174     Set Global Variable         ${log1}
175
176
177 Verifying Subscription Request From Xapp
178    [Tags]  etetests  xapptests
179    Sleep        80
180    Log To Console      "Sending Subscription Message from Xapp"
181    Should Match Regexp   ${stringLog}    Transmitted subscription request
182
183
184 Verifying Subscription Requests on Submgr
185    [Tags]  etetests  xapptests
186    Sleep        20
187    Log To Console      "Verifying the Subscription Requests on submgr"
188    ${subvalidation} =   Run Keyword     Run submgr SUBSCRIPTIONGET Request      /ric/v1/subscriptions
189    Should Be Equal As Strings    ${subvalidation}       True
190
191
192 Verifying Subscription Response From E2sim
193    [Tags]  etetests  xapptests
194     Log To Console      "Received Subscription Message from RAN"
195     Should Match Regexp  ${stringLog}    Received subscription message of type = 12011
196
197 Verifying Ric Indication on Xapp
198    [Tags]  etetests  xapptests
199     Log To Console      "Received Indication Message from RAN"
200     Should Match Regexp  ${stringLog}    Received indication message of type = 12050
201
202 Verifying Control message on Xapp
203    [Tags]  etetests  xapptests
204     Log To Console      "Verified Control message from Xapp"
205     Should Match Regexp  ${stringLog}   Bouncer Control OK
206
207 RetriveLog From duplicate XAPP
208     [Tags]  etetests  xapptests  intrusive
209     ${podname} =        Run Keyword     RetrievePodsForDeployment       ${GLOBAL_DUPLICATE_XAPP}        namespace=ricxapp
210     Log To Console      ${podname}
211     ${ric_xapp_pod2} =  Set Variable    ${podname[0]}
212     Log To Console      ${ric_xapp_pod2}
213     ${log2} =           Run keyword     RetrieveLogForPod       ${ric_xapp_pod2}       namespace=ricxapp
214     ${stringLog1}        Convert To String       ${log2}
215     Set Global Variable         ${stringLog1}
216     Set Global Variable         ${log2}
217
218 Verifying Subscription Requests on Submgr
219    [Tags]  etetests  xapptests
220    Sleep        20
221    Log To Console      "Verifying the Subscription Requests on submgr"
222    ${subvalidation} =   Run Keyword     Run submgr SUBSCRIPTIONGET Request      /ric/v1/subscriptions
223    Should Be Equal As Strings    ${subvalidation}       True
224
225 Verifying Subscription Merge Requests on Submgr
226    [Tags]  etetests  xapptests
227    Log To Console      "Verifying the Subscription Merge on submgr"
228    ${subvalidation1} =   Run Keyword     Run submgr SUBSCRIPTIONMERGE Check      /ric/v1/subscriptions
229    Should Be Equal As Strings    ${subvalidation1}       True
230