Issue ID: RIC-779: xAPP Functionality Enhancement- Subscription Duplication Automation
[it/test.git] / ric_robot_suite / helm / nanobot / configmap-src / public / testsuites / Subscription_Duplication_Scen1.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
27 Library   Collections
28 Library   OperatingSystem
29 Library   RequestsLibrary
30 Library   KubernetesEntity  ricplt
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     Log To Console      ${cType}
116     ${ctrl} =  Run Keyword      ${cType}        ${name}
117     Should Be Equal      ${ctrl.status.replicas}          ${ctrl.status.ready_replicas}
118
119 Ensure E2Sim is deployed and available
120     [Tags]  etetests  xapptests
121     ${ctrl} =   Run Keyword     deployment      ${Global_RAN_DEPLOYMENT}        ${Global_RAN_NAMESPACE}
122     Should Be Equal      ${ctrl.status.replicas}          ${ctrl.status.ready_replicas}
123 #Before doing this kept configfile.json in to shared path and create url
124 #onboard the xapp using onboard link
125
126 Attempt To Undeploy An Already Undeployed XApp
127     [Tags]  etetests  xapptests  intrusive
128     Undeploy Nondeployed XApp And Expect Error
129
130 Attempt To Request A Nonexistent XApp
131     [Tags]  etetests  xapptests  intrusive
132     Request Nonexistent XApp And Expect Error
133
134 Get All NodeBs Via E2Mgr
135     [Tags]   e2mgrtest   etetests   e2setup   x2setup 
136     ${log} =    Run E2Mgr Get All NodeBs Request
137     FOR ${item} IN      @{log.json()}
138         Log To Console  ${item}
139         ${json}=  Set variable    ${item['globalNbId']["plmnId"]}
140         Log To Console  ${json}
141         #Should Be Equal        ${json} ${GLOBAL_PLMNID}
142         Exit For Loop If        "${json}" == "${GLOBAL_PLMNID}" 
143         Log     ${json}
144     END
145
146 Get All E2T Via E2Mgr
147     [Tags]   e2mgrtests   etetests   e2setup   x2setup
148     ${log} =    Run E2Mgr Get All E2T Request
149     Log To Console      ${log}
150
151 Get NodeB Request Via E2Mgr
152     [Tags]   e2mgrtests   etetests   e2setup   x2setup
153     Run E2Mgr Get NodeB Request ${GLOBAL_GNBID}
154
155
156 RetriveLog From XAPP
157     [Tags]  etetests  xapptests  intrusive
158     ${podname} =        Run Keyword     RetrievePodsForDeployment       ${GLOBAL_XAPP_DEPLOYMENT}      namespace=ricxapp
159     Log To Console      ${podname}
160     ${ric_xapp_pod1} =  Set Variable    ${podname[0]}
161     Log To Console      ${ric_xapp_pod1}
162     ${log1} =           Run keyword     RetrieveLogForPod       ${ric_xapp_pod1}       namespace=ricxapp
163     ${stringLog}        Convert To String       ${log1}
164     Set Global Variable         ${stringLog}
165     Set Global Variable         ${log1}
166
167 RetriveLog From duplicate XAPP
168     [Tags]  etetests  xapptests  intrusive
169     ${podname} =        Run Keyword     RetrievePodsForDeployment       ${GLOBAL_DUPLICATE_XAPP}        namespace=ricxapp
170     Log To Console      ${podname}
171     ${ric_xapp_pod2} =  Set Variable    ${podname[0]}
172     Log To Console      ${ric_xapp_pod2}
173     ${log2} =           Run keyword     RetrieveLogForPod       ${ric_xapp_pod2}       namespace=ricxapp
174     ${stringLog1}        Convert To String       ${log2}
175     Set Global Variable         ${stringLog1}
176     Set Global Variable         ${log2}
177
178
179 Verifying Subscription Request From Xapp
180    [Tags]  etetests  xapptests
181    Sleep        80
182    Log To Console      "Sending Subscription Message from Xapp"
183    Should Match Regexp   ${stringLog}    Transmitted subscription request
184
185 Verifying Subscription Request From AnotherXapp
186    [Tags]  etetests  xapptests
187    Sleep        10
188    Log To Console      "Sending Subscription Message from Xapp"
189    Should Match Regexp   ${stringLog1}    Transmitted subscription request
190
191 Verifying Subscription Requests on Submgr
192    [Tags]  etetests  xapptests
193    Sleep        20
194    Log To Console      "Verifying the Subscription Requests on submgr"
195    ${subvalidation} =   Run Keyword     Run submgr SUBSCRIPTIONGET Request      /ric/v1/subscriptions
196    Should Be Equal As Strings    ${subvalidation}       True
197
198
199 Verifying Subscription Merge Requests on Submgr
200    [Tags]  etetests  xapptests
201    Log To Console      "Verifying the Subscription Merge on submgr"
202    ${subvalidation1} =   Run Keyword     Run submgr SUBSCRIPTIONMERGE Check      /ric/v1/subscriptions
203    Should Be Equal As Strings    ${subvalidation1}       True
204
205 Verifying Subscription Response From E2sim
206    [Tags]  etetests  xapptests
207     Log To Console      "Received Subscription Message from RAN"
208     Should Match Regexp  ${stringLog}    Received subscription message of type = 12011
209
210 Verifying Ric Indication on Xapp
211    [Tags]  etetests  xapptests
212     Log To Console      "Received Indication Message from RAN"
213     Should Match Regexp  ${stringLog}    Received indication message of type = 12050
214
215 Verifying Control message on Xapp
216    [Tags]  etetests  xapptests
217     Log To Console      "Verified Control message from Xapp"
218     Should Match Regexp  ${stringLog}   Bouncer Control OK
219