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="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
24 #App names to include in the test when running docker, space separated list
25 DOCKER_INCLUDED_IMAGES="" # Not used - KUBE only test script
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=" PA RICSIM CP ICS RC SDNC DMAAPMED DMAAPADP"
32 #Supported test environment profiles
33 SUPPORTED_PROFILES="ORAN-E-RELEASE"
35 SUPPORTED_RUNMODES="KUBE"
37 . ../common/testcase_common.sh $@
52 if [ $ICS_VERSION == "V1-1" ]; then
53 use_rapp_catalogue_http # https not yet supported
55 ########################################use_rapp_catalogue_https
56 use_rapp_catalogue_http
59 echo -e "$RED CHECK WHY RC HTTPS DOES NOT WORK $ERED"
61 ###############################use_control_panel_https
62 use_control_panel_http
64 if [ "$PMS_VERSION" == "V1" ]; then
65 echo "PMS VERSION 2 (V2) is required"
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"
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"
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"
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"
99 kafkapc_api_create_topic 201 "unauthenticated.dmaapadp_kafka.text" "text/plain"
101 kafkapc_api_start_sending 200 "unauthenticated.dmaapadp_kafka.text"
121 #### Test RAPP Catalogue ####
123 rapp_cat_api_get_services 200 EMPTY
125 rapp_cat_api_put_service 201 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
127 rapp_cat_api_get_services 200 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
129 #Check the number of services
130 rc_equal json:services 1
134 #### Test Policy Management Service ####
136 # Print the A1 version for STD 1.1.X
137 for ((i=0; i<$STD_NUM_RICS; i++))
139 sim_print "a1-sim-std-"$i interface
142 # Print the A1 version for STD 2.0.X
143 for ((i=0; i<$STD_NUM_RICS; i++))
145 sim_print "a1-sim-std2-"$i interface
148 # Print the A1 version for OSC 2.1.X
149 for ((i=0; i<$OSC_NUM_RICS; i++))
151 sim_print "a1-sim-osc-"$i interface
154 # Check the number of policies in STD and STD2
155 for ((i=0; i<$STD_NUM_RICS; i++))
157 sim_equal "a1-sim-std-"$i num_instances 0
158 sim_equal "a1-sim-std2-"$i num_instances 0
161 # Check the number of policies in OSC
162 for ((i=0; i<$STD_NUM_RICS; i++))
164 sim_equal "a1-sim-osc-"$i num_instances 0
167 #Check the number of schemas
168 api_equal json:policy-types 1
170 # Load the polictypes in STD 2
171 for ((i=0; i<$STD_NUM_RICS; i++))
173 sim_put_policy_type 201 "a1-sim-std2-"$i STD_QOS_0_2_0 testdata/STD2/sim_qos.json
174 sim_put_policy_type 201 "a1-sim-std2-"$i STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
177 # Load the polictypes in OSC
178 for ((i=0; i<$OSC_NUM_RICS; i++))
180 sim_put_policy_type 201 "a1-sim-osc-"$i 1 testdata/OSC/sim_1.json
181 sim_put_policy_type 201 "a1-sim-osc-"$i 2 testdata/OSC/sim_2.json
184 # Check that all rics are synced in
185 api_equal json:rics 6 300
187 #Check the number of schemas and the individual schemas
188 api_equal json:policy-types 5 300
190 for ((i=0; i<$STD_NUM_RICS; i++))
193 api_equal json:policy-types?ric_id=ric$ricid 1 120
196 for ((i=0; i<$STD_NUM_RICS; i++))
199 api_equal json:policy-types?ric_id=ric$ricid 2 120
202 for ((i=0; i<$OSC_NUM_RICS; i++))
205 api_equal json:policy-types?ric_id=ric$ricid 2 120
208 #Check the schemas in STD 2
209 for ((i=0; i<$OSC_NUM_RICS; i++))
212 api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-agent-modified.json
213 api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-agent-modified.json
216 # Check the schemas in OSC
217 for ((i=0; i<$OSC_NUM_RICS; i++))
219 api_get_policy_type 200 1 testdata/OSC/1-agent-modified.json
220 api_get_policy_type 200 2 testdata/OSC/2-agent-modified.json
223 if [ "$PMS_VERSION" == "V2" ]; then
225 api_equal json:policy-types 5 120
227 api_equal json:policies 0
229 api_equal json:policy-instances 0
232 api_equal json:policy_schemas 5 120
234 api_equal json:policy_types 5
236 api_equal json:policies 0
238 api_equal json:policy_ids 0
241 api_put_service 201 "Emergency-response-app" 0 "$CR_SERVICE_APP_PATH_0/ER-app"
243 # Create policies in STD
244 for ((i=0; i<$STD_NUM_RICS; i++))
248 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
250 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
253 #Create policies in STD 2
254 for ((i=0; i<$STD_NUM_RICS; i++))
258 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
260 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
263 # Create policies in OSC
264 for ((i=0; i<$OSC_NUM_RICS; i++))
268 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
270 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
274 # Check the number of policies in STD and STD2
275 for ((i=0; i<$STD_NUM_RICS; i++))
277 sim_equal "a1-sim-std-"$i num_instances 2
278 sim_equal "a1-sim-std2-"$i num_instances 2
281 # Check the number of policies in OSC
282 for ((i=0; i<$STD_NUM_RICS; i++))
284 sim_equal "a1-sim-osc-"$i num_instances 2
289 start_stopped_policy_agent
291 # Check PMS state after restart
295 if [ "$PMS_VERSION" == "V2" ]; then
297 api_equal json:policy-types 5 120
299 api_equal json:policies 12
301 api_equal json:policy-instances 12
304 api_equal json:policy_schemas 5 120
306 api_equal json:policy_types 5
308 api_equal json:policies 12
310 api_equal json:policy_ids 12
313 # Check the number of policies in STD and STD2
314 for ((i=0; i<$STD_NUM_RICS; i++))
316 sim_equal "a1-sim-std-"$i num_instances 2
317 sim_equal "a1-sim-std2-"$i num_instances 2
320 # Check the number of policies in OSC
321 for ((i=0; i<$STD_NUM_RICS; i++))
323 sim_equal "a1-sim-osc-"$i num_instances 2
326 cr_api_reset 0 # Reset CR to count new events
328 echo "ADD EVENT/STATUS CHECK"
335 CB_JOB="$PROD_STUB_SERVICE_PATH$PROD_STUB_JOB_CALLBACK"
336 CB_SV="$PROD_STUB_SERVICE_PATH$PROD_STUB_SUPERVISION_CALLBACK"
337 TARGET1="$RIC_SIM_HTTPX://a1-sim-std2-0.a1-sim:$RIC_SIM_PORT/datadelivery"
338 TARGET2="$RIC_SIM_HTTPX://a1-sim-std2-1.a1-sim:$RIC_SIM_PORT/datadelivery"
340 STATUS1="$CR_SERVICE_APP_PATH_0/job1-status"
341 STATUS2="$CR_SERVICE_APP_PATH_0/job2-status"
343 prodstub_arm_producer 200 prod-a
344 prodstub_arm_type 200 prod-a type1
345 prodstub_arm_job_create 200 prod-a job1
346 prodstub_arm_job_create 200 prod-a job2
350 ics_api_service_status 200
353 if [ $ICS_VERSION == "V1-1" ]; then
354 ics_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ics/ei-type-1.json
356 ics_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ics/ei-type-1.json
358 ics_api_edp_put_type_2 201 type1 testdata/ics/ei-type-1.json
359 ics_api_edp_get_type_2 200 type1
360 ics_api_edp_get_type_ids 200 STD_Fault_Messages ExampleInformationTypeKafka ExampleInformationType type1
362 ics_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
363 ics_api_edp_put_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
366 ics_api_edp_get_producer_status 200 prod-a ENABLED
369 ## Create a job for prod-a
371 if [ -z "$FLAT_A1_EI" ]; then
372 ics_api_a1_put_job 201 type1 job1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json
374 ics_api_a1_put_job 201 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ics/job-template.json
377 # Check the job data in the producer
378 if [ $ICS_VERSION == "V1-1" ]; then
379 prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json
381 if [[ "$ICS_FEATURE3LEVEL" == *"INFO-TYPES"* ]]; then
382 prodstub_check_jobdata_3 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json
384 prodstub_check_jobdata_2 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json
388 ## Create a second job for prod-a
390 if [ -z "$FLAT_A1_EI" ]; then
391 ics_api_a1_put_job 201 type1 job2 $TARGET2 ricsim_g3_2 testdata/ics/job-template.json
393 ics_api_a1_put_job 201 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ics/job-template.json
396 # Check the job data in the producer
397 if [ $ICS_VERSION == "V1-1" ]; then
398 prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ics/job-template.json
400 if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
401 prodstub_check_jobdata_3 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ics/job-template.json
403 prodstub_check_jobdata_2 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ics/job-template.json
407 # Dmaap mediator and adapter
408 start_dmaapadp NOPROXY $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_CONFIG_FILE $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_DATA_FILE
410 start_dmaapmed NOPROXY $SIM_GROUP/$DMAAP_MED_COMPOSE_DIR/$DMAAP_MED_DATA_FILE
412 ics_equal json:data-producer/v1/info-producers 3 120
414 ics_api_idc_get_type_ids 200 ExampleInformationType ExampleInformationTypeKafka STD_Fault_Messages type-1
416 ics_api_edp_get_producer_ids_2 200 NOTYPE prod-a DmaapGenericInfoProducer DMaaP_Mediator_Producer
420 for ((i=1; i<=$NUM_JOBS; i++))
422 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-template.json
425 for ((i=1; i<=$NUM_JOBS; i++))
427 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-template.json
428 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
431 for ((i=1; i<=$NUM_JOBS; i++))
433 ics_api_a1_get_job_status 200 jobx$i ENABLED 30
434 ics_api_a1_get_job_status 200 joby$i ENABLED 30
435 ics_api_a1_get_job_status 200 jobz$i ENABLED 30
438 mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-0"}'
439 mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-1"}'
440 mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-2"}'
441 mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-3"}'
442 kafkapc_api_post_msg 200 "unauthenticated.dmaapadp_kafka.text" "text/plain" 'Message-------4'
443 kafkapc_api_post_msg 200 "unauthenticated.dmaapadp_kafka.text" "text/plain" 'Message-------6'
446 cr_equal 0 received_callbacks $(($NUM_JOBS*2*3)) 200
447 for ((i=1; i<=$NUM_JOBS; i++))
449 cr_equal 0 received_callbacks?id=jobx-data$i 2
450 cr_equal 0 received_callbacks?id=joby-data$i 2
451 cr_equal 0 received_callbacks?id=jobz-data$i 2
454 for ((i=1; i<=$NUM_JOBS; i++))
456 cr_api_check_single_genric_json_event 200 0 jobx-data$i '{"msg":"msg-0"}'
457 cr_api_check_single_genric_json_event 200 0 jobx-data$i '{"msg":"msg-2"}'
458 cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-1"}'
459 cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-3"}'
460 cr_api_check_single_genric_json_event 200 0 jobz-data$i 'Message-------4'
461 cr_api_check_single_genric_json_event 200 0 jobz-data$i 'Message-------6'
469 # Check ICS status after restart
471 if [ -z "$FLAT_A1_EI" ]; then
472 ics_api_a1_get_job_status 200 type1 job1 DISABLED
473 ics_api_a1_get_job_status 200 type1 job2 DISABLED
475 ics_api_a1_get_job_status 200 job1 DISABLED
476 ics_api_a1_get_job_status 200 job2 DISABLED
479 check_policy_agent_logs
483 #### TEST COMPLETE ####