Adaptation of test env to helm chart
[nonrtric.git] / test / auto-test / FTC_HELM_E_RELEASE.sh
similarity index 76%
rename from test/auto-test/FTC_HELM_RECIPE_E_RELEASE.sh
rename to test/auto-test/FTC_HELM_E_RELEASE.sh
index b609222..71a5d50 100755 (executable)
@@ -17,7 +17,9 @@
 #  ============LICENSE_END=================================================
 #
 
-TC_ONELINE_DESCR="Sanity test of Non-RT RIC Helm recepie - all components - E-RELEASE"
+TC_ONELINE_DESCR="Sanity test of Non-RT RIC Helm chats - all components - E-RELEASE"
+# This script requires the helm charts for nonrtric, a1simulator and a1controller are installed
+# There should be 2 simulator of version started
 
 #App names to include in the test when running docker, space separated list
 DOCKER_INCLUDED_IMAGES="" # Not used -  KUBE only test script
@@ -25,7 +27,7 @@ DOCKER_INCLUDED_IMAGES="" # Not used -  KUBE only test script
 #App names to include in the test when running kubernetes, space separated list
 KUBE_INCLUDED_IMAGES=" MR CR  PRODSTUB KUBEPROXY"
 #Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
-KUBE_PRESTARTED_IMAGES=" PA RICSIM CP ECS RC SDNC"
+KUBE_PRESTARTED_IMAGES=" PA RICSIM CP ECS RC SDNC DMAAPMED DMAAPADP"
 
 #Supported test environment profiles
 SUPPORTED_PROFILES="ORAN-E-RELEASE"
@@ -43,6 +45,8 @@ SUPPORTED_RUNMODES="KUBE"
 . ../common/control_panel_api_functions.sh
 . ../common/controller_api_functions.sh
 . ../common/kube_proxy_api_functions.sh
+. ../common/dmaapmed_api_functions.sh
+. ../common/dmaapadp_api_functions.sh
 
 setup_testenvironment
 
@@ -55,6 +59,7 @@ use_sdnc_https
 use_simulator_https
 use_ecs_rest_https
 use_prod_stub_https
+
 if [ $ECS_VERSION == "V1-1" ]; then
     use_rapp_catalogue_http # https not yet supported
 else
@@ -148,6 +153,22 @@ do
     sim_print "a1-sim-osc-"$i interface
 done
 
+# Check the number of policies in STD and STD2
+for ((i=0; i<$STD_NUM_RICS; i++))
+do
+    sim_equal "a1-sim-std-"$i num_instances 0
+    sim_equal "a1-sim-std2-"$i num_instances 0
+done
+
+# Check the number of policies in OSC
+for ((i=0; i<$STD_NUM_RICS; i++))
+do
+    sim_equal "a1-sim-osc-"$i num_instances 0
+done
+
+#Check the number of schemas
+api_equal json:policy-types 1
+
 # Load the polictypes in STD 2
 for ((i=0; i<$STD_NUM_RICS; i++))
 do
@@ -219,16 +240,16 @@ else
     api_equal json:policy_ids 0
 fi
 
-api_put_service 201 "Emergency-response-app" 0 "$CR_SERVICE_PATH/ER-app"
+api_put_service 201 "Emergency-response-app" 0 "$CR_SERVICE_APP_PATH/ER-app"
 
 # Create policies in STD
 for ((i=0; i<$STD_NUM_RICS; i++))
 do
     ricid=$((3+$i))
     generate_policy_uuid
