3 # ============LICENSE_START===============================================
4 # Copyright (C) 2020 Nordix Foundation. All rights reserved.
5 # ========================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 # ============LICENSE_END=================================================
20 TC_ONELINE_DESCR="Change supported policy types and reconfigure rics"
22 #App names to include in the test, space separated list
23 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
25 #SUPPORTED TEST ENV FILE
26 SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY"
28 . ../common/testcase_common.sh $@
29 . ../common/agent_api_functions.sh
30 . ../common/ricsimulator_api_functions.sh
31 . ../common/cr_api_functions.sh
40 NUM_RICS_2=$(($NUM_RICS-2))
42 # Tested variants of REST/SDNC config
43 TESTED_VARIANTS="REST REST+SDNC"
45 for interface in $TESTED_VARIANTS ; do
47 echo "#####################################################################"
48 echo "#####################################################################"
49 echo "### Testing agent: "$interface
50 echo "#####################################################################"
51 echo "#####################################################################"
54 # Clean container and start all needed containers #
57 #Start simulators and prepare two configs
59 start_ric_simulators ricsim_g1 $NUM_RICS_2 OSC_2.1.0
68 if [[ $interface = *"SDNC"* ]]; then
70 prepare_consul_config SDNC ".consul_config_initial.json"
72 prepare_consul_config NOSDNC ".consul_config_initial.json"
75 # Create 2nd config and save for later
76 start_ric_simulators ricsim_g1 $NUM_RICS OSC_2.1.0
78 if [[ $interface = *"SDNC"* ]]; then
79 prepare_consul_config SDNC ".consul_config_all.json"
81 prepare_consul_config NOSDNC ".consul_config_all.json"
90 # Create service to be able to receive events when rics becomes available
91 # Must use rest towards the agent since dmaap is not configured yet
92 api_put_service 201 "ric-registration" 0 "$CR_PATH/ric-registration"
95 consul_config_app ".consul_config_initial.json"
97 for ((i=1; i<=${NUM_RICS}; i++))
99 sim_print ricsim_g1_$i interface
102 # All sims running but 2 are not configured in consul
103 api_equal json:rics 8 120
105 if [ "$PMS_VERSION" == "V2" ]; then
106 cr_equal received_callbacks?id=ric-registration 8 120
107 cr_api_check_all_sync_events 200 ric-registration ricsim_g1_1 ricsim_g1_2 ricsim_g1_3 ricsim_g1_4 ricsim_g1_5 ricsim_g1_6 ricsim_g1_7 ricsim_g1_8
110 api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:NOTYPE:???? \
111 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:NOTYPE:???? \
112 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:NOTYPE:???? \
113 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:NOTYPE:???? \
114 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:NOTYPE:???? \
115 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:NOTYPE:???? \
116 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:NOTYPE:???? \
117 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:NOTYPE:???? "
120 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
121 sim_put_policy_type 201 ricsim_g1_2 1 testdata/OSC/sim_1.json
122 sim_put_policy_type 201 ricsim_g1_3 1 testdata/OSC/sim_1.json
123 sim_put_policy_type 201 ricsim_g1_4 1 testdata/OSC/sim_1.json
124 sim_put_policy_type 201 ricsim_g1_5 1 testdata/OSC/sim_1.json
126 sim_put_policy_type 201 ricsim_g1_2 2 testdata/OSC/sim_2.json
127 sim_put_policy_type 201 ricsim_g1_3 2 testdata/OSC/sim_2.json
128 sim_put_policy_type 201 ricsim_g1_4 2 testdata/OSC/sim_2.json
129 sim_put_policy_type 201 ricsim_g1_5 2 testdata/OSC/sim_2.json
130 sim_put_policy_type 201 ricsim_g1_6 2 testdata/OSC/sim_2.json
132 sim_put_policy_type 201 ricsim_g1_3 3 testdata/OSC/sim_3.json
133 sim_put_policy_type 201 ricsim_g1_4 3 testdata/OSC/sim_3.json
134 sim_put_policy_type 201 ricsim_g1_5 3 testdata/OSC/sim_3.json
135 sim_put_policy_type 201 ricsim_g1_6 3 testdata/OSC/sim_3.json
136 sim_put_policy_type 201 ricsim_g1_7 3 testdata/OSC/sim_3.json
138 sim_put_policy_type 201 ricsim_g1_4 4 testdata/OSC/sim_4.json
139 sim_put_policy_type 201 ricsim_g1_5 4 testdata/OSC/sim_4.json
140 sim_put_policy_type 201 ricsim_g1_6 4 testdata/OSC/sim_4.json
141 sim_put_policy_type 201 ricsim_g1_7 4 testdata/OSC/sim_4.json
142 sim_put_policy_type 201 ricsim_g1_8 4 testdata/OSC/sim_4.json
144 sim_put_policy_type 201 ricsim_g1_5 5 testdata/OSC/sim_5.json
145 sim_put_policy_type 201 ricsim_g1_6 5 testdata/OSC/sim_5.json
146 sim_put_policy_type 201 ricsim_g1_7 5 testdata/OSC/sim_5.json
147 sim_put_policy_type 201 ricsim_g1_8 5 testdata/OSC/sim_5.json
149 if [ "$PMS_VERSION" == "V2" ]; then
150 api_equal json:policy-types 5 120
152 echo "Check the number of types in the agent for each ric"
153 api_equal json:policy-types?ric_id=ricsim_g1_1 1 120
154 api_equal json:policy-types?ric_id=ricsim_g1_2 2 120
155 api_equal json:policy-types?ric_id=ricsim_g1_3 3 120
156 api_equal json:policy-types?ric_id=ricsim_g1_4 4 120
157 api_equal json:policy-types?ric_id=ricsim_g1_5 5 120
158 api_equal json:policy-types?ric_id=ricsim_g1_6 4 120
159 api_equal json:policy-types?ric_id=ricsim_g1_7 3 120
160 api_equal json:policy-types?ric_id=ricsim_g1_8 2 120
162 api_equal json:policy_types 5 120
164 echo "Check the number of types in the agent for each ric"
165 api_equal json:policy_types?ric=ricsim_g1_1 1 120
166 api_equal json:policy_types?ric=ricsim_g1_2 2 120
167 api_equal json:policy_types?ric=ricsim_g1_3 3 120
168 api_equal json:policy_types?ric=ricsim_g1_4 4 120
169 api_equal json:policy_types?ric=ricsim_g1_5 5 120
170 api_equal json:policy_types?ric=ricsim_g1_6 4 120
171 api_equal json:policy_types?ric=ricsim_g1_7 3 120
172 api_equal json:policy_types?ric=ricsim_g1_8 2 120
175 api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
176 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
177 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
178 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \
179 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \
180 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \
181 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \
182 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? "
184 if [ "$PMS_VERSION" == "V2" ]; then
185 cr_equal received_callbacks?id=ric-registration 16 120
186 cr_api_check_all_sync_events 200 ric-registration ricsim_g1_1 ricsim_g1_2 ricsim_g1_3 ricsim_g1_4 ricsim_g1_5 ricsim_g1_6 ricsim_g1_7 ricsim_g1_8
189 #Load config with all rics
190 consul_config_app ".consul_config_all.json"
192 api_equal json:rics 10 120
194 if [ "$PMS_VERSION" == "V2" ]; then
195 cr_equal received_callbacks?id=ric-registration 18 120
196 cr_api_check_all_sync_events 200 ric-registration ricsim_g1_9 ricsim_g1_10
199 sim_put_policy_type 201 ricsim_g1_9 5 testdata/OSC/sim_5.json
201 if [ "$PMS_VERSION" == "V2" ]; then
203 echo "Check the number of types in the agent for each ric"
204 api_equal json:policy-types?ric_id=ricsim_g1_1 1 120
205 api_equal json:policy-types?ric_id=ricsim_g1_2 2 120
206 api_equal json:policy-types?ric_id=ricsim_g1_3 3 120
207 api_equal json:policy-types?ric_id=ricsim_g1_4 4 120
208 api_equal json:policy-types?ric_id=ricsim_g1_5 5 120
209 api_equal json:policy-types?ric_id=ricsim_g1_6 4 120
210 api_equal json:policy-types?ric_id=ricsim_g1_7 3 120
211 api_equal json:policy-types?ric_id=ricsim_g1_8 2 120
212 api_equal json:policy-types?ric_id=ricsim_g1_9 1 120
213 api_equal json:policy-types?ric_id=ricsim_g1_10 0 120
216 echo "Check the number of types in the agent for each ric"
217 api_equal json:policy_types?ric=ricsim_g1_1 1 120
218 api_equal json:policy_types?ric=ricsim_g1_2 2 120
219 api_equal json:policy_types?ric=ricsim_g1_3 3 120
220 api_equal json:policy_types?ric=ricsim_g1_4 4 120
221 api_equal json:policy_types?ric=ricsim_g1_5 5 120
222 api_equal json:policy_types?ric=ricsim_g1_6 4 120
223 api_equal json:policy_types?ric=ricsim_g1_7 3 120
224 api_equal json:policy_types?ric=ricsim_g1_8 2 120
225 api_equal json:policy_types?ric=ricsim_g1_9 1 120
226 api_equal json:policy_types?ric=ricsim_g1_10 0 120
229 api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
230 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
231 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
232 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \
233 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \
234 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \
235 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \
236 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? \
237 ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \
238 ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? "
240 if [ "$PMS_VERSION" == "V2" ]; then
241 cr_equal received_callbacks?id=ric-registration 19 120
242 cr_api_check_all_sync_events 200 ric-registration ricsim_g1_9
245 #No policy type in sim #10
247 if [ "$PMS_VERSION" == "V2" ]; then
248 api_equal json:policy-types 5
250 api_equal json:policy_types 5
253 api_put_service 201 "serv1" 3600 "$CR_PATH/serv1"
255 if [ "$PMS_VERSION" == "V2" ]; then
256 notificationurl=$CR_PATH"/test"
263 # Load config with reduced number of rics
264 consul_config_app ".consul_config_initial.json"
266 api_equal json:rics 8 120
268 if [ "$PMS_VERSION" == "V2" ]; then
269 cr_equal received_callbacks?id=ric-registration 19 120
270 cr_api_check_all_sync_events 200 ric-registration EMPTY
273 if [ "$PMS_VERSION" == "V2" ]; then
274 echo "Check the number of types in the agent for each ric"
275 api_equal json:policy-types?ric_id=ricsim_g1_1 1 120
276 api_equal json:policy-types?ric_id=ricsim_g1_2 2 120
277 api_equal json:policy-types?ric_id=ricsim_g1_3 3 120
278 api_equal json:policy-types?ric_id=ricsim_g1_4 4 120
279 api_equal json:policy-types?ric_id=ricsim_g1_5 5 120
280 api_equal json:policy-types?ric_id=ricsim_g1_6 4 120
281 api_equal json:policy-types?ric_id=ricsim_g1_7 3 120
282 api_equal json:policy-types?ric_id=ricsim_g1_8 2 120
284 echo "Check the number of types in the agent for each ric"
285 api_equal json:policy_types?ric=ricsim_g1_1 1 120
286 api_equal json:policy_types?ric=ricsim_g1_2 2 120
287 api_equal json:policy_types?ric=ricsim_g1_3 3 120
288 api_equal json:policy_types?ric=ricsim_g1_4 4 120
289 api_equal json:policy_types?ric=ricsim_g1_5 5 120
290 api_equal json:policy_types?ric=ricsim_g1_6 4 120
291 api_equal json:policy_types?ric=ricsim_g1_7 3 120
292 api_equal json:policy_types?ric=ricsim_g1_8 2 120
295 api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
296 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
297 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
298 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \
299 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \
300 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \
301 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \
302 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? "
306 if [ "$PMS_VERSION" == "V2" ]; then
307 api_equal json:policy-instances 0
309 api_equal json:policy_ids 0
312 api_get_policy_types 404 ricsim_g1_9
314 # Load config with all rics
315 consul_config_app ".consul_config_all.json"
317 api_equal json:rics 10 120
319 if [ "$PMS_VERSION" == "V2" ]; then
320 echo "Check the number of types in the agent for each ric"
321 api_equal json:policy-types?ric_id=ricsim_g1_1 1 120
322 api_equal json:policy-types?ric_id=ricsim_g1_2 2 120
323 api_equal json:policy-types?ric_id=ricsim_g1_3 3 120
324 api_equal json:policy-types?ric_id=ricsim_g1_4 4 120
325 api_equal json:policy-types?ric_id=ricsim_g1_5 5 120
326 api_equal json:policy-types?ric_id=ricsim_g1_6 4 120
327 api_equal json:policy-types?ric_id=ricsim_g1_7 3 120
328 api_equal json:policy-types?ric_id=ricsim_g1_8 2 120
329 api_equal json:policy-types?ric_id=ricsim_g1_9 1 120
330 api_equal json:policy-types?ric_id=ricsim_g1_10 0 120
332 echo "Check the number of types in the agent for each ric"
333 api_equal json:policy_types?ric=ricsim_g1_1 1 120
334 api_equal json:policy_types?ric=ricsim_g1_2 2 120
335 api_equal json:policy_types?ric=ricsim_g1_3 3 120
336 api_equal json:policy_types?ric=ricsim_g1_4 4 120
337 api_equal json:policy_types?ric=ricsim_g1_5 5 120
338 api_equal json:policy_types?ric=ricsim_g1_6 4 120
339 api_equal json:policy_types?ric=ricsim_g1_7 3 120
340 api_equal json:policy_types?ric=ricsim_g1_8 2 120
341 api_equal json:policy_types?ric=ricsim_g1_9 1 120
342 api_equal json:policy_types?ric=ricsim_g1_10 0 120
345 api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
346 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
347 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
348 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \
349 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \
350 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \
351 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \
352 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? \
353 ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \
354 ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? "
358 if [ "$PMS_VERSION" == "V2" ]; then
359 api_equal json:policy-instances 0
361 api_equal json:policy_ids 0
364 sim_equal ricsim_g1_9 num_instances 0
367 sim_delete_policy_type 204 ricsim_g1_4 4
368 sim_delete_policy_type 204 ricsim_g1_5 4
369 sim_delete_policy_type 204 ricsim_g1_6 4
370 sim_delete_policy_type 204 ricsim_g1_7 4
374 if [ "$PMS_VERSION" == "V2" ]; then
375 api_equal json:policy-types?ric_id=ricsim_g1_1 1 120
376 api_equal json:policy-types?ric_id=ricsim_g1_2 2 120
377 api_equal json:policy-types?ric_id=ricsim_g1_3 3 120
378 api_equal json:policy-types?ric_id=ricsim_g1_4 3 120
379 api_equal json:policy-types?ric_id=ricsim_g1_5 4 120
380 api_equal json:policy-types?ric_id=ricsim_g1_6 3 120
381 api_equal json:policy-types?ric_id=ricsim_g1_7 2 120
382 api_equal json:policy-types?ric_id=ricsim_g1_8 2 120
383 api_equal json:policy-types?ric_id=ricsim_g1_9 1 120
384 api_equal json:policy-types?ric_id=ricsim_g1_10 0 120
386 api_equal json:policy_types?ric=ricsim_g1_1 1 120
387 api_equal json:policy_types?ric=ricsim_g1_2 2 120
388 api_equal json:policy_types?ric=ricsim_g1_3 3 120
389 api_equal json:policy_types?ric=ricsim_g1_4 3 120
390 api_equal json:policy_types?ric=ricsim_g1_5 4 120
391 api_equal json:policy_types?ric=ricsim_g1_6 3 120
392 api_equal json:policy_types?ric=ricsim_g1_7 2 120
393 api_equal json:policy_types?ric=ricsim_g1_8 2 120
394 api_equal json:policy_types?ric=ricsim_g1_9 1 120
395 api_equal json:policy_types?ric=ricsim_g1_10 0 120
398 api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
399 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
400 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
401 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3:???? \
402 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,5:???? \
403 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,5:???? \
404 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,5:???? \
405 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? \
406 ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \
407 ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? "
409 sim_delete_policy_type 204 ricsim_g1_8 4
411 if [ "$PMS_VERSION" == "V2" ]; then
412 api_equal json:policy-types?ric_id=ricsim_g1_8 1 120
414 api_equal json:policy_types?ric=ricsim_g1_8 1 120
417 api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
418 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
419 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
420 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3:???? \
421 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,5:???? \
422 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,5:???? \
423 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,5:???? \
424 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:5:???? \
425 ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \
426 ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? "
430 check_policy_agent_logs
431 if [[ $interface = *"SDNC"* ]]; then
435 store_logs ${interface}
440 #### TEST COMPLETE ####
445 auto_clean_containers