Added STD sim 2.0.0 tests 52/5052/2
authorBjornMagnussonXA <bjorn.magnusson@est.tech>
Wed, 11 Nov 2020 23:52:08 +0000 (00:52 +0100)
committerBjornMagnussonXA <bjorn.magnusson@est.tech>
Thu, 12 Nov 2020 09:29:01 +0000 (10:29 +0100)
Issue-ID: NONRTRIC-308

Signed-off-by: BjornMagnussonXA <bjorn.magnusson@est.tech>
Change-Id: I2be9d7a474d52593f8c716ee77f7406de42efe45

17 files changed:
test/auto-test/FTC1.sh
test/auto-test/FTC10.sh
test/auto-test/FTC100.sh
test/auto-test/FTC110.sh
test/auto-test/FTC350.sh
test/auto-test/FTC800.sh
test/auto-test/FTC810.sh
test/auto-test/FTC900.sh
test/auto-test/PM_DEMO.sh
test/auto-test/testdata/STD2/pi_qos2_template.json [new file with mode: 0644]
test/auto-test/testdata/STD2/pi_qos_template.json [new file with mode: 0644]
test/auto-test/testdata/STD2/qos-agent-modified.json [new file with mode: 0644]
test/auto-test/testdata/STD2/qos2-agent-modified.json [new file with mode: 0644]
test/auto-test/testdata/STD2/sim_qos.json [new file with mode: 0644]
test/auto-test/testdata/STD2/sim_qos2.json [new file with mode: 0644]
test/common/cr_api_functions.sh [new file with mode: 0644]
test/common/testcase_common.sh

index 1898457..3b02510 100755 (executable)
@@ -120,6 +120,9 @@ for __httpx in $TESTED_PROTOCOLS ; do
         sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
 
         if [ "$PMS_VERSION" == "V2" ]; then
+
+            sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
+
             api_equal json:rics 3 60
 
             api_equal json:policy-types 2 120
@@ -165,7 +168,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
         echo "############################################"
 
         if [ "$PMS_VERSION" == "V2" ]; then
-            api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:AVAILABLE  ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:NOTYPE:AVAILABLE"
+            api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:AVAILABLE  ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0:AVAILABLE"
         else
             api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:AVAILABLE  ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
         fi
@@ -181,14 +184,28 @@ for __httpx in $TESTED_PROTOCOLS ; do
         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
+        if [ "$PMS_VERSION" == "V2" ]; then
+            api_put_policy 201 "serv1" ricsim_g3_1 STD_QOS_0_2_0 5200 true $notificationurl testdata/STD2/pi_qos_template.json
+            api_put_policy 200 "serv1" ricsim_g3_1 STD_QOS_0_2_0 5200 true $notificationurl testdata/STD2/pi_qos_template.json
+        fi
 
         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
 
+        if [ "$PMS_VERSION" == "V2" ]; then
+            api_equal json:policies 3
+        else
+            api_equal json:policies 2
+        fi
+
         api_delete_policy 204 5000
 
         api_delete_policy 204 5100
 
+        if [ "$PMS_VERSION" == "V2" ]; then
+            api_delete_policy 204 5200
+        fi
+
         if [ "$PMS_VERSION" == "V2" ]; then
             api_equal json:policies 0
 
@@ -204,7 +221,12 @@ for __httpx in $TESTED_PROTOCOLS ; do
         fi
 
         if [[ $interface = *"DMAAP"* ]]; then
-            VAL=11 # Number of Agent API calls over DMAAP
+
+            if [ "$PMS_VERSION" == "V2" ]; then
+                VAL=14 # Number of Agent API calls over DMAAP
+            else
+                VAL=11 # Number of Agent API calls over DMAAP
+            fi
             mr_equal requests_fetched $VAL
             mr_equal responses_submitted $VAL
             mr_equal responses_fetched $VAL
index ee57b62..e0d6ecb 100755 (executable)
@@ -76,7 +76,8 @@ fi
 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
 
 if [ "$PMS_VERSION" == "V2" ]; then
-    api_equal json:policy-types 2 60
+    sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
+    api_equal json:policy-types 3 60
 else
     api_equal json:policy_types 2 60
 fi
@@ -118,6 +119,20 @@ api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT $notificationu
 
 sim_equal ricsim_g2_1 num_instances 2
 
+if [ "$PMS_VERSION" == "V2" ]; then
+    use_agent_rest_http
+
+    api_put_policy 201 "service1" ricsim_g3_1 STD_QOS_0_2_0 2200 true $notificationurl testdata/STD2/pi_qos_template.json 1
+
+    sim_equal ricsim_g3_1 num_instances 1
+
+    use_agent_dmaap_http
+
+    api_put_policy 201 "service1" ricsim_g3_1 STD_QOS_0_2_0 3200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos_template.json 1
+
+    sim_equal ricsim_g3_1 num_instances 2
+
+fi
 
 #Update policies
 use_agent_rest_http
