fix drools-apps csit failure
[integration/csit.git] / plans / ccsdk-oran / polmansuite / FTC1.sh
index 1ccb425..ce9aa73 100755 (executable)
@@ -23,9 +23,13 @@ TC_ONELINE_DESCR="Sanity test, create service and then create,update and delete
 #App names to include in the test, space separated list
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
+#Supported test env file (profile)
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
+
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
 . ../common/ricsimulator_api_functions.sh
+. ../common/cr_api_functions.sh
 
 #### TEST BEGIN ####
 
@@ -46,28 +50,23 @@ for __httpx in $TESTED_PROTOCOLS ; do
         echo "#####################################################################"
         echo "#####################################################################"
 
-        #Local vars in test script
-        ##########################
-
-        if [ $__httpx == "HTTPS" ]; then
-            # Path to callback receiver
-            CR_PATH="https://$CR_APP_NAME:$CR_EXTERNAL_SECURE_PORT/callbacks"
-            use_cr_https
-        else
-            # Path to callback receiver
-            CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
-            use_cr_http
-        fi
-
         # Clean container and start all needed containers #
         clean_containers
 
         if [ $__httpx == "HTTPS" ]; then
+            use_cr_https
+            #echo "Using secure ports between agent and MR"
+            use_mr_https
             #"Using secure ports towards simulators"
             use_simulator_https
+            use_agent_rest_https
         else
+            use_cr_http
+            #"Using non-secure ports between agent and MR"
+            use_mr_http
             #"Using non-secure ports towards simulators"
             use_simulator_http
+            use_agent_rest_http
         fi
 
         start_ric_simulators ricsim_g1 1  OSC_2.1.0
@@ -75,16 +74,16 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         start_mr
 
-        if [ $__httpx == "HTTPS" ]; then
-            #echo "Using secure ports between agent and MR"
-            use_mr_https
-        else
-            #"Using non-secure ports between agent and MR"
-            use_mr_http
-        fi
-
         start_cr
 
+        start_policy_agent
+
+        set_agent_debug
+
+        # Create service to be able to receive events when rics becomes available
+        # Must use rest towards the agent since dmaap is not configured yet
+        api_put_service 201 "ric-registration" 0 "$CR_PATH/ric-registration"
+
         if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+SDNC" ]; then
 
             start_sdnc
@@ -98,6 +97,8 @@ for __httpx in $TESTED_PROTOCOLS ; do
             fi
         fi
 
+        cr_equal received_callbacks 0
+
         start_consul_cbs
 
         if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+SDNC" ]; then
@@ -110,10 +111,6 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         start_control_panel
 
-        start_policy_agent
-
-        set_agent_debug
-
         if [ $interface == "DMAAP" ] || [ $interface == "DMAAP+SDNC" ]; then
             if [ $__httpx == "HTTPS" ]; then
                 echo "Using secure ports towards dmaap"
@@ -132,21 +129,29 @@ for __httpx in $TESTED_PROTOCOLS ; do
             fi
         fi
 
-
-        cr_equal received_callbacks 0
         mr_equal requests_submitted 0
 
         sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
 
-        api_equal json:rics 2 60
+        if [ "$PMS_VERSION" == "V2" ]; then
+            api_equal json:rics 2 60
 
-        api_equal json:policy_schemas 2 120
+            api_equal json:policy-types 2 120
 
-        api_equal json:policy_types 2
+            api_equal json:policies 0
 
-        api_equal json:policies 0
+            api_equal json:policy-instances 0
+        else
+            api_equal json:rics 2 60
+
+            api_equal json:policy_schemas 2 120
+
+            api_equal json:policy_types 2
 
-        api_equal json:policy_ids 0
+            api_equal json:policies 0
+
+            api_equal json:policy_ids 0
+        fi
 
         echo "############################################"
         echo "############## Health check ################"
@@ -160,7 +165,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         api_put_service 201 "serv1" 1000 "$CR_PATH/1"
 
-        api_get_service_ids 200 "serv1"
+        api_get_service_ids 200 "serv1" "ric-registration"
 
         api_put_services_keepalive 200 "serv1"
 
@@ -174,11 +179,16 @@ for __httpx in $TESTED_PROTOCOLS ; do
         echo "########### A1 Policy Management ###########"
         echo "############################################"
 
-        api_put_policy 201 "serv1" ricsim_g1_1 1 5000 NOTRANSIENT testdata/OSC/pi1_template.json
-        api_put_policy 200 "serv1" ricsim_g1_1 1 5000 NOTRANSIENT testdata/OSC/pi1_template.json
+        if [ "$PMS_VERSION" == "V2" ]; then
+            notificationurl=$CR_PATH/2
+        else
+            notificationurl=""
+        fi
+        api_put_policy 201 "serv1" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
+        api_put_policy 200 "serv1" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
 
-        api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT testdata/STD/pi1_template.json
-        api_put_policy 200 "serv1" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT testdata/STD/pi1_template.json
+        api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
+        api_put_policy 200 "serv1" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
 
         api_delete_policy 204 5000
 
@@ -186,9 +196,17 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         api_equal json:policies 0
 
-        api_equal json:policy_ids 0
+        if [ "$PMS_VERSION" == "V2" ]; then
+            api_equal json:policy-instances 0
+        else
+            api_equal json:policy_ids 0
+        fi
+
+        if [ "$PMS_VERSION" == "V2" ]; then
+            cr_equal received_callbacks?id=ric-registration 2
 
-        cr_equal received_callbacks 0
+            cr_api_check_all_sync_events 200 ric-registration ricsim_g1_1 ricsim_g2_1
+        fi
 
         if [ $interface == "DMAAP" ] || [ $interface == "DMAAP+SDNC" ]; then
             VAL=11 # Number of Agent API calls over DMAAP