-    api_put_policy 201 "Emergency-response-app" ric$ricid NOTYPE $((1100+$i)) NOTRANSIENT $CR_SERVICE_PATH/"std2" testdata/STD/pi1_template.json 1
+    api_put_policy 201 "Emergency-response-app" ric$ricid NOTYPE $((1100+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH/"std2" testdata/STD/pi1_template.json 1
     generate_policy_uuid
-    api_put_policy 201 "Emergency-response-app" ric$ricid NOTYPE $((1200+$i)) NOTRANSIENT $CR_SERVICE_PATH/"std2" testdata/STD/pi1_template.json 1
+    api_put_policy 201 "Emergency-response-app" ric$ricid NOTYPE $((1200+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH/"std2" testdata/STD/pi1_template.json 1
 done
 
 #Create policies in STD 2
@@ -236,9 +257,9 @@ for ((i=0; i<$STD_NUM_RICS; i++))
 do
    ricid=$((5+$i))
    generate_policy_uuid
-   api_put_policy 201 "Emergency-response-app" ric$ricid STD_QOS_0_2_0 $((2100+$i)) NOTRANSIENT $CR_SERVICE_PATH/"std2" testdata/STD2/pi_qos_template.json 1
+   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
    generate_policy_uuid
-   api_put_policy 201 "Emergency-response-app" ric$ricid STD_QOS2_0.1.0 $((2200+$i)) NOTRANSIENT $CR_SERVICE_PATH/"std2" testdata/STD2/pi_qos2_template.json 1
+   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
 done
 
 # Create policies in OSC
@@ -246,9 +267,9 @@ for ((i=0; i<$OSC_NUM_RICS; i++))
 do
     ricid=$((1+$i))
     generate_policy_uuid
-    api_put_policy 201 "Emergency-response-app" ric$ricid 1 $((3100+$i)) NOTRANSIENT $CR_SERVICE_PATH/"osc" testdata/OSC/pi1_template.json 1
+    api_put_policy 201 "Emergency-response-app" ric$ricid 1 $((3100+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH/"osc" testdata/OSC/pi1_template.json 1
     generate_policy_uuid
-    api_put_policy 201 "Emergency-response-app" ric$ricid 2 $((3200+$i)) NOTRANSIENT $CR_SERVICE_PATH/"osc" testdata/OSC/pi2_template.json 1
+    api_put_policy 201 "Emergency-response-app" ric$ricid 2 $((3200+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH/"osc" testdata/OSC/pi2_template.json 1
 done
 
 
@@ -317,8 +338,8 @@ CB_SV="$PROD_STUB_SERVICE_PATH$PROD_STUB_SUPERVISION_CALLBACK"
 TARGET1="$RIC_SIM_HTTPX://a1-sim-std2-0.a1-sim:$RIC_SIM_PORT/datadelivery"
 TARGET2="$RIC_SIM_HTTPX://a1-sim-std2-1.a1-sim:$RIC_SIM_PORT/datadelivery"
 
-STATUS1="$CR_SERVICE_PATH/job1-status"
-STATUS2="$CR_SERVICE_PATH/job2-status"
+STATUS1="$CR_SERVICE_APP_PATH/job1-status"
+STATUS2="$CR_SERVICE_APP_PATH/job2-status"
 
 prodstub_arm_producer 200 prod-a
 prodstub_arm_type 200 prod-a type1
@@ -384,6 +405,55 @@ else
     fi
 fi
 
+# Dmaap mediator and adapter
+start_dmaapadp NOPROXY $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_CONFIG_FILE $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_DATA_FILE
+
+start_dmaapmed NOPROXY $SIM_GROUP/$DMAAP_MED_COMPOSE_DIR/$DMAAP_MED_DATA_FILE
+
+ecs_equal json:ei-producer/v1/eiproducers 2 60
+
+ecs_api_idc_get_type_ids 200 ExampleInformationType STD_Fault_Messages
+
+ecs_api_edp_get_producer_ids_2 200 NOTYPE DmaapGenericInfoProducer DMaaP_Mediator_Producer
+
+NUM_JOBS=5
+
+for ((i=1; i<=$NUM_JOBS; i++))
+do
+    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
+done
+
+for ((i=1; i<=$NUM_JOBS; i++))
+do
+    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
+done
+
+for ((i=1; i<=$NUM_JOBS; i++))
+do
+    ecs_api_a1_get_job_status 200 jobx$i ENABLED 30
+done
+
+mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-0"}'
+mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-1"}'
+mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-2"}'
+mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-3"}'
+
+cr_equal received_callbacks $(($NUM_JOBS*2*2)) 60
+for ((i=1; i<=$NUM_JOBS; i++))
+do
+    cr_equal received_callbacks?id=jobx-data$i 2
+    cr_equal received_callbacks?id=joby-data$i 2
+done
+
+for ((i=1; i<=$NUM_JOBS; i++))
+do
+    cr_api_check_single_genric_json_event 200 jobx-data$i '{"msg":"msg-0"}'
+    cr_api_check_single_genric_json_event 200 jobx-data$i '{"msg":"msg-2"}'
+    cr_api_check_single_genric_json_event 200 joby-data$i '{"msg":"msg-1"}'
+    cr_api_check_single_genric_json_event 200 joby-data$i '{"msg":"msg-3"}'
+done
+
+
 stop_ecs
 
 start_stopped_ecs