@@ -150,12 +165,29 @@ api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT $notificationu
 
 sim_equal ricsim_g2_1 num_instances 2
 
+if [ "$PMS_VERSION" == "V2" ]; then
+    use_agent_rest_http
+
+    api_put_policy 200 "service1" ricsim_g3_1 STD_QOS_0_2_0 2200 true $notificationurl testdata/STD2/pi_qos_template.json 1
+
+    sim_equal ricsim_g3_1 num_instances 2
+
+
+    use_agent_dmaap_http
+
+    api_put_policy 200 "service1" ricsim_g3_1 STD_QOS_0_2_0 3200 true $notificationurl testdata/STD2/pi_qos_template.json 1
+
+    sim_equal ricsim_g3_1 num_instances 2
+fi
+
 # Check policies
 if [ "$PMS_VERSION" == "V2" ]; then
     api_get_policy 200 2000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
     api_get_policy 200 3000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
     api_get_policy 200 2100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
     api_get_policy 200 3100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
+    api_get_policy 200 2200 testdata/STD2/pi_qos_template.json "service1" ricsim_g3_1 STD_QOS_0_2_0 true $notificationurl
+    api_get_policy 200 3200 testdata/STD2/pi_qos_template.json "service1" ricsim_g3_1 STD_QOS_0_2_0 true $notificationurl
 else
     api_get_policy 200 2000 testdata/OSC/pi1_template.json
     api_get_policy 200 3000 testdata/OSC/pi1_template.json
@@ -163,6 +195,13 @@ else
     api_get_policy 200 3100 testdata/STD/pi1_template.json
 fi
 
+sim_equal ricsim_g1_1 num_instances 2
+sim_equal ricsim_g2_1 num_instances 2
+
+if [ "$PMS_VERSION" == "V2" ]; then
+    sim_equal ricsim_g3_1 num_instances 2
+fi
+
 # Remove policies
 
 use_agent_dmaap_http
@@ -173,6 +212,12 @@ use_agent_dmaap_http
 api_delete_policy 204 2100
 use_agent_rest_http
 api_delete_policy 204 3100
+if [ "$PMS_VERSION" == "V2" ]; then
+    use_agent_dmaap_http
+    api_delete_policy 204 2200
+    use_agent_rest_http
+    api_delete_policy 204 3200
+fi
 
 sim_equal ricsim_g1_1 num_instances 0
 sim_equal ricsim_g2_1 num_instances 0
@@ -196,6 +241,11 @@ api_get_policy 404 3000
 api_get_policy 404 2100
 api_get_policy 404 3100
 
+if [ "$PMS_VERSION" == "V2" ]; then
+    api_get_policy 404 2200
+    api_get_policy 404 3200
+fi
+
 # Remove the service
 use_agent_dmaap_http
 api_delete_services 204 "service1"
index e0b8d87..e20adab 100755 (executable)
@@ -122,9 +122,12 @@ for __httpx in $TESTED_PROTOCOLS ; do
         sim_put_policy_type 201 ricsim_g1_1 2 testdata/OSC/sim_2.json
 
         if [ "$PMS_VERSION" == "V2" ]; then
+            sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
+            sim_put_policy_type 201 ricsim_g3_1 STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
+
             api_equal json:rics 3 60
 
-            api_equal json:policy-types 3 120
+            api_equal json:policy-types 5 120
 
             api_equal json:policies 0
 
@@ -237,7 +240,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
         echo "############################################"
 
         if [ "$PMS_VERSION" == "V2" ]; then
-            api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE  ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:NOTYPE:AVAILABLE"
+            api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE  ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0,STD_QOS2_0.1.0:AVAILABLE"
         else
             api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE  ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
         fi
@@ -256,10 +259,16 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
             api_get_ric 200 me2_ricsim_g2_1 NORIC "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
 
+            api_get_ric 200 me1_ricsim_g3_1 NORIC "ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0,STD_QOS2_0.1.0:AVAILABLE"
+
+            api_get_ric 200 me2_ricsim_g3_1 NORIC "ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0,STD_QOS2_0.1.0:AVAILABLE"
+
             api_get_ric 200 NOME      ricsim_g1_1 "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2:AVAILABLE"
 
             api_get_ric 200 NOME      ricsim_g2_1 "ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
 
+            api_get_ric 200 NOME      ricsim_g3_1 "ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0,STD_QOS2_0.1.0:AVAILABLE"
+
             api_get_ric 404 NOME test1
 
             api_get_ric 404 test NORIC
@@ -293,6 +302,12 @@ for __httpx in $TESTED_PROTOCOLS ; do
             deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
             #Behaviour accepted for now
             api_get_policy_type 200 2 testdata/OSC/2-agent-modified.json
+            deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
+            #Behaviour accepted for now
+            api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-agent-modified.json
+            deviation "TR9 - agent modify the type with type id - test combo $interface and $__httpx"
+            #Behaviour accepted for now
+            api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-agent-modified.json
 
             api_get_policy_type 404 3
         else
