Enhanced ECS function tests
[nonrtric.git] / test / auto-test / FTC810.sh
index 460fb8e..74ecf72 100755 (executable)
 
 TC_ONELINE_DESCR="Repeatedly create and delete policies in each RICs for 24h (or configured number of days). Via agent REST/DMAAP/DMAAP_BATCH and SDNC using http or https"
 
-#App names to exclude checking pulling images for, space separated list
-EXCLUDED_IMAGES="ECS"
+#App names to include in the test, space separated list
+INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
+
+#SUPPORTED TEST ENV FILE
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
 . ../common/ricsimulator_api_functions.sh
+. ../common/cr_api_functions.sh
 
 #### TEST BEGIN ####
 
@@ -35,6 +39,10 @@ generate_uuid
 
 # Number of RICs per interface type (OSC and STD)
 NUM_RICS=30
+if [ "$PMS_VERSION" == "V2" ]; then
+   NUM_RICS=20 # 3 A1 interfaces test, less sims per interface. total sims will be same
+fi
+
 # Number of policy instances per RIC
 NUM_INSTANCES=5
 
@@ -46,15 +54,11 @@ clean_containers
 HTTPX=HTTPS
 
 if [ $HTTPX == "HTTP" ]; then
-   # Path to callback receiver
-   CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
    use_cr_http
    use_agent_rest_http
    use_sdnc_http
    use_simulator_http
 else
-   # Path to callback receiver
-   CR_PATH="https://$CR_APP_NAME:$CR_EXTERNAL_SECURE_PORT/callbacks"
    use_cr_https
    use_agent_rest_https
    use_sdnc_https
@@ -65,6 +69,10 @@ start_ric_simulators ricsim_g1 $NUM_RICS OSC_2.1.0
 
 start_ric_simulators ricsim_g2 $NUM_RICS STD_1.1.3
 
+if [ "$PMS_VERSION" == "V2" ]; then
+   start_ric_simulators ricsim_g3 $NUM_RICS  STD_2.0.0
+fi
+
 start_mr
 
 start_cr
@@ -95,12 +103,28 @@ do
    sim_print ricsim_g2_$i interface
 done
 
+if [ "$PMS_VERSION" == "V2" ]; then
+   echo "Print the interface for group 2 simulators, shall be STD 2"
+   for ((i=1; i<=$NUM_RICS; i++))
+   do
+      sim_print ricsim_g3_$i interface
+   done
+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 [ "$PMS_VERSION" == "V2" ]; then
+   echo "Load policy type in group 3 simulators"
+   for ((i=1; i<=$NUM_RICS; i++))
+   do
+      sim_put_policy_type 201 ricsim_g3_$i STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
+   done
+fi
+
 echo "Check the number of instances in  group 1 simulators, shall be 0"
 for ((i=1; i<=$NUM_RICS; i++))
 do
@@ -113,13 +137,30 @@ do
    sim_equal ricsim_g2_$i num_instances 0
 done
 
+if [ "$PMS_VERSION" == "V2" ]; then
+   echo "Check the number of instances in group 3 simulators, shall be 0"
+   for ((i=1; i<=$NUM_RICS; i++))
+   do
+      sim_equal ricsim_g3_$i num_instances 0
+   done
+fi
+
 echo "Wait for the agent to refresh types from the simulator"
-api_equal json:policy_types 2 120
+if [ "$PMS_VERSION" == "V2" ]; then
+   api_equal json:policy-types 3 120
+else
+   api_equal json:policy_types 2 120
+fi
 
 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
+   if [ "$PMS_VERSION" == "V2" ]; then
+      api_equal json:policy-types?ric_id=ricsim_g1_$i 1 120
+      api_equal json:policy-types?ric_id=ricsim_g3_$i 1 120
+   else
+      api_equal json:policy_types?ric=ricsim_g1_$i 1 120
+   fi
 done
 
 echo "Register a service"
@@ -132,6 +173,12 @@ AGENT_INTERFACES="REST REST_PARALLEL DMAAP DMAAP-BATCH"
 
 MR_MESSAGES=0
 
+if [ "$PMS_VERSION" == "V2" ]; then
+      notificationurl=$CR_PATH"/test"
+else
+      notificationurl=""
+fi
+
 while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
 
     echo ""
@@ -166,14 +213,14 @@ while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
       INSTANCE_ID=200000
       INSTANCES=0
       if [ $interface == "REST_PARALLEL" ]; then
-         api_put_policy_parallel 201 "serv1" ricsim_g1_ $NUM_RICS 1 $INSTANCE_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_INSTANCES 3
+         api_put_policy_parallel 201 "serv1" ricsim_g1_ $NUM_RICS 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES 3
       fi
       for ((i=1; i<=$NUM_RICS; i++))
       do
          if [ $interface == "DMAAP-BATCH" ]; then
-            api_put_policy_batch 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_INSTANCES
+            api_put_policy_batch 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
          elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
