Removal of older test profiles
[nonrtric.git] / test / auto-test / FTC_HELM_E_RELEASE.sh
1 #!/usr/bin/env bash
2
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
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
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=================================================
18 #
19
20 TC_ONELINE_DESCR="Sanity test of Non-RT RIC Helm chats - all components - E-RELEASE"
21 # This script requires the helm charts for nonrtric, a1simulator and a1controller are installed
22 # There should be 2 simulator of each A1 interface version started
23
24 #App names to include in the test when running docker, space separated list
25 DOCKER_INCLUDED_IMAGES="" # Not used -  KUBE only test script
26
27 #App names to include in the test when running kubernetes, space separated list
28 KUBE_INCLUDED_IMAGES=" MR DMAAPMR CR  PRODSTUB KUBEPROXY KAFKAPC"
29 #Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
30 KUBE_PRESTARTED_IMAGES=" A1PMS RICSIM CP ICS RC SDNC DMAAPMED DMAAPADP"
31
32 #Ignore image in DOCKER_INCLUDED_IMAGES, KUBE_INCLUDED_IMAGES if
33 #the image is not configured in the supplied env_file
34 #Used for images not applicable to all supported profile
35 CONDITIONALLY_IGNORED_IMAGES=""
36
37 #Supported test environment profiles
38 SUPPORTED_PROFILES="ORAN-E-RELEASE"
39 #Supported run modes
40 SUPPORTED_RUNMODES="KUBE"
41
42 . ../common/testcase_common.sh $@
43
44 setup_testenvironment
45
46 #### TEST BEGIN ####
47
48 use_mr_https
49 use_cr_https
50 use_a1pms_rest_https
51 use_sdnc_https
52 use_simulator_https
53 use_ics_rest_https
54 use_prod_stub_https
55 use_dmaapmed_https
56
57 if [ $ICS_VERSION == "V1-1" ]; then
58     use_rapp_catalogue_http # https not yet supported
59 else
60     ########################################use_rapp_catalogue_https
61     use_rapp_catalogue_http
62 fi
63
64 echo -e "$RED CHECK WHY RC HTTPS DOES NOT WORK $ERED"
65
66 ###############################use_control_panel_https
67 use_control_panel_http
68
69 clean_environment
70
71 ics_kube_pvc_reset
72
73 a1pms_kube_pvc_reset
74
75 start_kube_proxy
76
77 STD_NUM_RICS=2
78 OSC_NUM_RICS=2
79
80 start_ric_simulators a1-sim-osc $STD_NUM_RICS OSC_2.1.0
81 echo " RIC MAPPING a1-sim-osc-0 : ric1"
82 echo " RIC MAPPING a1-sim-osc-1 : ric2"
83
84 start_ric_simulators a1-sim-std $STD_NUM_RICS STD_1.1.3
85 echo " RIC MAPPING a1-sim-std-0 : ric3"
86 echo " RIC MAPPING a1-sim-std-1 : ric4"
87
88 start_ric_simulators a1-sim-std2 $STD_NUM_RICS STD_2.0.0
89 echo " RIC MAPPING a1-sim-std2-0 : ric5"
90 echo " RIC MAPPING a1-sim-std2-1 : ric6"
91
92 start_mr    "$MR_READ_TOPIC"  "/events" "users/policy-agent" \
93             "$MR_WRITE_TOPIC" "/events" "users/mr-stub" \
94             "unauthenticated.dmaapmed.json" "/events" "dmaapmediatorproducer/STD_Fault_Messages" \
95             "unauthenticated.dmaapadp.json" "/events" "dmaapadapterproducer/msgs"
96
97 start_kafkapc
98
99 kafkapc_api_create_topic 201 "unauthenticated.dmaapadp_kafka.text" "text/plain"
100
101 kafkapc_api_start_sending 200 "unauthenticated.dmaapadp_kafka.text"
102
103 start_control_panel
104
105 start_sdnc
106
107 start_a1pms
108
109 start_cr 1
110
111 start_prod_stub
112
113 start_ics NOPROXY
114
115 set_ics_trace
116
117 start_rapp_catalogue
118
119 set_a1pms_trace
120
121 #### Test RAPP Catalogue ####
122
123 rapp_cat_api_get_services 200 EMPTY
124
125 rapp_cat_api_put_service 201 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
126
127 rapp_cat_api_get_services 200 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
128
129 #Check the number of services
130 rc_equal json:services 1
131
132 sleep_wait 120 "Let A1PMS cofiguration take effect"
133
134 a1_a1pms_api_get_status 200
135
136 #### Test Policy Management Service ####
137
138 # Print the A1 version for STD 1.1.X
139 for ((i=0; i<$STD_NUM_RICS; i++))
140 do
141     sim_print "a1-sim-std-"$i interface
142 done
143
144 # Print the A1 version for STD 2.0.X
145 for ((i=0; i<$STD_NUM_RICS; i++))
146 do
147    sim_print "a1-sim-std2-"$i interface
148 done
149
150 # Print the A1 version for OSC 2.1.X
151 for ((i=0; i<$OSC_NUM_RICS; i++))
152 do
153     sim_print "a1-sim-osc-"$i interface
154 done
155
156 # Check the number of policies in STD and STD2
157 for ((i=0; i<$STD_NUM_RICS; i++))
158 do
159     sim_equal "a1-sim-std-"$i num_instances 0
160     sim_equal "a1-sim-std2-"$i num_instances 0
161 done
162
163 # Check the number of policies in OSC
164 for ((i=0; i<$STD_NUM_RICS; i++))
165 do
166     sim_equal "a1-sim-osc-"$i num_instances 0
167 done
168
169 #Check the number of schemas
170 a1pms_equal json:policy-types 1
171
172 # Load the polictypes in STD 2
173 for ((i=0; i<$STD_NUM_RICS; i++))
174 do
175    sim_put_policy_type 201 "a1-sim-std2-"$i STD_QOS_0_2_0 testdata/STD2/sim_qos.json
176    sim_put_policy_type 201 "a1-sim-std2-"$i STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
177 done
178
179 # Load the polictypes in OSC
180 for ((i=0; i<$OSC_NUM_RICS; i++))
181 do
182     sim_put_policy_type 201 "a1-sim-osc-"$i 1 testdata/OSC/sim_1.json
183     sim_put_policy_type 201 "a1-sim-osc-"$i 2 testdata/OSC/sim_2.json
184 done
185
186 # Check that all rics are synced in
187 a1pms_equal json:rics 6 300
188
189 #Check the number of schemas and the individual schemas
190 a1pms_equal json:policy-types 5 300
191
192 for ((i=0; i<$STD_NUM_RICS; i++))
193 do
194     ricid=$((3+$i))
195     a1pms_equal json:policy-types?ric_id=ric$ricid 1 120
196 done
197
198 for ((i=0; i<$STD_NUM_RICS; i++))
199 do
200    ricid=$((5+$i))
201    a1pms_equal json:policy-types?ric_id=ric$ricid 2 120
202 done
203
204 for ((i=0; i<$OSC_NUM_RICS; i++))
205 do
206     ricid=$((1+$i))
207     a1pms_equal json:policy-types?ric_id=ric$ricid 2 120
208 done
209
210 #Check the schemas in STD 2
211 for ((i=0; i<$OSC_NUM_RICS; i++))
212 do
213    ricid=$((5+$i))
214    a1_a1pms_api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-a1pms-modified.json
215    a1_a1pms_api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-a1pms-modified.json
216 done
217
218 # Check the schemas in OSC
219 for ((i=0; i<$OSC_NUM_RICS; i++))
220 do
221     a1_a1pms_api_get_policy_type 200 1 testdata/OSC/1-a1pms-modified.json
222     a1_a1pms_api_get_policy_type 200 2 testdata/OSC/2-a1pms-modified.json
223 done
224
225 a1pms_equal json:policy-types 5 120
226
227 a1pms_equal json:policies 0
228
229 a1pms_equal json:policy-instances 0
230
231 a1pms_api_put_service 201 "Emergency-response-app" 0 "$CR_SERVICE_APP_PATH_0/ER-app"
232
233 # Create policies in STD
234 for ((i=0; i<$STD_NUM_RICS; i++))
235 do
236     ricid=$((3+$i))
237     generate_policy_uuid
238     a1pms_api_put_policy 201 "Emergency-response-app" ric$ricid NOTYPE $((1100+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH_0/"std2" testdata/STD/pi1_template.json 1
239     generate_policy_uuid
240     a1pms_api_put_policy 201 "Emergency-response-app" ric$ricid NOTYPE $((1200+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH_0/"std2" testdata/STD/pi1_template.json 1
241 done
242
243 #Create policies in STD 2
244 for ((i=0; i<$STD_NUM_RICS; i++))
245 do
246    ricid=$((5+$i))
247    generate_policy_uuid
248    a1pms_api_put_policy 201 "Emergency-response-app" ric$ricid STD_QOS_0_2_0 $((2100+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH_0/"std2" testdata/STD2/pi_qos_template.json 1
249    generate_policy_uuid
250    a1pms_api_put_policy 201 "Emergency-response-app" ric$ricid STD_QOS2_0.1.0 $((2200+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH_0/"std2" testdata/STD2/pi_qos2_template.json 1
251 done
252
253 # Create policies in OSC
254 for ((i=0; i<$OSC_NUM_RICS; i++))
255 do
256     ricid=$((1+$i))
257     generate_policy_uuid
258     a1pms_api_put_policy 201 "Emergency-response-app" ric$ricid 1 $((3100+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH_0/"osc" testdata/OSC/pi1_template.json 1
259     generate_policy_uuid
260     a1pms_api_put_policy 201 "Emergency-response-app" ric$ricid 2 $((3200+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH_0/"osc" testdata/OSC/pi2_template.json 1
261 done
262
263
264 # Check the number of policies in STD and STD2
265 for ((i=0; i<$STD_NUM_RICS; i++))
266 do
267     sim_equal "a1-sim-std-"$i num_instances 2
268     sim_equal "a1-sim-std2-"$i num_instances 2
269 done
270
271 # Check the number of policies in OSC
272 for ((i=0; i<$STD_NUM_RICS; i++))
273 do
274     sim_equal "a1-sim-osc-"$i num_instances 2
275 done
276
277 stop_a1pms
278
279 start_stopped_a1pms
280
281 # Check A1PMS state after restart
282
283 sleep_wait 200
284
285 a1pms_equal json:policy-types 5 120
286
287 a1pms_equal json:policies 12
288
289 a1pms_equal json:policy-instances 12
290
291 # Check the number of policies in STD and STD2
292 for ((i=0; i<$STD_NUM_RICS; i++))
293 do
294     sim_equal "a1-sim-std-"$i num_instances 2
295     sim_equal "a1-sim-std2-"$i num_instances 2
296 done
297
298 # Check the number of policies in OSC
299 for ((i=0; i<$STD_NUM_RICS; i++))
300 do
301     sim_equal "a1-sim-osc-"$i num_instances 2
302 done
303
304 cr_api_reset 0   # Reset CR to count new events
305
306 echo "ADD EVENT/STATUS CHECK"
307 echo "ADD MR CHECK"
308
309 FLAT_A1_EI="1"
310
311 ics_api_admin_reset
312
313 CB_JOB="$PROD_STUB_SERVICE_PATH$PROD_STUB_JOB_CALLBACK"
314 CB_SV="$PROD_STUB_SERVICE_PATH$PROD_STUB_SUPERVISION_CALLBACK"
315 TARGET1="$RIC_SIM_HTTPX://a1-sim-std2-0.a1-sim:$RIC_SIM_PORT/datadelivery"
316 TARGET2="$RIC_SIM_HTTPX://a1-sim-std2-1.a1-sim:$RIC_SIM_PORT/datadelivery"
317
318 STATUS1="$CR_SERVICE_APP_PATH_0/job1-status"
319 STATUS2="$CR_SERVICE_APP_PATH_0/job2-status"
320
321 prodstub_arm_producer 200 prod-a
322 prodstub_arm_type 200 prod-a type1
323 prodstub_arm_job_create 200 prod-a job1
324 prodstub_arm_job_create 200 prod-a job2
325
326
327 ### ics status
328 ics_api_service_status 200
329
330 ## Setup prod-a
331 if [ $ICS_VERSION == "V1-1" ]; then
332     ics_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ics/ei-type-1.json
333
334     ics_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ics/ei-type-1.json
335 else
336     ics_api_edp_put_type_2 201 type1 testdata/ics/ei-type-1.json
337     ics_api_edp_get_type_2 200 type1
338
339     ics_api_edp_get_type_ids 200 type1
340
341     ics_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
342     ics_api_edp_put_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
343 fi
344
345 ics_api_edp_get_producer_status 200 prod-a ENABLED
346
347
348 ## Create a job for prod-a
349 ## job1 - prod-a
350 if [  -z "$FLAT_A1_EI" ]; then
351     ics_api_a1_put_job 201 type1 job1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json
352 else
353     ics_api_a1_put_job 201 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ics/job-template.json
354 fi
355
356 # Check the job data in the producer
357 if [ $ICS_VERSION == "V1-1" ]; then
358     prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json
359 else
360     if [[ "$ICS_FEATURE3LEVEL" == *"INFO-TYPES"* ]]; then
361         prodstub_check_jobdata_3 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json
362     else
363         prodstub_check_jobdata_2 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json
364     fi
365 fi
366
367 ## Create a second job for prod-a
368 ## job2 - prod-a
369 if [  -z "$FLAT_A1_EI" ]; then
370     ics_api_a1_put_job 201 type1 job2 $TARGET2 ricsim_g3_2 testdata/ics/job-template.json
371 else
372     ics_api_a1_put_job 201 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ics/job-template.json
373 fi
374
375 # Check the job data in the producer
376 if [ $ICS_VERSION == "V1-1" ]; then
377     prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ics/job-template.json
378 else
379     if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
380         prodstub_check_jobdata_3 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ics/job-template.json
381     else
382         prodstub_check_jobdata_2 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ics/job-template.json
383     fi
384 fi
385
386 # Dmaap mediator and adapter
387 start_dmaapadp NOPROXY $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_CONFIG_FILE_TEMPLATE $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_DATA_FILE
388
389 start_dmaapmed NOPROXY $SIM_GROUP/$DMAAP_MED_COMPOSE_DIR/$DMAAP_MED_HOST_DATA_FILE
390
391 ics_equal json:data-producer/v1/info-producers 3 120
392
393 ics_equal json:data-producer/v1/info-types 4 30
394
395 ics_api_idc_get_type_ids 200 ExampleInformationType ExampleInformationTypeKafka STD_Fault_Messages type1
396
397 ics_api_edp_get_producer_ids_2 200 NOTYPE prod-a DmaapGenericInfoProducer DMaaP_Mediator_Producer
398
399 NUM_JOBS=1
400
401 for ((i=1; i<=$NUM_JOBS; i++))
402 do
403     ics_api_idc_put_job 201 jobx$i STD_Fault_Messages $CR_SERVICE_MR_PATH_0/jobx-data$i info-ownerx$i $CR_SERVICE_MR_PATH_0/job_status_info-ownerx$i testdata/dmaap-adapter/job-template1.json
404 done
405
406 for ((i=1; i<=$NUM_JOBS; i++))
407 do
408     ics_api_idc_put_job 201 joby$i ExampleInformationType $CR_SERVICE_MR_PATH_0/joby-data$i info-ownery$i $CR_SERVICE_MR_PATH_0/job_status_info-ownery$i testdata/dmaap-adapter/job-template1.json
409     ics_api_idc_put_job 201 jobz$i ExampleInformationTypeKafka $CR_SERVICE_MR_PATH_0/jobz-data$i info-ownerz$i $CR_SERVICE_MR_PATH_0/job_status_info-ownerz$i testdata/dmaap-adapter/job-template-1-kafka.json
410 done
411
412 for ((i=1; i<=$NUM_JOBS; i++))
413 do
414     ics_api_a1_get_job_status 200 jobx$i ENABLED 30
415     ics_api_a1_get_job_status 200 joby$i ENABLED 30
416     ics_api_a1_get_job_status 200 jobz$i ENABLED 30
417 done
418
419 sleep_wait 30 # Wait for mediator to listening to kafka
420
421 mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-0"}'
422 mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-1"}'
423 mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-2"}'
424 mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-3"}'
425 kafkapc_api_post_msg 200 "unauthenticated.dmaapadp_kafka.text" "text/plain" 'Message-------4'
426 kafkapc_api_post_msg 200 "unauthenticated.dmaapadp_kafka.text" "text/plain" 'Message-------6'
427
428
429 cr_equal 0 received_callbacks $(($NUM_JOBS*2*3)) 200
430 for ((i=1; i<=$NUM_JOBS; i++))
431 do
432     cr_equal 0 received_callbacks?id=jobx-data$i 2
433     cr_equal 0 received_callbacks?id=joby-data$i 2
434     cr_equal 0 received_callbacks?id=jobz-data$i 2
435 done
436
437 for ((i=1; i<=$NUM_JOBS; i++))
438 do
439     cr_api_check_single_genric_json_event 200 0 jobx-data$i '{"msg":"msg-0"}'
440     cr_api_check_single_genric_json_event 200 0 jobx-data$i '{"msg":"msg-2"}'
441     cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-1"}'
442     cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-3"}'
443     cr_api_check_single_genric_json_event 200 0 jobz-data$i 'Message-------4'
444     cr_api_check_single_genric_json_event 200 0 jobz-data$i 'Message-------6'
445 done
446
447
448 stop_ics
449
450 start_stopped_ics
451
452 # Check ICS status after restart
453
454 if [  -z "$FLAT_A1_EI" ]; then
455     ics_api_a1_get_job_status 200 type1 job1 DISABLED
456     ics_api_a1_get_job_status 200 type1 job2 DISABLED
457 else
458     ics_api_a1_get_job_status 200 job1 DISABLED
459     ics_api_a1_get_job_status 200 job2 DISABLED
460 fi
461
462 check_a1pms_logs
463 check_ics_logs
464 check_sdnc_logs
465
466 #### TEST COMPLETE ####
467
468 store_logs          END
469
470 print_result