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 $@
43 use_mr_http #MR only supports http?
51 if [ $ECS_VERSION == "V1-1" ]; then
52 use_rapp_catalogue_http # https not yet supported
54 ########################################use_rapp_catalogue_https
55 use_rapp_catalogue_http
58 echo -e "$RED CHECK WHY RC HTTPS DOES NOT WORK $ERED"
60 ###############################use_control_panel_https
61 use_control_panel_http
63 if [ "$PMS_VERSION" == "V1" ]; then
64 echo "PMS VERSION 2 (V2) is required"
79 start_ric_simulators a1-sim-osc $STD_NUM_RICS OSC_2.1.0
80 echo " RIC MAPPING a1-sim-osc-0 : ric1"
81 echo " RIC MAPPING a1-sim-osc-1 : ric2"
83 start_ric_simulators a1-sim-std $STD_NUM_RICS STD_1.1.3
84 echo " RIC MAPPING a1-sim-std-0 : ric3"
85 echo " RIC MAPPING a1-sim-std-1 : ric4"
87 start_ric_simulators a1-sim-std2 $STD_NUM_RICS STD_2.0.0
88 echo " RIC MAPPING a1-sim-std2-0 : ric5"
89 echo " RIC MAPPING a1-sim-std2-1 : ric6"
111 #### Test RAPP Catalogue ####
113 rapp_cat_api_get_services 200 EMPTY
115 rapp_cat_api_put_service 201 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
117 rapp_cat_api_get_services 200 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
119 #Check the number of services
120 rc_equal json:services 1
124 #### Test Policy Management Service ####
126 # Print the A1 version for STD 1.1.X
127 for ((i=0; i<$STD_NUM_RICS; i++))
129 sim_print "a1-sim-std-"$i interface
132 # Print the A1 version for STD 2.0.X
133 for ((i=0; i<$STD_NUM_RICS; i++))
135 sim_print "a1-sim-std2-"$i interface
138 # Print the A1 version for OSC 2.1.X
139 for ((i=0; i<$OSC_NUM_RICS; i++))
141 sim_print "a1-sim-osc-"$i interface
144 # Check the number of policies in STD and STD2
145 for ((i=0; i<$STD_NUM_RICS; i++))
147 sim_equal "a1-sim-std-"$i num_instances 0
148 sim_equal "a1-sim-std2-"$i num_instances 0
151 # Check the number of policies in OSC
152 for ((i=0; i<$STD_NUM_RICS; i++))
154 sim_equal "a1-sim-osc-"$i num_instances 0
157 #Check the number of schemas
158 api_equal json:policy-types 1
160 # Load the polictypes in STD 2
161 for ((i=0; i<$STD_NUM_RICS; i++))
163 sim_put_policy_type 201 "a1-sim-std2-"$i STD_QOS_0_2_0 testdata/STD2/sim_qos.json
164 sim_put_policy_type 201 "a1-sim-std2-"$i STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
167 # Load the polictypes in OSC
168 for ((i=0; i<$OSC_NUM_RICS; i++))
170 sim_put_policy_type 201 "a1-sim-osc-"$i 1 testdata/OSC/sim_1.json
171 sim_put_policy_type 201 "a1-sim-osc-"$i 2 testdata/OSC/sim_2.json
174 # Check that all rics are synced in
175 api_equal json:rics 6 300
177 #Check the number of schemas and the individual schemas
178 api_equal json:policy-types 5 300
180 for ((i=0; i<$STD_NUM_RICS; i++))
183 api_equal json:policy-types?ric_id=ric$ricid 1 120
186 for ((i=0; i<$STD_NUM_RICS; i++))
189 api_equal json:policy-types?ric_id=ric$ricid 2 120
192 for ((i=0; i<$OSC_NUM_RICS; i++))
195 api_equal json:policy-types?ric_id=ric$ricid 2 120
198 #Check the schemas in STD 2
199 for ((i=0; i<$OSC_NUM_RICS; i++))
202 api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-agent-modified.json
203 api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-agent-modified.json
206 # Check the schemas in OSC
207 for ((i=0; i<$OSC_NUM_RICS; i++))
209 api_get_policy_type 200 1 testdata/OSC/1-agent-modified.json
210 api_get_policy_type 200 2 testdata/OSC/2-agent-modified.json
213 if [ "$PMS_VERSION" == "V2" ]; then
215 api_equal json:policy-types 5 120
217 api_equal json:policies 0
219 api_equal json:policy-instances 0
222 api_equal json:policy_schemas 5 120
224 api_equal json:policy_types 5
226 api_equal json:policies 0
228 api_equal json:policy_ids 0
231 api_put_service 201 "Emergency-response-app" 0 "$CR_SERVICE_APP_PATH_0/ER-app"
233 # Create policies in STD
234 for ((i=0; i<$STD_NUM_RICS; i++))
238 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
240 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
243 #Create policies in STD 2
244 for ((i=0; i<$STD_NUM_RICS; i++))
248 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
250 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
253 # Create policies in OSC
254 for ((i=0; i<$OSC_NUM_RICS; i++))
258 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
260 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
264 # Check the number of policies in STD and STD2
265 for ((i=0; i<$STD_NUM_RICS; i++))
267 sim_equal "a1-sim-std-"$i num_instances 2
268 sim_equal "a1-sim-std2-"$i num_instances 2
271 # Check the number of policies in OSC
272 for ((i=0; i<$STD_NUM_RICS; i++))
274 sim_equal "a1-sim-osc-"$i num_instances 2
279 start_stopped_policy_agent
281 # Check PMS state after restart
285 if [ "$PMS_VERSION" == "V2" ]; then
287 api_equal json:policy-types 5 120
289 api_equal json:policies 12
291 api_equal json:policy-instances 12
294 api_equal json:policy_schemas 5 120
296 api_equal json:policy_types 5
298 api_equal json:policies 12
300 api_equal json:policy_ids 12
303 # Check the number of policies in STD and STD2
304 for ((i=0; i<$STD_NUM_RICS; i++))
306 sim_equal "a1-sim-std-"$i num_instances 2
307 sim_equal "a1-sim-std2-"$i num_instances 2
310 # Check the number of policies in OSC
311 for ((i=0; i<$STD_NUM_RICS; i++))
313 sim_equal "a1-sim-osc-"$i num_instances 2
317 echo "ADD EVENT/STATUS CHECK"
324 CB_JOB="$PROD_STUB_SERVICE_PATH$PROD_STUB_JOB_CALLBACK"
325 CB_SV="$PROD_STUB_SERVICE_PATH$PROD_STUB_SUPERVISION_CALLBACK"
326 TARGET1="$RIC_SIM_HTTPX://a1-sim-std2-0.a1-sim:$RIC_SIM_PORT/datadelivery"
327 TARGET2="$RIC_SIM_HTTPX://a1-sim-std2-1.a1-sim:$RIC_SIM_PORT/datadelivery"
329 STATUS1="$CR_SERVICE_APP_PATH_0/job1-status"
330 STATUS2="$CR_SERVICE_APP_PATH_0/job2-status"
332 prodstub_arm_producer 200 prod-a
333 prodstub_arm_type 200 prod-a type1
334 prodstub_arm_job_create 200 prod-a job1
335 prodstub_arm_job_create 200 prod-a job2
339 ecs_api_service_status 200
342 if [ $ECS_VERSION == "V1-1" ]; then
343 ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
345 ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
347 ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json
348 ecs_api_edp_get_type_2 200 type1
349 ecs_api_edp_get_type_ids 200 type1
351 ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
352 ecs_api_edp_put_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
355 ecs_api_edp_get_producer_status 200 prod-a ENABLED
358 ## Create a job for prod-a
360 if [ -z "$FLAT_A1_EI" ]; then
361 ecs_api_a1_put_job 201 type1 job1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
363 ecs_api_a1_put_job 201 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ecs/job-template.json
366 # Check the job data in the producer
367 if [ $ECS_VERSION == "V1-1" ]; then
368 prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
370 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
371 prodstub_check_jobdata_3 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
373 prodstub_check_jobdata_2 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
377 ## Create a second job for prod-a
379 if [ -z "$FLAT_A1_EI" ]; then
380 ecs_api_a1_put_job 201 type1 job2 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
382 ecs_api_a1_put_job 201 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ecs/job-template.json
385 # Check the job data in the producer
386 if [ $ECS_VERSION == "V1-1" ]; then
387 prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
389 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
390 prodstub_check_jobdata_3 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
392 prodstub_check_jobdata_2 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
396 # Dmaap mediator and adapter
397 start_dmaapadp NOPROXY $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_CONFIG_FILE $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_DATA_FILE
399 start_dmaapmed NOPROXY $SIM_GROUP/$DMAAP_MED_COMPOSE_DIR/$DMAAP_MED_DATA_FILE
401 ecs_equal json:ei-producer/v1/eiproducers 2 60
403 ecs_api_idc_get_type_ids 200 ExampleInformationType STD_Fault_Messages
405 ecs_api_edp_get_producer_ids_2 200 NOTYPE DmaapGenericInfoProducer DMaaP_Mediator_Producer
409 for ((i=1; i<=$NUM_JOBS; i++))
411 ecs_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
414 for ((i=1; i<=$NUM_JOBS; i++))
416 ecs_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
419 for ((i=1; i<=$NUM_JOBS; i++))
421 ecs_api_a1_get_job_status 200 jobx$i ENABLED 30
424 mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-0"}'
425 mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-1"}'
426 mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-2"}'
427 mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-3"}'
429 cr_equal 0 received_callbacks $(($NUM_JOBS*2*2)) 60
430 for ((i=1; i<=$NUM_JOBS; i++))
432 cr_equal 0 received_callbacks?id=jobx-data$i 2
433 cr_equal 0 received_callbacks?id=joby-data$i 2
436 for ((i=1; i<=$NUM_JOBS; i++))
438 cr_api_check_single_genric_json_event 200 0 jobx-data$i '{"msg":"msg-0"}'
439 cr_api_check_single_genric_json_event 200 0 jobx-data$i '{"msg":"msg-2"}'
440 cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-1"}'
441 cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-3"}'
449 # Check ECS status after restart
451 if [ -z "$FLAT_A1_EI" ]; then
452 ecs_api_a1_get_job_status 200 type1 job1 DISABLED
453 ecs_api_a1_get_job_status 200 type1 job2 DISABLED
455 ecs_api_a1_get_job_status 200 job1 DISABLED
456 ecs_api_a1_get_job_status 200 job2 DISABLED
459 check_policy_agent_logs
463 #### TEST COMPLETE ####