@@ -322,13 +337,20 @@ for __httpx in $TESTED_PROTOCOLS ; do
         fi
 
 
-
-        api_get_policy_types 200 NORIC 1 2 EMPTY
+        if [ "$PMS_VERSION" == "V2" ]; then
+            api_get_policy_types 200 NORIC 1 2 EMPTY STD_QOS_0_2_0 STD_QOS2_0.1.0
+        else
+            api_get_policy_types 200 NORIC 1 2 EMPTY
+        fi
 
         api_get_policy_types 200 ricsim_g1_1 1 2
 
         api_get_policy_types 200 ricsim_g2_1 EMPTY
 
+        if [ "$PMS_VERSION" == "V2" ]; then
+            api_get_policy_types 200 ricsim_g3_1 STD_QOS_0_2_0 STD_QOS2_0.1.0
+        fi
+
         api_get_policy_types 404 dummy-ric
 
 
@@ -358,23 +380,38 @@ for __httpx in $TESTED_PROTOCOLS ; do
         api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 true $notificationurl testdata/STD/pi1_template.json
         api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 false $notificationurl testdata/STD/pi1_template.json
 
+        if [ "$PMS_VERSION" == "V2" ]; then
+            api_put_policy 201 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json
+            api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json
+
+            api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 true $notificationurl testdata/STD2/pi_qos2_template.json
+            api_put_policy 200 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 false $notificationurl testdata/STD2/pi_qos2_template.json
+        fi
+
         VAL='NOT IN EFFECT'
         api_get_policy_status 200 5000 OSC "$VAL" "false"
         api_get_policy_status 200 5100 STD "UNDEFINED"
+        if [ "$PMS_VERSION" == "V2" ]; then
+            api_get_policy_status 200 5200 STD "UNDEFINED"
+        fi
 
 
         deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
         #kept until decision
         #api_equal json:policies 2
         #Allow 3 for now
-        api_equal json:policies 3
+        if [ "$PMS_VERSION" == "V2" ]; then
+            api_equal json:policies 4
+        else
+            api_equal json:policies 3
+        fi
 
         deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
         #kept until decision
         #api_equal json:policy_ids 2
         #Allow 3 for now
         if [ "$PMS_VERSION" == "V2" ]; then
-            api_equal json:policy-instances 3
+            api_equal json:policy-instances 4
         else
             api_equal json:policy_ids 3
         fi
@@ -383,28 +420,46 @@ for __httpx in $TESTED_PROTOCOLS ; do
         #kept until decision
         #api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100
         #Allow policy create with unregistered service for now
-        api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 2000
-
+        if [ "$PMS_VERSION" == "V2" ]; then
+            api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 2000 5200
+        else
+            api_get_policy_ids 200 NORIC NOSERVICE NOTYPE 5000 5100 2000
+        fi
 
         deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
         #kept until decision
         #api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000
         #Allow policy create with unregistered service for now
-        api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 2000
+        if [ "$PMS_VERSION" == "V2" ]; then
+            api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 2000
+
+            api_get_policy_ids 200 ricsim_g2_1 NOSERVICE NOTYPE 5100
+
+            api_get_policy_ids 200 ricsim_g3_1 NOSERVICE NOTYPE 5200
+
+            api_get_policy_ids 200 NORIC "service10" NOTYPE 5000 5100 5200
+        else
+            api_get_policy_ids 200 ricsim_g1_1 NOSERVICE NOTYPE 5000 2000
 
-        api_get_policy_ids 200 ricsim_g2_1 NOSERVICE NOTYPE 5100
+            api_get_policy_ids 200 ricsim_g2_1 NOSERVICE NOTYPE 5100
 
 
-        api_get_policy_ids 200 NORIC "service10" NOTYPE 5000 5100
+            api_get_policy_ids 200 NORIC "service10" NOTYPE 5000 5100
+        fi
 
         deviation "TR10 - agent allows policy creation on unregistered service (side effect of orig. problem)- test combo $interface and $__httpx"
         #kept until decision
         #api_get_policy_ids 200 NORIC NOSERVICE 1 5000
         #Allow policy create with unregistered service for now
+
         api_get_policy_ids 200 NORIC NOSERVICE 1 5000 2000
 
         api_get_policy_ids 200 NORIC NOSERVICE 2 NOID
 
+        if [ "$PMS_VERSION" == "V2" ]; then
+            api_get_policy_ids 200 NORIC NOSERVICE STD_QOS2_0.1.0 5200
+        fi
+
         api_get_policy_ids 200 ricsim_g2_1 NOSERVICE 1 NOID
 
         if [ "$PMS_VERSION" == "V2" ]; then
@@ -412,7 +467,9 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
             api_get_policy 200 5100 testdata/STD/pi1_template.json "service10" ricsim_g2_1 NOTYPE false $notificationurl
 
