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 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 CR PRODSTUB KUBEPROXY"
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 ECS RC SDNC DMAAPMED DMAAPADP"
32 #Supported test environment profiles
33 SUPPORTED_PROFILES="ORAN-E-RELEASE"
35 SUPPORTED_RUNMODES="KUBE"
37 . ../common/testcase_common.sh $@
38 . ../common/agent_api_functions.sh
39 . ../common/ricsimulator_api_functions.sh
40 . ../common/ecs_api_functions.sh
41 . ../common/prodstub_api_functions.sh
42 . ../common/cr_api_functions.sh
43 . ../common/rapp_catalogue_api_functions.sh
44 . ../common/mr_api_functions.sh
45 . ../common/control_panel_api_functions.sh
46 . ../common/controller_api_functions.sh
47 . ../common/kube_proxy_api_functions.sh
48 . ../common/dmaapmed_api_functions.sh
49 . ../common/dmaapadp_api_functions.sh
55 use_mr_http #MR only supports http?
63 if [ $ECS_VERSION == "V1-1" ]; then
64 use_rapp_catalogue_http # https not yet supported
66 ########################################use_rapp_catalogue_https
67 use_rapp_catalogue_http
70 echo -e "$RED CHECK WHY RC HTTPS DOES NOT WORK $ERED"
72 ###############################use_control_panel_https
73 use_control_panel_http
75 if [ "$PMS_VERSION" == "V1" ]; then
76 echo "PMS VERSION 2 (V2) is required"
91 start_ric_simulators a1-sim-osc $STD_NUM_RICS OSC_2.1.0
92 echo " RIC MAPPING a1-sim-osc-0 : ric1"
93 echo " RIC MAPPING a1-sim-osc-1 : ric2"
95 start_ric_simulators a1-sim-std $STD_NUM_RICS STD_1.1.3
96 echo " RIC MAPPING a1-sim-std-0 : ric3"
97 echo " RIC MAPPING a1-sim-std-1 : ric4"
99 start_ric_simulators a1-sim-std2 $STD_NUM_RICS STD_2.0.0
100 echo " RIC MAPPING a1-sim-std2-0 : ric5"
101 echo " RIC MAPPING a1-sim-std2-1 : ric6"
123 #### Test RAPP Catalogue ####
125 rapp_cat_api_get_services 200 EMPTY
127 rapp_cat_api_put_service 201 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
129 rapp_cat_api_get_services 200 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
131 #Check the number of services
132 rc_equal json:services 1
136 #### Test Policy Management Service ####
138 # Print the A1 version for STD 1.1.X
139 for ((i=0; i<$STD_NUM_RICS; i++))
141 sim_print "a1-sim-std-"$i interface
144 # Print the A1 version for STD 2.0.X
145 for ((i=0; i<$STD_NUM_RICS; i++))
147 sim_print "a1-sim-std2-"$i interface
150 # Print the A1 version for OSC 2.1.X
151 for ((i=0; i<$OSC_NUM_RICS; i++))
153 sim_print "a1-sim-osc-"$i interface
156 # Check the number of policies in STD and STD2
157 for ((i=0; i<$STD_NUM_RICS; i++))
159 sim_equal "a1-sim-std-"$i num_instances 0
160 sim_equal "a1-sim-std2-"$i num_instances 0
163 # Check the number of policies in OSC
164 for ((i=0; i<$STD_NUM_RICS; i++))
166 sim_equal "a1-sim-osc-"$i num_instances 0
169 #Check the number of schemas
170 api_equal json:policy-types 1
172 # Load the polictypes in STD 2
173 for ((i=0; i<$STD_NUM_RICS; i++))
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
179 # Load the polictypes in OSC
180 for ((i=0; i<$OSC_NUM_RICS; i++))
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
186 # Check that all rics are synced in
187 api_equal json:rics 6 300
189 #Check the number of schemas and the individual schemas
190 api_equal json:policy-types 5 300
192 for ((i=0; i<$STD_NUM_RICS; i++))
195 api_equal json:policy-types?ric_id=ric$ricid 1 120
198 for ((i=0; i<$STD_NUM_RICS; i++))
201 api_equal json:policy-types?ric_id=ric$ricid 2 120
204 for ((i=0; i<$OSC_NUM_RICS; i++))
207 api_equal json:policy-types?ric_id=ric$ricid 2 120
210 #Check the schemas in STD 2
211 for ((i=0; i<$OSC_NUM_RICS; i++))
214 api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-agent-modified.json
215 api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-agent-modified.json
218 # Check the schemas in OSC
219 for ((i=0; i<$OSC_NUM_RICS; i++))
221 api_get_policy_type 200 1 testdata/OSC/1-agent-modified.json
222 api_get_policy_type 200 2 testdata/OSC/2-agent-modified.json
225 if [ "$PMS_VERSION" == "V2" ]; then
227 api_equal json:policy-types 5 120
229 api_equal json:policies 0
231 api_equal json:policy-instances 0
234 api_equal json:policy_schemas 5 120
236 api_equal json:policy_types 5
238 api_equal json:policies 0
240 api_equal json:policy_ids 0
243 api_put_service 201 "Emergency-response-app" 0 "$CR_SERVICE_APP_PATH/ER-app"
245 # Create policies in STD
246 for ((i=0; i<$STD_NUM_RICS; i++))
250 api_put_policy 201 "Emergency-response-app" ric$ricid NOTYPE $((1100+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH/"std2" testdata/STD/pi1_template.json 1
252 api_put_policy 201 "Emergency-response-app" ric$ricid NOTYPE $((1200+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH/"std2" testdata/STD/pi1_template.json 1
255 #Create policies in STD 2
256 for ((i=0; i<$STD_NUM_RICS; i++))
260 api_put_policy 201 "Emergency-response-app" ric$ricid STD_QOS_0_2_0 $((2100+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH/"std2" testdata/STD2/pi_qos_template.json 1
262 api_put_policy 201 "Emergency-response-app" ric$ricid STD_QOS2_0.1.0 $((2200+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH/"std2" testdata/STD2/pi_qos2_template.json 1
265 # Create policies in OSC
266 for ((i=0; i<$OSC_NUM_RICS; i++))
270 api_put_policy 201 "Emergency-response-app" ric$ricid 1 $((3100+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH/"osc" testdata/OSC/pi1_template.json 1
272 api_put_policy 201 "Emergency-response-app" ric$ricid 2 $((3200+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH/"osc" testdata/OSC/pi2_template.json 1
276 # Check the number of policies in STD and STD2
277 for ((i=0; i<$STD_NUM_RICS; i++))
279 sim_equal "a1-sim-std-"$i num_instances 2
280 sim_equal "a1-sim-std2-"$i num_instances 2
283 # Check the number of policies in OSC
284 for ((i=0; i<$STD_NUM_RICS; i++))
286 sim_equal "a1-sim-osc-"$i num_instances 2
291 start_stopped_policy_agent
293 # Check PMS state after restart
297 if [ "$PMS_VERSION" == "V2" ]; then
299 api_equal json:policy-types 5 120
301 api_equal json:policies 12
303 api_equal json:policy-instances 12
306 api_equal json:policy_schemas 5 120
308 api_equal json:policy_types 5
310 api_equal json:policies 12
312 api_equal json:policy_ids 12
315 # Check the number of policies in STD and STD2
316 for ((i=0; i<$STD_NUM_RICS; i++))
318 sim_equal "a1-sim-std-"$i num_instances 2
319 sim_equal "a1-sim-std2-"$i num_instances 2
322 # Check the number of policies in OSC
323 for ((i=0; i<$STD_NUM_RICS; i++))
325 sim_equal "a1-sim-osc-"$i num_instances 2
329 echo "ADD EVENT/STATUS CHECK"
336 CB_JOB="$PROD_STUB_SERVICE_PATH$PROD_STUB_JOB_CALLBACK"
337 CB_SV="$PROD_STUB_SERVICE_PATH$PROD_STUB_SUPERVISION_CALLBACK"
338 TARGET1="$RIC_SIM_HTTPX://a1-sim-std2-0.a1-sim:$RIC_SIM_PORT/datadelivery"
339 TARGET2="$RIC_SIM_HTTPX://a1-sim-std2-1.a1-sim:$RIC_SIM_PORT/datadelivery"
341 STATUS1="$CR_SERVICE_APP_PATH/job1-status"
342 STATUS2="$CR_SERVICE_APP_PATH/job2-status"
344 prodstub_arm_producer 200 prod-a
345 prodstub_arm_type 200 prod-a type1
346 prodstub_arm_job_create 200 prod-a job1
347 prodstub_arm_job_create 200 prod-a job2
351 ecs_api_service_status 200
354 if [ $ECS_VERSION == "V1-1" ]; then
355 ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
357 ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
359 ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json
360 ecs_api_edp_get_type_2 200 type1
361 ecs_api_edp_get_type_ids 200 type1
363 ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
364 ecs_api_edp_put_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
367 ecs_api_edp_get_producer_status 200 prod-a ENABLED
370 ## Create a job for prod-a
372 if [ -z "$FLAT_A1_EI" ]; then
373 ecs_api_a1_put_job 201 type1 job1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
375 ecs_api_a1_put_job 201 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ecs/job-template.json
378 # Check the job data in the producer
379 if [ $ECS_VERSION == "V1-1" ]; then
380 prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
382 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
383 prodstub_check_jobdata_3 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
385 prodstub_check_jobdata_2 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
389 ## Create a second job for prod-a
391 if [ -z "$FLAT_A1_EI" ]; then
392 ecs_api_a1_put_job 201 type1 job2 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
394 ecs_api_a1_put_job 201 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ecs/job-template.json
397 # Check the job data in the producer
398 if [ $ECS_VERSION == "V1-1" ]; then
399 prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
401 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
402 prodstub_check_jobdata_3 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
404 prodstub_check_jobdata_2 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
408 # Dmaap mediator and adapter
409 start_dmaapadp NOPROXY $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_CONFIG_FILE $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_DATA_FILE
411 start_dmaapmed NOPROXY $SIM_GROUP/$DMAAP_MED_COMPOSE_DIR/$DMAAP_MED_DATA_FILE
413 ecs_equal json:ei-producer/v1/eiproducers 2 60
415 ecs_api_idc_get_type_ids 200 ExampleInformationType STD_Fault_Messages
417 ecs_api_edp_get_producer_ids_2 200 NOTYPE DmaapGenericInfoProducer DMaaP_Mediator_Producer
421 for ((i=1; i<=$NUM_JOBS; i++))
423 ecs_api_idc_put_job 201 jobx$i STD_Fault_Messages $CR_SERVICE_MR_PATH/jobx-data$i info-ownerx$i $CR_SERVICE_MR_PATH/job_status_info-ownerx$i testdata/dmaap-adapter/job-template.json
426 for ((i=1; i<=$NUM_JOBS; i++))
428 ecs_api_idc_put_job 201 joby$i ExampleInformationType $CR_SERVICE_MR_PATH/joby-data$i info-ownery$i $CR_SERVICE_MR_PATH/job_status_info-ownery$i testdata/dmaap-adapter/job-template.json
431 for ((i=1; i<=$NUM_JOBS; i++))
433 ecs_api_a1_get_job_status 200 jobx$i ENABLED 30
436 mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-0"}'
437 mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-1"}'
438 mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-2"}'
439 mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-3"}'
441 cr_equal received_callbacks $(($NUM_JOBS*2*2)) 60
442 for ((i=1; i<=$NUM_JOBS; i++))
444 cr_equal received_callbacks?id=jobx-data$i 2
445 cr_equal received_callbacks?id=joby-data$i 2
448 for ((i=1; i<=$NUM_JOBS; i++))
450 cr_api_check_single_genric_json_event 200 jobx-data$i '{"msg":"msg-0"}'
451 cr_api_check_single_genric_json_event 200 jobx-data$i '{"msg":"msg-2"}'
452 cr_api_check_single_genric_json_event 200 joby-data$i '{"msg":"msg-1"}'
453 cr_api_check_single_genric_json_event 200 joby-data$i '{"msg":"msg-3"}'
461 # Check ECS status after restart
463 if [ -z "$FLAT_A1_EI" ]; then
464 ecs_api_a1_get_job_status 200 type1 job1 DISABLED
465 ecs_api_a1_get_job_status 200 type1 job2 DISABLED
467 ecs_api_a1_get_job_status 200 job1 DISABLED
468 ecs_api_a1_get_job_status 200 job2 DISABLED
471 check_policy_agent_logs
475 #### TEST COMPLETE ####