-            api_put_policy 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_INSTANCES
+            api_put_policy 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
          fi
          if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
             MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
@@ -183,18 +230,22 @@ while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
          INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
       done
 
-      api_equal json:policy_ids $INSTANCES
+      if [ "$PMS_VERSION" == "V2" ]; then
+         api_equal json:policy-instances $INSTANCES
+      else
+         api_equal json:policy_ids $INSTANCES
+      fi
 
       echo "Create $NUM_INSTANCES instances in each STD RIC"
       if [ $interface == "REST_PARALLEL" ]; then
-         api_put_policy_parallel 201 "serv1" ricsim_g2_ $NUM_RICS NOTYPE $INSTANCE_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_INSTANCES 3
+         api_put_policy_parallel 201 "serv1" ricsim_g2_ $NUM_RICS NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES 3
       fi
       for ((i=1; i<=$NUM_RICS; i++))
       do
          if [ $interface == "DMAAP-BATCH" ]; then
-            api_put_policy_batch 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_INSTANCES
+            api_put_policy_batch 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
          elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
-            api_put_policy 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_INSTANCES
+            api_put_policy 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
          fi
          if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
             MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
@@ -204,7 +255,38 @@ while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
          INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
       done
 
-      api_equal json:policy_ids $INSTANCES
+      if [ "$PMS_VERSION" == "V2" ]; then
+         api_equal json:policy-instances $INSTANCES
+      else
+         api_equal json:policy_ids $INSTANCES
+      fi
+
+      if [ "$PMS_VERSION" == "V2" ]; then
+         echo "Create $NUM_INSTANCES instances in each STD 2 RIC"
+         if [ $interface == "REST_PARALLEL" ]; then
+            api_put_policy_parallel 201 "serv1" ricsim_g3_ $NUM_RICS STD_QOS2_0.1.0 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json $NUM_INSTANCES 3
+         fi
+         for ((i=1; i<=$NUM_RICS; i++))
+         do
+            if [ $interface == "DMAAP-BATCH" ]; then
+               api_put_policy_batch 201 "serv1" ricsim_g3_$i STD_QOS2_0.1.0 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json $NUM_INSTANCES
+            elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
+               api_put_policy 201 "serv1" ricsim_g3_$i STD_QOS2_0.1.0 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json $NUM_INSTANCES
+            fi
+            if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
+               MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
+            fi
+            sim_equal ricsim_g3_$i num_instances $NUM_INSTANCES
+            INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
+            INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
+         done
+
+         if [ "$PMS_VERSION" == "V2" ]; then
+            api_equal json:policy-instances $INSTANCES
+         else
+            api_equal json:policy_ids $INSTANCES
+         fi
+      fi
 
 
       echo "Delete all instances in each OSC RIC"
@@ -228,7 +310,11 @@ while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
          INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
       done
 
-      api_equal json:policy_ids $INSTANCES
+      if [ "$PMS_VERSION" == "V2" ]; then
+         api_equal json:policy-instances $INSTANCES
+      else
+         api_equal json:policy_ids $INSTANCES
+      fi
 
       echo "Delete all instances in each STD RIC"
 
@@ -250,9 +336,39 @@ while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
          INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
       done
 
-      api_equal json:policy_ids 0
+      if [ "$PMS_VERSION" == "V2" ]; then
+         api_equal json:policy-instances $INSTANCES
+      else
+         api_equal json:policy_ids $INSTANCES
+      fi
 
-      cr_equal received_callbacks 0
+      if [ "$PMS_VERSION" == "V2" ]; then
+         echo "Delete all instances in each STD 2 RIC"
+
+         if [ $interface == "REST_PARALLEL" ]; then
+            api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
+         fi
+         for ((i=1; i<=$NUM_RICS; i++))
+         do
+            if [ $interface == "DMAAP-BATCH" ]; then
+               api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
+            elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
+               api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
+            fi
+            if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
+               MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
+            fi
+            INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
+            sim_equal ricsim_g3_$i num_instances 0
+            INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
+         done
+
+         if [ "$PMS_VERSION" == "V2" ]; then
+            api_equal json:policy-instances $INSTANCES
+         else
+            api_equal json:policy_ids $INSTANCES
+         fi
+      fi
 
       mr_equal requests_submitted $MR_MESSAGES
       mr_equal requests_fetched $MR_MESSAGES
@@ -266,6 +382,10 @@ while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
       do
          sim_contains_str ricsim_g1_$i remote_hosts "a1-controller"
          sim_contains_str ricsim_g2_$i remote_hosts "a1-controller"
+
+         if [ "$PMS_VERSION" == "V2" ]; then
+            sim_contains_str ricsim_g3_$i remote_hosts "a1-controller"
+         fi
       done
 
    done
@@ -273,6 +393,7 @@ while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
 done
 
 check_policy_agent_logs
+check_sdnc_logs
 
 #### TEST COMPLETE ####