-            api_get_policies 200 ricsim_g1_1 "service10" 1 5000 ricsim_g1_1 "service10" 1 false $notificationurl testdata/OSC/pi1_template.json
+            api_get_policy 200 5200 testdata/STD2/pi_qos2_template.json "service10" ricsim_g3_1 NOTYPE false $notificationurl
+
+            api_get_policies 200 ricsim_g1_1 "service10" 1 5000 ricsim_g1_1 "service10" STD_QOS2_0 true $notificationurl testdata/OSC/pi1_template.json
         else
             api_get_policy 200 5000 testdata/OSC/pi1_template.json
 
@@ -431,8 +488,14 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         api_delete_policy 204 5000
 
+        if [ "$PMS_VERSION" == "V2" ]; then
+
+            api_delete_policy 204 5200
+        fi
+
         api_equal json:policies 1
 
+
         if [ "$PMS_VERSION" == "V2" ]; then
             api_equal json:policy-instances 1
         else
index 8419a5d..bc566df 100755 (executable)
@@ -157,11 +157,14 @@ api_put_service 201 "service10" 600 "$CR_PATH/service10"
 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
 
 if [ "$PMS_VERSION" == "V2" ]; then
+
+    sim_put_policy_type 201 ricsim_g3_1 STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
+
     api_equal json:rics 3 60
 
     #api_equal json:policy_schemas 2 120
 
-    api_equal json:policy-types 2 120
+    api_equal json:policy-types 3 120
 
     api_equal json:policies 0
 else
@@ -183,7 +186,12 @@ fi
 api_put_policy 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
 api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
 
-api_equal json:policies 2
+if [ "$PMS_VERSION" == "V2" ]; then
+    api_put_policy 201 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json
+    api_equal json:policies 3
+else
+    api_equal json:policies 2
+fi
 
 sim_equal ricsim_g1_1 num_instances 1
 sim_equal ricsim_g2_1 num_instances 1
@@ -191,19 +199,38 @@ sim_equal ricsim_g2_1 num_instances 1
 api_put_policy 201 "service10" ricsim_g1_1 1 5001 true $notificationurl testdata/OSC/pi1_template.json
 api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5101 true $notificationurl testdata/STD/pi1_template.json
 
-api_equal json:policies 4
+if [ "$PMS_VERSION" == "V2" ]; then
+    api_put_policy 201 "service10" ricsim_g3_1 STD_QOS2_0.1.0 5201 true $notificationurl testdata/STD2/pi_qos2_template.json
+    api_equal json:policies 6
+else
+    api_equal json:policies 4
+fi
 
 sim_equal ricsim_g1_1 num_instances 2
 sim_equal ricsim_g2_1 num_instances 2
+if [ "$PMS_VERSION" == "V2" ]; then
+    sim_equal ricsim_g3_1 num_instances 2
+fi
 
 sim_post_delete_instances 200 ricsim_g1_1
 sim_post_delete_instances 200 ricsim_g2_1
 
+if [ "$PMS_VERSION" == "V2" ]; then
+    sim_post_delete_instances 200 ricsim_g3_1
+fi
+
 #Wait for recreate of non transient policy
-api_equal json:policies 2 180
+if [ "$PMS_VERSION" == "V2" ]; then
+    api_equal json:policies 3 180
+else
+    api_equal json:policies 2 180
+fi
 
 sim_equal ricsim_g1_1 num_instances 1
 sim_equal ricsim_g2_1 num_instances 1
+if [ "$PMS_VERSION" == "V2" ]; then
+    sim_equal ricsim_g3_1 num_instances 1
+fi
 
 api_put_service 200 "service10" 10 "$CR_PATH/service10"
 
@@ -212,6 +239,9 @@ api_equal json:policies 0 120
 
 sim_equal ricsim_g1_1 num_instances 0
 sim_equal ricsim_g2_1 num_instances 0
+if [ "$PMS_VERSION" == "V2" ]; then
+    sim_equal ricsim_g3_1 num_instances 0
+fi
 
 api_get_service_ids 200
 
index 8e36676..959f00f 100755 (executable)
@@ -258,6 +258,8 @@ for interface in $TESTED_VARIANTS ; do
         notificationurl=""
     fi
 
+    sleep_wait 120
+
     # Load config with reduced number of rics
     consul_config_app                  ".consul_config_initial.json"
 
index da80201..b7e49d4 100755 (executable)
@@ -44,6 +44,7 @@ TESTED_VARIANTS="NOSDNC   SDNC"
 
 #Test agent and simulator protocol versions (others are http only)
 TESTED_PROTOCOLS="HTTP HTTPS"
+
 for __httpx in $TESTED_PROTOCOLS ; do
     for interface in $TESTED_VARIANTS ; do
 
@@ -104,11 +105,16 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         sim_print ricsim_g1_1 interface
         sim_print ricsim_g2_1 interface
+        if [ "$PMS_VERSION" == "V2" ]; then
+            sim_print ricsim_g3_1 interface
+        fi
 
         sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
 
         if [ "$PMS_VERSION" == "V2" ]; then
