X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fauto-test%2FFTC310.sh;h=0f24ce4fd5bd33e4d5312b333e6d92bdf549b9ed;hb=refs%2Fchanges%2F33%2F9733%2F1;hp=9600f4ad70a26e7dfeee1557cbe41304c8765513;hpb=c488e37b5803ca41d7b8feb4434cb570aae2cd43;p=nonrtric.git diff --git a/test/auto-test/FTC310.sh b/test/auto-test/FTC310.sh index 9600f4ad..0f24ce4f 100755 --- a/test/auto-test/FTC310.sh +++ b/test/auto-test/FTC310.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash # ============LICENSE_START=============================================== # Copyright (C) 2020 Nordix Foundation. All rights reserved. @@ -17,156 +17,153 @@ # ============LICENSE_END================================================= # -TC_ONELINE_DESCR="Repeatedly create and delete 10000 policies in each RICs for 24h. Via agent REST" -. ../common/testcase_common.sh $@ -. ../common/agent_api_functions.sh -. ../common/ricsimulator_api_functions.sh +TC_ONELINE_DESCR="Resync of RIC via changes in the consul config or pushed config" + +#App names to include in the test when running docker, space separated list +DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR A1PMS RICSIM KUBEPROXY" + +#Ignore image in DOCKER_INCLUDED_IMAGES, KUBE_INCLUDED_IMAGES if +#the image is not configured in the supplied env_file +#Used for images not applicable to all supported profile +CONDITIONALLY_IGNORED_IMAGES="CBS CONSUL" + +#Supported test environment profiles +SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ONAP-JAKARTA ONAP-KOHN ONAP-LONDON ORAN-CHERRY ORAN-D-RELEASE ORAN-E-RELEASE ORAN-F-RELEASE ORAN-G-RELEASE" +#Supported run modes +SUPPORTED_RUNMODES="DOCKER" + +. ../common/testcase_common.sh $@ + +setup_testenvironment #### TEST BEGIN #### -#Local vars in test script -########################## -# Path to callback receiver -CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks" -# Number of RICs per interface type (OSC and STD) -NUM_RICS=4 -# Number of policy instances per RIC -NUM_INSTANCES=10000 +if [ "$A1PMS_VERSION" == "V2" ]; then + TESTED_VARIANTS="CONSUL NOCONSUL" + if [[ "$A1PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then + TESTED_VARIANTS="NOCONSUL" + fi +else + TESTED_VARIANTS="CONSUL" +fi -clean_containers +for consul_conf in $TESTED_VARIANTS ; do + generate_policy_uuid -start_ric_simulators ricsim_g1 4 OSC_2.1.0 + # Clean container and start all needed containers # + clean_environment -start_ric_simulators ricsim_g2 4 STD_1.1.3 + start_kube_proxy -start_mr + start_a1pms NOPROXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE -start_cr + set_a1pms_trace -start_consul_cbs + # Create service to be able to receive events when rics becomes available + # Must use rest towards the a1pms since dmaap is not configured yet + a1pms_api_put_service 201 "ric-registration" 0 "$CR_SERVICE_APP_PATH_0/ric-registration" -prepare_consul_config NOSDNC ".consul_config.json" -consul_config_app ".consul_config.json" + # Start one RIC of each type + start_ric_simulators ricsim_g1 1 OSC_2.1.0 + start_ric_simulators ricsim_g2 1 STD_1.1.3 + if [ "$A1PMS_VERSION" == "V2" ]; then + start_ric_simulators ricsim_g3 1 STD_2.0.0 + fi -start_control_panel + start_mr -start_policy_agent + start_cr 1 -use_agent_rest_http + start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE -api_get_status 200 + if [ $consul_conf == "CONSUL" ]; then + start_consul_cbs + fi -echo "Print the interface for group 1 simulators, shall be OSC" -for ((i=1; i<=$NUM_RICS; i++)) -do - sim_print ricsim_g1_$i interface -done + __CONFIG_HEADER="NOHEADER" + if [ $RUNMODE == "KUBE" ]; then + __CONFIG_HEADER="HEADER" + else + if [[ "$A1PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then + __CONFIG_HEADER="HEADER" + fi + fi + prepare_consul_config NOSDNC ".consul_config.json" $__CONFIG_HEADER -echo "Print the interface for group 2 simulators, shall be STD" -for ((i=1; i<=$NUM_RICS; i++)) -do - sim_print ricsim_g2_$i interface -done + if [ "$A1PMS_VERSION" == "V2" ] && [ $consul_conf == "NOCONSUL" ]; then + a1pms_api_put_configuration 200 ".consul_config.json" + a1pms_api_get_configuration 200 ".consul_config.json" + else + consul_config_app ".consul_config.json" + fi -echo "Load policy type in group 1 simulators" -for ((i=1; i<=$NUM_RICS; i++)) -do - sim_put_policy_type 201 ricsim_g1_$i 1 testdata/OSC/sim_1.json -done + if [ "$A1PMS_VERSION" == "V2" ]; then + a1pms_equal json:rics 3 300 -echo "Check the number of instances in group 1 simulators, shall be 0" -for ((i=1; i<=$NUM_RICS; i++)) -do - sim_equal ricsim_g1_$i num_instances 0 -done + cr_equal 0 received_callbacks 3 120 -echo "Check the number of instances in group 2 simulators, shall be 0" -for ((i=1; i<=$NUM_RICS; i++)) -do - sim_equal ricsim_g2_$i num_instances 0 -done + cr_api_check_all_sync_events 200 0 ric-registration ricsim_g1_1 ricsim_g2_1 ricsim_g3_1 + else + a1pms_equal json:rics 2 300 + fi -echo "Wait for the agent to refresh types from the simulator" -api_equal json:policy_types 2 120 + # Add an STD RIC and check + start_ric_simulators ricsim_g2 2 STD_1.1.3 -echo "Check the number of types in the agent for each ric is 1" -for ((i=1; i<=$NUM_RICS; i++)) -do - api_equal json:policy_types?ric=ricsim_g1_$i 1 120 -done + prepare_consul_config NOSDNC ".consul_config.json" $__CONFIG_HEADER + if [ "$A1PMS_VERSION" == "V2" ] && [ $consul_conf == "NOCONSUL" ]; then + a1pms_api_put_configuration 200 ".consul_config.json" + a1pms_api_get_configuration 200 ".consul_config.json" + else + consul_config_app ".consul_config.json" + fi -echo "Register a service" -api_put_service 201 "rapp1" 0 "$CR_PATH/1" - -TEST_DURATION=$((24*3600)) -TEST_START=$SECONDS - -while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do - - echo "" - echo "#########################################################################################################" - echo -e $BOLD"INFO: Test executed for: "$(($SECONDS-$TEST_START)) "seconds. Target is: "$TEST_DURATION" seconds (24h)."$EBOLD - echo "#########################################################################################################" - echo "" - - - echo "Create 10000 instances in each OSC RIC" - INSTANCE_ID=200000 - INSTANCES=0 - for ((i=1; i<=$NUM_RICS; i++)) - do - api_put_policy 201 "rapp1" ricsim_g1_$i 1 $INSTANCE_ID testdata/OSC/pi1_template.json $NUM_INSTANCES - sim_equal ricsim_g1_$i num_instances $NUM_INSTANCES - INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES)) - INSTANCES=$(($INSTANCES+$NUM_INSTANCES)) - done - - api_equal json:policy_ids $INSTANCES - - echo "Create 10000 instances in each OSC RIC" - for ((i=1; i<=$NUM_RICS; i++)) - do - api_put_policy 201 "rapp1" ricsim_g2_$i NOTYPE $INSTANCE_ID testdata/STD/pi1_template.json $NUM_INSTANCES - sim_equal ricsim_g2_$i num_instances $NUM_INSTANCES - INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES)) - INSTANCES=$(($INSTANCES+$NUM_INSTANCES)) - done - - api_equal json:policy_ids $INSTANCES - - - echo "Delete all instances in each OSC RIC" - - INSTANCE_ID=200000 - for ((i=1; i<=$NUM_RICS; i++)) - do - api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES - INSTANCES=$(($INSTANCES-$NUM_INSTANCES)) - sim_equal ricsim_g1_$i num_instances $NUM_INSTANCES - INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES)) - done - - api_equal json:policy_ids $INSTANCES - - echo "Delete all instances in each STD RIC" - INSTANCE_ID=200000 - for ((i=1; i<=$NUM_RICS; i++)) - do - api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES - INSTANCES=$(($INSTANCES-$NUM_INSTANCES)) - sim_equal ricsim_g2_$i num_instances $NUM_INSTANCES - INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES)) - done - - api_equal json:policy_ids 0 -done + if [ "$A1PMS_VERSION" == "V2" ]; then + a1pms_equal json:rics 4 120 + cr_equal 0 received_callbacks 4 120 + + cr_api_check_all_sync_events 200 0 ric-registration ricsim_g2_2 + else + a1pms_equal json:rics 3 120 + fi + + check_a1pms_logs + + + # Remove one RIC RIC and check + start_ric_simulators ricsim_g2 1 STD_1.1.3 + + prepare_consul_config NOSDNC ".consul_config.json" $__CONFIG_HEADER + if [ "$A1PMS_VERSION" == "V2" ] && [ $consul_conf == "NOCONSUL" ]; then + a1pms_api_put_configuration 200 ".consul_config.json" + a1pms_api_get_configuration 200 ".consul_config.json" + else + consul_config_app ".consul_config.json" + fi + + if [ "$A1PMS_VERSION" == "V2" ]; then + a1pms_equal json:rics 3 120 + + cr_equal 0 received_callbacks 4 120 + else + a1pms_equal json:rics 2 120 + fi + + if [ "$A1PMS_VERSION" == "V2" ] && [ $consul_conf == "NOCONSUL" ]; then + a1pms_api_get_configuration 200 ".consul_config.json" + fi + + check_a1pms_logs + + store_logs END_$consul_conf +done -check_policy_agent_logs #### TEST COMPLETE #### -store_logs END -print_result \ No newline at end of file +print_result + +auto_clean_environment