-            api_equal json:policy-types 2 120  #Wait for the agent to refresh types from the simulators
+            sim_put_policy_type 201 ricsim_g3_1 STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
+
+            api_equal json:policy-types 3 120  #Wait for the agent to refresh types from the simulators
         else
             api_equal json:policy_types 2 120  #Wait for the agent to refresh types from the simulators
         fi
@@ -135,6 +141,17 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         sim_equal ricsim_g2_1 num_instances $NUM_POLICIES
 
+        if [ "$PMS_VERSION" == "V2" ]; then
+
+            START_ID=$(($START_ID+$NUM_POLICIES))
+
+            start_timer "Create polices in STD 2 via agent REST and $interface using "$__httpx
+            api_put_policy 201 "serv1" ricsim_g3_1 STD_QOS2_0.1.0 $START_ID NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json $NUM_POLICIES
+            print_timer "Create polices in STD via agent REST and $interface using "$__httpx
+
+            sim_equal ricsim_g3_1 num_instances $NUM_POLICIES
+        fi
+
         if [ $__httpx == "HTTPS" ]; then
             echo "Using secure ports towards dmaap"
             use_agent_dmaap_https
@@ -159,6 +176,17 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         sim_equal ricsim_g2_1 num_instances $((2*$NUM_POLICIES))
 
+        if [ "$PMS_VERSION" == "V2" ]; then
+
+            START_ID=$(($START_ID+$NUM_POLICIES))
+
+            start_timer "Create polices in STD 2 via agent DMAAP, one by one, and $interface using "$__httpx
+            api_put_policy 201 "serv1" ricsim_g3_1 STD_QOS2_0.1.0 $START_ID NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json $NUM_POLICIES
+            print_timer "Create polices in STD via agent DMAAP, one by one, and $interface using "$__httpx
+
+            sim_equal ricsim_g3_1 num_instances $((2*$NUM_POLICIES))
+        fi
+
         START_ID=$(($START_ID+$NUM_POLICIES))
 
         start_timer "Create polices in OSC via agent DMAAP in batch and $interface using "$__httpx
@@ -175,6 +203,17 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
         sim_equal ricsim_g2_1 num_instances $((3*$NUM_POLICIES))
 
+        if [ "$PMS_VERSION" == "V2" ]; then
+
+            START_ID=$(($START_ID+$NUM_POLICIES))
+
+            start_timer "Create polices in STD via agent DMAAP in batch and $interface using "$__httpx
+            api_put_policy_batch 201 "serv1" ricsim_g3_1 STD_QOS2_0.1.0 $START_ID NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json $NUM_POLICIES
+            print_timer "Create polices in STD via agent DMAAP in batch and $interface using "$__httpx
+
+            sim_equal ricsim_g3_1 num_instances $((3*$NUM_POLICIES))
+        fi
+
         if [ $interface == "SDNC" ]; then
             sim_contains_str ricsim_g1_1 remote_hosts "a1-controller"
             sim_contains_str ricsim_g2_1 remote_hosts "a1-controller"
index 911a1eb..3dd2a0e 100755 (executable)
@@ -39,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
 
@@ -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,9 +137,17 @@ 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"
 if [ "$PMS_VERSION" == "V2" ]; then
-   api_equal json:policy-types 2 120
+   api_equal json:policy-types 3 120
 else
    api_equal json:policy_types 2 120
 fi
@@ -125,6 +157,7 @@ for ((i=1; i<=$NUM_RICS; i++))
 do
    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
@@ -228,6 +261,33 @@ while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
          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"
 
@@ -282,6 +342,34 @@ while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
          api_equal json:policy_ids $INSTANCES
       fi
 
+      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
       mr_equal responses_submitted $MR_MESSAGES
@@ -294,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
index e50fcc0..f7e91e3 100755 (executable)
@@ -72,6 +72,13 @@ do
     sim_print $RIC_SIM_PREFIX"_g2_"$i interface
 done
 
+if [ "$PMS_VERSION" == "V2" ]; then
+    # Print the A1 version for STD 2.X
+    for ((i=1; i<=$STD_NUM_RICS; i++))
+    do
+        sim_print $RIC_SIM_PREFIX"_g3_"$i interface
+    done
+fi
 
 # Load the polictypes in osc
 for ((i=1; i<=$OSC_NUM_RICS; i++))
@@ -115,6 +122,31 @@ else
     done
 fi
 
+if [ "$PMS_VERSION" == "V2" ]; then
+
+    # Load the polictypes in std
+    for ((i=1; i<=$STD_NUM_RICS; i++))
+    do
+        sim_put_policy_type 201 $RIC_SIM_PREFIX"_g3_"$i STD_QOS_0_2_0 demo-testdata/STD2/sim_qos.json
+        sim_put_policy_type 201 $RIC_SIM_PREFIX"_g3_"$i STD_QOS2_0.1.0 demo-testdata/STD2/sim_qos2.json
+    done
+
+    #Check the number of schemas and the individual schemas in STD
+    api_equal json:policy-types 6 120
+
+    for ((i=1; i<=$STD_NUM_RICS; i++))
+    do
+        api_equal json:policy-types?ric_id=$RIC_SIM_PREFIX"_g3_"$i 2 120
+    done
+
+    # Check the schemas in STD
+    for ((i=1; i<=$STD_NUM_RICS; i++))
+    do
+        api_get_policy_type 200 STD_QOS_0_2_0 demo-testdata/STD2/qos-agent-modified.json
+        api_get_policy_type 200 'STD_QOS2_0.1.0' demo-testdata/STD2/qos2-agent-modified.json
+    done
+fi
+
 # Create policies
 use_agent_rest_http
 
@@ -150,6 +182,12 @@ for ((i=1; i<=$STD_NUM_RICS; i++))
 do
     generate_uuid
     api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g2_"$i NOTYPE $((2100+$i)) NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
+    if [ "$PMS_VERSION" == "V2" ]; then
+        generate_uuid
+        api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g3_"$i STD_QOS_0_2_0 $((2300+$i)) NOTRANSIENT $notificationurl demo-testdata/STD2/pi1_template.json 1
+        generate_uuid
+        api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g3_"$i 'STD_QOS2_0.1.0' $((2400+$i)) NOTRANSIENT $notificationurl demo-testdata/STD2/pi1_template.json 1
+    fi
 done
 
 
@@ -157,6 +195,9 @@ done
 for ((i=1; i<=$STD_NUM_RICS; i++))
 do
     sim_equal $RIC_SIM_PREFIX"_g2_"$i num_instances 1
+    if [ "$PMS_VERSION" == "V2" ]; then
+        sim_equal $RIC_SIM_PREFIX"_g3_"$i num_instances 2
+    fi
 done
 
 check_policy_agent_logs
index 8473a75..3e0858f 100755 (executable)
@@ -166,7 +166,7 @@ if [ "$PMS_VERSION" == "V2" ]; then
     done
 fi
 
-#Check the number of schemas and the individual schemas in OSC
+#Check the number of types
 if [ "$PMS_VERSION" == "V2" ]; then
     api_equal json:policy-types 5 120
 else
diff --git a/test/auto-test/testdata/STD2/pi_qos2_template.json b/test/auto-test/testdata/STD2/pi_qos2_template.json
new file mode 100644 (file)
index 0000000..28a7fba
--- /dev/null
@@ -0,0 +1,8 @@
+{
+  "scope": {
+    "qosId": "qosXXX"
+  },
+  "qosObjectives": {
+    "priorityLevel": XXX
+  }
+}
\ No newline at end of file
diff --git a/test/auto-test/testdata/STD2/pi_qos_template.json b/test/auto-test/testdata/STD2/pi_qos_template.json
new file mode 100644 (file)
index 0000000..e06b031
--- /dev/null
@@ -0,0 +1,9 @@
+{
+  "scope": {
+    "ueId": "ueXXX",
+    "qosId": "qosXXX"
+  },
+  "qosObjectives": {
+    "priorityLevel": XXX
+  }
+}
\ No newline at end of file
diff --git a/test/auto-test/testdata/STD2/qos-agent-modified.json b/test/auto-test/testdata/STD2/qos-agent-modified.json
new file mode 100644 (file)
index 0000000..3748b79
--- /dev/null
@@ -0,0 +1,36 @@
+{
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "description": "STD QOS policy type",
+    "title": "STD_QOS_0_2_0",
+    "type": "object",
+    "properties": {
+      "qosObjectives": {
+        "additionalProperties": false,
+        "type": "object",
+        "properties": {
+          "priorityLevel": {
+            "type": "number"
+          }
+        },
+        "required": [
+          "priorityLevel"
+        ]
+      },
+      "scope": {
+        "additionalProperties": false,
+        "type": "object",
+        "properties": {
+          "qosId": {
+            "type": "string"
+          },
+          "ueId": {
+            "type": "string"
+          }
+        },
+        "required": [
+          "ueId",
+          "qosId"
+        ]
+      }
+    }
+  }
\ No newline at end of file
diff --git a/test/auto-test/testdata/STD2/qos2-agent-modified.json b/test/auto-test/testdata/STD2/qos2-agent-modified.json
new file mode 100644 (file)
index 0000000..1423a23
--- /dev/null
@@ -0,0 +1,32 @@
+{
+  "$schema": "http://json-schema.org/draft-07/schema#",
+  "description": "STD QOS2 policy type",
+  "title": "STD_QOS2_0.1.0",
+  "type": "object",
+  "properties": {
+    "qosObjectives": {
+      "additionalProperties": false,
+      "type": "object",
+      "properties": {
+        "priorityLevel": {
+          "type": "number"
+        }
+      },
+      "required": [
+        "priorityLevel"
+      ]
+    },
+    "scope": {
+      "additionalProperties": false,
+      "type": "object",
+      "properties": {
+        "qosId": {
+          "type": "string"
+        }
+      },
+      "required": [
+        "qosId"
+      ]
+    }
+  }
+}
\ No newline at end of file
diff --git a/test/auto-test/testdata/STD2/sim_qos.json b/test/auto-test/testdata/STD2/sim_qos.json
new file mode 100644 (file)
index 0000000..931498c
--- /dev/null
@@ -0,0 +1,56 @@
+{
+    "policySchema": {
+      "$schema": "http://json-schema.org/draft-07/schema#",
+      "title": "STD_QOS_0_2_0",
+      "description": "STD QOS policy type",
+      "type": "object",
+      "properties": {
+        "scope": {
+          "type": "object",
+          "properties": {
+            "ueId": {
+              "type": "string"
+            },
+            "qosId": {
+              "type": "string"
+            }
+          },
+          "additionalProperties": false,
+          "required": [
+            "ueId",
+            "qosId"
+          ]
+        },
+        "qosObjectives": {
+          "type": "object",
+          "properties": {
+            "priorityLevel": {
+              "type": "number"
+            }
+          },
+          "additionalProperties": false,
+          "required": [
+            "priorityLevel"
+          ]
+        }
+      }
+    },
+    "statusSchema": {
+      "$schema": "http://json-schema.org/draft-07/schema#",
+      "title": "STD_QOS_0.2.0",
+      "description": "STD QOS policy type status",
+      "type": "object",
+      "properties": {
+        "enforceStatus": {
+          "type": "string"
+        },
+        "enforceReason": {
+          "type": "string"
+        },
+        "additionalProperties": false,
+        "required": [
+          "enforceStatus"
+        ]
+      }
+    }
+  }
\ No newline at end of file
diff --git a/test/auto-test/testdata/STD2/sim_qos2.json b/test/auto-test/testdata/STD2/sim_qos2.json
new file mode 100644 (file)
index 0000000..f60ed89
--- /dev/null
@@ -0,0 +1,52 @@
+{
+    "policySchema": {
+      "$schema": "http://json-schema.org/draft-07/schema#",
+      "title": "STD_QOS2_0.1.0",
+      "description": "STD QOS2 policy type",
+      "type": "object",
+      "properties": {
+        "scope": {
+          "type": "object",
+          "properties": {
+            "qosId": {
+              "type": "string"
+            }
+          },
+          "additionalProperties": false,
+          "required": [
+            "qosId"
+          ]
+        },
+        "qosObjectives": {
+          "type": "object",
+          "properties": {
+            "priorityLevel": {
+              "type": "number"
+            }
+          },
+          "additionalProperties": false,
+          "required": [
+            "priorityLevel"
+          ]
+        }
+      }
+    },
+    "statusSchema": {
+      "$schema": "http://json-schema.org/draft-07/schema#",
+      "title": "STD_QOS_0.2.0",
+      "description": "STD QOS policy type status",
+      "type": "object",
+      "properties": {
+        "enforceStatus": {
+          "type": "string"
+        },
+        "enforceReason": {
+          "type": "string"
+        },
+        "additionalProperties": false,
+        "required": [
+          "enforceStatus"
+        ]
+      }
+    }
+  }
\ No newline at end of file
diff --git a/test/common/cr_api_functions.sh b/test/common/cr_api_functions.sh
new file mode 100644 (file)
index 0000000..fe4b1fd
--- /dev/null
@@ -0,0 +1,127 @@
+#!/bin/bash
+
+#  ============LICENSE_START===============================================
+#  Copyright (C) 2020 Nordix Foundation. All rights reserved.
+#  ========================================================================
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#  ============LICENSE_END=================================================
+#
+
+. ../common/api_curl.sh
+
+### Admin API functions for the Callback Reciver
+
+
+# Excute a curl cmd towards a Callback Reciver admin interface and check the response code.
+# args: <expected-response-code> <curl-cmd-string>
+__execute_curl_to_cr() {
+       echo ${FUNCNAME[1]} "line: "${BASH_LINENO[1]} >> $HTTPLOG
+       echo " CMD: $2" >> $HTTPLOG
+       res="$($2)"
+       echo " RESP: $res" >> $HTTPLOG
+       retcode=$?
+    if [ $retcode -ne 0 ]; then
+               ((RES_CONF_FAIL++))
+               echo " RETCODE: "$retcode
+        echo -e $RED" FAIL - fatal error when executing curl."$ERED
+        return 1
+    fi
+    status=${res:${#res}-3}
+    if [ $status -eq $1 ]; then
+        echo -e $GREEN" OK"$EGREEN
+        return 0
+    fi
+    echo -e $RED" FAIL - expected http response: "$1" but got http response: "$status $ERED
+       ((RES_CONF_FAIL++))
+    return 1
+}
+
+# Tests if a variable value in the CR is equal to a target value and and optional timeout.
+# Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
+# equal to the target or not.
+# Arg: <variable-name> <target-value> <timeout-in-sec>  - This test waits up to the timeout seconds
+# before setting pass or fail depending on if the variable value becomes equal to the target
+# value or not.
+# (Function for test scripts)
+cr_equal() {
+       if [ $# -eq 2 ] || [ $# -eq 3 ]; then
+               __var_test "CR" "$LOCALHOST$CR_EXTERNAL_PORT/counter/" $1 "=" $2 $3
+       else
+               ((RES_CONF_FAIL++))
+               __print_err "Wrong args to cr_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
+       fi
+}
+
+# CR API: Check the contents of all current ric sync events from PMS
+# <response-code> <id> [ EMPTY | ( <ric-id> )+ ]
+# (Function for test scripts)
+cr_api_check_all_sync_events() {
+       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+
+       if [ "$PMS_VERSION" != "V2" ]; then
+               echo -e $RED" FAIL, function not supported"$ERED
+               ((RES_FAIL++))
+               __check_stop_at_error
+               return 1
+       fi
+
+    if [ $# -lt 2 ]; then
+        __print_err "<response-code> <id> [ EMPTY | ( <ric-id> )+ ]" $@
+        return 1
+    fi
+
+       query="/get-all-events/"$2
+       res="$(__do_curl_to_api CR GET $query)"
+       status=${res:${#res}-3}
+
+       if [ $status -ne $1 ]; then
+               echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
+               ((RES_FAIL++))
+               __check_stop_at_error
+               return 1
+       fi
+
+       if [ $# -gt 2 ]; then
+               body=${res:0:${#res}-3}
+               if [ $# -eq 3 ] && [ $3 == "EMPTY" ]; then
+                       targetJson="["
+               else
+                       targetJson="["
+                       arr=(${@:3})
+
+                       for ((i=0; i<$(($#-2)); i=i+1)); do
+
+                               if [ "$targetJson" != "[" ]; then
+                                       targetJson=$targetJson","
+                               fi
+                               targetJson=$targetJson"{\"ric_id\":\"${arr[$i]}\",\"event_type\":\"AVAILABLE\"}"
+                       done
+               fi
+
+               targetJson=$targetJson"]"
+               echo "TARGET JSON: $targetJson" >> $HTTPLOG
+               res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+               if [ $res -ne 0 ]; then
+                       echo -e $RED" FAIL, returned body not correct"$ERED
+                       ((RES_FAIL++))
+                       __check_stop_at_error
+                       return 1
+               fi
+       fi
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+       return 0
+}
\ No newline at end of file
index 0afc2bc..3ed51c9 100755 (executable)
@@ -698,6 +698,8 @@ if [ $? -eq 0 ]; then
                echo -e $RED" Build Failed"$ERED
                ((RES_CONF_FAIL++))
                cat .dockererr
+               echo -e $RED"Exiting...."$ERED
+               exit 1
        fi
        cd $curdir
 else
@@ -715,6 +717,8 @@ if [ $? -eq 0 ]; then
                echo -e $RED" Build Failed"$ERED
                ((RES_CONF_FAIL++))
                cat .dockererr
+               echo -e $RED"Exiting...."$ERED
+               exit 1
        fi
        cd $curdir
 else
@@ -732,6 +736,8 @@ if [ $? -eq 0 ]; then
                echo -e $RED" Build Failed"$ERED
                ((RES_CONF_FAIL++))
                cat .dockererr
+               echo -e $RED"Exiting...."$ERED
+               exit 1
        fi
        cd $curdir
 else
@@ -811,6 +817,7 @@ print_result() {
        echo "-------------------------------------------------------------------------------------------------"
        echo "-- Description: "$TC_ONELINE_DESCR
        echo "-- Execution time: " $duration " seconds"
+       echo "-- Used env file: "$TEST_ENV_VAR_FILE
        echo "-------------------------------------------------------------------------------------------------"
        echo "-------------------------------------     RESULTS"
        echo ""
@@ -1868,6 +1875,23 @@ use_agent_retries() {
 start_ecs() {
 
        echo -e $BOLD"Starting ECS"$EBOLD
+
+       curdir=$PWD
+       cd $SIM_GROUP
+       cd ecs
+       cd $ECS_HOST_MNT_DIR
+       if [ -d database ]; then
+               echo -e $BOLD" Cleaning files in mounted dir: $PWD/database"$EBOLD
+               rm database/* > /dev/null
+               if [ $? -ne 0 ]; then
+                       echo -e $RED" Cannot remove database files in: $PWD"$ERED
+                       exit 1
+               fi
+       else
+               echo " No files in mounted dir or dir does not exists"
+       fi
+       cd $curdir
+
        __check_included_image 'ECS'
        if [ $? -eq 1 ]; then
                echo -e $RED"The ECS image has not been checked for this test run due to arg to the test script"$ERED