Enhanced ECS function tests 37/5137/2
authorBjornMagnussonXA <bjorn.magnusson@est.tech>
Mon, 23 Nov 2020 09:57:57 +0000 (10:57 +0100)
committerBjornMagnussonXA <bjorn.magnusson@est.tech>
Wed, 25 Nov 2020 07:18:16 +0000 (08:18 +0100)
Documentation updates

Also includes re-factoring of some scripts and functions

Issue-ID: NONRTRIC-311

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

49 files changed:
test/auto-test/FTC1.sh
test/auto-test/FTC100.sh
test/auto-test/FTC110.sh
test/auto-test/FTC1100.sh
test/auto-test/FTC150.sh
test/auto-test/FTC1800.sh [new file with mode: 0755]
test/auto-test/FTC300.sh
test/auto-test/FTC310.sh
test/auto-test/FTC350.sh
test/auto-test/FTC800.sh
test/auto-test/FTC810.sh
test/auto-test/FTC850.sh
test/auto-test/FTC900.sh
test/auto-test/PM_DEMO.sh
test/auto-test/PM_EI_DEMO.sh [new file with mode: 0755]
test/auto-test/testdata/ecs/ei-type-3.json [new file with mode: 0644]
test/auto-test/testdata/ecs/ei-type-4.json [new file with mode: 0644]
test/auto-test/testdata/ecs/ei-type-5.json [new file with mode: 0644]
test/auto-test/testdata/ecs/ei-type-6.json [new file with mode: 0644]
test/common/README.md
test/common/agent_api_functions.sh
test/common/api_curl.sh
test/common/controller_api_functions.sh
test/common/cr_api_functions.sh
test/common/do_curl_function.sh
test/common/ecs_api_functions.sh
test/common/prodstub_api_functions.sh
test/common/ricsimulator_api_functions.sh
test/common/test_env-onap-guilin.sh
test/common/test_env-onap-master.sh
test/common/test_env-oran-master.sh
test/common/testcase_common.sh
test/cr/Dockerfile
test/cr/README.md
test/cr/app/cr.py
test/cr/cr-build-start.sh
test/mrstub/.gitignore
test/mrstub/Dockerfile
test/mrstub/README.md
test/mrstub/app/main.py
test/mrstub/mrstub-build-start.sh
test/prodstub/Dockerfile
test/prodstub/README.md
test/prodstub/app/prodstub.py
test/prodstub/basic_test.sh
test/prodstub/prod-stub-build-start.sh
test/simulator-group/ecs/docker-compose.yml
test/simulator-group/ecs/mnt/.gitignore [new file with mode: 0644]
test/simulator-group/sim-monitor.js

index 3b02510..1fd48e3 100755 (executable)
@@ -24,7 +24,7 @@ TC_ONELINE_DESCR="Sanity test, create service and then create,update and delete
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
 #SUPPORTED TEST ENV FILE
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
 #SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
@@ -125,7 +125,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
             api_equal json:rics 3 60
 
 
             api_equal json:rics 3 60
 
-            api_equal json:policy-types 2 120
+            api_equal json:policy-types 3 120
 
             api_equal json:policies 0
 
 
             api_equal json:policies 0
 
index e20adab..e357041 100755 (executable)
 #
 
 
 #
 
 
-TC_ONELINE_DESCR="Full agent API walk through using agent REST/DMAAP and with/without SDNC A1 Controller"
+TC_ONELINE_DESCR="Full agent API walkthrough using agent REST/DMAAP and with/without SDNC A1 Controller"
 
 #App names to include in the test, space separated list
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
 
 #SUPPORTED TEST ENV FILE
 
 #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"
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
@@ -55,9 +55,11 @@ for __httpx in $TESTED_PROTOCOLS ; do
         clean_containers
 
         if [ $__httpx == "HTTPS" ]; then
         clean_containers
 
         if [ $__httpx == "HTTPS" ]; then
+            use_cr_https
             use_agent_rest_https
         else
             use_agent_rest_http
             use_agent_rest_https
         else
             use_agent_rest_http
+            use_cr_http
         fi
 
         start_policy_agent
         fi
 
         start_policy_agent
@@ -70,7 +72,6 @@ for __httpx in $TESTED_PROTOCOLS ; do
 
 
         if [ $__httpx == "HTTPS" ]; then
 
 
         if [ $__httpx == "HTTPS" ]; then
-            use_cr_https
             use_simulator_https
             use_mr_https
             if [[ $interface = *"SDNC"* ]]; then
             use_simulator_https
             use_mr_https
             if [[ $interface = *"SDNC"* ]]; then
@@ -82,7 +83,6 @@ for __httpx in $TESTED_PROTOCOLS ; do
                 use_agent_rest_https
             fi
         else
                 use_agent_rest_https
             fi
         else
-            use_cr_http
             use_simulator_http
             use_mr_http
             if [[ $interface = *"SDNC"* ]]; then
             use_simulator_http
             use_mr_http
             if [[ $interface = *"SDNC"* ]]; then
@@ -392,7 +392,7 @@ for __httpx in $TESTED_PROTOCOLS ; do
         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 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"
+            api_get_policy_status 200 5200 STD2 EMPTY EMPTY
         fi
 
 
         fi
 
 
@@ -467,9 +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_policy 200 5100 testdata/STD/pi1_template.json "service10" ricsim_g2_1 NOTYPE false $notificationurl
 
-            api_get_policy 200 5200 testdata/STD2/pi_qos2_template.json "service10" ricsim_g3_1 NOTYPE false $notificationurl
+            api_get_policy 200 5200 testdata/STD2/pi_qos2_template.json "service10" ricsim_g3_1 STD_QOS2_0.1.0 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
+            api_get_policies 200 ricsim_g1_1 "service10" 1 5000 ricsim_g1_1 "service10" 1 false $notificationurl testdata/OSC/pi1_template.json
         else
             api_get_policy 200 5000 testdata/OSC/pi1_template.json
 
         else
             api_get_policy 200 5000 testdata/OSC/pi1_template.json
 
index bc566df..6171ec3 100755 (executable)
@@ -24,7 +24,7 @@ TC_ONELINE_DESCR="Testing of service registration timeouts and keepalive"
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM"
 
 #SUPPORTED TEST ENV FILE
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM"
 
 #SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
index 0a1a014..266b3b5 100755 (executable)
 #
 
 
 #
 
 
-TC_ONELINE_DESCR="Experimental ECS test case"
+TC_ONELINE_DESCR="ECS full intefaces walkthrough"
 
 #App names to include in the test, space separated list
 
 #App names to include in the test, space separated list
-INCLUDED_IMAGES="ECS PRODSTUB"
+INCLUDED_IMAGES="ECS PRODSTUB CR RICSIM CP"
+
+#SUPPORTED TEST ENV FILE
+SUPPORTED_PROFILES="ONAP-MASTER ORAN-MASTER"
 
 . ../common/testcase_common.sh  $@
 . ../common/ecs_api_functions.sh
 . ../common/prodstub_api_functions.sh
 
 . ../common/testcase_common.sh  $@
 . ../common/ecs_api_functions.sh
 . ../common/prodstub_api_functions.sh
+. ../common/cr_api_functions.sh
 
 #### TEST BEGIN ####
 
 
 #### TEST BEGIN ####
 
@@ -33,35 +37,77 @@ FLAT_A1_EI="1"
 
 clean_containers
 
 
 clean_containers
 
-use_ecs_rest_http
+use_ecs_rest_https
+
+use_prod_stub_https
 
 
-use_prod_stub_http
+use_simulator_https
+
+use_cr_https
 
 start_ecs
 
 start_prod_stub
 
 
 start_ecs
 
 start_prod_stub
 
-set_ecs_debug
-
 set_ecs_trace
 
 set_ecs_trace
 
-# Setup prodstub sim to accept calls for producers, types and jobs
+start_control_panel
+
+if [ "$PMS_VERSION" == "V2" ]; then
+    start_ric_simulators ricsim_g3 4  STD_2.0.0
+fi
+
+start_cr
+
+CB_JOB="$PROD_STUB_HTTPX://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/job"
+CB_SV="$PROD_STUB_HTTPX://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/supervision"
+TARGET1="$RIC_SIM_HTTPX://ricsim_g3_1:$RIC_SIM_PORT/datadelivery"
+TARGET2="$RIC_SIM_HTTPX://ricsim_g3_2:$RIC_SIM_PORT/datadelivery"
+TARGET3="$RIC_SIM_HTTPX://ricsim_g3_3:$RIC_SIM_PORT/datadelivery"
+TARGET8="$RIC_SIM_HTTPX://ricsim_g3_4:$RIC_SIM_PORT/datadelivery"
+TARGET10="$RIC_SIM_HTTPX://ricsim_g3_4:$RIC_SIM_PORT/datadelivery"
+
+STATUS1="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job1-status"
+STATUS2="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job2-status"
+STATUS3="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job3-status"
+STATUS8="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job8-status"
+STATUS10="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job10-status"
+
+### Setup prodstub sim to accept calls for producers, types and jobs
+## prod-a type1
+## prod-b type1 and type2
+## prod-c no-type
+## prod-d type4
+## prod-e type6
+## prod-f type6
+
+## job1 -> prod-a
+## job2 -> prod-a
+## job3 -> prod-b
+## job4 -> prod-a
+## job6 -> prod-b
+## job8 -> prod-d
+## job10 -> prod-e and prod-f
+
 prodstub_arm_producer 200 prod-a
 prodstub_arm_producer 200 prod-b
 prodstub_arm_producer 200 prod-c
 prodstub_arm_producer 200 prod-a
 prodstub_arm_producer 200 prod-b
 prodstub_arm_producer 200 prod-c
-
 prodstub_arm_producer 200 prod-d
 prodstub_arm_producer 200 prod-d
-prodstub_arm_type 200 prod-d type4
-prodstub_arm_job_create 200 prod-d job8
+prodstub_arm_producer 200 prod-e
+prodstub_arm_producer 200 prod-f
 
 prodstub_arm_type 200 prod-a type1
 prodstub_arm_type 200 prod-b type2
 prodstub_arm_type 200 prod-b type3
 
 prodstub_arm_type 200 prod-a type1
 prodstub_arm_type 200 prod-b type2
 prodstub_arm_type 200 prod-b type3
+prodstub_arm_type 200 prod-d type4
+prodstub_arm_type 200 prod-e type6
+prodstub_arm_type 200 prod-f type6
 
 prodstub_disarm_type 200 prod-b type3
 prodstub_arm_type 200 prod-b type1
 prodstub_disarm_type 200 prod-b type1
 
 
 prodstub_disarm_type 200 prod-b type3
 prodstub_arm_type 200 prod-b type1
 prodstub_disarm_type 200 prod-b type1
 
+
 prodstub_arm_job_create 200 prod-a job1
 prodstub_arm_job_create 200 prod-a job2
 prodstub_arm_job_create 200 prod-b job3
 prodstub_arm_job_create 200 prod-a job1
 prodstub_arm_job_create 200 prod-a job2
 prodstub_arm_job_create 200 prod-b job3
@@ -73,16 +119,21 @@ prodstub_arm_job_delete 200 prod-b job3
 prodstub_arm_job_create 200 prod-b job4
 prodstub_arm_job_create 200 prod-a job4
 
 prodstub_arm_job_create 200 prod-b job4
 prodstub_arm_job_create 200 prod-a job4
 
-prodstub_arm_job_create 200 prod-b job5
-prodstub_arm_job_create 200 prod-a job5
-prodstub_arm_job_delete 200 prod-a job5
-
 prodstub_arm_job_create 200 prod-b job6
 
 prodstub_arm_job_create 200 prod-b job6
 
-# ecs status
+prodstub_arm_job_create 200 prod-d job8
+
+prodstub_arm_job_create 200 prod-e job10
+prodstub_arm_job_create 200 prod-f job10
+
+### ecs status
 ecs_api_service_status 200
 
 ecs_api_service_status 200
 
-# Initial tests - no config made
+cr_equal received_callbacks 0
+
+### Initial tests - no config made
+### GET: type ids, types, producer ids, producers, job ids, jobs
+### DELETE: jobs
 ecs_api_a1_get_type_ids 200 EMPTY
 ecs_api_a1_get_type 404 test-type
 
 ecs_api_a1_get_type_ids 200 EMPTY
 ecs_api_a1_get_type 404 test-type
 
@@ -121,10 +172,12 @@ fi
 ecs_api_edp_get_producer_jobs 404 test-prod
 
 
 ecs_api_edp_get_producer_jobs 404 test-prod
 
 
-# Setup of producer/job and test apis
-#prod-a
-ecs_api_edp_put_producer 201 prod-a http://producer-stub:8092/callbacks/create/prod-a http://producer-stub:8092/callbacks/delete/prod-a http://producer-stub:8092/callbacks/supervision/prod-a type1 testdata/ecs/ei-type-1.json
-ecs_api_edp_put_producer 200 prod-a http://producer-stub:8092/callbacks/create/prod-a http://producer-stub:8092/callbacks/delete/prod-a http://producer-stub:8092/callbacks/supervision/prod-a type1 testdata/ecs/ei-type-1.json
+### Setup of producer/job and testing apis ###
+
+## Setup prod-a
+ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+ecs_api_edp_put_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+
 
 ecs_api_a1_get_type_ids 200 type1
 if [  -z "$FLAT_A1_EI" ]; then
 
 ecs_api_a1_get_type_ids 200 type1
 if [  -z "$FLAT_A1_EI" ]; then
@@ -137,7 +190,8 @@ ecs_api_edp_get_type_ids 200 type1
 ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
 
 ecs_api_edp_get_producer_ids 200 prod-a
 ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
 
 ecs_api_edp_get_producer_ids 200 prod-a
-ecs_api_edp_get_producer 200 prod-a http://producer-stub:8092/callbacks/create/prod-a http://producer-stub:8092/callbacks/delete/prod-a http://producer-stub:8092/callbacks/supervision/prod-a type1 testdata/ecs/ei-type-1.json
+
+ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
 
 ecs_api_edp_get_producer_status 200 prod-a ENABLED
 
 
 ecs_api_edp_get_producer_status 200 prod-a ENABLED
 
@@ -156,66 +210,72 @@ fi
 
 ecs_api_edp_get_producer_jobs 200 prod-a EMPTY
 
 
 ecs_api_edp_get_producer_jobs 200 prod-a EMPTY
 
-
-#job1 - prod-a
+## Create a job for prod-a
+#job1 - prod-a
 if [  -z "$FLAT_A1_EI" ]; then
 if [  -z "$FLAT_A1_EI" ]; then
-    ecs_api_a1_put_job 201 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json
+    ecs_api_a1_put_job 201 type1 job1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
 else
 else
-    ecs_api_a1_put_job 201 job1 type1 http://localhost:80/target1 ric1 http://localhost:80/status1 testdata/ecs/job-template.json
+    ecs_api_a1_put_job 201 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ecs/job-template.json
 fi
 
 fi
 
-prodstub_check_jobdata 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json
+# Check the job data in the producer
+prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 testdata/ecs/job-template.json
 
 ecs_api_a1_get_job_ids 200 type1 NOWNER job1
 
 ecs_api_a1_get_job_ids 200 type1 NOWNER job1
-ecs_api_a1_get_job_ids 200 type1 ric1 job1
+ecs_api_a1_get_job_ids 200 type1 ricsim_g3_1 job1
+
 if [ ! -z "$FLAT_A1_EI" ]; then
     ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1
 fi
 
 if [  -z "$FLAT_A1_EI" ]; then
 if [ ! -z "$FLAT_A1_EI" ]; then
     ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1
 fi
 
 if [  -z "$FLAT_A1_EI" ]; then
-    ecs_api_a1_get_job 200 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json
+    ecs_api_a1_get_job 200 type1 job1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
 
     ecs_api_a1_get_job_status 200 type1 job1 ENABLED
 else
 
     ecs_api_a1_get_job_status 200 type1 job1 ENABLED
 else
-    ecs_api_a1_get_job 200 job1 type1 http://localhost:80/target1 ric1 http://localhost:80/status1 testdata/ecs/job-template.json
+    ecs_api_a1_get_job 200 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ecs/job-template.json
 
     ecs_api_a1_get_job_status 200 job1 ENABLED
 fi
 
 
     ecs_api_a1_get_job_status 200 job1 ENABLED
 fi
 
-ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json
+prodstub_equal create/prod-a/job1 1
 
 
+ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 testdata/ecs/job-template.json
 
 
-#job2 - prod-a
+## Create a second job for prod-a
+## job2 - prod-a
 if [  -z "$FLAT_A1_EI" ]; then
 if [  -z "$FLAT_A1_EI" ]; then
-    ecs_api_a1_put_job 201 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json
+    ecs_api_a1_put_job 201 type1 job2 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
 else
 else
-    ecs_api_a1_put_job 201 job2 type1 http://localhost:80/target2 ric2 http://localhost:80/status2 testdata/ecs/job-template.json
+    ecs_api_a1_put_job 201 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ecs/job-template.json
 fi
 
 fi
 
-prodstub_check_jobdata 200 prod-a job2 type1 http://localhost:80/target2 testdata/ecs/job-template.json
+# Check the job data in the producer
+prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 testdata/ecs/job-template.json
 
 ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
 
 ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
-ecs_api_a1_get_job_ids 200 type1 ric1 job1
-ecs_api_a1_get_job_ids 200 type1 ric2 job2
+ecs_api_a1_get_job_ids 200 type1 ricsim_g3_1 job1
+ecs_api_a1_get_job_ids 200 type1 ricsim_g3_2 job2
 if [ ! -z "$FLAT_A1_EI" ]; then
     ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2
 fi
 
 if [  -z "$FLAT_A1_EI" ]; then
 if [ ! -z "$FLAT_A1_EI" ]; then
     ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2
 fi
 
 if [  -z "$FLAT_A1_EI" ]; then
-    ecs_api_a1_get_job 200 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json
+    ecs_api_a1_get_job 200 type1 job2 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
 
     ecs_api_a1_get_job_status 200 type1 job2 ENABLED
 else
 
     ecs_api_a1_get_job_status 200 type1 job2 ENABLED
 else
-    ecs_api_a1_get_job 200 job2 type1 http://localhost:80/target2 ric2 http://localhost:80/status2 testdata/ecs/job-template.json
+    ecs_api_a1_get_job 200 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ecs/job-template.json
 
     ecs_api_a1_get_job_status 200 job2 ENABLED
 fi
 
 
     ecs_api_a1_get_job_status 200 job2 ENABLED
 fi
 
-ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json job2 type1 http://localhost:80/target2 testdata/ecs/job-template.json
+prodstub_equal create/prod-a/job2 1
 
 
+ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 testdata/ecs/job-template.json job2 type1 $TARGET2 testdata/ecs/job-template.json
 
 
-#prod-b
-ecs_api_edp_put_producer 201 prod-b http://producer-stub:8092/callbacks/create/prod-b http://producer-stub:8092/callbacks/delete/prod-b http://producer-stub:8092/callbacks/supervision/prod-b type2 testdata/ecs/ei-type-2.json
+## Setup prod-b
+ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
 
 ecs_api_a1_get_type_ids 200 type1 type2
 if [  -z "$FLAT_A1_EI" ]; then
 
 ecs_api_a1_get_type_ids 200 type1 type2
 if [  -z "$FLAT_A1_EI" ]; then
@@ -231,107 +291,477 @@ ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
 ecs_api_edp_get_type 200 type2 testdata/ecs/ei-type-2.json prod-b
 
 ecs_api_edp_get_producer_ids 200 prod-a prod-b
 ecs_api_edp_get_type 200 type2 testdata/ecs/ei-type-2.json prod-b
 
 ecs_api_edp_get_producer_ids 200 prod-a prod-b
-ecs_api_edp_get_producer 200 prod-a http://producer-stub:8092/callbacks/create/prod-a http://producer-stub:8092/callbacks/delete/prod-a http://producer-stub:8092/callbacks/supervision/prod-a type1 testdata/ecs/ei-type-1.json
-ecs_api_edp_get_producer 200 prod-b http://producer-stub:8092/callbacks/create/prod-b http://producer-stub:8092/callbacks/delete/prod-b http://producer-stub:8092/callbacks/supervision/prod-b type2 testdata/ecs/ei-type-2.json
 
 
-ecs_api_edp_get_producer_status 200 prod-b ENABLED
+ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+ecs_api_edp_get_producer 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
 
 
 
 
-#job3 - prod-b
+ecs_api_edp_get_producer_status 200 prod-b ENABLED
+
+## Create job for prod-b
+##  job3 - prod-b
 if [  -z "$FLAT_A1_EI" ]; then
 if [  -z "$FLAT_A1_EI" ]; then
-    ecs_api_a1_put_job 201 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json
+    ecs_api_a1_put_job 201 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
 else
 else
-    ecs_api_a1_put_job 201 job3 type2 http://localhost:80/target3 ric3 http://localhost:80/status3 testdata/ecs/job-template.json
+    ecs_api_a1_put_job 201 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json
 fi
 
 fi
 
-prodstub_check_jobdata 200 prod-b job3 type2 http://localhost:80/target3 testdata/ecs/job-template.json
+prodstub_equal create/prod-b/job3 1
+
+# Check the job data in the producer
+prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 testdata/ecs/job-template.json
 
 ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
 ecs_api_a1_get_job_ids 200 type2 NOWNER job3
 
 ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
 ecs_api_a1_get_job_ids 200 type2 NOWNER job3
-ecs_api_a1_get_job_ids 200 type1 ric1 job1
-ecs_api_a1_get_job_ids 200 type1 ric2 job2
-ecs_api_a1_get_job_ids 200 type2 ric3 job3
+ecs_api_a1_get_job_ids 200 type1 ricsim_g3_1 job1
+ecs_api_a1_get_job_ids 200 type1 ricsim_g3_2 job2
+ecs_api_a1_get_job_ids 200 type2 ricsim_g3_3 job3
 
 if [  -z "$FLAT_A1_EI" ]; then
 
 if [  -z "$FLAT_A1_EI" ]; then
-    ecs_api_a1_get_job 200 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json
+    ecs_api_a1_get_job 200 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
 
     ecs_api_a1_get_job_status 200 type2 job3 ENABLED
 else
 
     ecs_api_a1_get_job_status 200 type2 job3 ENABLED
 else
-    ecs_api_a1_get_job 200 job3 type2 http://localhost:80/target3 ric3 http://localhost:80/status3 testdata/ecs/job-template.json
+    ecs_api_a1_get_job 200 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json
 
     ecs_api_a1_get_job_status 200 job3 ENABLED
 fi
 
 
     ecs_api_a1_get_job_status 200 job3 ENABLED
 fi
 
-ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json job2 type1 http://localhost:80/target2 testdata/ecs/job-template.json
-ecs_api_edp_get_producer_jobs 200 prod-b job3 type2 http://localhost:80/target3 testdata/ecs/job-template.json
+ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 testdata/ecs/job-template.json job2 type1 $TARGET2 testdata/ecs/job-template.json
+ecs_api_edp_get_producer_jobs 200 prod-b job3 type2 $TARGET3 testdata/ecs/job-template.json
+
 
 
+## Setup prod-c (no types)
+ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c NOTYPE
 
 
-#prod-c (no types)
-ecs_api_edp_put_producer 201 prod-c http://producer-stub:8092/callbacks/create/prod-c http://producer-stub:8092/callbacks/delete/prod-c http://producer-stub:8092/callbacks/supervision/prod-c NOTYPE
 
 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
 
 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
-ecs_api_edp_get_producer 200 prod-a http://producer-stub:8092/callbacks/create/prod-a http://producer-stub:8092/callbacks/delete/prod-a http://producer-stub:8092/callbacks/supervision/prod-a type1 testdata/ecs/ei-type-1.json
-ecs_api_edp_get_producer 200 prod-b http://producer-stub:8092/callbacks/create/prod-b http://producer-stub:8092/callbacks/delete/prod-b http://producer-stub:8092/callbacks/supervision/prod-b type2 testdata/ecs/ei-type-2.json
-ecs_api_edp_get_producer 200 prod-c http://producer-stub:8092/callbacks/create/prod-c http://producer-stub:8092/callbacks/delete/prod-c http://producer-stub:8092/callbacks/supervision/prod-c EMPTY
+
+ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+ecs_api_edp_get_producer 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
+ecs_api_edp_get_producer 200 prod-c $CB_JOB/prod-c $CB_SV/prod-c EMPTY
 
 ecs_api_edp_get_producer_status 200 prod-c ENABLED
 
 
 ecs_api_edp_get_producer_status 200 prod-c ENABLED
 
+
+## Delete job3 and prod-b and re-create if different order
+
+# Delete job then producer
+ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3
+ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
+
 if [  -z "$FLAT_A1_EI" ]; then
     ecs_api_a1_delete_job 204 type2 job3
 else
     ecs_api_a1_delete_job 204 job3
 fi
 
 if [  -z "$FLAT_A1_EI" ]; then
     ecs_api_a1_delete_job 204 type2 job3
 else
     ecs_api_a1_delete_job 204 job3
 fi
 
+ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2
+ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
+
 ecs_api_edp_delete_producer 204 prod-b
 
 ecs_api_edp_delete_producer 204 prod-b
 
+ecs_api_edp_get_producer_status 404 prod-b
 
 
-prodstub_equal create/prod-d/job8 0
-prodstub_equal delete/prod-d/job8 0
+ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2
+ecs_api_edp_get_producer_ids 200 prod-a prod-c
+
+prodstub_equal delete/prod-b/job3 1
+
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_put_job 404 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
+else
+    ecs_api_a1_put_job 404 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json
+fi
+
+# Put producer then job
+ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
+
+ecs_api_edp_get_producer_status 200 prod-b ENABLED
+
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_put_job 201 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json
+    ecs_api_a1_get_job_status 200 type2 job3 ENABLED
+else
+    ecs_api_a1_put_job 201 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template2.json
+    ecs_api_a1_get_job_status 200 job3 ENABLED
+fi
+
+prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 testdata/ecs/job-template2.json
+
+ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3
+ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
+
+prodstub_equal create/prod-b/job3 2
+prodstub_equal delete/prod-b/job3 1
+
+# Delete only the producer
+ecs_api_edp_delete_producer 204 prod-b
+
+ecs_api_edp_get_producer_status 404 prod-b
+
+ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3
+ecs_api_edp_get_producer_ids 200 prod-a prod-c
+
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_get_job_status 200 type2 job3 DISABLED
+else
+    ecs_api_a1_get_job_status 200 job3 DISABLED
+fi
+
+cr_equal received_callbacks 1 30
+cr_equal received_callbacks?id=job3-status 1
+cr_api_check_all_ecs_events 200 job3-status DISABLED
+
+# Re-create the producer
+ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
+
+ecs_api_edp_get_producer_status 200 prod-b ENABLED
+
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_get_job_status 200 type2 job3 ENABLED
+else
+    ecs_api_a1_get_job_status 200 job3 ENABLED
+fi
+
+cr_equal received_callbacks 2 30
+cr_equal received_callbacks?id=job3-status 2
+cr_api_check_all_ecs_events 200 job3-status ENABLED
 
 
-ecs_api_edp_put_producer 201 prod-d http://producer-stub:8092/callbacks/create/prod-d http://producer-stub:8092/callbacks/delete/prod-d http://producer-stub:8092/callbacks/supervision/prod-d type4 testdata/ecs/ei-type-1.json
+prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 testdata/ecs/job-template2.json
+
+
+## Setup prod-d
+ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-1.json
 
 ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY
 
 if [  -z "$FLAT_A1_EI" ]; then
 
 ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY
 
 if [  -z "$FLAT_A1_EI" ]; then
-    ecs_api_a1_put_job 201 type4 job8 http://localhost:80/target8 ric4 testdata/ecs/job-template.json
+    ecs_api_a1_put_job 201 type4 job8 $TARGET8 ricsim_g3_4 testdata/ecs/job-template.json
 else
 else
-    ecs_api_a1_put_job 201 job8 type4 http://localhost:80/target8 ric4 http://localhost:80/status4 testdata/ecs/job-template.json
+    ecs_api_a1_put_job 201 job8 type4 $TARGET8 ricsim_g3_4 $STATUS8 testdata/ecs/job-template.json
 fi
 fi
-read -p "<continue>"
+
+prodstub_check_jobdata 200 prod-d job8 type4 $TARGET8 testdata/ecs/job-template.json
+
 prodstub_equal create/prod-d/job8 1
 prodstub_equal delete/prod-d/job8 0
 
 ecs_api_a1_get_job_ids 200 type4 NOWNER job8
 
 prodstub_equal create/prod-d/job8 1
 prodstub_equal delete/prod-d/job8 0
 
 ecs_api_a1_get_job_ids 200 type4 NOWNER job8
 
-ecs_api_edp_put_producer 200 prod-d http://producer-stub:8092/callbacks/create/prod-d http://producer-stub:8092/callbacks/delete/prod-d http://producer-stub:8092/callbacks/supervision/prod-d NOTYPE
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_get_job_status 200 type4 job8 ENABLED
+else
+    ecs_api_a1_get_job_status 200 job8 ENABLED
+fi
+
+# Re-PUT the producer with zero types
+ecs_api_edp_put_producer 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d NOTYPE
 
 if [  -z "$FLAT_A1_EI" ]; then
     ecs_api_a1_get_job_ids 404 type4 NOWNER
 else
 
 if [  -z "$FLAT_A1_EI" ]; then
     ecs_api_a1_get_job_ids 404 type4 NOWNER
 else
-    ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY
-    ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job8
+    ecs_api_a1_get_job_ids 200 type4 NOWNER job8
+    ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3 job8
 fi
 
 fi
 
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_get_job_status 200 type4 job8 DISABLED
+else
+    ecs_api_a1_get_job_status 200 job8 DISABLED
+fi
+
+cr_equal received_callbacks 3 30
+cr_equal received_callbacks?id=job8-status 1
+cr_api_check_all_ecs_events 200 job8-status DISABLED
+
 prodstub_equal create/prod-d/job8 1
 prodstub_equal delete/prod-d/job8 0
 
 prodstub_equal create/prod-d/job8 1
 prodstub_equal delete/prod-d/job8 0
 
+## Re-setup prod-d
+ecs_api_edp_put_producer 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-1.json
+
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_get_job_ids 404 type4 NOWNER
+else
+    ecs_api_a1_get_job_ids 200 type4 NOWNER job8
+    ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3 job8
+fi
 
 
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_get_job_status 200 type4 job8 ENABLED
+else
+    ecs_api_a1_get_job_status 200 job8 ENABLED
+fi
 
 
-ecs_api_edp_put_producer 200 prod-d http://producer-stub:8092/callbacks/create/prod-d http://producer-stub:8092/callbacks/delete/prod-d http://producer-stub:8092/callbacks/supervision/prod-d type4 testdata/ecs/ei-type-1.json
+ecs_api_edp_get_producer_status 200 prod-a ENABLED
+ecs_api_edp_get_producer_status 200 prod-b ENABLED
+ecs_api_edp_get_producer_status 200 prod-c ENABLED
+ecs_api_edp_get_producer_status 200 prod-d ENABLED
+
+cr_equal received_callbacks 4 30
+cr_equal received_callbacks?id=job8-status 2
+cr_api_check_all_ecs_events 200 job8-status ENABLED
+
+prodstub_equal create/prod-d/job8 2
+prodstub_equal delete/prod-d/job8 0
+
+
+## Setup prod-e
+ecs_api_edp_put_producer 201 prod-e $CB_JOB/prod-e $CB_SV/prod-e type6 testdata/ecs/ei-type-6.json
+
+ecs_api_a1_get_job_ids 200 type6 NOWNER EMPTY
 
 if [  -z "$FLAT_A1_EI" ]; then
 
 if [  -z "$FLAT_A1_EI" ]; then
-    ecs_api_a1_get_job_ids 404 type4 NOWNER
+    ecs_api_a1_put_job 201 type6 job10 $TARGET10 ricsim_g3_4 testdata/ecs/job-template.json
 else
 else
-    ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY
-    ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job8
+    ecs_api_a1_put_job 201 job10 type6 $TARGET10 ricsim_g3_4 $STATUS10 testdata/ecs/job-template.json
 fi
 
 fi
 
+prodstub_check_jobdata 200 prod-e job10 type6 $TARGET10 testdata/ecs/job-template.json
+
+prodstub_equal create/prod-e/job10 1
+prodstub_equal delete/prod-e/job10 0
+
+ecs_api_a1_get_job_ids 200 type6 NOWNER job10
+
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_get_job_status 200 type6 job10 ENABLED
+else
+    ecs_api_a1_get_job_status 200 job10 ENABLED
+fi
 
 
+## Setup prod-f
+ecs_api_edp_put_producer 201 prod-f $CB_JOB/prod-f $CB_SV/prod-f type6 testdata/ecs/ei-type-6.json
 
 
+ecs_api_a1_get_job_ids 200 type6 NOWNER job10
 
 
+prodstub_check_jobdata 200 prod-f job10 type6 $TARGET10 testdata/ecs/job-template.json
 
 
+prodstub_equal create/prod-f/job10 1
+prodstub_equal delete/prod-f/job10 0
 
 
-check_sdnc_logs
+ecs_api_a1_get_job_ids 200 type6 NOWNER job10
+
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_get_job_status 200 type6 job10 ENABLED
+else
+    ecs_api_a1_get_job_status 200 job10 ENABLED
+fi
+
+## Status updates prod-a and jobs
+
+ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
+
+ecs_api_edp_get_producer_status 200 prod-a ENABLED
+ecs_api_edp_get_producer_status 200 prod-b ENABLED
+ecs_api_edp_get_producer_status 200 prod-c ENABLED
+ecs_api_edp_get_producer_status 200 prod-d ENABLED
+ecs_api_edp_get_producer_status 200 prod-e ENABLED
+ecs_api_edp_get_producer_status 200 prod-f ENABLED
+
+# Arm producer prod-a for supervision failure
+prodstub_arm_producer 200 prod-a 400
+
+# Wait for producer prod-a to go disabled
+ecs_api_edp_get_producer_status 200 prod-a DISABLED 360
+
+ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d  prod-e prod-f
+
+ecs_api_edp_get_producer_status 200 prod-a DISABLED
+ecs_api_edp_get_producer_status 200 prod-b ENABLED
+ecs_api_edp_get_producer_status 200 prod-c ENABLED
+ecs_api_edp_get_producer_status 200 prod-d ENABLED
+ecs_api_edp_get_producer_status 200 prod-e ENABLED
+ecs_api_edp_get_producer_status 200 prod-f ENABLED
+
+
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_get_job_status 200 type1 job1 ENABLED
+    ecs_api_a1_get_job_status 200 type1 job2 ENABLED
+    ecs_api_a1_get_job_status 200 type2 job3 ENABLED
+    ecs_api_a1_get_job_status 200 type4 job8 ENABLED
+    ecs_api_a1_get_job_status 200 type6 job10 ENABLED
+else
+    ecs_api_a1_get_job_status 200 job1 ENABLED
+    ecs_api_a1_get_job_status 200 job2 ENABLED
+    ecs_api_a1_get_job_status 200 job3 ENABLED
+    ecs_api_a1_get_job_status 200 job8 ENABLED
+    ecs_api_a1_get_job_status 200 job10 ENABLED
+fi
+
+# Arm producer prod-a for supervision
+prodstub_arm_producer 200 prod-a 200
+
+# Wait for producer prod-a to go enabled
+ecs_api_edp_get_producer_status 200 prod-a ENABLED 360
+
+ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
+
+ecs_api_edp_get_producer_status 200 prod-a ENABLED
+ecs_api_edp_get_producer_status 200 prod-b ENABLED
+ecs_api_edp_get_producer_status 200 prod-c ENABLED
+ecs_api_edp_get_producer_status 200 prod-d ENABLED
+ecs_api_edp_get_producer_status 200 prod-e ENABLED
+ecs_api_edp_get_producer_status 200 prod-f ENABLED
+
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_get_job_status 200 type1 job1 ENABLED
+    ecs_api_a1_get_job_status 200 type1 job2 ENABLED
+    ecs_api_a1_get_job_status 200 type2 job3 ENABLED
+    ecs_api_a1_get_job_status 200 type4 job8 ENABLED
+    ecs_api_a1_get_job_status 200 type6 job10 ENABLED
+else
+    ecs_api_a1_get_job_status 200 job1 ENABLED
+    ecs_api_a1_get_job_status 200 job2 ENABLED
+    ecs_api_a1_get_job_status 200 job3 ENABLED
+    ecs_api_a1_get_job_status 200 job8 ENABLED
+    ecs_api_a1_get_job_status 200 job10 ENABLED
+fi
+
+# Arm producer prod-a for supervision failure
+prodstub_arm_producer 200 prod-a 400
+
+# Wait for producer prod-a to go disabled
+ecs_api_edp_get_producer_status 200 prod-a DISABLED 360
+
+ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
+
+ecs_api_edp_get_producer_status 200 prod-a DISABLED
+ecs_api_edp_get_producer_status 200 prod-b ENABLED
+ecs_api_edp_get_producer_status 200 prod-c ENABLED
+ecs_api_edp_get_producer_status 200 prod-d ENABLED
+ecs_api_edp_get_producer_status 200 prod-e ENABLED
+ecs_api_edp_get_producer_status 200 prod-f ENABLED
+
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_get_job_status 200 type1 job1 ENABLED
+    ecs_api_a1_get_job_status 200 type1 job2 ENABLED
+    ecs_api_a1_get_job_status 200 type2 job3 ENABLED
+    ecs_api_a1_get_job_status 200 type4 job8 ENABLED
+    ecs_api_a1_get_job_status 200 type6 job10 ENABLED
+else
+    ecs_api_a1_get_job_status 200 job1 ENABLED
+    ecs_api_a1_get_job_status 200 job2 ENABLED
+    ecs_api_a1_get_job_status 200 job3 ENABLED
+    ecs_api_a1_get_job_status 200 job8 ENABLED
+    ecs_api_a1_get_job_status 200 job10 ENABLED
+fi
+
+# Wait for producer prod-a to be removed
+ecs_equal json:ei-producer/v1/eiproducers 5 1000
+
+ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
+
+ecs_api_edp_get_producer_status 404 prod-a
+ecs_api_edp_get_producer_status 200 prod-b ENABLED
+ecs_api_edp_get_producer_status 200 prod-c ENABLED
+ecs_api_edp_get_producer_status 200 prod-d ENABLED
+ecs_api_edp_get_producer_status 200 prod-e ENABLED
+ecs_api_edp_get_producer_status 200 prod-f ENABLED
+
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_get_job_status 200 type1 job1 DISABLED
+    ecs_api_a1_get_job_status 200 type1 job2 DISABLED
+    ecs_api_a1_get_job_status 200 type2 job3 ENABLED
+    ecs_api_a1_get_job_status 200 type4 job8 ENABLED
+    ecs_api_a1_get_job_status 200 type6 job10 ENABLED
+else
+    ecs_api_a1_get_job_status 200 job1 DISABLED
+    ecs_api_a1_get_job_status 200 job2 DISABLED
+    ecs_api_a1_get_job_status 200 job3 ENABLED
+    ecs_api_a1_get_job_status 200 job8 ENABLED
+    ecs_api_a1_get_job_status 200 job10 ENABLED
+fi
+
+cr_equal received_callbacks 6 30
+cr_equal received_callbacks?id=job1-status 1
+cr_equal received_callbacks?id=job2-status 1
+
+cr_api_check_all_ecs_events 200 job1-status DISABLED
+cr_api_check_all_ecs_events 200 job2-status DISABLED
+
+
+# Arm producer prod-e for supervision failure
+prodstub_arm_producer 200 prod-e 400
+
+ecs_api_edp_get_producer_status 200 prod-e DISABLED 1000
+
+ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
+
+ecs_api_edp_get_producer_status 404 prod-a
+ecs_api_edp_get_producer_status 200 prod-b ENABLED
+ecs_api_edp_get_producer_status 200 prod-c ENABLED
+ecs_api_edp_get_producer_status 200 prod-d ENABLED
+ecs_api_edp_get_producer_status 200 prod-e DISABLED
+ecs_api_edp_get_producer_status 200 prod-f ENABLED
+
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_get_job_status 200 type1 job1 DISABLED
+    ecs_api_a1_get_job_status 200 type1 job2 DISABLED
+    ecs_api_a1_get_job_status 200 type2 job3 ENABLED
+    ecs_api_a1_get_job_status 200 type4 job8 ENABLED
+    ecs_api_a1_get_job_status 200 type6 job10 ENABLED
+else
+    ecs_api_a1_get_job_status 200 job1 DISABLED
+    ecs_api_a1_get_job_status 200 job2 DISABLED
+    ecs_api_a1_get_job_status 200 job3 ENABLED
+    ecs_api_a1_get_job_status 200 job8 ENABLED
+    ecs_api_a1_get_job_status 200 job10 ENABLED
+fi
+
+#Disable create for job10 in prod-e
+prodstub_arm_job_create 200 prod-e job10 400
+
+#Update tjob 10 - only prod-f will be updated
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_put_job 200 type6 job10 $TARGET10 ricsim_g3_4 testdata/ecs/job-template2.json
+else
+    ecs_api_a1_put_job 200 job10 type6 $TARGET10 ricsim_g3_4 $STATUS10 testdata/ecs/job-template2.json
+fi
+#Reset producer and job responses
+prodstub_arm_producer 200 prod-e 200
+prodstub_arm_job_create 200 prod-e job10 200
+
+ecs_api_edp_get_producer_status 200 prod-e ENABLED 360
+
+ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
+
+#Job 10 should be updated when the producer goes enabled
+deviation "Job 10 should be updated when the producer prod-e goes enabled"
+prodstub_check_jobdata 200 prod-e job10 type6 $TARGET10 testdata/ecs/job-template2.json
+prodstub_check_jobdata 200 prod-f job10 type6 $TARGET10 testdata/ecs/job-template2.json
+
+prodstub_arm_producer 200 prod-f 400
+
+ecs_api_edp_get_producer_status 200 prod-f DISABLED 360
+
+ecs_equal json:ei-producer/v1/eiproducers 4 1000
+
+ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e
+
+ecs_api_edp_get_producer_status 404 prod-a
+ecs_api_edp_get_producer_status 200 prod-b ENABLED
+ecs_api_edp_get_producer_status 200 prod-c ENABLED
+ecs_api_edp_get_producer_status 200 prod-d ENABLED
+ecs_api_edp_get_producer_status 200 prod-e ENABLED
+ecs_api_edp_get_producer_status 404 prod-f
+
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_get_job_status 200 type1 job1 DISABLED
+    ecs_api_a1_get_job_status 200 type1 job2 DISABLED
+    ecs_api_a1_get_job_status 200 type2 job3 ENABLED
+    ecs_api_a1_get_job_status 200 type4 job8 ENABLED
+    ecs_api_a1_get_job_status 200 type6 job10 ENABLED
+else
+    ecs_api_a1_get_job_status 200 job1 DISABLED
+    ecs_api_a1_get_job_status 200 job2 DISABLED
+    ecs_api_a1_get_job_status 200 job3 ENABLED
+    ecs_api_a1_get_job_status 200 job8 ENABLED
+    ecs_api_a1_get_job_status 200 job10 ENABLED
+fi
+
+cr_equal received_callbacks 6
 
 check_ecs_logs
 
 
 check_ecs_logs
 
@@ -339,7 +769,6 @@ store_logs END
 
 #### TEST COMPLETE ####
 
 
 #### TEST COMPLETE ####
 
-
 print_result
 
 auto_clean_containers
 print_result
 
 auto_clean_containers
index bd33bee..60108ba 100755 (executable)
@@ -24,7 +24,7 @@ TC_ONELINE_DESCR="Sample tests of the SDNC A1 controller restconf API using http
 INCLUDED_IMAGES="RICSIM SDNC"
 
 #SUPPORTED TEST ENV FILE
 INCLUDED_IMAGES="RICSIM SDNC"
 
 #SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER"
 
 . ../common/testcase_common.sh  $@
 . ../common/controller_api_functions.sh
 
 . ../common/testcase_common.sh  $@
 . ../common/controller_api_functions.sh
diff --git a/test/auto-test/FTC1800.sh b/test/auto-test/FTC1800.sh
new file mode 100755 (executable)
index 0000000..d8ecc85
--- /dev/null
@@ -0,0 +1,384 @@
+#!/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=================================================
+#
+
+
+TC_ONELINE_DESCR="ECS Create 10000 jobs and restart, test job persisency"
+
+#App names to include in the test, space separated list
+INCLUDED_IMAGES="ECS PRODSTUB CR CP"
+
+#SUPPORTED TEST ENV FILE
+SUPPORTED_PROFILES="ONAP-MASTER ORAN-MASTER"
+
+. ../common/testcase_common.sh  $@
+. ../common/ecs_api_functions.sh
+. ../common/prodstub_api_functions.sh
+
+#### TEST BEGIN ####
+
+FLAT_A1_EI="1"
+
+clean_containers
+
+use_ecs_rest_http
+
+use_prod_stub_http
+
+start_ecs
+
+start_prod_stub
+
+set_ecs_trace
+
+start_control_panel
+
+start_cr
+
+CB_JOB="http://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/job"
+CB_SV="http://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/supervision"
+TARGET="http://localhost:80/target"  # Dummy target
+
+NUM_JOBS=10000
+
+# Setup prodstub sim to accept calls for producers, types and jobs
+prodstub_arm_producer 200 prod-a
+prodstub_arm_producer 200 prod-b
+prodstub_arm_producer 200 prod-c
+prodstub_arm_producer 200 prod-d
+
+prodstub_arm_type 200 prod-a type1
+
+prodstub_arm_type 200 prod-b type1
+prodstub_arm_type 200 prod-b type2
+
+prodstub_arm_type 200 prod-c type1
+prodstub_arm_type 200 prod-c type2
+prodstub_arm_type 200 prod-c type3
+
+prodstub_arm_type 200 prod-d type4
+prodstub_arm_type 200 prod-d type5
+
+for ((i=1; i<=$NUM_JOBS; i++))
+do
+    if [ $(($i%5)) -eq 0 ]; then
+        prodstub_arm_job_create 200 prod-a job$i
+        prodstub_arm_job_create 200 prod-b job$i
+        prodstub_arm_job_create 200 prod-c job$i
+    fi
+    if [ $(($i%5)) -eq 1 ]; then
+        prodstub_arm_job_create 200 prod-b job$i
+        prodstub_arm_job_create 200 prod-c job$i
+    fi
+    if [ $(($i%5)) -eq 2 ]; then
+        prodstub_arm_job_create 200 prod-c job$i
+    fi
+    if [ $(($i%5)) -eq 3 ]; then
+        prodstub_arm_job_create 200 prod-d job$i
+    fi
+    if [ $(($i%5)) -eq 4 ]; then
+        prodstub_arm_job_create 200 prod-d job$i
+    fi
+done
+
+ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+
+ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json
+
+ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json type3 testdata/ecs/ei-type-3.json
+
+ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json type5 testdata/ecs/ei-type-5.json
+
+ecs_equal json:ei-producer/v1/eiproducers 4
+
+ecs_api_edp_get_producer_status 200 prod-a ENABLED
+ecs_api_edp_get_producer_status 200 prod-b ENABLED
+ecs_api_edp_get_producer_status 200 prod-c ENABLED
+ecs_api_edp_get_producer_status 200 prod-d ENABLED
+
+for ((i=1; i<=$NUM_JOBS; i++))
+do
+    if [ $(($i%5)) -eq 0 ]; then
+        ecs_api_a1_put_job 201 job$i type1 $TARGET ric1 $CR_PATH/job_status_ric1 testdata/ecs/job-template.json
+        if [  -z "$FLAT_A1_EI" ]; then
+            ecs_api_a1_get_job_status 200 type1 job$i ENABLED
+        else
+            ecs_api_a1_get_job_status 200 job$i ENABLED
+        fi
+    fi
+    if [ $(($i%5)) -eq 1 ]; then
+        ecs_api_a1_put_job 201 job$i type2 $TARGET ric1 $CR_PATH/job_status_ric1 testdata/ecs/job-template.json
+        if [  -z "$FLAT_A1_EI" ]; then
+            ecs_api_a1_get_job_status 200 type2 job$i ENABLED
+        else
+            ecs_api_a1_get_job_status 200 job$i ENABLED
+        fi
+    fi
+    if [ $(($i%5)) -eq 2 ]; then
+        ecs_api_a1_put_job 201 job$i type3 $TARGET ric1 $CR_PATH/job_status_ric1 testdata/ecs/job-template.json
+        if [  -z "$FLAT_A1_EI" ]; then
+            ecs_api_a1_get_job_status 200 type3 job$i ENABLED
+        else
+            ecs_api_a1_get_job_status 200 job$i ENABLED
+        fi
+    fi
+    if [ $(($i%5)) -eq 3 ]; then
+        ecs_api_a1_put_job 201 job$i type4 $TARGET ric1 $CR_PATH/job_status_ric1 testdata/ecs/job-template.json
+        if [  -z "$FLAT_A1_EI" ]; then
+            ecs_api_a1_get_job_status 200 type4 job$i ENABLED
+        else
+            ecs_api_a1_get_job_status 200 job$i ENABLED
+        fi
+    fi
+    if [ $(($i%5)) -eq 4 ]; then
+        ecs_api_a1_put_job 201 job$i type5 $TARGET ric1 $CR_PATH/job_status_ric1 testdata/ecs/job-template.json
+        if [  -z "$FLAT_A1_EI" ]; then
+            ecs_api_a1_get_job_status 200 type5 job$i ENABLED
+        else
+            ecs_api_a1_get_job_status 200 job$i ENABLED
+        fi
+    fi
+done
+
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_equal json:A1-EI/v1/eitypes/type1/eijobs $(($NUM_JOBS/5))
+    ecs_equal json:A1-EI/v1/eitypes/type2/eijobs $(($NUM_JOBS/5))
+    ecs_equal json:A1-EI/v1/eitypes/type3/eijobs $(($NUM_JOBS/5))
+    ecs_equal json:A1-EI/v1/eitypes/type4/eijobs $(($NUM_JOBS/5))
+    ecs_equal json:A1-EI/v1/eitypes/type5/eijobs $(($NUM_JOBS/5))
+else
+    ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
+    ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
+    ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
+    ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
+    ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
+fi
+
+restart_ecs
+
+set_ecs_trace
+
+for ((i=1; i<=$NUM_JOBS; i++))
+do
+    if [ $(($i%5)) -eq 0 ]; then
+        prodstub_delete_jobdata 204 prod-a job$i
+        prodstub_delete_jobdata 204 prod-b job$i
+        prodstub_delete_jobdata 204 prod-c job$i
+    fi
+    if [ $(($i%5)) -eq 1 ]; then
+        prodstub_delete_jobdata 204 prod-b job$i
+        prodstub_delete_jobdata 204 prod-c job$i
+    fi
+    if [ $(($i%5)) -eq 2 ]; then
+        prodstub_delete_jobdata 204 prod-c job$i
+    fi
+    if [ $(($i%5)) -eq 3 ]; then
+        prodstub_delete_jobdata 204 prod-d job$i
+    fi
+    if [ $(($i%5)) -eq 4 ]; then
+        prodstub_delete_jobdata 204 prod-d job$i
+    fi
+done
+
+ecs_api_edp_get_producer_status 404 prod-a
+ecs_api_edp_get_producer_status 404 prod-b
+ecs_api_edp_get_producer_status 404 prod-c
+ecs_api_edp_get_producer_status 404 prod-d
+
+for ((i=1; i<=$NUM_JOBS; i++))
+do
+    if [ $(($i%5)) -eq 0 ]; then
+        if [  -z "$FLAT_A1_EI" ]; then
+            ecs_api_a1_get_job_status 200 type1 job$i DISABLED
+        else
+            ecs_api_a1_get_job_status 200 job$i DISABLED
+        fi
+    fi
+    if [ $(($i%5)) -eq 1 ]; then
+        if [  -z "$FLAT_A1_EI" ]; then
+            ecs_api_a1_get_job_status 200 type2 job$i DISABLED
+        else
+            ecs_api_a1_get_job_status 200 job$i DISABLED
+        fi
+    fi
+    if [ $(($i%5)) -eq 2 ]; then
+        if [  -z "$FLAT_A1_EI" ]; then
+            ecs_api_a1_get_job_status 200 type3 job$i DISABLED
+        else
+            ecs_api_a1_get_job_status 200 job$i DISABLED
+        fi
+    fi
+    if [ $(($i%5)) -eq 3 ]; then
+        if [  -z "$FLAT_A1_EI" ]; then
+            ecs_api_a1_get_job_status 200 type4 job$i DISABLED
+        else
+            ecs_api_a1_get_job_status 200 job$i DISABLED
+        fi
+    fi
+    if [ $(($i%5)) -eq 4 ]; then
+        if [  -z "$FLAT_A1_EI" ]; then
+            ecs_api_a1_get_job_status 200 type5 job$i DISABLED
+        else
+            ecs_api_a1_get_job_status 200 job$i DISABLED
+        fi
+    fi
+done
+
+
+ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+
+ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json
+
+ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json type3 testdata/ecs/ei-type-3.json
+
+ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json type5 testdata/ecs/ei-type-5.json
+
+ecs_equal json:ei-producer/v1/eiproducers 4
+
+ecs_api_edp_get_producer_status 200 prod-a ENABLED
+ecs_api_edp_get_producer_status 200 prod-b ENABLED
+ecs_api_edp_get_producer_status 200 prod-c ENABLED
+ecs_api_edp_get_producer_status 200 prod-d ENABLED
+
+for ((i=1; i<=$NUM_JOBS; i++))
+do
+    if [ $(($i%5)) -eq 0 ]; then
+        if [  -z "$FLAT_A1_EI" ]; then
+            ecs_api_a1_get_job_status 200 type1 job$i ENABLED
+        else
+            ecs_api_a1_get_job_status 200 job$i ENABLED
+        fi
+    fi
+    if [ $(($i%5)) -eq 1 ]; then
+        if [  -z "$FLAT_A1_EI" ]; then
+            ecs_api_a1_get_job_status 200 type2 job$i ENABLED
+        else
+            ecs_api_a1_get_job_status 200 job$i ENABLED
+        fi
+    fi
+    if [ $(($i%5)) -eq 2 ]; then
+        if [  -z "$FLAT_A1_EI" ]; then
+            ecs_api_a1_get_job_status 200 type3 job$i ENABLED
+        else
+            ecs_api_a1_get_job_status 200 job$i ENABLED
+        fi
+    fi
+    if [ $(($i%5)) -eq 3 ]; then
+        if [  -z "$FLAT_A1_EI" ]; then
+            ecs_api_a1_get_job_status 200 type4 job$i ENABLED
+        else
+            ecs_api_a1_get_job_status 200 job$i ENABLED
+        fi
+    fi
+    if [ $(($i%5)) -eq 4 ]; then
+        if [  -z "$FLAT_A1_EI" ]; then
+            ecs_api_a1_get_job_status 200 type5 job$i ENABLED
+        else
+            ecs_api_a1_get_job_status 200 job$i ENABLED
+        fi
+    fi
+done
+
+
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_equal json:A1-EI/v1/eitypes/type1/eijobs $(($NUM_JOBS/5))
+    ecs_equal json:A1-EI/v1/eitypes/type2/eijobs $(($NUM_JOBS/5))
+    ecs_equal json:A1-EI/v1/eitypes/type3/eijobs $(($NUM_JOBS/5))
+    ecs_equal json:A1-EI/v1/eitypes/type4/eijobs $(($NUM_JOBS/5))
+    ecs_equal json:A1-EI/v1/eitypes/type5/eijobs $(($NUM_JOBS/5))
+else
+    ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
+    ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
+    ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
+    ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
+    ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5))
+fi
+
+for ((i=1; i<=$NUM_JOBS; i++))
+do
+    if [ $(($i%5)) -eq 0 ]; then
+        prodstub_check_jobdata 200 prod-a job$i type1 $TARGET testdata/ecs/job-template.json
+        prodstub_check_jobdata 200 prod-b job$i type1 $TARGET testdata/ecs/job-template.json
+        prodstub_check_jobdata 200 prod-c job$i type1 $TARGET testdata/ecs/job-template.json
+    fi
+    if [ $(($i%5)) -eq 1 ]; then
+        prodstub_check_jobdata 200 prod-b job$i type2 $TARGET testdata/ecs/job-template.json
+        prodstub_check_jobdata 200 prod-c job$i type2 $TARGET testdata/ecs/job-template.json
+    fi
+    if [ $(($i%5)) -eq 2 ]; then
+        prodstub_check_jobdata 200 prod-c job$i type3 $TARGET testdata/ecs/job-template.json
+    fi
+    if [ $(($i%5)) -eq 3 ]; then
+        prodstub_check_jobdata 200 prod-d job$i type4 $TARGET testdata/ecs/job-template.json
+    fi
+    if [ $(($i%5)) -eq 4 ]; then
+        prodstub_check_jobdata 200 prod-d job$i type5 $TARGET testdata/ecs/job-template.json
+    fi
+done
+
+
+for ((i=1; i<=$NUM_JOBS; i++))
+do
+    if [ $(($i%5)) -eq 0 ]; then
+        ecs_api_a1_delete_job 204 job$i
+    fi
+    if [ $(($i%5)) -eq 1 ]; then
+        ecs_api_a1_delete_job 204 job$i
+    fi
+    if [ $(($i%5)) -eq 2 ]; then
+        ecs_api_a1_delete_job 204 job$i
+    fi
+    if [ $(($i%5)) -eq 3 ]; then
+        ecs_api_a1_delete_job 204 job$i
+    fi
+    if [ $(($i%5)) -eq 4 ]; then
+        ecs_api_a1_delete_job 204 job$i
+    fi
+done
+
+ecs_equal json:ei-producer/v1/eiproducers 4
+
+ecs_api_edp_get_producer_status 200 prod-a ENABLED
+ecs_api_edp_get_producer_status 200 prod-b ENABLED
+ecs_api_edp_get_producer_status 200 prod-c ENABLED
+ecs_api_edp_get_producer_status 200 prod-d ENABLED
+
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_equal json:A1-EI/v1/eitypes/type1/eijobs 0
+    ecs_equal json:A1-EI/v1/eitypes/type2/eijobs 0
+    ecs_equal json:A1-EI/v1/eitypes/type3/eijobs 0
+    ecs_equal json:A1-EI/v1/eitypes/type4/eijobs 0
+    ecs_equal json:A1-EI/v1/eitypes/type5/eijobs 0
+else
+    ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0
+    ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0
+    ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0
+    ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0
+    ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0
+fi
+
+check_ecs_logs
+
+store_logs END
+
+#### TEST COMPLETE ####
+
+
+print_result
+
+auto_clean_containers
index 61ae8d6..f33146f 100755 (executable)
@@ -23,7 +23,7 @@ TC_ONELINE_DESCR="Resync 10000 policies using OSC and STD interface"
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
 #SUPPORTED TEST ENV FILE
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
 #SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
index 3edb022..994d0ca 100755 (executable)
 #
 
 
 #
 
 
-TC_ONELINE_DESCR="Resync of RIC via changes in the consul config"
+TC_ONELINE_DESCR="Resync of RIC via changes in the consul config or pushed config"
 
 #App names to include in the test, space separated list
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM"
 
 #SUPPORTED TEST ENV FILE
 
 #App names to include in the test, space separated list
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM"
 
 #SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
@@ -33,87 +33,114 @@ SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
 
 #### TEST BEGIN ####
 
 
 #### TEST BEGIN ####
 
-generate_uuid
+if [ "$PMS_VERSION" == "V2" ]; then
+    TESTED_VARIANTS="CONSUL NOCONSUL"
+else
+    TESTED_VARIANTS="CONSUL"
+fi
 
 
-# Clean container and start all needed containers #
-clean_containers
+for consul_conf in $TESTED_VARIANTS ; do
+    generate_uuid
 
 
-start_policy_agent
+    # Clean container and start all needed containers #
+    clean_containers
 
 
-set_agent_trace
+    start_policy_agent
 
 
-# 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"
+    set_agent_trace
 
 
-# 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 [ "$PMS_VERSION" == "V2" ]; then
-    start_ric_simulators ricsim_g3 1  STD_2.0.0
-fi
+    # 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"
 
 
-start_mr
+    # 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 [ "$PMS_VERSION" == "V2" ]; then
+        start_ric_simulators ricsim_g3 1  STD_2.0.0
+    fi
 
 
-start_cr
+    start_mr
 
 
-start_consul_cbs
+    start_cr
 
 
-start_control_panel
+    start_control_panel
 
 
-prepare_consul_config      NOSDNC  ".consul_config.json"
+    if [ $consul_conf == "CONSUL" ]; then
+        start_consul_cbs
+    fi
 
 
-consul_config_app                  ".consul_config.json"
+    prepare_consul_config      NOSDNC  ".consul_config.json"
 
 
-if [ "$PMS_VERSION" == "V2" ]; then
-    api_equal json:rics 3 120
+    if [ "$PMS_VERSION" == "V2" ] && [ $consul_conf == "NOCONSUL" ]; then
+        api_put_configuration 200 ".consul_config.json"
+        api_get_configuration 200 ".consul_config.json"
+    else
+        consul_config_app                  ".consul_config.json"
+    fi
 
 
-    cr_equal received_callbacks 3 120
+    if [ "$PMS_VERSION" == "V2" ]; then
+        api_equal json:rics 3 120
 
 
-    cr_api_check_all_sync_events 200 ric-registration ricsim_g1_1 ricsim_g2_1 ricsim_g3_1
-else
-    api_equal json:rics 2 120
-fi
+        cr_equal received_callbacks 3 120
 
 
-# Add an STD RIC and check
-start_ric_simulators ricsim_g2 2  STD_1.1.3
+        cr_api_check_all_sync_events 200 ric-registration ricsim_g1_1 ricsim_g2_1 ricsim_g3_1
+    else
+        api_equal json:rics 2 120
+    fi
 
 
-prepare_consul_config      NOSDNC  ".consul_config.json"
+    # Add an STD RIC and check
+    start_ric_simulators ricsim_g2 2  STD_1.1.3
 
 
-consul_config_app                  ".consul_config.json"
+    prepare_consul_config      NOSDNC  ".consul_config.json"
+    if [ "$PMS_VERSION" == "V2" ] && [ $consul_conf == "NOCONSUL" ]; then
+        api_put_configuration 200 ".consul_config.json"
+        api_get_configuration 200 ".consul_config.json"
+    else
+        consul_config_app                  ".consul_config.json"
+    fi
 
 
-if [ "$PMS_VERSION" == "V2" ]; then
-    api_equal json:rics 4 120
+    if [ "$PMS_VERSION" == "V2" ]; then
+        api_equal json:rics 4 120
 
 
-    cr_equal received_callbacks 4 120
+        cr_equal received_callbacks 4 120
 
 
-    cr_api_check_all_sync_events 200 ric-registration ricsim_g2_2
-else
-    api_equal json:rics 3 120
-fi
+        cr_api_check_all_sync_events 200 ric-registration ricsim_g2_2
+    else
+        api_equal json:rics 3 120
+    fi
 
 
-check_policy_agent_logs
-check_control_panel_logs
+    check_policy_agent_logs
+    check_control_panel_logs
 
 
-# Remove one RIC RIC and check
-start_ric_simulators ricsim_g2 1  STD_1.1.3
+    # Remove one RIC RIC and check
+    start_ric_simulators ricsim_g2 1  STD_1.1.3
 
 
-prepare_consul_config      NOSDNC  ".consul_config.json"
+    prepare_consul_config      NOSDNC  ".consul_config.json"
+    if [ "$PMS_VERSION" == "V2" ] && [ $consul_conf == "NOCONSUL" ]; then
+        api_put_configuration 200 ".consul_config.json"
+        api_get_configuration 200 ".consul_config.json"
+    else
+        consul_config_app                  ".consul_config.json"
+    fi
 
 
-consul_config_app                  ".consul_config.json"
+    if [ "$PMS_VERSION" == "V2" ]; then
+        api_equal json:rics 3 120
 
 
-if [ "$PMS_VERSION" == "V2" ]; then
-    api_equal json:rics 3 120
+        cr_equal received_callbacks 4 120
+    else
+        api_equal json:rics 2 120
+    fi
 
 
-    cr_equal received_callbacks 4 120
-else
-    api_equal json:rics 2 120
-fi
+    if [ "$PMS_VERSION" == "V2" ] && [ $consul_conf == "NOCONSUL" ]; then
+        api_get_configuration 200 ".consul_config.json"
+    fi
 
 
-check_policy_agent_logs
-check_control_panel_logs
+    check_policy_agent_logs
+    check_control_panel_logs
 
 
-store_logs          END
+    store_logs          END_$consul_conf
+done
 
 
 #### TEST COMPLETE ####
 
 
 #### TEST COMPLETE ####
index 959f00f..3c6f443 100755 (executable)
@@ -23,7 +23,7 @@ TC_ONELINE_DESCR="Change supported policy types and reconfigure rics"
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
 #SUPPORTED TEST ENV FILE
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
 #SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
index b7e49d4..401d310 100755 (executable)
@@ -23,7 +23,7 @@ TC_ONELINE_DESCR="Create 10000 policies in sequence using http/https and Agent R
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
 #SUPPORTED TEST ENV FILE
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
 #SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
index 3dd2a0e..74ecf72 100755 (executable)
@@ -23,7 +23,7 @@ TC_ONELINE_DESCR="Repeatedly create and delete policies in each RICs for 24h (or
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
 #SUPPORTED TEST ENV FILE
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
 #SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
index c6f61d7..26a5ffa 100755 (executable)
 #  ============LICENSE_END=================================================
 #
 
 #  ============LICENSE_END=================================================
 #
 
-TC_ONELINE_DESCR="Create/delete policies in parallel over a number of ric using a number of child process"
+TC_ONELINE_DESCR="Create/delete policies in parallel over a number of rics using a number of child process"
 
 #App names to include in the test, space separated list
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
 #SUPPORTED TEST ENV FILE
 
 #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"
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER"
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
 
 . ../common/testcase_common.sh  $@
 . ../common/agent_api_functions.sh
index f7e91e3..ea3ef87 100755 (executable)
@@ -23,7 +23,7 @@ TC_ONELINE_DESCR="Preparation for test of the Control Panel and the Health Check
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM"
 
 #SUPPORTED TEST ENV FILE
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM"
 
 #SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER"
 
 . ../common/testcase_common.sh $@
 . ../common/agent_api_functions.sh
 
 . ../common/testcase_common.sh $@
 . ../common/agent_api_functions.sh
index 3e0858f..ce54a5f 100755 (executable)
@@ -23,7 +23,7 @@ TC_ONELINE_DESCR="Preparation demo setup  - populating a number of ric simulator
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
 #SUPPORTED TEST ENV FILE
 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
 
 #SUPPORTED TEST ENV FILE
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER"
 
 . ../common/testcase_common.sh $@
 . ../common/agent_api_functions.sh
 
 . ../common/testcase_common.sh $@
 . ../common/agent_api_functions.sh
@@ -34,16 +34,17 @@ SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
 #Local vars in test script
 ##########################
 
 #Local vars in test script
 ##########################
 
+use_cr_https
+use_agent_rest_https
+use_sdnc_https
+use_simulator_https
+
 if [ "$PMS_VERSION" == "V2" ]; then
     notificationurl=$CR_PATH"/test"
 else
     notificationurl=""
 fi
 
 if [ "$PMS_VERSION" == "V2" ]; then
     notificationurl=$CR_PATH"/test"
 else
     notificationurl=""
 fi
 
-use_agent_rest_https
-use_sdnc_https
-use_simulator_https
-
 clean_containers
 
 OSC_NUM_RICS=6
 clean_containers
 
 OSC_NUM_RICS=6
@@ -61,8 +62,6 @@ start_mr #Just to prevent errors in the agent log...
 
 start_control_panel
 
 
 start_control_panel
 
-start_control_panel
-
 start_sdnc
 
 start_consul_cbs
 start_sdnc
 
 start_consul_cbs
diff --git a/test/auto-test/PM_EI_DEMO.sh b/test/auto-test/PM_EI_DEMO.sh
new file mode 100755 (executable)
index 0000000..2bca307
--- /dev/null
@@ -0,0 +1,198 @@
+#!/usr/bin/env 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=================================================
+#
+
+TC_ONELINE_DESCR="Preparation demo setup  - policy management and enrichment information"
+
+#App names to include in the test, space separated list
+INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC ECS PRODSTUB"
+
+#SUPPORTED TEST ENV FILE
+SUPPORTED_PROFILES="ONAP-MASTER ORAN-MASTER"
+
+. ../common/testcase_common.sh $@
+. ../common/agent_api_functions.sh
+. ../common/ricsimulator_api_functions.sh
+. ../common/ecs_api_functions.sh
+. ../common/prodstub_api_functions.sh
+. ../common/cr_api_functions.sh
+
+#### TEST BEGIN ####
+
+#Local vars in test script
+##########################
+
+use_cr_https
+use_agent_rest_https
+use_sdnc_https
+use_simulator_https
+use_ecs_rest_https
+use_prod_stub_https
+
+if [ "$PMS_VERSION" == "V2" ]; then
+    notificationurl=$CR_PATH"/test"
+else
+   echo "PMS VERSION 2 (V2) is required"
+   exit 1
+fi
+
+clean_containers
+
+STD_NUM_RICS=2
+
+start_ric_simulators $RIC_SIM_PREFIX"_g3" $STD_NUM_RICS STD_2.0.0
+
+start_mr #Just to prevent errors in the agent log...
+
+start_control_panel
+
+start_sdnc
+
+start_consul_cbs
+
+prepare_consul_config      SDNC  ".consul_config.json"
+consul_config_app                  ".consul_config.json"
+
+start_policy_agent
+
+start_cr
+
+start_prod_stub
+
+start_ecs
+
+set_agent_trace
+
+set_ecs_trace
+
+api_get_status 200
+
+# 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
+# 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 2 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
+
+#Check the number of types
+api_equal json:policy-types 2 120
+
+api_put_service 201 "Emergency-response-app" 0 "$CR_PATH/1"
+
+# Create policies in STD
+for ((i=1; i<=$STD_NUM_RICS; i++))
+do
+    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
+done
+
+
+# Check the number of policies in STD
+for ((i=1; i<=$STD_NUM_RICS; i++))
+do
+    sim_equal $RIC_SIM_PREFIX"_g3_"$i num_instances 2
+done
+
+
+
+FLAT_A1_EI="1"
+
+CB_JOB="$PROD_STUB_HTTPX://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/job"
+CB_SV="$PROD_STUB_HTTPX://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/supervision"
+TARGET1="$RIC_SIM_HTTPX://ricsim_g3_1:$RIC_SIM_PORT/datadelivery"
+TARGET2="$RIC_SIM_HTTPX://ricsim_g3_2:$RIC_SIM_PORT/datadelivery"
+
+STATUS1="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job1-status"
+STATUS2="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job2-status"
+
+prodstub_arm_producer 200 prod-a
+prodstub_arm_type 200 prod-a type1
+prodstub_arm_job_create 200 prod-a job1
+prodstub_arm_job_create 200 prod-a job2
+
+
+### ecs status
+ecs_api_service_status 200
+
+
+
+## Setup prod-a
+ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+
+ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
+
+ecs_api_edp_get_producer_status 200 prod-a ENABLED
+
+
+## Create a job for prod-a
+## job1 - prod-a
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_put_job 201 type1 job1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
+else
+    ecs_api_a1_put_job 201 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ecs/job-template.json
+fi
+
+# Check the job data in the producer
+prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 testdata/ecs/job-template.json
+
+
+## Create a second job for prod-a
+## job2 - prod-a
+if [  -z "$FLAT_A1_EI" ]; then
+    ecs_api_a1_put_job 201 type1 job2 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
+else
+    ecs_api_a1_put_job 201 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ecs/job-template.json
+fi
+
+# Check the job data in the producer
+prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 testdata/ecs/job-template.json
+
+
+
+
+check_policy_agent_logs
+check_ecs_logs
+check_sdnc_logs
+
+#### TEST COMPLETE ####
+
+store_logs          END
+
+print_result
diff --git a/test/auto-test/testdata/ecs/ei-type-3.json b/test/auto-test/testdata/ecs/ei-type-3.json
new file mode 100644 (file)
index 0000000..8dcbbc8
--- /dev/null
@@ -0,0 +1,6 @@
+{
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "STD_Type3_1.0.0",
+    "description": "EI-Type 3",
+    "type": "object"
+}
\ No newline at end of file
diff --git a/test/auto-test/testdata/ecs/ei-type-4.json b/test/auto-test/testdata/ecs/ei-type-4.json
new file mode 100644 (file)
index 0000000..56d0ad1
--- /dev/null
@@ -0,0 +1,6 @@
+{
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "STD_Type4_1.0.0",
+    "description": "EI-Type 4",
+    "type": "object"
+}
\ No newline at end of file
diff --git a/test/auto-test/testdata/ecs/ei-type-5.json b/test/auto-test/testdata/ecs/ei-type-5.json
new file mode 100644 (file)
index 0000000..3b95ec7
--- /dev/null
@@ -0,0 +1,6 @@
+{
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "STD_Type5_1.0.0",
+    "description": "EI-Type 5",
+    "type": "object"
+}
\ No newline at end of file
diff --git a/test/auto-test/testdata/ecs/ei-type-6.json b/test/auto-test/testdata/ecs/ei-type-6.json
new file mode 100644 (file)
index 0000000..8b6d680
--- /dev/null
@@ -0,0 +1,6 @@
+{
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "title": "STD_Type6_1.0.0",
+    "description": "EI-Type 6",
+    "type": "object"
+}
\ No newline at end of file
index 24dfc9d..4cde532 100644 (file)
@@ -742,15 +742,17 @@ Test of GET '/policy_status' or V2 GET '/policies/{policy_id}/status'.
 
 | arg list |
 |--|
 
 | arg list |
 |--|
-| `<response-code> <policy-id> (STD <enforce-status> [<reason>])|(OSC <instance-status> <has-been-deleted>)` |
+| `<response-code> <policy-id> (STD|STD2 <enforce-status>|EMPTY [<reason>|EMPTY])|(OSC <instance-status> <has-been-deleted>)` |
 
 | parameter | description |
 | --------- | ----------- |
 | `<response-code>` | Expected http response code |
 | `<policy-id>` |  Id of the policy |
 | `STD` |  Indicator of status of Standarized A1 |
 
 | parameter | description |
 | --------- | ----------- |
 | `<response-code>` | Expected http response code |
 | `<policy-id>` |  Id of the policy |
 | `STD` |  Indicator of status of Standarized A1 |
+| `STD2` |  Indicator of status of Standarized A1 version 2 |
 | `<enforce-status>` |  Enforcement status |
 | `<reason>` |  Optional reason |
 | `<enforce-status>` |  Enforcement status |
 | `<reason>` |  Optional reason |
+| `EMPTY` |  Indicator of empty string status or reason |
 | `OSC` |  Indicator of status of Non-Standarized OSC A1 |
 | `<instance-status>` |  Instance status |
 | `<has-been-deleted>` |  Deleted status, true or false |
 | `OSC` |  Indicator of status of Non-Standarized OSC A1 |
 | `<instance-status>` |  Instance status |
 | `<has-been-deleted>` |  Deleted status, true or false |
@@ -890,6 +892,30 @@ Test of PUT '/services/keepalive' or V2 PUT '/v2/services/{service_id}/keepalive
 | `<response-code>` | Expected http response code |
 | `<service-name>` |  Service name |
 
 | `<response-code>` | Expected http response code |
 | `<service-name>` |  Service name |
 
+## Function: api_put_configuration() ##
+Test of PUT '/v2/configuration'
+
+| arg list |
+|--|
+| <response-code> <config-file>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<config-file>` |  Path json config file |
+
+## Function: api_get_configuration() ##
+Test of GET '/v2/configuration'
+
+| arg list |
+|--|
+| <response-code> [<config-file>]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<config-file>` |  Path json config file to compare the retrieved config with |
+
 # Description of functions in ricsimulator_api_functions.sh #
 The functions below only use the admin interface of the simulator, no usage of the A1 interface.
 
 # Description of functions in ricsimulator_api_functions.sh #
 The functions below only use the admin interface of the simulator, no usage of the A1 interface.
 
@@ -1115,6 +1141,22 @@ Checks the status of a policy
 
 # Description of functions in ecs_api_function.sh #
 
 
 # Description of functions in ecs_api_function.sh #
 
+## Function: ecs_equal ##
+Tests if a variable value in the ECS is equal to a target value.
+Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
+With the timeout, the 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.
+See the 'a1-interface' repo for more details.
+
+| arg list |
+|--|
+| `<variable-name> <target-value> [ <timeout-in-sec> ]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<variable-name>` | Variable name in ecs  |
+| `<target-value>` | Target value for the variable  |
+| `<timeout-in-sec>` | Max time to wait for the variable to reach the target value  |
+
 ## Function: ecs_api_a1_get_job_ids() ##
 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs' and optional check of the array of returned job ids.
 To test the response code only, provide the response code parameter as well as a type id and an owner id.
 ## Function: ecs_api_a1_get_job_ids() ##
 Test of GET '/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs' and optional check of the array of returned job ids.
 To test the response code only, provide the response code parameter as well as a type id and an owner id.
@@ -1329,14 +1371,13 @@ To test, provide all parameters. The list of type/schema pair may be empty.
 
 | arg list |
 |--|
 
 | arg list |
 |--|
-| `<response-code> <producer-id> <create-callback> <delete-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+)` |
+| `<response-code> <producer-id> <job-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+)` |
 
 | parameter | description |
 | --------- | ----------- |
 | `<response-code>` | Expected http response code |
 | `<producer-id>` | Id of the producer  |
 
 | parameter | description |
 | --------- | ----------- |
 | `<response-code>` | Expected http response code |
 | `<producer-id>` | Id of the producer  |
-| `<create-callback>` | Callback for create job  |
-| `<delete-callback>` | Callback for delete job  |
+| `<job-callback>` | Callback for create/delete job  |
 | `<supervision-callback>` | Callback for producer supervision  |
 | `<type-id>` | Id of the EI type  |
 | `<schema-file>` | Path to a schema file  |
 | `<supervision-callback>` | Callback for producer supervision  |
 | `<type-id>` | Id of the EI type  |
 | `<schema-file>` | Path to a schema file  |
@@ -1456,6 +1497,20 @@ Check a job in the prodstub towards the list of provided parameters.
 | `<target-url>` | Target url for data delivery  |
 | `<template-job-file>` | Path to a job template file  |
 
 | `<target-url>` | Target url for data delivery  |
 | `<template-job-file>` | Path to a job template file  |
 
+## Function: prodstub_delete_jobdata() ##
+Delete the job parameters, job data, for a job.
+
+| arg list |
+|--|
+| `<response-code> <producer-id> <job-id>` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<producer-id>` | Id of the producer  |
+| `<job-id>` | Id of the job  |
+
+
 ## Function: prodstub_equal ##
 Tests if a variable value in the prodstub is equal to a target value.
 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
 ## Function: prodstub_equal ##
 Tests if a variable value in the prodstub is equal to a target value.
 Without the timeout, the test sets pass or fail immediately depending on if the variable is equal to the target or not.
index 5f5a2c6..fbd9fc4 100644 (file)
@@ -43,8 +43,6 @@ api_equal() {
                        return 0
                fi
        fi
                        return 0
                fi
        fi
-
-       ((RES_CONF_FAIL++))
        __print_err "needs two or three args: json:<json-array-param> <target-value> [ timeout ]" $@
        return 1
 }
        __print_err "needs two or three args: json:<json-array-param> <target-value> [ timeout ]" $@
        return 1
 }
@@ -54,9 +52,7 @@ api_equal() {
 # args(V2): <response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <transient> <notification-url> <template-file>]*]
 # (Function for test scripts)
 api_get_policies() {
 # args(V2): <response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <transient> <notification-url> <template-file>]*]
 # (Function for test scripts)
 api_get_policies() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
        if [ "$PMS_VERSION" == "V2" ]; then
                paramError=0
 
        if [ "$PMS_VERSION" == "V2" ]; then
                paramError=0
@@ -115,9 +111,7 @@ api_get_policies() {
                status=${res:${#res}-3}
 
                if [ $status -ne $1 ]; then
                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
+                       __log_test_fail_status_code $1 $status
                        return 1
                fi
 
                        return 1
                fi
 
@@ -154,9 +148,7 @@ api_get_policies() {
                        res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                        if [ $res -ne 0 ]; then
                        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
+                               __log_test_fail_body
                                return 1
                        fi
                fi
                                return 1
                        fi
                fi
@@ -184,9 +176,7 @@ api_get_policies() {
                status=${res:${#res}-3}
 
                if [ $status -ne $1 ]; then
                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
+                       __log_test_fail_status_code $1 $status
                        return 1
                fi
 
                        return 1
                fi
 
@@ -221,16 +211,13 @@ api_get_policies() {
                        res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                        if [ $res -ne 0 ]; then
                        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
+                               __log_test_fail_body
                                return 1
                        fi
                fi
        fi
 
                                return 1
                        fi
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 
 }
        return 0
 
 }
@@ -242,9 +229,7 @@ api_get_policies() {
 
 # (Function for test scripts)
 api_get_policy() {
 
 # (Function for test scripts)
 api_get_policy() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
 
        if [ "$PMS_VERSION" == "V2" ]; then
 
 
        if [ "$PMS_VERSION" == "V2" ]; then
@@ -264,9 +249,7 @@ api_get_policy() {
        status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
        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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
@@ -275,7 +258,6 @@ api_get_policy() {
 
                        #Create a policy json to compare with
                        body=${res:0:${#res}-3}
 
                        #Create a policy json to compare with
                        body=${res:0:${#res}-3}
-                       file="./tmp/.p.json"
 
                        targetJson="\"ric_id\":\"$5\",\"policy_id\":\"$UUID$2\",\"service_id\":\"$4\""
                        if [ $7 != "NOTRANSIENT" ]; then
 
                        targetJson="\"ric_id\":\"$5\",\"policy_id\":\"$UUID$2\",\"service_id\":\"$4\""
                        if [ $7 != "NOTRANSIENT" ]; then
@@ -290,16 +272,14 @@ api_get_policy() {
                                targetJson=$targetJson", \"status_notification_uri\":\"$8\""
                        fi
 
                                targetJson=$targetJson", \"status_notification_uri\":\"$8\""
                        fi
 
-                       data=$(sed 's/XXX/'${2}'/g' $temp)
+                       data=$(sed 's/XXX/'${2}'/g' $3)
                        targetJson=$targetJson", \"policy_data\":$data"
                        targetJson="{$targetJson}"
 
                        echo "TARGET JSON: $targetJson" >> $HTTPLOG
                        res=$(python3 ../common/compare_json.py "$targetJson" "$body")
                        if [ $res -ne 0 ]; then
                        targetJson=$targetJson", \"policy_data\":$data"
                        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
+                               __log_test_fail_body
                                return 1
                        fi
                fi
                                return 1
                        fi
                fi
@@ -313,16 +293,12 @@ api_get_policy() {
                        echo "TARGET JSON: $targetJson" >> $HTTPLOG
                        res=$(python3 ../common/compare_json.py "$targetJson" "$body")
                        if [ $res -ne 0 ]; then
                        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
+                               __log_test_fail_body
                        fi
                fi
        fi
 
                        fi
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -331,9 +307,7 @@ api_get_policy() {
 # args(V2): <response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <notification-url>|NOURL <template-file> [<count>]
 # (Function for test scripts)
 api_put_policy() {
 # args(V2): <response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <notification-url>|NOURL <template-file> [<count>]
 # (Function for test scripts)
 api_put_policy() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
        if [ "$PMS_VERSION" == "V2" ]; then
                if [ $# -lt 8 ] || [ $# -gt 9 ]; then
 
        if [ "$PMS_VERSION" == "V2" ]; then
                if [ $# -lt 8 ] || [ $# -gt 9 ]; then
@@ -409,9 +383,7 @@ api_put_policy() {
                echo -ne " Executing "$count"("$max")${SAMELINE}"
                if [ $status -ne $1 ]; then
                        echo " Executed "$count"?("$max")"
                echo -ne " Executing "$count"("$max")${SAMELINE}"
                if [ $status -ne $1 ]; then
                        echo " Executed "$count"?("$max")"
-                       echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
-                       ((RES_FAIL++))
-                       __check_stop_at_error
+                       __log_test_fail_status_code $1 $status
                        return 1
                fi
 
                        return 1
                fi
 
@@ -421,8 +393,7 @@ api_put_policy() {
        done
        echo ""
 
        done
        echo ""
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -432,9 +403,7 @@ api_put_policy() {
 # (Function for test scripts)
 
 api_put_policy_batch() {
 # (Function for test scripts)
 
 api_put_policy_batch() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
        if [ "$PMS_VERSION" == "V2" ]; then
                if [ $# -lt 8 ] || [ $# -gt 9 ]; then
 
        if [ "$PMS_VERSION" == "V2" ]; then
                if [ $# -lt 8 ] || [ $# -gt 9 ]; then
@@ -509,9 +478,7 @@ api_put_policy_batch() {
 
                if [ $status -ne 200 ]; then
                        echo " Requested(batch) "$count"?("$max")"
 
                if [ $status -ne 200 ]; then
                        echo " Requested(batch) "$count"?("$max")"
-                       echo -e $RED" FAIL. Exepected status 200 (in request), got "$status $ERED
-                       ((RES_FAIL++))
-                       __check_stop_at_error
+                       __log_test_fail_status_code 200 $status
                        return 1
                fi
                cid=${res:0:${#res}-3}
                        return 1
                fi
                cid=${res:0:${#res}-3}
@@ -531,9 +498,7 @@ api_put_policy_batch() {
 
                if [ $status -ne $1 ]; then
                        echo " Accepted(batch) "$count"?("$max")"
 
                if [ $status -ne $1 ]; then
                        echo " Accepted(batch) "$count"?("$max")"
-                       echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
-                       ((RES_FAIL++))
-                       __check_stop_at_error
+                       __log_test_fail_status_code $1 $status
                        return 1
                fi
 
                        return 1
                fi
 
@@ -543,8 +508,7 @@ api_put_policy_batch() {
 
        echo ""
 
 
        echo ""
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -553,9 +517,7 @@ api_put_policy_batch() {
 # args(V2): <response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <notification-url>|NOURL <template-file> <count-per-ric> <number-of-threads>
 # (Function for test scripts)
 api_put_policy_parallel() {
 # args(V2): <response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <notification-url>|NOURL <template-file> <count-per-ric> <number-of-threads>
 # (Function for test scripts)
 api_put_policy_parallel() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
        if [ "$PMS_VERSION" == "V2" ]; then
                if [ $# -ne 11 ]; then
 
        if [ "$PMS_VERSION" == "V2" ]; then
                if [ $# -ne 11 ]; then
@@ -648,15 +610,11 @@ api_put_policy_parallel() {
                fi
        done
        if [ -z $msg ]; then
                fi
        done
        if [ -z $msg ]; then
-               echo " $(($count*$num_rics)) policy request(s) executed"
-               ((RES_PASS++))
-               echo -e $GREEN" PASS"$EGREEN
+               __log_test_pass " $(($count*$num_rics)) policy request(s) executed"
                return 0
        fi
 
                return 0
        fi
 
-       echo -e $RED" FAIL. One of more processes failed to execute" $ERED
-       ((RES_FAIL++))
-       __check_stop_at_error
+       __log_test_fail_general "One of more processes failed to execute"
        return 1
 }
 
        return 1
 }
 
@@ -664,9 +622,7 @@ api_put_policy_parallel() {
 # args: <response-code> <policy-id> [count]
 # (Function for test scripts)
 api_delete_policy() {
 # args: <response-code> <policy-id> [count]
 # (Function for test scripts)
 api_delete_policy() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     if [ $# -lt 2 ] || [ $# -gt 3 ]; then
         __print_err "<response-code> <policy-id> [count]" $@
 
     if [ $# -lt 2 ] || [ $# -gt 3 ]; then
         __print_err "<response-code> <policy-id> [count]" $@
@@ -694,9 +650,7 @@ api_delete_policy() {
 
                if [ $status -ne $1 ]; then
                        echo " Executed "$count"?("$max")"
 
                if [ $status -ne $1 ]; then
                        echo " Executed "$count"?("$max")"
-                       echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
-                       ((RES_FAIL++))
-                       __check_stop_at_error
+                       __log_test_fail_status_code $1 $status
                        return 1
                fi
                let pid=$pid+1
                        return 1
                fi
                let pid=$pid+1
@@ -705,8 +659,7 @@ api_delete_policy() {
        done
        echo ""
 
        done
        echo ""
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -714,9 +667,7 @@ api_delete_policy() {
 # args: <response-code> <policy-id> [count]
 # (Function for test scripts)
 api_delete_policy_batch() {
 # args: <response-code> <policy-id> [count]
 # (Function for test scripts)
 api_delete_policy_batch() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     if [ $# -lt 2 ] || [ $# -gt 3 ]; then
         __print_err "<response-code> <policy-id> [count]" $@
 
     if [ $# -lt 2 ] || [ $# -gt 3 ]; then
         __print_err "<response-code> <policy-id> [count]" $@
@@ -744,9 +695,7 @@ api_delete_policy_batch() {
 
                if [ $status -ne 200 ]; then
                        echo " Requested(batch) "$count"?("$max")"
 
                if [ $status -ne 200 ]; then
                        echo " Requested(batch) "$count"?("$max")"
-                       echo -e $RED" FAIL. Exepected status 200 (in request), got "$status $ERED
-                       ((RES_FAIL++))
-                       __check_stop_at_error
+                       __log_test_fail_status_code 200 $status
                        return 1
                fi
                cid=${res:0:${#res}-3}
                        return 1
                fi
                cid=${res:0:${#res}-3}
@@ -767,9 +716,7 @@ api_delete_policy_batch() {
 
                if [ $status -ne $1 ]; then
                        echo " Deleted(batch) "$count"?("$max")"
 
                if [ $status -ne $1 ]; then
                        echo " Deleted(batch) "$count"?("$max")"
-                       echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
-                       ((RES_FAIL++))
-                       __check_stop_at_error
+                       __log_test_fail_status_code $1 $status
                        return 1
                fi
 
                        return 1
                fi
 
@@ -779,8 +726,7 @@ api_delete_policy_batch() {
 
        echo ""
 
 
        echo ""
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -788,9 +734,7 @@ api_delete_policy_batch() {
 # args: <response-code> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>
 # (Function for test scripts)
 api_delete_policy_parallel() {
 # args: <response-code> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>
 # (Function for test scripts)
 api_delete_policy_parallel() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     if [ $# -ne 5 ]; then
         __print_err " <response-code> <ric-id-base> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>" $@
 
     if [ $# -ne 5 ]; then
         __print_err " <response-code> <ric-id-base> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>" $@
@@ -849,15 +793,11 @@ api_delete_policy_parallel() {
                fi
        done
        if [ -z $msg ]; then
                fi
        done
        if [ -z $msg ]; then
-               echo " $(($count*$num_rics)) policy request(s) executed"
-               ((RES_PASS++))
-               echo -e $GREEN" PASS"$EGREEN
+               __log_test_pass " $(($count*$num_rics)) policy request(s) executed"
                return 0
        fi
 
                return 0
        fi
 
-       echo -e $RED" FAIL. One of more processes failed to execute" $ERED
-       ((RES_FAIL++))
-       __check_stop_at_error
+       __log_test_fail_general "One of more processes failed to execute"
        return 1
 }
 
        return 1
 }
 
@@ -865,9 +805,7 @@ api_delete_policy_parallel() {
 # args: <response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)
 # (Function for test scripts)
 api_get_policy_ids() {
 # args: <response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)
 # (Function for test scripts)
 api_get_policy_ids() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     if [ $# -lt 4 ]; then
                __print_err "<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)" $@
 
     if [ $# -lt 4 ]; then
                __print_err "<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)" $@
@@ -924,9 +862,7 @@ api_get_policy_ids() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
@@ -951,15 +887,12 @@ api_get_policy_ids() {
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                if [ $res -ne 0 ]; then
                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
+                       __log_test_fail_body
                        return 1
                fi
        fi
 
                        return 1
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -967,14 +900,10 @@ api_get_policy_ids() {
 # args(V2): <response-code> <policy-type-id> [<schema-file>]
 # (Function for test scripts)
 api_get_policy_type() {
 # args(V2): <response-code> <policy-type-id> [<schema-file>]
 # (Function for test scripts)
 api_get_policy_type() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
        if [ "$PMS_VERSION" != "V2" ]; then
 
        if [ "$PMS_VERSION" != "V2" ]; then
-               echo -e $RED" FAIL, function not supported"$ERED
-               ((RES_FAIL++))
-               __check_stop_at_error
+               __log_test_fail_not_supported
                return 1
        fi
 
                return 1
        fi
 
@@ -988,9 +917,7 @@ api_get_policy_type() {
        status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
        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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
@@ -1004,15 +931,12 @@ api_get_policy_type() {
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                if [ $res -ne 0 ]; then
                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
+                       __log_test_fail_body
                        return 1
                fi
        fi
 
                        return 1
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -1020,14 +944,10 @@ api_get_policy_type() {
 # args: <response-code> <policy-type-id> [<schema-file>]
 # (Function for test scripts)
 api_get_policy_schema() {
 # args: <response-code> <policy-type-id> [<schema-file>]
 # (Function for test scripts)
 api_get_policy_schema() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
        if [ "$PMS_VERSION" == "V2" ]; then
 
        if [ "$PMS_VERSION" == "V2" ]; then
-               echo -e $RED" FAIL, function not supported"$ERED
-               ((RES_FAIL++))
-               __check_stop_at_error
+               __log_test_fail_not_supported
                return 1
        fi
 
                return 1
        fi
 
@@ -1040,9 +960,7 @@ api_get_policy_schema() {
        status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
        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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
@@ -1056,15 +974,12 @@ api_get_policy_schema() {
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                if [ $res -ne 0 ]; then
                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
+                       __log_test_fail_body
                        return 1
                fi
        fi
 
                        return 1
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -1073,9 +988,7 @@ api_get_policy_schema() {
 # args(V2): <response-code>
 # (Function for test scripts)
 api_get_policy_schemas() {
 # args(V2): <response-code>
 # (Function for test scripts)
 api_get_policy_schemas() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
        if [ "$PMS_VERSION" == "V2" ]; then
                if [ $# -ne 1 ]; then
 
        if [ "$PMS_VERSION" == "V2" ]; then
                if [ $# -ne 1 ]; then
@@ -1101,9 +1014,7 @@ api_get_policy_schemas() {
        status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
        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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
@@ -1130,28 +1041,23 @@ api_get_policy_schemas() {
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                if [ $res -ne 0 ]; then
                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
+                       __log_test_fail_body
                        return 1
                fi
        fi
 
                        return 1
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
 # API Test function: GET /policy_status and V2 GET /policies/{policy_id}/status
        return 0
 }
 
 # API Test function: GET /policy_status and V2 GET /policies/{policy_id}/status
-# arg: <response-code> <policy-id> (STD <enforce-status> [<reason>])|(OSC <instance-status> <has-been-deleted>)
+# arg: <response-code> <policy-id> (STD|STD2 <enforce-status>|EMPTY [<reason>|EMPTY])|(OSC <instance-status> <has-been-deleted>)
 # (Function for test scripts)
 api_get_policy_status() {
 # (Function for test scripts)
 api_get_policy_status() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     if [ $# -lt 4 ] || [ $# -gt 5 ]; then
 
     if [ $# -lt 4 ] || [ $# -gt 5 ]; then
-               __print_err "<response-code> <policy-id> (STD <enforce-status> [<reason>])|(OSC <instance-status> <has-been-deleted>)" $@
+               __print_err "<response-code> <policy-id> (STD <enforce-status>|EMPTY [<reason>|EMPTY])|(OSC <instance-status> <has-been-deleted>)" $@
                return 1
        fi
 
                return 1
        fi
 
@@ -1163,6 +1069,20 @@ api_get_policy_status() {
                        targetJson=$targetJson",\"reason\":\"$5\""
                fi
                targetJson=$targetJson"}"
                        targetJson=$targetJson",\"reason\":\"$5\""
                fi
                targetJson=$targetJson"}"
+       elif [ $3 == "STD2" ]; then
+               if [ $4 == "EMPTY" ]; then
+                       targetJson="{\"enforceStatus\":\"\""
+               else
+                       targetJson="{\"enforceStatus\":\"$4\""
+               fi
+               if [ $# -eq 5 ]; then
+                       if [ $5 == "EMPTY" ]; then
+                               targetJson=$targetJson",\"enforceReason\":\"\""
+                       else
+                               targetJson=$targetJson",\"enforceReason\":\"$5\""
+                       fi
+               fi
+               targetJson=$targetJson"}"
        elif [ $3 == "OSC" ]; then
                targetJson="{\"instance_status\":\"$4\""
                if [ $# -eq 5 ]; then
        elif [ $3 == "OSC" ]; then
                targetJson="{\"instance_status\":\"$4\""
                if [ $# -eq 5 ]; then
@@ -1185,9 +1105,7 @@ api_get_policy_status() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
@@ -1196,14 +1114,11 @@ api_get_policy_status() {
        res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
        if [ $res -ne 0 ]; then
        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
+               __log_test_fail_body
                return 1
        fi
 
                return 1
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -1211,9 +1126,7 @@ api_get_policy_status() {
 # args: <response-code> [<ric-id>|NORIC [<policy-type-id>|EMPTY [<policy-type-id>]*]]
 # (Function for test scripts)
 api_get_policy_types() {
 # args: <response-code> [<ric-id>|NORIC [<policy-type-id>|EMPTY [<policy-type-id>]*]]
 # (Function for test scripts)
 api_get_policy_types() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     if [ $# -lt 1 ]; then
                __print_err "<response-code> [<ric-id>|NORIC [<policy-type-id>|EMPTY [<policy-type-id>]*]]" $@
 
     if [ $# -lt 1 ]; then
                __print_err "<response-code> [<ric-id>|NORIC [<policy-type-id>|EMPTY [<policy-type-id>]*]]" $@
@@ -1242,9 +1155,7 @@ api_get_policy_types() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
@@ -1270,15 +1181,12 @@ api_get_policy_types() {
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                if [ $res -ne 0 ]; then
                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
+                       __log_test_fail_body
                        return 1
                fi
        fi
 
                        return 1
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -1290,9 +1198,7 @@ api_get_policy_types() {
 # args: <response-code>
 # (Function for test scripts)
 api_get_status() {
 # args: <response-code>
 # (Function for test scripts)
 api_get_status() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
     if [ $# -ne 1 ]; then
                __print_err "<response-code>" $@
                return 1
     if [ $# -ne 1 ]; then
                __print_err "<response-code>" $@
                return 1
@@ -1306,14 +1212,11 @@ api_get_status() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -1330,9 +1233,7 @@ api_get_status() {
 
 # (Function for test scripts)
 api_get_ric() {
 
 # (Function for test scripts)
 api_get_ric() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
        if [ "$PMS_VERSION" == "V2" ]; then
                if [ $# -lt 3 ]; then
 
        if [ "$PMS_VERSION" == "V2" ]; then
                if [ $# -lt 3 ]; then
@@ -1356,9 +1257,7 @@ api_get_ric() {
                status=${res:${#res}-3}
 
                if [ $status -ne $1 ]; then
                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
+                       __log_test_fail_status_code $1 $status
                        return 1
                fi
 
                        return 1
                fi
 
@@ -1366,9 +1265,7 @@ api_get_ric() {
                        body=${res:0:${#res}-3}
                        res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "V2" "$4" )
                        if [ $res -ne 0 ]; then
                        body=${res:0:${#res}-3}
                        res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "V2" "$4" )
                        if [ $res -ne 0 ]; then
-                               echo -e $RED" FAIL, could not create target ric info json"$ERED
-                               ((RES_FAIL++))
-                               __check_stop_at_error
+                               __log_test_fail_general "Could not create target ric info json"
                                return 1
                        fi
 
                                return 1
                        fi
 
@@ -1377,9 +1274,7 @@ api_get_ric() {
                        echo " TARGET JSON: $targetJson" >> $HTTPLOG
                        res=$(python3 ../common/compare_json.py "$targetJson" "$body")
                        if [ $res -ne 0 ]; then
                        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
+                               __log_test_fail_body
                                return 1
                        fi
                fi
                                return 1
                        fi
                fi
@@ -1395,24 +1290,19 @@ api_get_ric() {
                status=${res:${#res}-3}
 
                if [ $status -ne $1 ]; then
                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
+                       __log_test_fail_status_code $1 $status
                        return 1
                fi
 
                if [ $# -eq 3 ]; then
                        body=${res:0:${#res}-3}
                        if [ "$body" != "$3" ]; then
                        return 1
                fi
 
                if [ $# -eq 3 ]; then
                        body=${res:0:${#res}-3}
                        if [ "$body" != "$3" ]; then
-                               echo -e $RED" FAIL, returned body not correct"$ERED
-                               ((RES_FAIL++))
-                               __check_stop_at_error
+                               __log_test_fail_body
                                return 1
                        fi
                fi
        fi
                                return 1
                        fi
                fi
        fi
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -1422,9 +1312,7 @@ api_get_ric() {
 # format of ric-info:  <ric-id>:<list-of-mes>:<list-of-policy-type-ids>
 # (Function for test scripts)
 api_get_rics() {
 # format of ric-info:  <ric-id>:<list-of-mes>:<list-of-policy-type-ids>
 # (Function for test scripts)
 api_get_rics() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     if [ $# -lt 2 ]; then
                __print_err "<reponse-code> <policy-type-id>|NOTYPE [<space-separate-string-of-ricinfo>]" $@
 
     if [ $# -lt 2 ]; then
                __print_err "<reponse-code> <policy-type-id>|NOTYPE [<space-separate-string-of-ricinfo>]" $@
@@ -1447,9 +1335,7 @@ api_get_rics() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
@@ -1461,9 +1347,7 @@ api_get_rics() {
                        res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "V1" "$3" )
                fi
                if [ $res -ne 0 ]; then
                        res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "V1" "$3" )
                fi
                if [ $res -ne 0 ]; then
-                       echo -e $RED" FAIL, could not create target ric info json"$ERED
-                       ((RES_FAIL++))
-                       __check_stop_at_error
+                       __log_test_fail_general "Could not create target ric info json"
                        return 1
                fi
 
                        return 1
                fi
 
@@ -1474,15 +1358,12 @@ api_get_rics() {
        echo "TARGET JSON: $targetJson" >> $HTTPLOG
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
                if [ $res -ne 0 ]; then
        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
+                       __log_test_fail_body
                        return 1
                fi
        fi
 
                        return 1
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -1494,9 +1375,7 @@ api_get_rics() {
 # args: <response-code>  <service-name> <keepalive-timeout> <callbackurl>
 # (Function for test scripts)
 api_put_service() {
 # args: <response-code>  <service-name> <keepalive-timeout> <callbackurl>
 # (Function for test scripts)
 api_put_service() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
     if [ $# -ne 4 ]; then
         __print_err "<response-code>  <service-name> <keepalive-timeout> <callbackurl>" $@
         return 1
     if [ $# -ne 4 ]; then
         __print_err "<response-code>  <service-name> <keepalive-timeout> <callbackurl>" $@
         return 1
@@ -1516,14 +1395,11 @@ api_put_service() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -1531,9 +1407,7 @@ api_put_service() {
 #args: <response-code> [ (<query-service-name> <target-service-name> <keepalive-timeout> <callbackurl>) | (NOSERVICE <target-service-name> <keepalive-timeout> <callbackurl> [<target-service-name> <keepalive-timeout> <callbackurl>]* )]
 # (Function for test scripts)
 api_get_services() {
 #args: <response-code> [ (<query-service-name> <target-service-name> <keepalive-timeout> <callbackurl>) | (NOSERVICE <target-service-name> <keepalive-timeout> <callbackurl> [<target-service-name> <keepalive-timeout> <callbackurl>]* )]
 # (Function for test scripts)
 api_get_services() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
        #Number of accepted parameters: 1, 2, 4, 7, 10, 13,...
        paramError=1
        if [ $# -eq 1 ]; then
        #Number of accepted parameters: 1, 2, 4, 7, 10, 13,...
        paramError=1
        if [ $# -eq 1 ]; then
@@ -1571,9 +1445,7 @@ api_get_services() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
@@ -1605,15 +1477,12 @@ api_get_services() {
                echo "TARGET JSON: $targetJson" >> $HTTPLOG
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
                if [ $res -ne 0 ]; then
                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
+                       __log_test_fail_body
                        return 1
                fi
        fi
 
                        return 1
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -1621,9 +1490,7 @@ api_get_services() {
 # args: <response-code> [<service-name>]*"
 # (Function for test scripts)
 api_get_service_ids() {
 # args: <response-code> [<service-name>]*"
 # (Function for test scripts)
 api_get_service_ids() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     if [ $# -lt 1 ]; then
                __print_err "<response-code> [<service-name>]*" $@
 
     if [ $# -lt 1 ]; then
                __print_err "<response-code> [<service-name>]*" $@
@@ -1639,9 +1506,7 @@ api_get_service_ids() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
@@ -1666,14 +1531,11 @@ api_get_service_ids() {
        res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
        if [ $res -ne 0 ]; then
        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
+               __log_test_fail_body
                return 1
        fi
 
                return 1
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -1681,9 +1543,7 @@ api_get_service_ids() {
 # args: <response-code> <service-name>
 # (Function for test scripts)
 api_delete_services() {
 # args: <response-code> <service-name>
 # (Function for test scripts)
 api_delete_services() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     if [ $# -ne 2 ]; then
                __print_err "<response-code> <service-name>" $@
 
     if [ $# -ne 2 ]; then
                __print_err "<response-code> <service-name>" $@
@@ -1698,14 +1558,11 @@ api_delete_services() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -1713,9 +1570,7 @@ api_delete_services() {
 # args: <response-code> <service-name>
 # (Function for test scripts)
 api_put_services_keepalive() {
 # args: <response-code> <service-name>
 # (Function for test scripts)
 api_put_services_keepalive() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     if [ $# -ne 2 ]; then
                __print_err "<response-code> <service-name>" $@
 
     if [ $# -ne 2 ]; then
                __print_err "<response-code> <service-name>" $@
@@ -1731,14 +1586,98 @@ api_put_services_keepalive() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
+##################################################################
+#### API Test case functions Configuration                    ####
+##################################################################
+
+# API Test function: PUT /v2/configuration
+# args: <response-code> <config-file>
+# (Function for test scripts)
+api_put_configuration() {
+       __log_test_start $@
+
+       if [ "$PMS_VERSION" != "V2" ]; then
+               __log_test_fail_not_supported
+               return 1
+       fi
+
+    if [ $# -ne 2 ]; then
+        __print_err "<response-code> <config-file>" $@
+        return 1
+    fi
+       if [ ! -f $2 ]; then
+               _log_test_fail_general "Config file "$2", does not exist"
+               return 1
+       fi
+       inputJson=$(< $2)
+       inputJson="{\"config\":"$inputJson"}"
+       file="./tmp/.config.json"
+       echo $inputJson > $file
+       query="/v2/configuration"
+       res="$(__do_curl_to_api PA PUT $query $file)"
+       status=${res:${#res}-3}
+
+       if [ $status -ne $1 ]; then
+               __log_test_fail_status_code $1 $status
+               return 1
+       fi
+
+       __log_test_pass
+       return 0
+}
+
+# API Test function: GET /v2/configuration
+# args: <response-code> [<config-file>]
+# (Function for test scripts)
+api_get_configuration() {
+       __log_test_start $@
+
+       if [ "$PMS_VERSION" != "V2" ]; then
+               __log_test_fail_not_supported
+               return 1
+       fi
+
+    if [ $# -lt 1 ] || [ $# -gt 2 ]; then
+        __print_err "<response-code> [<config-file>]" $@
+        return 1
+    fi
+       if [ ! -f $2 ]; then
+               _log_test_fail_general "Config file "$2" for comparison, does not exist"
+               return 1
+       fi
+
+       query="/v2/configuration"
+       res="$(__do_curl_to_api PA GET $query)"
+       status=${res:${#res}-3}
+
+       if [ $status -ne $1 ]; then
+               __log_test_fail_status_code $1 $status
+               return 1
+       fi
+
+       if [ $# -eq 2 ]; then
+
+               body=${res:0:${#res}-3}
+
+               targetJson=$(< $2)
+               targetJson="{\"config\":"$targetJson"}"
+               echo "TARGET JSON: $targetJson" >> $HTTPLOG
+               res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+               if [ $res -ne 0 ]; then
+                       __log_test_fail_body
+                       return 1
+               fi
+       fi
+
+       __log_test_pass
+       return 0
+}
\ No newline at end of file
index 611fc4d..cd3e979 100644 (file)
@@ -26,7 +26,8 @@
 # arg: (PA|ECS GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH <url> [<file>]) | (PA|ECS RESPONSE <correlation-id>)
 # (Not for test scripts)
 __do_curl_to_api() {
 # arg: (PA|ECS GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH <url> [<file>]) | (PA|ECS RESPONSE <correlation-id>)
 # (Not for test scripts)
 __do_curl_to_api() {
-    echo "(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+       TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
+    echo " (${BASH_LINENO[0]}) - ${TIMESTAMP}: ${FUNCNAME[0]}" $@ >> $HTTPLOG
        paramError=0
 
     if [ $# -gt 0 ]; then
        paramError=0
 
     if [ $# -gt 0 ]; then
index b0ae641..4d568d7 100644 (file)
@@ -75,9 +75,7 @@ __do_curl_to_controller() {
 # arg: <response-code> (OSC <ric-id> <policy-type-id> [ <policy-id> [<policy-id>]* ]) | ( STD <ric-id> [ <policy-id> [<policy-id>]* ] )
 # (Function for test scripts)
 controller_api_get_A1_policy_ids() {
 # arg: <response-code> (OSC <ric-id> <policy-type-id> [ <policy-id> [<policy-id>]* ]) | ( STD <ric-id> [ <policy-id> [<policy-id>]* ] )
 # (Function for test scripts)
 controller_api_get_A1_policy_ids() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     paramError=1
     if [ $# -gt 3 ] && [ $2 == "OSC" ]; then
 
     paramError=1
     if [ $# -gt 3 ] && [ $2 == "OSC" ]; then
@@ -97,17 +95,13 @@ controller_api_get_A1_policy_ids() {
     retcode=$?
     status=${res:${#res}-3}
 
     retcode=$?
     status=${res:${#res}-3}
 
-    if [ $? -ne 0 ]; then
-               echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$ERED
-               ((RES_FAIL++))
-               __check_stop_at_error
+    if [ $retcode -ne 0 ]; then
+               __log_test_fail_status_code $1 $retcode "(likely remote server error)"
                return 1
        fi
 
        if [ $status -ne $1 ]; then
                return 1
        fi
 
        if [ $status -ne $1 ]; then
-               echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
-               ((RES_FAIL++))
-               __check_stop_at_error
+               __log_test_fail_status_code $1 $status
                return 1
        fi
     body=${res:0:${#res}-3}
                return 1
        fi
     body=${res:0:${#res}-3}
@@ -130,14 +124,11 @@ controller_api_get_A1_policy_ids() {
        res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
        if [ $res -ne 0 ]; then
        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
+               __log_test_fail_body
                return 1
        fi
 
                return 1
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -146,9 +137,7 @@ controller_api_get_A1_policy_ids() {
 # arg: <response-code> OSC <ric-id> <policy-type-id> [<policy-type-file>]
 # (Function for test scripts)
 controller_api_get_A1_policy_type() {
 # arg: <response-code> OSC <ric-id> <policy-type-id> [<policy-type-file>]
 # (Function for test scripts)
 controller_api_get_A1_policy_type() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     paramError=1
     if [ $# -gt 3 ] && [ $2 == "OSC" ]; then
 
     paramError=1
     if [ $# -gt 3 ] && [ $2 == "OSC" ]; then
@@ -165,17 +154,13 @@ controller_api_get_A1_policy_type() {
     retcode=$?
     status=${res:${#res}-3}
 
     retcode=$?
     status=${res:${#res}-3}
 
-    if [ $? -ne 0 ]; then
-               echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$ERED
-               ((RES_FAIL++))
-               __check_stop_at_error
+    if [ $retcode -ne 0 ]; then
+               __log_test_fail_status_code $1 $retcode "(likely remote server error)"
                return 1
        fi
 
        if [ $status -ne $1 ]; then
                return 1
        fi
 
        if [ $status -ne $1 ]; then
-               echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
-               ((RES_FAIL++))
-               __check_stop_at_error
+               __log_test_fail_status_code $1 $status
                return 1
        fi
     body=${res:0:${#res}-3}
                return 1
        fi
     body=${res:0:${#res}-3}
@@ -189,15 +174,12 @@ controller_api_get_A1_policy_type() {
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                if [ $res -ne 0 ]; then
                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
+                       __log_test_fail_body
                        return 1
                fi
        fi
 
                        return 1
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -205,9 +187,7 @@ controller_api_get_A1_policy_type() {
 # arg: <response-code> (STD <ric-id> <policy-id>) | (OSC <ric-id> <policy-type-id> <policy-id>)
 # (Function for test scripts)
 controller_api_delete_A1_policy() {
 # arg: <response-code> (STD <ric-id> <policy-id>) | (OSC <ric-id> <policy-type-id> <policy-id>)
 # (Function for test scripts)
 controller_api_delete_A1_policy() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     paramError=1
     if [ $# -eq 5 ] && [ $2 == "OSC" ]; then
 
     paramError=1
     if [ $# -eq 5 ] && [ $2 == "OSC" ]; then
@@ -227,22 +207,17 @@ controller_api_delete_A1_policy() {
     retcode=$?
     status=${res:${#res}-3}
 
     retcode=$?
     status=${res:${#res}-3}
 
-    if [ $? -ne 0 ]; then
-               echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$ERED
-               ((RES_FAIL++))
-               __check_stop_at_error
+    if [ $retcode -ne 0 ]; then
+               __log_test_fail_status_code $1 $retcode "(likely remote server error)"
                return 1
        fi
 
        if [ $status -ne $1 ]; then
                return 1
        fi
 
        if [ $status -ne $1 ]; then
-               echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
-               ((RES_FAIL++))
-               __check_stop_at_error
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -250,9 +225,7 @@ controller_api_delete_A1_policy() {
 # arg: <response-code> (STD <ric-id> <policy-id> <template-file> ) | (OSC <ric-id> <policy-type-id> <policy-id> <template-file>)
 # (Function for test scripts)
 controller_api_put_A1_policy() {
 # arg: <response-code> (STD <ric-id> <policy-id> <template-file> ) | (OSC <ric-id> <policy-type-id> <policy-id> <template-file>)
 # (Function for test scripts)
 controller_api_put_A1_policy() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     paramError=1
     if [ $# -eq 6 ] && [ $2 == "OSC" ]; then
 
     paramError=1
     if [ $# -eq 6 ] && [ $2 == "OSC" ]; then
@@ -275,22 +248,17 @@ controller_api_put_A1_policy() {
     retcode=$?
     status=${res:${#res}-3}
 
     retcode=$?
     status=${res:${#res}-3}
 
-    if [ $? -ne 0 ]; then
-               echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$ERED
-               ((RES_FAIL++))
-               __check_stop_at_error
+    if [ $retcode -ne 0 ]; then
+               __log_test_fail_status_code $1 $retcode "(likely remote server error)"
                return 1
        fi
 
        if [ $status -ne $1 ]; then
                return 1
        fi
 
        if [ $status -ne $1 ]; then
-               echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
-               ((RES_FAIL++))
-               __check_stop_at_error
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -299,9 +267,7 @@ controller_api_put_A1_policy() {
 # arg: <response-code> (STD <ric-id> <policy-id> <enforce-status> [<reason>]) | (OSC <ric-id> <policy-type-id> <policy-id> <instance-status> <has-been-deleted>)
 # (Function for test scripts)
 controller_api_get_A1_policy_status() {
 # arg: <response-code> (STD <ric-id> <policy-id> <enforce-status> [<reason>]) | (OSC <ric-id> <policy-type-id> <policy-id> <instance-status> <has-been-deleted>)
 # (Function for test scripts)
 controller_api_get_A1_policy_status() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     targetJson=""
     paramError=1
 
     targetJson=""
     paramError=1
@@ -334,17 +300,13 @@ controller_api_get_A1_policy_status() {
     retcode=$?
     status=${res:${#res}-3}
 
     retcode=$?
     status=${res:${#res}-3}
 
-    if [ $? -ne 0 ]; then
-               echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$ERED
-               ((RES_FAIL++))
-               __check_stop_at_error
+    if [ $retcode -ne 0 ]; then
+               __log_test_fail_status_code $1 $retcode "(likely remote server error)"
                return 1
        fi
 
        if [ $status -ne $1 ]; then
                return 1
        fi
 
        if [ $status -ne $1 ]; then
-               echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
-               ((RES_FAIL++))
-               __check_stop_at_error
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
@@ -355,14 +317,11 @@ controller_api_get_A1_policy_status() {
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                if [ $res -ne 0 ]; then
                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
+                       __log_test_fail_body
                        return 1
                fi
        fi
 
                        return 1
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
\ No newline at end of file
        return 0
 }
\ No newline at end of file
index fe4b1fd..e2b9491 100644 (file)
@@ -57,23 +57,18 @@ cr_equal() {
        if [ $# -eq 2 ] || [ $# -eq 3 ]; then
                __var_test "CR" "$LOCALHOST$CR_EXTERNAL_PORT/counter/" $1 "=" $2 $3
        else
        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
 }
 
                __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
+# CR API: Check the contents of all current ric sync events for one id from PMS
 # <response-code> <id> [ EMPTY | ( <ric-id> )+ ]
 # (Function for test scripts)
 cr_api_check_all_sync_events() {
 # <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++))
+       __log_test_start $@
 
        if [ "$PMS_VERSION" != "V2" ]; then
 
        if [ "$PMS_VERSION" != "V2" ]; then
-               echo -e $RED" FAIL, function not supported"$ERED
-               ((RES_FAIL++))
-               __check_stop_at_error
+               __log_test_fail_not_supported
                return 1
        fi
 
                return 1
        fi
 
@@ -87,9 +82,7 @@ cr_api_check_all_sync_events() {
        status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
        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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
@@ -115,13 +108,60 @@ cr_api_check_all_sync_events() {
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                if [ $res -ne 0 ]; then
                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
+                       __log_test_fail_body
+                       return 1
+               fi
+       fi
+       __log_test_pass
+       return 0
+}
+
+# CR API: Check the contents of all current status events for one id from ECS
+# <response-code> <id> [ EMPTY | ( <status> )+ ]
+# (Function for test scripts)
+cr_api_check_all_ecs_events() {
+       __log_test_start $@
+
+    if [ $# -lt 2 ]; then
+        __print_err "<response-code> <id> [ EMPTY | ( <status> )+ ]" $@
+        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
+               __log_test_fail_status_code $1 $status
+               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"{\"eiJobStatus\":\"${arr[$i]}\"}"
+                       done
+               fi
+
+               targetJson=$targetJson"]"
+               echo "TARGET JSON: $targetJson" >> $HTTPLOG
+               res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+               if [ $res -ne 0 ]; then
+                       __log_test_fail_body
                        return 1
                fi
        fi
                        return 1
                fi
        fi
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
\ No newline at end of file
        return 0
 }
\ No newline at end of file
index ac945fe..1cff7a1 100755 (executable)
@@ -33,6 +33,7 @@
 # Env BODY contains the response body after the call
 # Any error will stop script execution
 # How to use in a test script:  source this file into your bash test script to the make the function available.
 # Env BODY contains the response body after the call
 # Any error will stop script execution
 # How to use in a test script:  source this file into your bash test script to the make the function available.
+# The function may create a dir 'tmp' for temporary files.
 
 do_curl() {
     echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
 
 do_curl() {
     echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
@@ -88,6 +89,7 @@ do_curl() {
             count=${RESULT:16:${#RESULT}}
             #Find dir of the common dir
             DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
             count=${RESULT:16:${#RESULT}}
             #Find dir of the common dir
             DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+            mkdir -p tmp
             echo $body > ./tmp/.tmp.json
             res=$(python ${DIR}/count_json_elements.py ./tmp/.tmp.json)
             if [ $res -eq $count ]; then
             echo $body > ./tmp/.tmp.json
             res=$(python ${DIR}/count_json_elements.py ./tmp/.tmp.json)
             if [ $res -eq $count ]; then
index b76d43b..56c2a2e 100644 (file)
 
 . ../common/api_curl.sh
 
 
 . ../common/api_curl.sh
 
-############### EXPERIMENTAL #############
+# Tests if a variable value in the ECS 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)
+ecs_equal() {
+       if [ $# -eq 2 ] || [ $# -eq 3 ]; then
+               __var_test ECS "$LOCALHOST$ECS_EXTERNAL_PORT/" $1 "=" $2 $3
+       else
+               __print_err "Wrong args to ecs_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
+       fi
+}
 
 
-##########################################
-###### Mainly only function skeletons ####
-##########################################
 
 ##########################################
 
 ##########################################
-### A1-E Enrichment Data Consumer API ####
+######### A1-E Enrichment  API ##########
 ##########################################
 #Function prefix: ecs_api_a1
 
 ##########################################
 #Function prefix: ecs_api_a1
 
@@ -37,9 +47,7 @@
 # args (flat uri structure): <response-code> <type-id>|NOTYPE  <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]
 # (Function for test scripts)
 ecs_api_a1_get_job_ids() {
 # args (flat uri structure): <response-code> <type-id>|NOTYPE  <owner-id>|NOOWNER [ EMPTY | <job-id>+ ]
 # (Function for test scripts)
 ecs_api_a1_get_job_ids() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
        if [ -z "$FLAT_A1_EI" ]; then
                # Valid number of parameters 4,5,6 etc
 
        if [ -z "$FLAT_A1_EI" ]; then
                # Valid number of parameters 4,5,6 etc
@@ -76,9 +84,7 @@ ecs_api_a1_get_job_ids() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
@@ -100,15 +106,12 @@ ecs_api_a1_get_job_ids() {
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                if [ $res -ne 0 ]; then
                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
+                       __log_test_fail_body
                        return 1
                fi
        fi
 
                        return 1
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -116,9 +119,7 @@ ecs_api_a1_get_job_ids() {
 # args: <response-code> <type-id> [<schema-file>]
 # (Function for test scripts)
 ecs_api_a1_get_type() {
 # args: <response-code> <type-id> [<schema-file>]
 # (Function for test scripts)
 ecs_api_a1_get_type() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     if [ $# -lt 2 ] || [ $# -gt 3 ]; then
                __print_err "<response-code> <type-id> [<schema-file>]" $@
 
     if [ $# -lt 2 ] || [ $# -gt 3 ]; then
                __print_err "<response-code> <type-id> [<schema-file>]" $@
@@ -130,9 +131,7 @@ ecs_api_a1_get_type() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
@@ -141,9 +140,7 @@ ecs_api_a1_get_type() {
                if [ -f $3 ]; then
                        schema=$(cat $3)
                else
                if [ -f $3 ]; then
                        schema=$(cat $3)
                else
-                       echo -e $RED" FAIL. Schema file "$3", does not exist"$ERED
-                       ((RES_FAIL++))
-                       __check_stop_at_error
+                       __log_test_fail_general "Schema file "$3", does not exist"
                        return 1
                fi
                if [ -z "$FLAT_A1_EI" ]; then
                        return 1
                fi
                if [ -z "$FLAT_A1_EI" ]; then
@@ -155,15 +152,12 @@ ecs_api_a1_get_type() {
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                if [ $res -ne 0 ]; then
                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
+                       __log_test_fail_body
                        return 1
                fi
        fi
 
                        return 1
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -171,9 +165,7 @@ ecs_api_a1_get_type() {
 # args: <response-code> [ (EMPTY | [<type-id>]+) ]
 # (Function for test scripts)
 ecs_api_a1_get_type_ids() {
 # args: <response-code> [ (EMPTY | [<type-id>]+) ]
 # (Function for test scripts)
 ecs_api_a1_get_type_ids() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     if [ $# -lt 1 ]; then
                __print_err "<response-code> [ (EMPTY | [<type-id>]+) ]" $@
 
     if [ $# -lt 1 ]; then
                __print_err "<response-code> [ (EMPTY | [<type-id>]+) ]" $@
@@ -185,9 +177,7 @@ ecs_api_a1_get_type_ids() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
        if [ $# -gt 1 ]; then
                return 1
        fi
        if [ $# -gt 1 ]; then
@@ -206,15 +196,12 @@ ecs_api_a1_get_type_ids() {
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                if [ $res -ne 0 ]; then
                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
+                       __log_test_fail_body
                        return 1
                fi
        fi
 
                        return 1
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -223,9 +210,7 @@ ecs_api_a1_get_type_ids() {
 # args (flat uri structure): <response-code> <job-id> [<status>]
 # (Function for test scripts)
 ecs_api_a1_get_job_status() {
 # args (flat uri structure): <response-code> <job-id> [<status>]
 # (Function for test scripts)
 ecs_api_a1_get_job_status() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
        if [ -z "$FLAT_A1_EI" ]; then
                if [ $# -ne 3 ] && [ $# -ne 4 ]; then
 
        if [ -z "$FLAT_A1_EI" ]; then
                if [ $# -ne 3 ] && [ $# -ne 4 ]; then
@@ -239,9 +224,7 @@ ecs_api_a1_get_job_status() {
                status=${res:${#res}-3}
 
                if [ $status -ne $1 ]; then
                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
+                       __log_test_fail_status_code $1 $status
                        return 1
                fi
                if [ $# -eq 4 ]; then
                        return 1
                fi
                if [ $# -eq 4 ]; then
@@ -251,9 +234,7 @@ ecs_api_a1_get_job_status() {
                        res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                        if [ $res -ne 0 ]; then
                        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
+                               __log_test_fail_body
                                return 1
                        fi
                fi
                                return 1
                        fi
                fi
@@ -270,9 +251,7 @@ ecs_api_a1_get_job_status() {
                status=${res:${#res}-3}
 
                if [ $status -ne $1 ]; then
                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
+                       __log_test_fail_status_code $1 $status
                        return 1
                fi
                if [ $# -eq 3 ]; then
                        return 1
                fi
                if [ $# -eq 3 ]; then
@@ -282,16 +261,13 @@ ecs_api_a1_get_job_status() {
                        res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                        if [ $res -ne 0 ]; then
                        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
+                               __log_test_fail_body
                                return 1
                        fi
                fi
        fi
 
                                return 1
                        fi
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -300,9 +276,7 @@ ecs_api_a1_get_job_status() {
 # args (flat uri structure): <response-code> <job-id> [<type-id> <target-url> <owner-id> <template-job-file>]
 # (Function for test scripts)
 ecs_api_a1_get_job() {
 # args (flat uri structure): <response-code> <job-id> [<type-id> <target-url> <owner-id> <template-job-file>]
 # (Function for test scripts)
 ecs_api_a1_get_job() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
        if [  -z "$FLAT_A1_EI" ]; then
                if [ $# -ne 3 ] && [ $# -ne 6 ]; then
 
        if [  -z "$FLAT_A1_EI" ]; then
                if [ $# -ne 3 ] && [ $# -ne 6 ]; then
@@ -322,9 +296,7 @@ ecs_api_a1_get_job() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
@@ -336,9 +308,7 @@ ecs_api_a1_get_job() {
                                jobfile=$(cat $6)
                                jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
                        else
                                jobfile=$(cat $6)
                                jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
                        else
-                               echo -e $RED" FAIL. Job template file "$6", does not exist"$ERED
-                               ((RES_FAIL++))
-                               __check_stop_at_error
+                               _log_test_fail_general "Job template file "$6", does not exist"
                                return 1
                        fi
                        targetJson="{\"targetUri\": \"$4\",\"jobOwner\": \"$5\",\"jobParameters\": $jobfile}"
                                return 1
                        fi
                        targetJson="{\"targetUri\": \"$4\",\"jobOwner\": \"$5\",\"jobParameters\": $jobfile}"
@@ -346,9 +316,7 @@ ecs_api_a1_get_job() {
                        res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                        if [ $res -ne 0 ]; then
                        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
+                               __log_test_fail_body
                                return 1
                        fi
                fi
                                return 1
                        fi
                fi
@@ -360,26 +328,21 @@ ecs_api_a1_get_job() {
                                jobfile=$(cat $7)
                                jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
                        else
                                jobfile=$(cat $7)
                                jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
                        else
-                               echo -e $RED" FAIL. Job template file "$6", does not exist"$ERED
-                               ((RES_FAIL++))
-                               __check_stop_at_error
+                               _log_test_fail_general "Job template file "$6", does not exist"
                                return 1
                        fi
                                return 1
                        fi
-                       targetJson="{\"eiTypeId\": \"$3\", \"targetUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}"
+                       targetJson="{\"eiTypeId\": \"$3\", \"jobResultUri\": \"$4\",\"jobOwner\": \"$5\",\"jobStatusNotificationUri\": \"$6\",\"jobDefinition\": $jobfile}"
                        echo " TARGET JSON: $targetJson" >> $HTTPLOG
                        res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                        if [ $res -ne 0 ]; then
                        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
+                               __log_test_fail_body
                                return 1
                        fi
                fi
        fi
 
                                return 1
                        fi
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -388,9 +351,7 @@ ecs_api_a1_get_job() {
 # args (flat uri structure): <response-code> <job-id>
 # (Function for test scripts)
 ecs_api_a1_delete_job() {
 # args (flat uri structure): <response-code> <job-id>
 # (Function for test scripts)
 ecs_api_a1_delete_job() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
        if [  -z "$FLAT_A1_EI" ]; then
                if [ $# -ne 3 ]; then
 
        if [  -z "$FLAT_A1_EI" ]; then
                if [ $# -ne 3 ]; then
@@ -411,14 +372,11 @@ ecs_api_a1_delete_job() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -427,9 +385,7 @@ ecs_api_a1_delete_job() {
 # args (flat uri structure): <response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file>
 # (Function for test scripts)
 ecs_api_a1_put_job() {
 # args (flat uri structure): <response-code> <job-id> <type-id> <target-url> <owner-id> <notification-url> <template-job-file>
 # (Function for test scripts)
 ecs_api_a1_put_job() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
        if [  -z "$FLAT_A1_EI" ]; then
                if [ $# -lt 6 ]; then
 
        if [  -z "$FLAT_A1_EI" ]; then
                if [ $# -lt 6 ]; then
@@ -440,9 +396,7 @@ ecs_api_a1_put_job() {
                        jobfile=$(cat $6)
                        jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
                else
                        jobfile=$(cat $6)
                        jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
                else
-                       echo -e $RED" FAIL. Job template file "$6", does not exist"$ERED
-                       ((RES_FAIL++))
-                       __check_stop_at_error
+                       _log_test_fail_general "Job template file "$6", does not exist"
                        return 1
                fi
 
                        return 1
                fi
 
@@ -461,9 +415,7 @@ ecs_api_a1_put_job() {
                        jobfile=$(cat $7)
                        jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
                else
                        jobfile=$(cat $7)
                        jobfile=$(echo "$jobfile" | sed "s/XXXX/$2/g")
                else
-                       echo -e $RED" FAIL. Job template file "$7", does not exist"$ERED
-                       ((RES_FAIL++))
-                       __check_stop_at_error
+                       _log_test_fail_general "Job template file "$7", does not exist"
                        return 1
                fi
 
                        return 1
                fi
 
@@ -478,14 +430,11 @@ ecs_api_a1_put_job() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -499,9 +448,7 @@ ecs_api_a1_put_job() {
 # args: <response-code> [ EMPTY | <type-id>+]
 # (Function for test scripts)
 ecs_api_edp_get_type_ids() {
 # args: <response-code> [ EMPTY | <type-id>+]
 # (Function for test scripts)
 ecs_api_edp_get_type_ids() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     if [ $# -lt 1 ]; then
                __print_err "<response-code> [ EMPTY | <type-id>+]" $@
 
     if [ $# -lt 1 ]; then
                __print_err "<response-code> [ EMPTY | <type-id>+]" $@
@@ -513,9 +460,7 @@ ecs_api_edp_get_type_ids() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
@@ -535,58 +480,74 @@ ecs_api_edp_get_type_ids() {
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                if [ $res -ne 0 ]; then
                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
+                       __log_test_fail_body
                        return 1
                fi
        fi
 
                        return 1
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
 # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/status
        return 0
 }
 
 # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/status
-# args: <response-code> <producer-id> [<status>]
+# args: <response-code> <producer-id> [<status> [<timeout>]]
 # (Function for test scripts)
 ecs_api_edp_get_producer_status() {
 # (Function for test scripts)
 ecs_api_edp_get_producer_status() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
 
-    if [ $# -lt 2 ] || [ $# -gt 3 ]; then
-               __print_err "<response-code> <producer-id> [<status>]" $@
+    if [ $# -lt 2 ] || [ $# -gt 4 ]; then
+               __print_err "<response-code> <producer-id> [<status> [<timeout>]]" $@
                return 1
        fi
 
        query="/ei-producer/v1/eiproducers/$2/status"
                return 1
        fi
 
        query="/ei-producer/v1/eiproducers/$2/status"
-    res="$(__do_curl_to_api ECS GET $query)"
-    status=${res:${#res}-3}
+       start=$SECONDS
+       for (( ; ; )); do
+               res="$(__do_curl_to_api ECS 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 [ $# -eq 3 ]; then
-               body=${res:0:${#res}-3}
-               targetJson="{\"operational_state\": \"$3\"}"
-               echo " TARGET JSON: $targetJson" >> $HTTPLOG
-               res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+               if [ $# -eq 4 ]; then
+                       duration=$((SECONDS-start))
+                       echo -ne " Response=${status} after ${duration} seconds, waiting for ${3} ${SAMELINE}"
+                       if [ $duration -gt $4 ]; then
+                               echo ""
+                               duration=-1  #Last iteration
+                       fi
+               else
+                       duration=-1 #single test, no wait
+               fi
 
 
-               if [ $res -ne 0 ]; then
-                       echo -e $RED" FAIL, returned body not correct"$ERED
-                       ((RES_FAIL++))
-                       __check_stop_at_error
-                       return 1
+               if [ $status -ne $1 ]; then
+                       if [ $duration -eq -1 ]; then
+                               __log_test_fail_status_code $1 $status
+                               return 1
+                       fi
                fi
                fi
-       fi
+               if [ $# -ge 3 ] && [ $status -eq $1 ]; then
+                       body=${res:0:${#res}-3}
+                       targetJson="{\"operational_state\": \"$3\"}"
+                       echo " TARGET JSON: $targetJson" >> $HTTPLOG
+                       res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
-       return 0
+                       if [ $res -ne 0 ]; then
+                               if [ $duration -eq -1 ]; then
+                                       __log_test_fail_body
+                                       return 1
+                               fi
+                       else
+                               duration=-1  #Goto pass
+                       fi
+               fi
+               if [ $duration -eq -1 ]; then
+                       if [ $# -eq 4 ]; then
+                               echo ""
+                       fi
+                       __log_test_pass
+                       return 0
+               else
+                       sleep 1
+               fi
+       done
 }
 
 
 }
 
 
@@ -594,9 +555,7 @@ ecs_api_edp_get_producer_status() {
 # args: <response-code> [ EMPTY | <producer-id>+]
 # (Function for test scripts)
 ecs_api_edp_get_producer_ids() {
 # args: <response-code> [ EMPTY | <producer-id>+]
 # (Function for test scripts)
 ecs_api_edp_get_producer_ids() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     if [ $# -lt 1 ]; then
                __print_err "<response-code> [ EMPTY | <producer-id>+]" $@
 
     if [ $# -lt 1 ]; then
                __print_err "<response-code> [ EMPTY | <producer-id>+]" $@
@@ -608,9 +567,7 @@ ecs_api_edp_get_producer_ids() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
@@ -632,15 +589,12 @@ ecs_api_edp_get_producer_ids() {
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                if [ $res -ne 0 ]; then
                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
+                       __log_test_fail_body
                        return 1
                fi
        fi
 
                        return 1
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -648,9 +602,7 @@ ecs_api_edp_get_producer_ids() {
 # args: <response-code> <type-id> [<job-schema-file> (EMPTY | [<producer-id>]+)]
 # (Function for test scripts)
 ecs_api_edp_get_type() {
 # args: <response-code> <type-id> [<job-schema-file> (EMPTY | [<producer-id>]+)]
 # (Function for test scripts)
 ecs_api_edp_get_type() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
        paramError=1
        if [ $# -eq 2 ]; then
 
        paramError=1
        if [ $# -eq 2 ]; then
@@ -669,9 +621,7 @@ ecs_api_edp_get_type() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
        if [ $# -gt 3 ]; then
                return 1
        fi
        if [ $# -gt 3 ]; then
@@ -680,9 +630,7 @@ ecs_api_edp_get_type() {
                if [ -f $3 ]; then
                        schema=$(cat $3)
                else
                if [ -f $3 ]; then
                        schema=$(cat $3)
                else
-                       echo -e $RED" FAIL. Job template file "$3", does not exist"$ERED
-                       ((RES_FAIL++))
-                       __check_stop_at_error
+                       __log_test_fail_general "Job template file "$3", does not exist"
                        return 1
                fi
 
                        return 1
                fi
 
@@ -701,40 +649,35 @@ ecs_api_edp_get_type() {
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                if [ $res -ne 0 ]; then
                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
+                       __log_test_fail_body
                        return 1
                fi
        fi
                        return 1
                fi
        fi
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
 # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}
        return 0
 }
 
 # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}
-# args: <response-code> <producer-id> [<create-callback> <delete-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+) ]
+# args: <response-code> <producer-id> [<job-callback> <supervision-callback> (EMPTY | [<type-id> <schema-file>]+) ]
 # (Function for test scripts)
 ecs_api_edp_get_producer() {
 # (Function for test scripts)
 ecs_api_edp_get_producer() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
 
-       #Possible arg count: 2, 6 7, 9, 11 etc
+       #Possible arg count: 2, 5 6, 8, 10 etc
        paramError=1
        if [ $# -eq 2 ]; then
                paramError=0
        fi
        paramError=1
        if [ $# -eq 2 ]; then
                paramError=0
        fi
-       if [ $# -eq 6 ] && [ "$6" == "EMPTY" ]; then
+       if [ $# -eq 5 ] && [ "$5" == "EMPTY" ]; then
                paramError=0
        fi
                paramError=0
        fi
-       variablecount=$(($#-5))
+       variablecount=$(($#-4))
        if [ $# -gt 5 ] && [ $(($variablecount%2)) -eq 0 ]; then
                paramError=0
        fi
 
     if [ $paramError -ne 0 ]; then
        if [ $# -gt 5 ] && [ $(($variablecount%2)) -eq 0 ]; then
                paramError=0
        fi
 
     if [ $paramError -ne 0 ]; then
-               __print_err "<response-code> <producer-id> [<create-callback> <delete-callback> <supervision-callback> (NOID | [<type-id> <schema-file>]+) ]" $@
+               __print_err "<response-code> <producer-id> [<job-callback> <supervision-callback> (NOID | [<type-id> <schema-file>]+) ]" $@
                return 1
        fi
 
                return 1
        fi
 
@@ -743,27 +686,23 @@ ecs_api_edp_get_producer() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
        if [ $# -gt 2 ]; then
                body=${res:0:${#res}-3}
                targetJson="["
                return 1
        fi
 
        if [ $# -gt 2 ]; then
                body=${res:0:${#res}-3}
                targetJson="["
-               if [ $# -gt 6 ]; then
-                       arr=(${@:6})
-                       for ((i=0; i<$(($#-6)); i=i+2)); do
+               if [ $# -gt 5 ]; then
+                       arr=(${@:5})
+                       for ((i=0; i<$(($#-5)); i=i+2)); do
                                if [ "$targetJson" != "[" ]; then
                                        targetJson=$targetJson","
                                fi
                                if [ -f ${arr[$i+1]} ]; then
                                        schema=$(cat ${arr[$i+1]})
                                else
                                if [ "$targetJson" != "[" ]; then
                                        targetJson=$targetJson","
                                fi
                                if [ -f ${arr[$i+1]} ]; then
                                        schema=$(cat ${arr[$i+1]})
                                else
-                                       echo -e $RED" FAIL. Schema file "${arr[$i+1]}", does not exist"$ERED
-                                       ((RES_FAIL++))
-                                       __check_stop_at_error
+                                       _log_test_fail_general "Schema file "${arr[$i+1]}", does not exist"
                                        return 1
                                fi
 
                                        return 1
                                fi
 
@@ -772,21 +711,18 @@ ecs_api_edp_get_producer() {
                fi
                targetJson=$targetJson"]"
                if [ $# -gt 4 ]; then
                fi
                targetJson=$targetJson"]"
                if [ $# -gt 4 ]; then
-                       targetJson="{\"supported_ei_types\":$targetJson,\"ei_job_creation_callback_url\": \"$3\",\"ei_job_deletion_callback_url\": \"$4\",\"ei_producer_supervision_callback_url\": \"$5\"}"
+                       targetJson="{\"supported_ei_types\":$targetJson,\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\"}"
                fi
                echo " TARGET JSON: $targetJson" >> $HTTPLOG
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                if [ $res -ne 0 ]; then
                fi
                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
+                       __log_test_fail_body
                        return 1
                fi
        fi
 
                        return 1
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -794,9 +730,7 @@ ecs_api_edp_get_producer() {
 # args: <response-code> <producer-id>
 # (Function for test scripts)
 ecs_api_edp_delete_producer() {
 # args: <response-code> <producer-id>
 # (Function for test scripts)
 ecs_api_edp_delete_producer() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     if [ $# -lt 2 ]; then
                __print_err "<response-code> <producer-id>" $@
 
     if [ $# -lt 2 ]; then
                __print_err "<response-code> <producer-id>" $@
@@ -808,50 +742,43 @@ ecs_api_edp_delete_producer() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
 # API Test function: PUT /ei-producer/v1/eiproducers/{eiProducerId}
        return 0
 }
 
 # API Test function: PUT /ei-producer/v1/eiproducers/{eiProducerId}
-# args: <response-code> <producer-id> <create-callback> <delete-callback> <supervision-callback> NOTYPE|[<type-id> <schema-file>]+
+# args: <response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id> <schema-file>]+
 # (Function for test scripts)
 ecs_api_edp_put_producer() {
 # (Function for test scripts)
 ecs_api_edp_put_producer() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
 
-       #Valid number of parametrer 6,7,9,11,
+       #Valid number of parametrer 5,6,8,10,
        paramError=1
        paramError=1
-       if  [ $# -eq 6 ] && [ "$6" == "NOTYPE" ]; then
+       if  [ $# -eq 5 ] && [ "$5" == "NOTYPE" ]; then
                paramError=0
                paramError=0
-       elif [ $# -gt 6 ] && [ $(($#%2)) -eq 1 ]; then
+       elif [ $# -gt 5 ] && [ $(($#%2)) -eq 0 ]; then
                paramError=0
        fi
        if [ $paramError -ne 0 ]; then
                paramError=0
        fi
        if [ $paramError -ne 0 ]; then
-               __print_err "<response-code> <producer-id> <create-callback> <delete-callback> <supervision-callback> [<type-id> <schema-file>]+" $@
+               __print_err "<response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id> <schema-file>]+" $@
                return 1
        fi
 
        inputJson="["
                return 1
        fi
 
        inputJson="["
-       if [ $# -gt 6 ]; then
-               arr=(${@:6})
-               for ((i=0; i<$(($#-6)); i=i+2)); do
+       if [ $# -gt 5 ]; then
+               arr=(${@:5})
+               for ((i=0; i<$(($#-5)); i=i+2)); do
                        if [ "$inputJson" != "[" ]; then
                                inputJson=$inputJson","
                        fi
                        if [ -f ${arr[$i+1]} ]; then
                                schema=$(cat ${arr[$i+1]})
                        else
                        if [ "$inputJson" != "[" ]; then
                                inputJson=$inputJson","
                        fi
                        if [ -f ${arr[$i+1]} ]; then
                                schema=$(cat ${arr[$i+1]})
                        else
-                               echo -e $RED" FAIL. Schema file "${arr[$i+1]}", does not exist"$ERED
-                               ((RES_FAIL++))
-                               __check_stop_at_error
+                               _log_test_fail_general "Schema file "${arr[$i+1]}", does not exist"
                                return 1
                        fi
                        inputJson=$inputJson"{\"ei_type_identity\":\"${arr[$i]}\",\"ei_job_data_schema\":$schema}"
                                return 1
                        fi
                        inputJson=$inputJson"{\"ei_type_identity\":\"${arr[$i]}\",\"ei_job_data_schema\":$schema}"
@@ -859,7 +786,7 @@ ecs_api_edp_put_producer() {
        fi
        inputJson="\"supported_ei_types\":"$inputJson"]"
 
        fi
        inputJson="\"supported_ei_types\":"$inputJson"]"
 
-       inputJson=$inputJson",\"ei_job_creation_callback_url\": \"$3\",\"ei_job_deletion_callback_url\": \"$4\",\"ei_producer_supervision_callback_url\": \"$5\""
+       inputJson=$inputJson",\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\""
 
        inputJson="{"$inputJson"}"
 
 
        inputJson="{"$inputJson"}"
 
@@ -870,14 +797,11 @@ ecs_api_edp_put_producer() {
     status=${res:${#res}-3}
 
        if [ $status -ne $1 ]; then
     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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
 
                return 1
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -885,9 +809,7 @@ ecs_api_edp_put_producer() {
 # args: <response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <template-job-file>]+)
 # (Function for test scripts)
 ecs_api_edp_get_producer_jobs() {
 # args: <response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <template-job-file>]+)
 # (Function for test scripts)
 ecs_api_edp_get_producer_jobs() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
        #Valid number of parameter 2,3,6,10
        paramError=1
 
        #Valid number of parameter 2,3,6,10
        paramError=1
@@ -910,9 +832,7 @@ ecs_api_edp_get_producer_jobs() {
     res="$(__do_curl_to_api ECS GET $query)"
     status=${res:${#res}-3}
        if [ $status -ne $1 ]; then
     res="$(__do_curl_to_api ECS 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
+               __log_test_fail_status_code $1 $status
                return 1
        fi
        if [ $# -gt 2 ]; then
                return 1
        fi
        if [ $# -gt 2 ]; then
@@ -928,9 +848,7 @@ ecs_api_edp_get_producer_jobs() {
                                        jobfile=$(cat ${arr[$i+3]})
                                        jobfile=$(echo "$jobfile" | sed "s/XXXX/${arr[$i]}/g")
                                else
                                        jobfile=$(cat ${arr[$i+3]})
                                        jobfile=$(echo "$jobfile" | sed "s/XXXX/${arr[$i]}/g")
                                else
-                                       echo -e $RED" FAIL. Job template file "${arr[$i+3]}", does not exist"$ERED
-                                       ((RES_FAIL++))
-                                       __check_stop_at_error
+                                       _log_test_fail_general "Job template file "${arr[$i+3]}", does not exist"
                                        return 1
                                fi
                                targetJson=$targetJson"{\"ei_job_identity\":\"${arr[$i]}\",\"ei_type_identity\":\"${arr[$i+1]}\",\"target_uri\":\"${arr[$i+2]}\",\"ei_job_data\":$jobfile}"
                                        return 1
                                fi
                                targetJson=$targetJson"{\"ei_job_identity\":\"${arr[$i]}\",\"ei_type_identity\":\"${arr[$i+1]}\",\"target_uri\":\"${arr[$i+2]}\",\"ei_job_data\":$jobfile}"
@@ -942,15 +860,12 @@ ecs_api_edp_get_producer_jobs() {
                res=$(python3 ../common/compare_json.py "$targetJson" "$body")
 
                if [ $res -ne 0 ]; then
                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
+                       __log_test_fail_body
                        return 1
                fi
        fi
 
                        return 1
                fi
        fi
 
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       __log_test_pass
        return 0
 }
 
        return 0
 }
 
@@ -964,16 +879,18 @@ ecs_api_edp_get_producer_jobs() {
 # args: <response-code>
 # (Function for test scripts)
 ecs_api_service_status() {
 # args: <response-code>
 # (Function for test scripts)
 ecs_api_service_status() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
-       ((RES_TEST++))
+       __log_test_start $@
 
     if [ $# -lt 1 ]; then
                __print_err "<response-code> [<producer-id>]*|NOID" $@
                return 1
        fi
 
     if [ $# -lt 1 ]; then
                __print_err "<response-code> [<producer-id>]*|NOID" $@
                return 1
        fi
-
-       ((RES_PASS++))
-       echo -e $GREEN" PASS"$EGREEN
+       res="$(__do_curl_to_api ECS GET /status)"
+    status=${res:${#res}-3}
+       if [ $status -ne $1 ]; then
+               __log_test_fail_status_code $1 $status
+               return 1
+       fi
+       __log_test_pass
        return 0
 }
\ No newline at end of file
        return 0
 }
\ No newline at end of file
index f30b876..f974df7 100644 (file)
 # Excute a curl cmd towards the prodstub simulator and check the response code.
 # args: TEST|CONF <expected-response-code> <curl-cmd-string> [<json-file-to-compare-output>]
 __execute_curl_to_prodstub() {
 # Excute a curl cmd towards the prodstub simulator and check the response code.
 # args: TEST|CONF <expected-response-code> <curl-cmd-string> [<json-file-to-compare-output>]
 __execute_curl_to_prodstub() {
-       #echo ${FUNCNAME[1]} "line: "${BASH_LINENO[1]} >> $HTTPLOG
-    echo "(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+    TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
+    echo "(${BASH_LINENO[0]}) - ${TIMESTAMP}: ${FUNCNAME[0]}" $@ >> $HTTPLOG
        echo " CMD: $3" >> $HTTPLOG
        res="$($3)"
        echo " RESP: $res" >> $HTTPLOG
        retcode=$?
     if [ $retcode -ne 0 ]; then
        echo " CMD: $3" >> $HTTPLOG
        res="$($3)"
        echo " RESP: $res" >> $HTTPLOG
        retcode=$?
     if [ $retcode -ne 0 ]; then
-               echo " RETCODE: "$retcode
-        echo -e $RED" FAIL - fatal error when executing curl."$ERED
+        __log_conf_fail_general " Fatal error when executing curl, response: "$retcode
         return 1
     fi
     status=${res:${#res}-3}
         return 1
     fi
     status=${res:${#res}-3}
@@ -43,18 +42,26 @@ __execute_curl_to_prodstub() {
             echo " TARGET JSON: $jobfile" >> $HTTPLOG
                    res=$(python3 ../common/compare_json.py "$jobfile" "$body")
             if [ $res -ne 0 ]; then
             echo " TARGET JSON: $jobfile" >> $HTTPLOG
                    res=$(python3 ../common/compare_json.py "$jobfile" "$body")
             if [ $res -ne 0 ]; then
-                echo -e $RED" FAIL, returned body not correct"$ERED
-                       return 1
+                if [ $1 == "TEST" ]; then
+                    __log_test_fail_body
+                 else
+                    __log_conf_fail_body
+                fi
+                return 1
             fi
         fi
         if [ $1 == "TEST" ]; then
             fi
         fi
         if [ $1 == "TEST" ]; then
-            echo -e $GREEN" PASS"$EGREEN
+            __log_test_pass
         else
         else
-            echo -e $GREEN" OK"$EGREEN
+            __log_conf_ok
         fi
         return 0
     fi
         fi
         return 0
     fi
-    echo -e $RED" FAIL - expected http response: "$2" but got http response: "$status $ERED
+    if [ $1 == "TEST" ]; then
+        __log_test_fail_status_code $2 $status
+        else
+        __log_conf_fail_status_code $2 $status
+    fi
     return 1
 }
 
     return 1
 }
 
@@ -62,10 +69,8 @@ __execute_curl_to_prodstub() {
 # <response-code> <producer-id> [<forced_response_code>]
 # (Function for test scripts)
 prodstub_arm_producer() {
 # <response-code> <producer-id> [<forced_response_code>]
 # (Function for test scripts)
 prodstub_arm_producer() {
-       echo -e $BOLD"CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@ $EBOLD
-    echo "CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@  >> $HTTPLOG
+       __log_conf_start $@
        if [ $# -ne 2 ] && [ $# -ne 3 ]; then
        if [ $# -ne 2 ] && [ $# -ne 3 ]; then
-               ((RES_CONF_FAIL++))
                __print_err "<response-code> <producer-id> [<forced_response_code>]" $@
                return 1
        fi
                __print_err "<response-code> <producer-id> [<forced_response_code>]" $@
                return 1
        fi
@@ -76,21 +81,15 @@ prodstub_arm_producer() {
        fi
 
     __execute_curl_to_prodstub CONF $1 "$curlString"
        fi
 
     __execute_curl_to_prodstub CONF $1 "$curlString"
-    retcode=$?
-    if [ $? -ne 0 ]; then
-        ((RES_CONF_FAIL++))
-    fi
-       return $retcode
+    return $?
 }
 
 # Prodstub API: Set (or reset) response code job create
 # <response-code> <producer-id> <job-id> [<forced_response_code>]
 # (Function for test scripts)
 prodstub_arm_job_create() {
 }
 
 # Prodstub API: Set (or reset) response code job create
 # <response-code> <producer-id> <job-id> [<forced_response_code>]
 # (Function for test scripts)
 prodstub_arm_job_create() {
-       echo -e $BOLD"CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@ $EBOLD
-    echo "CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@  >> $HTTPLOG
+       __log_conf_start $@
        if [ $# -ne 3 ] && [ $# -ne 4 ]; then
        if [ $# -ne 3 ] && [ $# -ne 4 ]; then
-               ((RES_CONF_FAIL++))
                __print_err "<response-code> <producer-id> <job-id> [<forced_response_code>]" $@
                return 1
        fi
                __print_err "<response-code> <producer-id> <job-id> [<forced_response_code>]" $@
                return 1
        fi
@@ -101,21 +100,15 @@ prodstub_arm_job_create() {
        fi
 
     __execute_curl_to_prodstub CONF $1 "$curlString"
        fi
 
     __execute_curl_to_prodstub CONF $1 "$curlString"
-    retcode=$?
-    if [ $? -ne 0 ]; then
-        ((RES_CONF_FAIL++))
-    fi
-       return $retcode
+    return $?
 }
 
 # Prodstub API: Set (or reset) response code job delete
 # <response-code> <producer-id> <job-id> [<forced_response_code>]
 # (Function for test scripts)
 prodstub_arm_job_delete() {
 }
 
 # Prodstub API: Set (or reset) response code job delete
 # <response-code> <producer-id> <job-id> [<forced_response_code>]
 # (Function for test scripts)
 prodstub_arm_job_delete() {
-       echo -e $BOLD"CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@ $EBOLD
-    echo "CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@  >> $HTTPLOG
+       __log_conf_start $@
        if [ $# -ne 3 ] && [ $# -ne 4 ]; then
        if [ $# -ne 3 ] && [ $# -ne 4 ]; then
-               ((RES_CONF_FAIL++))
                __print_err "<response-code> <producer-id> <job-id> [<forced_response_code>]" $@
                return 1
        fi
                __print_err "<response-code> <producer-id> <job-id> [<forced_response_code>]" $@
                return 1
        fi
@@ -126,21 +119,15 @@ prodstub_arm_job_delete() {
        fi
 
     __execute_curl_to_prodstub CONF $1 "$curlString"
        fi
 
     __execute_curl_to_prodstub CONF $1 "$curlString"
-    retcode=$?
-    if [ $? -ne 0 ]; then
-        ((RES_CONF_FAIL++))
-    fi
-       return $retcode
+    return $?
 }
 
 # Prodstub API: Arm a type of a producer
 # <response-code> <producer-id> <type-id>
 # (Function for test scripts)
 prodstub_arm_type() {
 }
 
 # Prodstub API: Arm a type of a producer
 # <response-code> <producer-id> <type-id>
 # (Function for test scripts)
 prodstub_arm_type() {
-       echo -e $BOLD"CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@ $EBOLD
-    echo "CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@  >> $HTTPLOG
+       __log_conf_start $@
        if [ $# -ne 3 ]; then
        if [ $# -ne 3 ]; then
-               ((RES_CONF_FAIL++))
                __print_err "<response-code> <producer-id> <type-id>" $@
                return 1
        fi
                __print_err "<response-code> <producer-id> <type-id>" $@
                return 1
        fi
@@ -148,21 +135,15 @@ prodstub_arm_type() {
     curlString="curl -X PUT -skw %{http_code} $PROD_STUB_LOCALHOST/arm/type/$2/$3"
 
     __execute_curl_to_prodstub CONF $1 "$curlString"
     curlString="curl -X PUT -skw %{http_code} $PROD_STUB_LOCALHOST/arm/type/$2/$3"
 
     __execute_curl_to_prodstub CONF $1 "$curlString"
-    retcode=$?
-    if [ $? -ne 0 ]; then
-        ((RES_CONF_FAIL++))
-    fi
-       return $retcode
+    return $?
 }
 
 # Prodstub API: Disarm a type in a producer
 # <response-code> <producer-id> <type-id>
 # (Function for test scripts)
 prodstub_disarm_type() {
 }
 
 # Prodstub API: Disarm a type in a producer
 # <response-code> <producer-id> <type-id>
 # (Function for test scripts)
 prodstub_disarm_type() {
-       echo -e $BOLD"CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@ $EBOLD
-    echo "CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@  >> $HTTPLOG
+       __log_conf_start $@
        if [ $# -ne 3 ]; then
        if [ $# -ne 3 ]; then
-               ((RES_CONF_FAIL++))
                __print_err "<response-code> <producer-id> <type-id>" $@
                return 1
        fi
                __print_err "<response-code> <producer-id> <type-id>" $@
                return 1
        fi
@@ -170,21 +151,15 @@ prodstub_disarm_type() {
     curlString="curl -X DELETE -skw %{http_code} $PROD_STUB_LOCALHOST/arm/type/$2/$3"
 
     __execute_curl_to_prodstub CONF $1 "$curlString"
     curlString="curl -X DELETE -skw %{http_code} $PROD_STUB_LOCALHOST/arm/type/$2/$3"
 
     __execute_curl_to_prodstub CONF $1 "$curlString"
-    retcode=$?
-    if [ $? -ne 0 ]; then
-        ((RES_CONF_FAIL++))
-    fi
-       return $retcode
+    return $?
 }
 
 # Prodstub API: Get job data for a job and compare with a target job json
 # <response-code> <producer-id> <job-id> <type-id> <target-url> <template-job-file>
 # (Function for test scripts)
 prodstub_check_jobdata() {
 }
 
 # Prodstub API: Get job data for a job and compare with a target job json
 # <response-code> <producer-id> <job-id> <type-id> <target-url> <template-job-file>
 # (Function for test scripts)
 prodstub_check_jobdata() {
-       echo -e $BOLD"TEST(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@ $EBOLD
-    echo "TEST(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@  >> $HTTPLOG
+       __log_test_start $@
        if [ $# -ne 6 ]; then
        if [ $# -ne 6 ]; then
-               ((RES_FAIL++))
                __print_err "<response-code> <producer-id> <job-id> <type-id> <target-url> <template-job-file>" $@
                return 1
        fi
                __print_err "<response-code> <producer-id> <job-id> <type-id> <target-url> <template-job-file>" $@
                return 1
        fi
@@ -192,7 +167,7 @@ prodstub_check_jobdata() {
         jobfile=$(cat $6)
         jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
     else
         jobfile=$(cat $6)
         jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
     else
-        echo -e $RED" FAIL.  Template file "$6" for jobdata, does not exist"$ERED
+        _log_test_fail_general "Template file "$6" for jobdata, does not exist"
         return 1
     fi
     targetJson="{\"ei_job_identity\":\"$3\",\"ei_type_identity\":\"$4\",\"target_uri\":\"$5\",\"ei_job_data\":$jobfile}"
         return 1
     fi
     targetJson="{\"ei_job_identity\":\"$3\",\"ei_type_identity\":\"$4\",\"target_uri\":\"$5\",\"ei_job_data\":$jobfile}"
@@ -202,11 +177,22 @@ prodstub_check_jobdata() {
     curlString="curl -X GET -skw %{http_code} $PROD_STUB_LOCALHOST/jobdata/$2/$3"
 
     __execute_curl_to_prodstub TEST $1 "$curlString" $file
     curlString="curl -X GET -skw %{http_code} $PROD_STUB_LOCALHOST/jobdata/$2/$3"
 
     __execute_curl_to_prodstub TEST $1 "$curlString" $file
-    retcode=$?
-    if [ $? -ne 0 ]; then
-        ((RES_FAIL++))
-    fi
-       return $retcode
+    return $?
+}
+
+# Prodstub API: Delete the job data
+# <response-code> <producer-id> <job-id>
+# (Function for test scripts)
+prodstub_delete_jobdata() {
+       __log_conf_start
+       if [ $# -ne 3 ]; then
+               __print_err "<response-code> <producer-id> <job-id> " $@
+               return 1
+       fi
+    curlString="curl -X DELETE -skw %{http_code} $PROD_STUB_LOCALHOST/jobdata/$2/$3"
+
+    __execute_curl_to_prodstub CONF $1 "$curlString"
+    return $?
 }
 
 # Tests if a variable value in the prod stub is equal to a target value and and optional timeout.
 }
 
 # Tests if a variable value in the prod stub is equal to a target value and and optional timeout.
@@ -220,7 +206,6 @@ prodstub_equal() {
        if [ $# -eq 2 ] || [ $# -eq 3 ]; then
                __var_test "PRODSTUB" "$LOCALHOST$PROD_STUB_EXTERNAL_PORT/counter/" $1 "=" $2 $3
        else
        if [ $# -eq 2 ] || [ $# -eq 3 ]; then
                __var_test "PRODSTUB" "$LOCALHOST$PROD_STUB_EXTERNAL_PORT/counter/" $1 "=" $2 $3
        else
-               ((RES_CONF_FAIL++))
                __print_err "Wrong args to prodstub_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
        fi
 }
\ No newline at end of file
                __print_err "Wrong args to prodstub_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
        fi
 }
\ No newline at end of file
index 56f968e..2a68aa0 100644 (file)
@@ -55,12 +55,10 @@ __execute_curl_to_sim() {
 sim_equal() {
 
        if [ $# -eq 3 ] || [ $# -eq 4 ]; then
 sim_equal() {
 
        if [ $# -eq 3 ] || [ $# -eq 4 ]; then
-               app=$1
-               port=$(__find_sim_port $app)
-               __var_test $app "$RIC_SIM_LOCALHOST$port/counter/" $2 "=" $3 $4
+               port=$(__find_sim_port $1)
+               __var_test $1 "$RIC_SIM_LOCALHOST$port/counter/" $2 "=" $3 $4
                return 0
        else
                return 0
        else
-               ((RES_CONF_FAIL++))
                __print_err "needs three or four args: <ric-id> <sim-param> <target-value> [ timeout ]"
                return 1
        fi
                __print_err "needs three or four args: <ric-id> <sim-param> <target-value> [ timeout ]"
                return 1
        fi
@@ -72,13 +70,11 @@ sim_equal() {
 sim_print() {
 
        if [ $# != 2 ]; then
 sim_print() {
 
        if [ $# != 2 ]; then
-               ((RES_CONF_FAIL++))
        __print_err "need two args, <ric-id> <sim-param>" $@
                exit 1
        fi
        __print_err "need two args, <ric-id> <sim-param>" $@
                exit 1
        fi
-       app=$1
-       port=$(__find_sim_port $app)
-       echo -e $BOLD"INFO(${BASH_LINENO[0]}): $app, $2 = $(__do_curl $RIC_SIM_LOCALHOST$port/counter/$2)"$EBOLD
+       port=$(__find_sim_port $1)
+       echo -e $BOLD"INFO(${BASH_LINENO[0]}): $1, $2 = $(__do_curl $RIC_SIM_LOCALHOST$port/counter/$2)"$EBOLD
 }
 
 # Tests if a variable value in the RIC simulator contains the target string and and optional timeout
 }
 
 # Tests if a variable value in the RIC simulator contains the target string and and optional timeout
@@ -91,12 +87,10 @@ sim_print() {
 sim_contains_str() {
 
        if [ $# -eq 3 ] || [ $# -eq 4 ]; then
 sim_contains_str() {
 
        if [ $# -eq 3 ] || [ $# -eq 4 ]; then
-               app=$1
-               port=$(__find_sim_port $app)
-               __var_test $app "$RIC_SIM_LOCALHOST$port/counter/" $2 "contain_str" $3 $4
+               port=$(__find_sim_port $1)
+               __var_test $1 "$RIC_SIM_LOCALHOST$port/counter/" $2 "contain_str" $3 $4
                return 0
        else
                return 0
        else
-               ((RES_CONF_FAIL++))
                __print_err "needs three or four args: <ric-id> <sim-param> <target-value> [ timeout ]"
                return 1
        fi
                __print_err "needs three or four args: <ric-id> <sim-param> <target-value> [ timeout ]"
                return 1
        fi
@@ -106,17 +100,13 @@ sim_contains_str() {
 # args: <response-code> <ric-id> <policy-type-id> <policy-type-file>
 # (Function for test scripts)
 sim_put_policy_type() {
 # args: <response-code> <ric-id> <policy-type-id> <policy-type-file>
 # (Function for test scripts)
 sim_put_policy_type() {
-       echo -e $BOLD"CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@ $EBOLD
+       __log_conf_start $@
        if [ $# -ne 4 ]; then
        if [ $# -ne 4 ]; then
-               ((RES_CONF_FAIL++))
                __print_err "<response-code> <ric-id> <policy-type-id> <policy-type-file>" $@
                return 1
        fi
                __print_err "<response-code> <ric-id> <policy-type-id> <policy-type-file>" $@
                return 1
        fi
-       app=$2
-       res=$(__find_sim_port $app)
-
+       res=$(__find_sim_port $2)
     curlString="curl -X PUT -skw %{http_code} $RIC_SIM_LOCALHOST"$res"/policytype?id="$3" -H Content-Type:application/json --data-binary @"$4
     curlString="curl -X PUT -skw %{http_code} $RIC_SIM_LOCALHOST"$res"/policytype?id="$3" -H Content-Type:application/json --data-binary @"$4
-
        __execute_curl_to_sim $1 "$curlString"
        return $?
 }
        __execute_curl_to_sim $1 "$curlString"
        return $?
 }
@@ -125,17 +115,13 @@ sim_put_policy_type() {
 # <response-code> <ric-id> <policy-type-id>
 # (Function for test scripts)
 sim_delete_policy_type() {
 # <response-code> <ric-id> <policy-type-id>
 # (Function for test scripts)
 sim_delete_policy_type() {
-       echo -e $BOLD"CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@ $EBOLD
+       __log_conf_start $@
        if [ $# -ne 3 ]; then
        if [ $# -ne 3 ]; then
-               ((RES_CONF_FAIL++))
                __print_err "<response-code> <ric-id> <policy_type_id>" $@
                return 1
        fi
                __print_err "<response-code> <ric-id> <policy_type_id>" $@
                return 1
        fi
-       app=$2
-       res=$(__find_sim_port $app)
-
+       res=$(__find_sim_port $2)
     curlString="curl -X DELETE -skw %{http_code} $RIC_SIM_LOCALHOST"$res"/policytype?id="$3
     curlString="curl -X DELETE -skw %{http_code} $RIC_SIM_LOCALHOST"$res"/policytype?id="$3
-
     __execute_curl_to_sim $1 "$curlString"
        return $?
 }
     __execute_curl_to_sim $1 "$curlString"
        return $?
 }
@@ -144,17 +130,13 @@ sim_delete_policy_type() {
 # <response-code> <ric-id>
 # (Function for test scripts)
 sim_post_delete_instances() {
 # <response-code> <ric-id>
 # (Function for test scripts)
 sim_post_delete_instances() {
-       echo -e $BOLD"CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@ $EBOLD
+       __log_conf_start $@
        if [ $# -ne 2 ]; then
        if [ $# -ne 2 ]; then
-               ((RES_CONF_FAIL++))
                __print_err "<response-code> <ric-id>" $@
                return 1
        fi
                __print_err "<response-code> <ric-id>" $@
                return 1
        fi
-       app=$2
-       res=$(__find_sim_port $app)
-
+       res=$(__find_sim_port $2)
     curlString="curl -X POST -skw %{http_code} $RIC_SIM_LOCALHOST"$res"/deleteinstances"
     curlString="curl -X POST -skw %{http_code} $RIC_SIM_LOCALHOST"$res"/deleteinstances"
-
     __execute_curl_to_sim $1 "$curlString"
        return $?
 }
     __execute_curl_to_sim $1 "$curlString"
        return $?
 }
@@ -163,17 +145,13 @@ sim_post_delete_instances() {
 # <response-code> <ric-id>
 # (Function for test scripts)
 sim_post_delete_all() {
 # <response-code> <ric-id>
 # (Function for test scripts)
 sim_post_delete_all() {
-       echo -e $BOLD"CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@ $EBOLD
+       __log_conf_start $@
        if [ $# -ne 3 ]; then
        if [ $# -ne 3 ]; then
-               ((RES_CONF_FAIL++))
                __print_err "<response-code> <numericic-id>" $@
                return 1
        fi
                __print_err "<response-code> <numericic-id>" $@
                return 1
        fi
-       app=$2
-       res=$(__find_sim_port $app)
-
+       res=$(__find_sim_port $2)
     curlString="curl -X POST -skw %{http_code} $RIC_SIM_LOCALHOST"$res"/deleteall"
     curlString="curl -X POST -skw %{http_code} $RIC_SIM_LOCALHOST"$res"/deleteall"
-
     __execute_curl_to_sim $1 "$curlString"
        return $?
 }
     __execute_curl_to_sim $1 "$curlString"
        return $?
 }
@@ -182,20 +160,16 @@ sim_post_delete_all() {
 # <response-code> <ric-id> [<forced_response_code>]
 # (Function for test scripts)
 sim_post_forcedresponse() {
 # <response-code> <ric-id> [<forced_response_code>]
 # (Function for test scripts)
 sim_post_forcedresponse() {
-       echo -e $BOLD"CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@ $EBOLD
+       __log_conf_start $@
        if [ $# -ne 3 ]; then
        if [ $# -ne 3 ]; then
-               ((RES_CONF_FAIL++))
                __print_err "<response-code> <ric-id> <forced_response_code>" $@
                return 1
        fi
                __print_err "<response-code> <ric-id> <forced_response_code>" $@
                return 1
        fi
-       app=$2
-       res=$(__find_sim_port $app)
-
+       res=$(__find_sim_port $2)
     curlString="curl -X POST -skw %{http_code} $RIC_SIM_LOCALHOST"$res"/forceresponse"
        if [ $# -eq 3 ]; then
                curlString=$curlString"?code="$3
        fi
     curlString="curl -X POST -skw %{http_code} $RIC_SIM_LOCALHOST"$res"/forceresponse"
        if [ $# -eq 3 ]; then
                curlString=$curlString"?code="$3
        fi
-
     __execute_curl_to_sim $1 "$curlString"
        return $?
 }
     __execute_curl_to_sim $1 "$curlString"
        return $?
 }
@@ -204,20 +178,16 @@ sim_post_forcedresponse() {
 # <response-code> <ric-id> [<delay-in-seconds>]
 # (Function for test scripts)
 sim_post_forcedelay() {
 # <response-code> <ric-id> [<delay-in-seconds>]
 # (Function for test scripts)
 sim_post_forcedelay() {
-       echo -e $BOLD"CONF(${BASH_LINENO[0]}): "${FUNCNAME[0]} $@ $EBOLD
+       __log_conf_start $@
        if [ $# -ne 3 ]; then
        if [ $# -ne 3 ]; then
-               ((RES_CONF_FAIL++))
                __print_err "<response-code> <ric-id> [<delay-in-seconds>]" $@
                return 1
        fi
                __print_err "<response-code> <ric-id> [<delay-in-seconds>]" $@
                return 1
        fi
-       app=$2
-       res=$(__find_sim_port $app)
-
+       res=$(__find_sim_port $2)
     curlString="curl -X POST -skw %{http_code} $RIC_SIM_LOCALHOST$res/forcedelay"
        if [ $# -eq 3 ]; then
                curlString=$curlString"?delay="$3
        fi
     curlString="curl -X POST -skw %{http_code} $RIC_SIM_LOCALHOST$res/forcedelay"
        if [ $# -eq 3 ]; then
                curlString=$curlString"?delay="$3
        fi
-
     __execute_curl_to_sim $1 "$curlString"
        return $?
 }
\ No newline at end of file
     __execute_curl_to_sim $1 "$curlString"
        return $?
 }
\ No newline at end of file
index 51eab69..1dc2b36 100644 (file)
@@ -16,8 +16,9 @@
 #  limitations under the License.
 #  ============LICENSE_END=================================================
 #
 #  limitations under the License.
 #  ============LICENSE_END=================================================
 #
-
+#Profile for ONAP guilin release
 TEST_ENV_PROFILE="ONAP-GUILIN"
 TEST_ENV_PROFILE="ONAP-GUILIN"
+NEXUS_PROXY_REPO="nexus3.onap.org:10001/"
 
 # Set up the image and tags for the test. Do not add the image tag to the image names.
 
 
 # Set up the image and tags for the test. Do not add the image tag to the image names.
 
@@ -28,7 +29,7 @@ TEST_ENV_PROFILE="ONAP-GUILIN"
 # Tag for guilin branch
 # Remote Policy Agent image and tag
 POLICY_AGENT_REMOTE_IMAGE="nexus3.onap.org:10003/onap/ccsdk-oran-a1policymanagementservice"
 # Tag for guilin branch
 # Remote Policy Agent image and tag
 POLICY_AGENT_REMOTE_IMAGE="nexus3.onap.org:10003/onap/ccsdk-oran-a1policymanagementservice"
-POLICY_AGENT_REMOTE_IMAGE_TAG="1.0.1-SNAPSHOT"
+POLICY_AGENT_REMOTE_IMAGE_TAG="1.0.2-SNAPSHOT"
 
 
 # Control Panel remote image and tag
 
 
 # Control Panel remote image and tag
@@ -42,7 +43,7 @@ SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG="2.0.2-STAGING-latest"
 
 
 #SDNC DB remote image and tag
 
 
 #SDNC DB remote image and tag
-SDNC_DB_REMOTE_IMAGE="mysql/mysql-server"
+SDNC_DB_REMOTE_IMAGE=$NEXUS_PROXY_REPO"mysql/mysql-server"
 SDNC_DB_REMOTE_IMAGE_TAG="5.6"
 #No local image for DB, remote image always used
 
 SDNC_DB_REMOTE_IMAGE_TAG="5.6"
 #No local image for DB, remote image always used
 
@@ -53,7 +54,7 @@ RIC_SIM_REMOTE_IMAGE_TAG="2.0.0"
 
 
 #Consul remote image and tag
 
 
 #Consul remote image and tag
-CONSUL_REMOTE_IMAGE="consul"
+CONSUL_REMOTE_IMAGE=$NEXUS_PROXY_REPO"consul"
 CONSUL_REMOTE_IMAGE_TAG="1.7.2"
 #No local image for Consul, remote image always used
 
 CONSUL_REMOTE_IMAGE_TAG="1.7.2"
 #No local image for Consul, remote image always used
 
index f97309c..29647bd 100644 (file)
@@ -16,8 +16,9 @@
 #  limitations under the License.
 #  ============LICENSE_END=================================================
 #
 #  limitations under the License.
 #  ============LICENSE_END=================================================
 #
-
+#Profile for ONAP master
 TEST_ENV_PROFILE="ONAP-MASTER"
 TEST_ENV_PROFILE="ONAP-MASTER"
+NEXUS_PROXY_REPO="nexus3.onap.org:10001/"
 
 # Set up the image and tags for the test. Do not add the image tag to the image names.
 
 
 # Set up the image and tags for the test. Do not add the image tag to the image names.
 
@@ -53,7 +54,7 @@ SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG="2.1.0-STAGING-latest"
 
 
 #SDNC DB remote image and tag
 
 
 #SDNC DB remote image and tag
-SDNC_DB_REMOTE_IMAGE="mysql/mysql-server"
+SDNC_DB_REMOTE_IMAGE=$NEXUS_PROXY_REPO"mysql/mysql-server"
 SDNC_DB_REMOTE_IMAGE_TAG="5.6"
 #No local image for DB, remote image always used
 
 SDNC_DB_REMOTE_IMAGE_TAG="5.6"
 #No local image for DB, remote image always used
 
@@ -66,7 +67,7 @@ RIC_SIM_REMOTE_IMAGE_TAG="2.1.0"
 
 
 #Consul remote image and tag
 
 
 #Consul remote image and tag
-CONSUL_REMOTE_IMAGE="consul"
+CONSUL_REMOTE_IMAGE=$NEXUS_PROXY_REPO"consul"
 CONSUL_REMOTE_IMAGE_TAG="1.7.2"
 #No local image for Consul, remote image always used
 
 CONSUL_REMOTE_IMAGE_TAG="1.7.2"
 #No local image for Consul, remote image always used
 
@@ -100,7 +101,7 @@ export POLICY_AGENT_INTERNAL_PORT=8081                          # Policy Agent c
 export POLICY_AGENT_EXTERNAL_SECURE_PORT=8433                   # Policy Agent container external secure port (host -> container)
 export POLICY_AGENT_INTERNAL_SECURE_PORT=8433                   # Policy Agent container internal secure port (container -> container)
 export POLICY_AGENT_APIS="V1 V2"                                # Supported northbound api versions
 export POLICY_AGENT_EXTERNAL_SECURE_PORT=8433                   # Policy Agent container external secure port (host -> container)
 export POLICY_AGENT_INTERNAL_SECURE_PORT=8433                   # Policy Agent container internal secure port (container -> container)
 export POLICY_AGENT_APIS="V1 V2"                                # Supported northbound api versions
-export PMS_VERSION="V2"
+export PMS_VERSION="V2"                                         # Tested version of northbound API
 
 export POLICY_AGENT_APP_NAME="policy-agent"                     # Name for Policy Agent container
 POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log"    # Path the application log in the Policy Agent container
 
 export POLICY_AGENT_APP_NAME="policy-agent"                     # Name for Policy Agent container
 POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log"    # Path the application log in the Policy Agent container
index 0077ef0..c0e28f6 100755 (executable)
@@ -16,8 +16,9 @@
 #  limitations under the License.
 #  ============LICENSE_END=================================================
 #
 #  limitations under the License.
 #  ============LICENSE_END=================================================
 #
-
+#Profile for ORAN master
 TEST_ENV_PROFILE="ORAN-MASTER"
 TEST_ENV_PROFILE="ORAN-MASTER"
+NEXUS_PROXY_REPO="nexus3.onap.org:10001/"
 
 # Set up the image and tags for the test. Do not add the image tag to the image names.
 
 
 # Set up the image and tags for the test. Do not add the image tag to the image names.
 
@@ -56,7 +57,7 @@ SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG="2.1.0"
 
 
 #SDNC DB remote image and tag
 
 
 #SDNC DB remote image and tag
-SDNC_DB_REMOTE_IMAGE="mysql/mysql-server"
+SDNC_DB_REMOTE_IMAGE=$NEXUS_PROXY_REPO"mysql/mysql-server"
 SDNC_DB_REMOTE_IMAGE_TAG="5.6"
 #No local image for DB, remote image always used
 
 SDNC_DB_REMOTE_IMAGE_TAG="5.6"
 #No local image for DB, remote image always used
 
@@ -66,11 +67,11 @@ RIC_SIM_LOCAL_IMAGE="o-ran-sc/a1-simulator"
 RIC_SIM_LOCAL_IMAGE_TAG="latest"
 # Near RT RIC Simulator remote image and tag
 RIC_SIM_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator"
 RIC_SIM_LOCAL_IMAGE_TAG="latest"
 # Near RT RIC Simulator remote image and tag
 RIC_SIM_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator"
-RIC_SIM_REMOTE_IMAGE_TAG="2.0.0"
+RIC_SIM_REMOTE_IMAGE_TAG="2.1.0"
 
 
 #Consul remote image and tag
 
 
 #Consul remote image and tag
-CONSUL_REMOTE_IMAGE="consul"
+CONSUL_REMOTE_IMAGE=$NEXUS_PROXY_REPO"consul"
 CONSUL_REMOTE_IMAGE_TAG="1.7.2"
 #No local image for Consul, remote image always used
 
 CONSUL_REMOTE_IMAGE_TAG="1.7.2"
 #No local image for Consul, remote image always used
 
@@ -103,7 +104,8 @@ export POLICY_AGENT_EXTERNAL_PORT=8081                          # Policy Agent c
 export POLICY_AGENT_INTERNAL_PORT=8081                          # Policy Agent container internal port (container -> container)
 export POLICY_AGENT_EXTERNAL_SECURE_PORT=8433                   # Policy Agent container external secure port (host -> container)
 export POLICY_AGENT_INTERNAL_SECURE_PORT=8433                   # Policy Agent container internal secure port (container -> container)
 export POLICY_AGENT_INTERNAL_PORT=8081                          # Policy Agent container internal port (container -> container)
 export POLICY_AGENT_EXTERNAL_SECURE_PORT=8433                   # Policy Agent container external secure port (host -> container)
 export POLICY_AGENT_INTERNAL_SECURE_PORT=8433                   # Policy Agent container internal secure port (container -> container)
-export POLICY_AGENT_APIS="V1"                                   # Supported northbound api versions
+export POLICY_AGENT_APIS="V1 V2"                                # Supported northbound api versions
+export PMS_VERSION="V2"                                         # Tested version of northbound API
 
 export POLICY_AGENT_APP_NAME="policy-agent"                     # Name for Policy Agent container
 POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log"    # Path the application log in the Policy Agent container
 
 export POLICY_AGENT_APP_NAME="policy-agent"                     # Name for Policy Agent container
 POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log"    # Path the application log in the Policy Agent container
index 3ed51c9..dd9e57a 100755 (executable)
@@ -159,6 +159,94 @@ RES_DEVIATION=0
 DEVIATION_FILE=".tmp_deviations"
 rm $DEVIATION_FILE &> /dev/null
 
 DEVIATION_FILE=".tmp_deviations"
 rm $DEVIATION_FILE &> /dev/null
 
+
+# Trap "command not found" and make the script fail
+trap_fnc() {
+
+       if [ $? -eq 127 ]; then
+               echo -e $RED"Function not found, set script to FAIL"$ERED
+               ((RES_CONF_FAIL++))
+       fi
+}
+trap trap_fnc ERR
+
+# Counter for tests
+TEST_SEQUENCE_NR=1
+
+__log_test_start() {
+       TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
+       echo -e $BOLD"TEST $TEST_SEQUENCE_NR (${BASH_LINENO[1]}): ${FUNCNAME[1]}" $@ $EBOLD
+    echo "TEST $TEST_SEQUENCE_NR - ${TIMESTAMP}: (${BASH_LINENO[1]}): ${FUNCNAME[1]}" $@ >> $HTTPLOG
+       ((RES_TEST++))
+       ((TEST_SEQUENCE_NR++))
+}
+
+__log_test_fail_general() {
+       echo -e $RED" FAIL."$1 $ERED
+       ((RES_FAIL++))
+       __check_stop_at_error
+}
+
+__log_test_fail_status_code() {
+       echo -e $RED" FAIL. Exepected status "$1", got "$2 $3 $ERED
+       ((RES_FAIL++))
+       __check_stop_at_error
+}
+
+__log_test_fail_body() {
+       echo -e $RED" FAIL, returned body not correct"$ERED
+       ((RES_FAIL++))
+       __check_stop_at_error
+}
+
+__log_test_fail_not_supported() {
+       echo -e $RED" FAIL, function not supported"$ERED
+       ((RES_FAIL++))
+       __check_stop_at_error
+}
+
+__log_test_pass() {
+       if [ $# -gt 0 ]; then
+               echo $@
+       fi
+       ((RES_PASS++))
+       echo -e $GREEN" PASS"$EGREEN
+}
+
+#Counter for configurations
+CONF_SEQUENCE_NR=1
+__log_conf_start() {
+       TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
+       echo -e $BOLD"CONF $CONF_SEQUENCE_NR (${BASH_LINENO[1]}): "${FUNCNAME[1]} $@ $EBOLD
+       echo "CONF $CONF_SEQUENCE_NR - ${TIMESTAMP}: (${BASH_LINENO[1]}): "${FUNCNAME[1]} $@  >> $HTTPLOG
+       ((CONF_SEQUENCE_NR++))
+}
+
+__log_conf_fail_general() {
+       echo -e $RED" FAIL."$1 $ERED
+       ((RES_CONF_FAIL++))
+       __check_stop_at_error
+}
+
+__log_conf_fail_status_code() {
+       echo -e $RED" FAIL. Exepected status "$1", got "$2 $3 $ERED
+       ((RES_CONF_FAIL++))
+       __check_stop_at_error
+}
+
+__log_conf_fail_body() {
+       echo -e $RED" FAIL, returned body not correct"$ERED
+       ((RES_CONF_FAIL++))
+       __check_stop_at_error
+}
+
+__log_conf_ok() {
+       if [ $# -gt 0 ]; then
+               echo $@
+       fi
+       echo -e $GREEN" OK"$EGREEN
+}
+
 #Var for measuring execution time
 TCTEST_START=$SECONDS
 
 #Var for measuring execution time
 TCTEST_START=$SECONDS
 
@@ -691,7 +779,7 @@ if [ $? -eq 0 ]; then
        cd $curdir
        cd ../mrstub
        echo " Building mrstub image: $MRSTUB_LOCAL_IMAGE:$MRSTUB_LOCAL_IMAGE_TAG"
        cd $curdir
        cd ../mrstub
        echo " Building mrstub image: $MRSTUB_LOCAL_IMAGE:$MRSTUB_LOCAL_IMAGE_TAG"
-       docker build -t $MRSTUB_LOCAL_IMAGE . &> .dockererr
+       docker build  --build-arg NEXUS_PROXY_REPO=$NEXUS_PROXY_REPO -t $MRSTUB_LOCAL_IMAGE . &> .dockererr
        if [ $? -eq 0 ]; then
                echo -e  $GREEN" Build Ok"$EGREEN
        else
        if [ $? -eq 0 ]; then
                echo -e  $GREEN" Build Ok"$EGREEN
        else
@@ -710,7 +798,7 @@ __check_included_image 'CR'
 if [ $? -eq 0 ]; then
        cd ../cr
        echo " Building Callback Receiver image: $CR_LOCAL_IMAGE:$CR_IMAGE_TAG"
 if [ $? -eq 0 ]; then
        cd ../cr
        echo " Building Callback Receiver image: $CR_LOCAL_IMAGE:$CR_IMAGE_TAG"
-       docker build -t $CR_LOCAL_IMAGE . &> .dockererr
+       docker build  --build-arg NEXUS_PROXY_REPO=$NEXUS_PROXY_REPO -t $CR_LOCAL_IMAGE . &> .dockererr
        if [ $? -eq 0 ]; then
                echo -e  $GREEN" Build Ok"$EGREEN
        else
        if [ $? -eq 0 ]; then
                echo -e  $GREEN" Build Ok"$EGREEN
        else
@@ -729,7 +817,7 @@ __check_included_image 'PRODSTUB'
 if [ $? -eq 0 ]; then
        cd ../prodstub
        echo " Building Producer stub image: $PROD_STUB_LOCAL_IMAGE:$PROD_STUB_LOCAL_IMAGE_TAG"
 if [ $? -eq 0 ]; then
        cd ../prodstub
        echo " Building Producer stub image: $PROD_STUB_LOCAL_IMAGE:$PROD_STUB_LOCAL_IMAGE_TAG"
-       docker build -t $PROD_STUB_LOCAL_IMAGE . &> .dockererr
+       docker build  --build-arg NEXUS_PROXY_REPO=$NEXUS_PROXY_REPO -t $PROD_STUB_LOCAL_IMAGE . &> .dockererr
        if [ $? -eq 0 ]; then
                echo -e  $GREEN" Build Ok"$EGREEN
        else
        if [ $? -eq 0 ]; then
                echo -e  $GREEN" Build Ok"$EGREEN
        else
@@ -1066,7 +1154,8 @@ clean_containers() {
        if [ $? -eq 0 ]; then
                if [ $CONTRS -ne 0 ]; then
                        echo -e $RED"Containers running, may cause distubance to the test case"$ERED
        if [ $? -eq 0 ]; then
                if [ $CONTRS -ne 0 ]; then
                        echo -e $RED"Containers running, may cause distubance to the test case"$ERED
-                       docker ps -a
+                       docker ps -a | indent1
+                       echo ""
                fi
        fi
 }
                fi
        fi
 }
@@ -1112,6 +1201,7 @@ __print_err() {
        if [ $# -gt 1 ]; then
                echo -e $RED" Got: "${FUNCNAME[1]} ${@:2} $ERED
        fi
        if [ $# -gt 1 ]; then
                echo -e $RED" Got: "${FUNCNAME[1]} ${@:2} $ERED
        fi
+       ((RES_CONF_FAIL++))
 }
 
 
 }
 
 
@@ -1482,7 +1572,8 @@ start_consul_cbs() {
 ###########################
 
 use_simulator_http() {
 ###########################
 
 use_simulator_http() {
-       echo -e "Using $BOLD http $EBOLD towards the simulators"
+       echo -e $BOLD"RICSIM protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD towards the simulators"
        export RIC_SIM_HTTPX="http"
        export RIC_SIM_LOCALHOST=$RIC_SIM_HTTPX"://localhost:"
        export RIC_SIM_PORT=$RIC_SIM_INTERNAL_PORT
        export RIC_SIM_HTTPX="http"
        export RIC_SIM_LOCALHOST=$RIC_SIM_HTTPX"://localhost:"
        export RIC_SIM_PORT=$RIC_SIM_INTERNAL_PORT
@@ -1490,7 +1581,8 @@ use_simulator_http() {
 }
 
 use_simulator_https() {
 }
 
 use_simulator_https() {
-       echo -e "Using $BOLD https $EBOLD towards the simulators"
+       echo -e $BOLD"RICSIM protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD towards the simulators"
        export RIC_SIM_HTTPX="https"
        export RIC_SIM_LOCALHOST=$RIC_SIM_HTTPX"://localhost:"
        export RIC_SIM_PORT=$RIC_SIM_INTERNAL_SECURE_PORT
        export RIC_SIM_HTTPX="https"
        export RIC_SIM_LOCALHOST=$RIC_SIM_HTTPX"://localhost:"
        export RIC_SIM_PORT=$RIC_SIM_INTERNAL_SECURE_PORT
@@ -1611,7 +1703,8 @@ start_sdnc() {
 }
 
 use_sdnc_http() {
 }
 
 use_sdnc_http() {
-       echo -e "Using $BOLD http $EBOLD towards SDNC"
+       echo -e $BOLD"SDNC protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD towards SDNC"
        export SDNC_HTTPX="http"
        export SDNC_PORT=$SDNC_INTERNAL_PORT
        export SDNC_LOCAL_PORT=$SDNC_EXTERNAL_PORT
        export SDNC_HTTPX="http"
        export SDNC_PORT=$SDNC_INTERNAL_PORT
        export SDNC_LOCAL_PORT=$SDNC_EXTERNAL_PORT
@@ -1619,7 +1712,8 @@ use_sdnc_http() {
 }
 
 use_sdnc_https() {
 }
 
 use_sdnc_https() {
-       echo -e "Using $BOLD https $EBOLD towards SDNC"
+       echo -e $BOLD"SDNC protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD towards SDNC"
        export SDNC_HTTPX="https"
        export SDNC_PORT=$SDNC_INTERNAL_SECURE_PORT
        export SDNC_LOCAL_PORT=$SDNC_EXTERNAL_SECURE_PORT
        export SDNC_HTTPX="https"
        export SDNC_PORT=$SDNC_INTERNAL_SECURE_PORT
        export SDNC_LOCAL_PORT=$SDNC_EXTERNAL_SECURE_PORT
@@ -1647,7 +1741,8 @@ start_mr() {
 }
 
 use_mr_http() {
 }
 
 use_mr_http() {
-       echo -e "Using $BOLD http $EBOLD towards MR"
+       echo -e $BOLD"MR protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD towards MR"
        export MR_HTTPX="http"
        export MR_PORT=$MR_INTERNAL_PORT
        export MR_LOCAL_PORT=$MR_EXTERNAL_PORT
        export MR_HTTPX="http"
        export MR_PORT=$MR_INTERNAL_PORT
        export MR_LOCAL_PORT=$MR_EXTERNAL_PORT
@@ -1655,7 +1750,8 @@ use_mr_http() {
 }
 
 use_mr_https() {
 }
 
 use_mr_https() {
-       echo -e "Using $BOLD https $EBOLD towards MR"
+       echo -e $BOLD"MR protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD towards MR"
        export MR_HTTPX="https"
        export MR_PORT=$MR_INTERNAL_SECURE_PORT
        export MR_LOCAL_PORT=$MR_EXTERNAL_SECURE_PORT
        export MR_HTTPX="https"
        export MR_PORT=$MR_INTERNAL_SECURE_PORT
        export MR_LOCAL_PORT=$MR_EXTERNAL_SECURE_PORT
@@ -1684,7 +1780,8 @@ start_cr() {
 }
 
 use_cr_http() {
 }
 
 use_cr_http() {
-       echo -e "Using $BOLD http $EBOLD towards CR"
+       echo -e $BOLD"CR protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD towards CR"
        export CR_HTTPX="http"
        export CR_PORT=$CR_INTERNAL_PORT
        export CR_LOCAL_PORT=$CR_EXTERNAL_PORT
        export CR_HTTPX="http"
        export CR_PORT=$CR_INTERNAL_PORT
        export CR_LOCAL_PORT=$CR_EXTERNAL_PORT
@@ -1693,7 +1790,8 @@ use_cr_http() {
 }
 
 use_cr_https() {
 }
 
 use_cr_https() {
-       echo -e "Using $BOLD https $EBOLD towards CR"
+       echo -e $BOLD"CR protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD towards CR"
        export CR_HTTPX="https"
        export CR_PORT=$CR_INTERNAL_SECURE_PORT
        export CR_LOCAL_PORT=$CR_EXTERNAL_SECURE_PORT
        export CR_HTTPX="https"
        export CR_PORT=$CR_INTERNAL_SECURE_PORT
        export CR_LOCAL_PORT=$CR_EXTERNAL_SECURE_PORT
@@ -1722,7 +1820,8 @@ start_prod_stub() {
 }
 
 use_prod_stub_http() {
 }
 
 use_prod_stub_http() {
-       echo -e "Using $BOLD http $EBOLD towards Producer stub"
+       echo -e $BOLD"Producer stub protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD towards Producer stub"
        export PROD_STUB_HTTPX="http"
        export PROD_STUB_PORT=$PROD_STUB_INTERNAL_PORT
        export PROD_STUB_LOCAL_PORT=$PROD_STUB_EXTERNAL_PORT
        export PROD_STUB_HTTPX="http"
        export PROD_STUB_PORT=$PROD_STUB_INTERNAL_PORT
        export PROD_STUB_LOCAL_PORT=$PROD_STUB_EXTERNAL_PORT
@@ -1731,7 +1830,8 @@ use_prod_stub_http() {
 }
 
 use_prod_stub_https() {
 }
 
 use_prod_stub_https() {
-       echo -e "Using $BOLD https $EBOLD towards Producer stub"
+       echo -e $BOLD"Producer stub protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD towards Producer stub"
        export PROD_STUB_HTTPX="https"
        export PROD_STUB_PORT=$PROD_STUB_INTERNAL_SECURE_PORT
        export PROD_STUB_LOCAL_PORT=$PROD_STUB_EXTERNAL_SECURE_PORT
        export PROD_STUB_HTTPX="https"
        export PROD_STUB_PORT=$PROD_STUB_INTERNAL_SECURE_PORT
        export PROD_STUB_LOCAL_PORT=$PROD_STUB_EXTERNAL_SECURE_PORT
@@ -1780,7 +1880,8 @@ start_policy_agent() {
 # args: -
 # (Function for test scripts)
 use_agent_rest_http() {
 # args: -
 # (Function for test scripts)
 use_agent_rest_http() {
-       echo -e "Using $BOLD http $EBOLD and $BOLD REST $EBOLD towards the agent"
+       echo -e $BOLD"Agent protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD and $BOLD REST $EBOLD towards the agent"
        export ADAPTER=$RESTBASE
        echo ""
 }
        export ADAPTER=$RESTBASE
        echo ""
 }
@@ -1789,7 +1890,8 @@ use_agent_rest_http() {
 # args: -
 # (Function for test scripts)
 use_agent_rest_https() {
 # args: -
 # (Function for test scripts)
 use_agent_rest_https() {
-       echo -e "Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards the agent"
+       echo -e $BOLD"Agent protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards the agent"
        export ADAPTER=$RESTBASE_SECURE
        echo ""
        return 0
        export ADAPTER=$RESTBASE_SECURE
        echo ""
        return 0
@@ -1799,7 +1901,8 @@ use_agent_rest_https() {
 # args: -
 # (Function for test scripts)
 use_agent_dmaap_http() {
 # args: -
 # (Function for test scripts)
 use_agent_dmaap_http() {
-       echo -e "Using $BOLD http $EBOLD and $BOLD DMAAP $EBOLD towards the agent"
+       echo -e $BOLD"Agent dmaap protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD and $BOLD DMAAP $EBOLD towards the agent"
        export ADAPTER=$DMAAPBASE
        echo ""
        return 0
        export ADAPTER=$DMAAPBASE
        echo ""
        return 0
@@ -1809,7 +1912,8 @@ use_agent_dmaap_http() {
 # args: -
 # (Function for test scripts)
 use_agent_dmaap_https() {
 # args: -
 # (Function for test scripts)
 use_agent_dmaap_https() {
-       echo -e "Using $BOLD https $EBOLD and $BOLD DMAAP $EBOLD towards the agent"
+       echo -e $BOLD"Agent dmaap protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD and $BOLD DMAAP $EBOLD towards the agent"
        export ADAPTER=$DMAAPBASE_SECURE
        echo ""
        return 0
        export ADAPTER=$DMAAPBASE_SECURE
        echo ""
        return 0
@@ -1819,7 +1923,7 @@ use_agent_dmaap_https() {
 # args: -
 # (Function for test scripts)
 set_agent_debug() {
 # args: -
 # (Function for test scripts)
 set_agent_debug() {
-       echo -e $BOLD"Setting agent debug"$EBOLD
+       echo -e $BOLD"Setting agent debug logging"$EBOLD
        actuator="/actuator/loggers/org.oransc.policyagent"
        if [[ $POLICY_AGENT_IMAGE = *"onap"* ]]; then
                actuator="/actuator/loggers/org.onap.ccsdk.oran.a1policymanagementservice"
        actuator="/actuator/loggers/org.oransc.policyagent"
        if [[ $POLICY_AGENT_IMAGE = *"onap"* ]]; then
                actuator="/actuator/loggers/org.onap.ccsdk.oran.a1policymanagementservice"
@@ -1839,7 +1943,7 @@ set_agent_debug() {
 # args: -
 # (Function for test scripts)
 set_agent_trace() {
 # args: -
 # (Function for test scripts)
 set_agent_trace() {
-       echo -e $BOLD"Setting agent trace"$EBOLD
+       echo -e $BOLD"Setting agent trace logging"$EBOLD
        actuator="/actuator/loggers/org.oransc.policyagent"
        if [[ $POLICY_AGENT_IMAGE = *"onap"* ]]; then
                actuator="/actuator/loggers/org.onap.ccsdk.oran.a1policymanagementservice"
        actuator="/actuator/loggers/org.oransc.policyagent"
        if [[ $POLICY_AGENT_IMAGE = *"onap"* ]]; then
                actuator="/actuator/loggers/org.onap.ccsdk.oran.a1policymanagementservice"
@@ -1881,11 +1985,13 @@ start_ecs() {
        cd ecs
        cd $ECS_HOST_MNT_DIR
        if [ -d database ]; then
        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
+               if [ "$(ls -A $DIR)" ]; then
+                       echo -e $BOLD" Cleaning files in mounted dir: $PWD/database"$EBOLD
+                       rm -rf database/*  &> /dev/null
+                       if [ $? -ne 0 ]; then
+                               echo -e $RED" Cannot remove database files in: $PWD"$ERED
+                               exit 1
+                       fi
                fi
        else
                echo " No files in mounted dir or dir does not exists"
                fi
        else
                echo " No files in mounted dir or dir does not exists"
@@ -1906,6 +2012,7 @@ start_ecs() {
 # args: -
 # (Function for test scripts)
 restart_ecs() {
 # args: -
 # (Function for test scripts)
 restart_ecs() {
+       echo -e $BOLD"Re-starting ECS"$EBOLD
        docker restart $ECS_APP_NAME &> ./tmp/.dockererr
        if [ $? -ne 0 ]; then
                __print_err "Could restart $ECS_APP_NAME" $@
        docker restart $ECS_APP_NAME &> ./tmp/.dockererr
        if [ $? -ne 0 ]; then
                __print_err "Could restart $ECS_APP_NAME" $@
@@ -1923,7 +2030,8 @@ restart_ecs() {
 # args: -
 # (Function for test scripts)
 use_ecs_rest_http() {
 # args: -
 # (Function for test scripts)
 use_ecs_rest_http() {
-       echo -e "Using $BOLD http $EBOLD and $BOLD REST $EBOLD towards ECS"
+       echo -e $BOLD"ECS protocol setting"$EBOLD
+       echo -e " Using $BOLD http $EBOLD and $BOLD REST $EBOLD towards ECS"
        export ECS_ADAPTER=$ECS_RESTBASE
        echo ""
 }
        export ECS_ADAPTER=$ECS_RESTBASE
        echo ""
 }
@@ -1932,7 +2040,8 @@ use_ecs_rest_http() {
 # args: -
 # (Function for test scripts)
 use_ecs_rest_https() {
 # args: -
 # (Function for test scripts)
 use_ecs_rest_https() {
-       echo -e "Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
+       echo -e $BOLD"ECS protocol setting"$EBOLD
+       echo -e " Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
        export ECS_ADAPTER=$ECS_RESTBASE_SECURE
        echo ""
        return 0
        export ECS_ADAPTER=$ECS_RESTBASE_SECURE
        echo ""
        return 0
@@ -1942,7 +2051,9 @@ use_ecs_rest_https() {
 # args: -
 # (Function for test scripts)
 use_ecs_dmaap_http() {
 # args: -
 # (Function for test scripts)
 use_ecs_dmaap_http() {
-       echo -e "Using $BOLD http $EBOLD and $BOLD DMAAP $EBOLD towards ECS"
+       echo -e $BOLD"ECS dmaap protocol setting"$EBOLD
+       echo -e $RED" - NOT SUPPORTED - "$ERED
+       echo -e " Using $BOLD http $EBOLD and $BOLD DMAAP $EBOLD towards ECS"
        export ECS_ADAPTER=$ECS_DMAAPBASE
        echo ""
        return 0
        export ECS_ADAPTER=$ECS_DMAAPBASE
        echo ""
        return 0
@@ -1952,7 +2063,9 @@ use_ecs_dmaap_http() {
 # args: -
 # (Function for test scripts)
 use_ecs_dmaap_https() {
 # args: -
 # (Function for test scripts)
 use_ecs_dmaap_https() {
-       echo -e "Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
+       echo -e $BOLD"RICSIM protocol setting"$EBOLD
+       echo -e $RED" - NOT SUPPORTED - "$ERED
+       echo -e " Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
        export ECS_ADAPTER=$ECS_DMAAPBASE_SECURE
        echo ""
        return 0
        export ECS_ADAPTER=$ECS_DMAAPBASE_SECURE
        echo ""
        return 0
@@ -1962,7 +2075,7 @@ use_ecs_dmaap_https() {
 # args: -
 # (Function for test scripts)
 set_ecs_debug() {
 # args: -
 # (Function for test scripts)
 set_ecs_debug() {
-       echo -e $BOLD"Setting ecs debug"$EBOLD
+       echo -e $BOLD"Setting ecs debug logging"$EBOLD
        curlString="$LOCALHOST$ECS_EXTERNAL_PORT/actuator/loggers/org.oransc.enrichment -X POST  -H Content-Type:application/json -d {\"configuredLevel\":\"debug\"}"
        result=$(__do_curl "$curlString")
        if [ $? -ne 0 ]; then
        curlString="$LOCALHOST$ECS_EXTERNAL_PORT/actuator/loggers/org.oransc.enrichment -X POST  -H Content-Type:application/json -d {\"configuredLevel\":\"debug\"}"
        result=$(__do_curl "$curlString")
        if [ $? -ne 0 ]; then
@@ -1978,7 +2091,7 @@ set_ecs_debug() {
 # args: -
 # (Function for test scripts)
 set_ecs_trace() {
 # args: -
 # (Function for test scripts)
 set_ecs_trace() {
-       echo -e $BOLD"Setting ecs trace"$EBOLD
+       echo -e $BOLD"Setting ecs trace logging"$EBOLD
        curlString="$LOCALHOST$ECS_EXTERNAL_PORT/actuator/loggers/org.oransc.enrichment -X POST  -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
        result=$(__do_curl "$curlString")
        if [ $? -ne 0 ]; then
        curlString="$LOCALHOST$ECS_EXTERNAL_PORT/actuator/loggers/org.oransc.enrichment -X POST  -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
        result=$(__do_curl "$curlString")
        if [ $? -ne 0 ]; then
@@ -2155,7 +2268,6 @@ __do_curl() {
                        echo "<no-response-from-server>"
                        return 1
                else
                        echo "<no-response-from-server>"
                        return 1
                else
-                       echo "X2" >> $HTTPLOG
                        return 0
                fi
        else
                        return 0
                fi
        else
@@ -2193,8 +2305,9 @@ __var_test() {
                        checkjsonarraycount=1
                fi
 
                        checkjsonarraycount=1
                fi
 
-               echo -e $BOLD"TEST(${BASH_LINENO[1]}): ${1}, ${3} ${4} ${5} within ${6} seconds"$EBOLD
+               echo -e $BOLD"TEST $TEST_SEQUENCE_NR (${BASH_LINENO[1]}): ${1}, ${3} ${4} ${5} within ${6} seconds"$EBOLD
                ((RES_TEST++))
                ((RES_TEST++))
+               ((TEST_SEQUENCE_NR++))
                start=$SECONDS
                ctr=0
                for (( ; ; )); do
                start=$SECONDS
                ctr=0
                for (( ; ; )); do
@@ -2254,8 +2367,9 @@ __var_test() {
                        checkjsonarraycount=1
                fi
 
                        checkjsonarraycount=1
                fi
 
-               echo -e $BOLD"TEST(${BASH_LINENO[1]}): ${1}, ${3} ${4} ${5}"$EBOLD
+               echo -e $BOLD"TEST $TEST_SEQUENCE_NR (${BASH_LINENO[1]}): ${1}, ${3} ${4} ${5}"$EBOLD
                ((RES_TEST++))
                ((RES_TEST++))
+               ((TEST_SEQUENCE_NR++))
                if [ $checkjsonarraycount -eq 0 ]; then
                        result="$(__do_curl $2$3)"
                        retcode=$?
                if [ $checkjsonarraycount -eq 0 ]; then
                        result="$(__do_curl $2$3)"
                        retcode=$?
index 8349554..24c9033 100644 (file)
@@ -15,7 +15,9 @@
 #  ============LICENSE_END=================================================
 #
 
 #  ============LICENSE_END=================================================
 #
 
-FROM python:3.8-slim-buster
+ARG NEXUS_PROXY_REPO
+
+FROM ${NEXUS_PROXY_REPO}python:3.8-slim-buster
 
 #install nginx
 RUN apt-get update
 
 #install nginx
 RUN apt-get update
index becace1..b8c4ad1 100644 (file)
@@ -53,10 +53,10 @@ All counters also support the query parameter "id" to fetch counter for one indi
 ### Build and start ###
 
 >Build image<br>
 ### Build and start ###
 
 >Build image<br>
-```docker build -t callback-receiver .```
+```docker build --build-arg NEXUS_PROXY_REPO=nexus3.onap.org:10001/ -t callback-receiver .```
 
 >Start the image on both http and https<br>
 
 >Start the image on both http and https<br>
-```docker run -it -p 8090:8090 -p 8091:8091 callback-receiver```
+```docker run --rm -it -p 8090:8090 -p 8091:8091 callback-receiver```
 
 It will listen to http 8090 port and https 8091 port(using default certificates) at the same time.
 
 
 It will listen to http 8090 port and https 8091 port(using default certificates) at the same time.
 
@@ -69,16 +69,16 @@ file "pass" stores the password when you run the shell script
 This certificates/key can be overriden by mounting a volume when using "docker run" or "docker-compose"
 In 'docker run', use field:
 --volume "$PWD/certificate:/usr/src/app/cert" a1test
 This certificates/key can be overriden by mounting a volume when using "docker run" or "docker-compose"
 In 'docker run', use field:
 --volume "$PWD/certificate:/usr/src/app/cert" a1test
-```docker run -it -p 8090:8090 -p 8091:8091 -v "/PATH_TO_CERT/cert:/usr/src/app/cert" callback-receiver```
+```docker run --rm -it -p 8090:8090 -p 8091:8091 -v "/PATH_TO_CERT/cert:/usr/src/app/cert" callback-receiver```
 In 'docker-compose.yml', use field:
 volumes:
       - ./certificate:/usr/src/app/cert:ro
 
 In 'docker-compose.yml', use field:
 volumes:
       - ./certificate:/usr/src/app/cert:ro
 
-The script ```crstub-build-start.sh``` do the above two steps in one go. This starts the callback-receiver container in stand-alone mode for basic test.<br>If the callback-receiver should be executed manually with the agent, replace docker run with this command to connect to the docker network with the correct service name (--name shall be aligned with the other components, i.e. the host named given in all callback urls).
-```docker run -it -p 8090:8090 -p 8091:8091 --network nonrtric-docker-net --name callback-receiver callback-receiver```
+The script ```cr-build-start.sh``` do the above two steps in one go. This starts the callback-receiver container in stand-alone mode for basic test.<br>If the callback-receiver should be executed manually with the agent, replace docker run with this command to connect to the docker network with the correct service name (--name shall be aligned with the other components, i.e. the host named given in all callback urls).
+```docker run --rm -it -p 8090:8090 -p 8091:8091 --network nonrtric-docker-net --name callback-receiver callback-receiver```
 
 >Start the image on http only<br>
 
 >Start the image on http only<br>
-```docker run -it -p 8090:8090 callback-receiver```
+```docker run --rm -it -p 8090:8090 callback-receiver```
 
 ### Basic test ###
 
 
 ### Basic test ###
 
index fe0fbe4..fa42c20 100644 (file)
 from flask import Flask, request, Response
 from time import sleep
 import time
 from flask import Flask, request, Response
 from time import sleep
 import time
-import datetime
+from datetime import datetime
 import json
 import traceback
 import json
 import traceback
+import logging
+
+# Disable all logging of GET on reading counters and db
+class AjaxFilter(logging.Filter):
+    def filter(self, record):
+        return ("/counter/" not in record.getMessage()) and ("/db" not in record.getMessage())
+
+log = logging.getLogger('werkzeug')
+log.addFilter(AjaxFilter())
 
 app = Flask(__name__)
 
 
 app = Flask(__name__)
 
@@ -47,6 +56,7 @@ MIME_TEXT="text/plain"
 MIME_JSON="application/json"
 CAUGHT_EXCEPTION="Caught exception: "
 SERVER_ERROR="Server error :"
 MIME_JSON="application/json"
 CAUGHT_EXCEPTION="Caught exception: "
 SERVER_ERROR="Server error :"
+TIME_STAMP="cr-timestamp"
 
 #I'm alive function
 @app.route('/',
 
 #I'm alive function
 @app.route('/',
@@ -71,6 +81,7 @@ def receiveresponse(id):
             cntr_callbacks[id][1]+=1
             msg=msg_callbacks[id][0]
             print("Fetching msg for id: "+id+", msg="+str(msg))
             cntr_callbacks[id][1]+=1
             msg=msg_callbacks[id][0]
             print("Fetching msg for id: "+id+", msg="+str(msg))
+            del msg[TIME_STAMP]
             del msg_callbacks[id][0]
             return json.dumps(msg),200
         print("No messages for id: "+id)
             del msg_callbacks[id][0]
             return json.dumps(msg),200
         print("No messages for id: "+id)
@@ -96,6 +107,8 @@ def receiveresponse_all(id):
             cntr_callbacks[id][1]+=len(msg_callbacks[id])
             msg=msg_callbacks[id]
             print("Fetching all msgs for id: "+id+", msg="+str(msg))
             cntr_callbacks[id][1]+=len(msg_callbacks[id])
             msg=msg_callbacks[id]
             print("Fetching all msgs for id: "+id+", msg="+str(msg))
+            for sub_msg in msg:
+                del sub_msg[TIME_STAMP]
             del msg_callbacks[id]
             return json.dumps(msg),200
         print("No messages for id: "+id)
             del msg_callbacks[id]
             return json.dumps(msg),200
         print("No messages for id: "+id)
@@ -132,6 +145,7 @@ def events_write(id):
             traceback.print_exc()
 
         cntr_msg_callbacks += 1
             traceback.print_exc()
 
         cntr_msg_callbacks += 1
+        msg[TIME_STAMP]=str(datetime.now())
         if (id in msg_callbacks.keys()):
             msg_callbacks[id].append(msg)
         else:
         if (id in msg_callbacks.keys()):
             msg_callbacks[id].append(msg)
         else:
@@ -210,10 +224,12 @@ def reset():
     global msg_callbacks
     global cntr_msg_fetched
     global cntr_msg_callbacks
     global msg_callbacks
     global cntr_msg_fetched
     global cntr_msg_callbacks
+    global cntr_callbacks
 
     msg_callbacks={}
     cntr_msg_fetched=0
     cntr_msg_callbacks=0
 
     msg_callbacks={}
     cntr_msg_fetched=0
     cntr_msg_callbacks=0
+    cntr_callbacks={}
 
     return Response('OK', status=200, mimetype=MIME_TEXT)
 
 
     return Response('OK', status=200, mimetype=MIME_TEXT)
 
index 2234679..03e9ed2 100755 (executable)
@@ -19,6 +19,6 @@
 
 #Builds the callback receiver container and starts it in interactive mode
 
 
 #Builds the callback receiver container and starts it in interactive mode
 
-docker build -t callback-receiver .
+docker build --build-arg NEXUS_PROXY_REPO=nexus3.onap.org:10001/ -t callback-receiver .
 
 
-docker run --rm -it -p 8090:8090 -p 8091:8091 callback-receiver
+docker run --rm -it -p 8090:8090 -p 8091:8091 --name cr callback-receiver
index e7940a2..d2a3fba 100644 (file)
@@ -1,3 +1,4 @@
+tmp
 .tmp.json
 .dockererr
 nginx_wsgi_flask/__init__.py
 .tmp.json
 .dockererr
 nginx_wsgi_flask/__init__.py
index 513894c..5219e74 100644 (file)
@@ -15,7 +15,9 @@
 #  ============LICENSE_END=================================================
 #
 
 #  ============LICENSE_END=================================================
 #
 
-FROM python:3.8-slim-buster
+ARG NEXUS_PROXY_REPO
+
+FROM ${NEXUS_PROXY_REPO}python:3.8-slim-buster
 
 COPY app/ /usr/src/app/
 COPY cert/ /usr/src/app/cert/
 
 COPY app/ /usr/src/app/
 COPY cert/ /usr/src/app/cert/
index e8e8edf..4365d76 100644 (file)
@@ -59,10 +59,10 @@ There are a number of counters that can be read to monitor the message processin
 ### Build and start ###
 
 >Build image<br>
 ### Build and start ###
 
 >Build image<br>
-```docker build -t mrstub .```
+```docker build --build-arg NEXUS_PROXY_REPO=nexus3.onap.org:10001/ -t mrstub .```
 
 >Start the image on http only<br>
 
 >Start the image on http only<br>
-```docker run -it -p 3905:3905 mrstub```
+```docker run --rm -it -p 3905:3905 mrstub```
 
 >Start the image on http and https<br>
 By default, this image has default certificates under /usr/src/app/cert
 
 >Start the image on http and https<br>
 By default, this image has default certificates under /usr/src/app/cert
@@ -72,20 +72,20 @@ file "generate_cert_and_key.sh" is a shell script to generate certificate and ke
 file "pass" stores the password when you run the shell script
 
 Start the a1-interface container without specifing external certificates:
 file "pass" stores the password when you run the shell script
 
 Start the a1-interface container without specifing external certificates:
-```docker run -it -p 3905:3905 -p 3906:3906 mrstub```
+```docker run --rm -it -p 3905:3905 -p 3906:3906 mrstub```
 
 It will listen to http 3905 port and https 3906 port(using default certificates) at the same time.
 
 This certificates/key can be overriden by mounting a volume when using "docker run" or "docker-compose"
 In 'docker run', use field:
 --volume "$PWD/certificate:/usr/src/app/cert" a1test
 
 It will listen to http 3905 port and https 3906 port(using default certificates) at the same time.
 
 This certificates/key can be overriden by mounting a volume when using "docker run" or "docker-compose"
 In 'docker run', use field:
 --volume "$PWD/certificate:/usr/src/app/cert" a1test
-```docker run -it -p 3905:3905 -p 3906:3906 -v "/PATH_TO_CERT/cert:/usr/src/app/cert" mrstub```
+```docker run --rm -it -p 3905:3905 -p 3906:3906 -v "/PATH_TO_CERT/cert:/usr/src/app/cert" mrstub```
 In 'docker-compose.yml', use field:
 volumes:
       - ./certificate:/usr/src/app/cert:ro
 
 The script ```mrstub-build-start.sh``` do the build and docker run in one go. This starts the stub container in stand-alone mode for basic test.<br>If the mrstub should be executed manually with the agent, replace docker run with this command to connect to the docker network with the correct service name (--name shall be the same as configured in consul for the read and write streams).
 In 'docker-compose.yml', use field:
 volumes:
       - ./certificate:/usr/src/app/cert:ro
 
 The script ```mrstub-build-start.sh``` do the build and docker run in one go. This starts the stub container in stand-alone mode for basic test.<br>If the mrstub should be executed manually with the agent, replace docker run with this command to connect to the docker network with the correct service name (--name shall be the same as configured in consul for the read and write streams).
-```docker run -it -p 3905:3905 --network nonrtric-docker-net --name message-router mrstub```
+```docker run --rm -it -p 3905:3905 --network nonrtric-docker-net --name message-router mrstub```
 
 
 ### Basic test ###
 
 
 ### Basic test ###
index 8804a04..75b23f1 100644 (file)
@@ -25,6 +25,15 @@ from flask import Flask
 from flask import Response
 import traceback
 from threading import RLock
 from flask import Response
 import traceback
 from threading import RLock
+import logging
+
+# Disable all logging of GET on reading counters
+class AjaxFilter(logging.Filter):
+    def filter(self, record):
+        return ("/counter/" not in record.getMessage())
+
+log = logging.getLogger('werkzeug')
+log.addFilter(AjaxFilter())
 
 app = Flask(__name__)
 lock = RLock()
 
 app = Flask(__name__)
 lock = RLock()
index 3e43116..8ad1d16 100755 (executable)
@@ -19,6 +19,6 @@
 
 #Builds the mrstub container and starts it in interactive mode
 
 
 #Builds the mrstub container and starts it in interactive mode
 
-docker build -t mrstub .
+docker build --build-arg NEXUS_PROXY_REPO=nexus3.onap.org:10001/  -t mrstub .
 
 
-docker run -it -p 3905:3905 -p 3906:3906 -v "$PWD/cert:/usr/src/app/cert" mrstub
+docker run --rm -it -p 3905:3905 -p 3906:3906 -v "$PWD/cert:/usr/src/app/cert" mrstub
index bdc3521..4768bf9 100644 (file)
@@ -15,7 +15,9 @@
 #  ============LICENSE_END=================================================
 #
 
 #  ============LICENSE_END=================================================
 #
 
-FROM python:3.8-slim-buster
+ARG NEXUS_PROXY_REPO
+
+FROM ${NEXUS_PROXY_REPO}python:3.8-slim-buster
 
 COPY app/ /usr/src/app/
 COPY cert/ /usr/src/app/cert/
 
 COPY app/ /usr/src/app/
 COPY cert/ /usr/src/app/cert/
index aa23b78..2fe2d59 100644 (file)
 ## producer stub - a stub interface to simulate data producers ##
 
 ## producer stub - a stub interface to simulate data producers ##
 
-The producer stub is intended for function tests to simulate data producers.
+The producer stub is intended for function tests of simulate data producers.
+The simulator handles the callbacks for supervision of producers as well as create/update and delete jobs.
+As an intial step, the indended job and producers, with supported types, are setup (armed) in the simulator.
+In addition, specific response codes can configured for each callback request.
 
 
 # Ports and certificates
 
 
 # Ports and certificates
-TBD
+The prodstub normally opens the port 8092 for http. If a certificate and a key are provided the simulator will also open port 8093 for https.
+The certificate and key shall be placed in the same dir and the dir shall be mounted to /usr/src/app/cert in the container.
 
 | Port     | Protocol |
 | -------- | ----- |
 | 8092     | http  |
 | 8093     | https |
 
 
 | Port     | Protocol |
 | -------- | ----- |
 | 8092     | http  |
 | 8093     | https |
 
+The dir cert contains a self-signed cert. Use the script generate_cert_and_key.sh to generate a new certificate and key. The password of the certificate must be set 'test'.
+The same urls are availables on both the http port 8092 and the https port 8093. If using curl and https, the flag -k shall be given to make curl ignore checking the certificate.
+
+
+### Prodstub interface ###
+
+>Create callback<br>
+This method receives a callback for create job. The request shall contain a job json. The request is checked towards what has been setup (armed) and the response will be set accordingly. <br>
+```URI and payload, (POST): /callbacks/job/<producer_id>,  <job-json>```<br>
+```response: 200/201 (or configured response) or 400 for other errors```
+
+>Delete callback<br>
+This method receives a callback for delete job. The request is checked towards what has been setup (armed) and the response will be set accordingly. <br>
+```URI and payload, (DELETE): /callbacks/job/<producer_id>```<br>
+```response: 204 (or configured response) or 400 for other errors```
+
+>Supervision callback<br>
+This method receives a callback for producer supervision. The request is checked towards what has been setup (armed) and the response will be set accordingly. <br>
+```URI and payload, (GET): /callbacks/supervision/<producer_id>```<br>
+```response: 200 (or configured response) or 400 for other errors```
 
 
 ### Control interface ###
 
 
 
 ### Control interface ###
 
-TBD
+The control interface can be used by any test script.
+The following REST operations are available:
+
+>Arm a job create<br>
+This method arms a job for creation and sets an optional response code for create/update<br>
+```URI and payload, (PUT): /arm/create/<producer_id>/<job_id>[?response=<resonsecode>]```<br>
+```response: 200 or 400 for other errors```
+
+>Arm a job delete<br>
+This method arms a job for deletion and sets an optional response code for delete<br>
+```URI and payload, (PUT): /arm/delete/<producer_id>/<job_id>[?response=<resonsecode>]```<br>
+```response: 200 or 400 for other errors```
+
+>Arm a producer supervision<br>
+This method arms a supervision and sets an optional response code for supervision calls<br>
+```URI and payload, (PUT): /arm/delete/<producer_id>[?response=<resonsecode>]```<br>
+```response: 200 or 400 for other errors```
+
+>Arm a type for a producer<br>
+This method arms a type for a producer<br>
+```URI and payload, (PUT): /arm/type/<producer_id>/<ype-id>```<br>
+```response: 200 or 400 for other errors```
+
+>Disarm a type for a producer<br>
+This method disarms a type for a producer<br>
+```URI and payload, (DELETE): /arm/type/<producer_id>/<ype-id>```<br>
+```response: 200 or 400 for other errors```
+
+>Get job data parameters<br>
+This method fetches the job data parameters of a job<br>
+```URI and payload, (GET): /jobdata/<producer_id>job_id>```<br>
+```response: 200 or 400 for other errors```
+
+>Remove job data parameters<br>
+This method removes the job data parameters from a job<br>
+```URI and payload, (DELETE): /jobdata/<producer_id>job_id>```<br>
+```response: 200 or 400 for other errors```
+
+>Start/stop job data delivery<br>
+This method start (or stops) delivering job data to the configured target url. Action is either 'start' or s'stop'<br>
+```URI and payload, (POST): /jobdata/<producer_id>job_id>?action=action```<br>
+```response: 200 or 400 for other errors```
+
+>Counter for create job<br>
+This method returns the number of create/update calls to a job<br>
+```URI and payload, (GET): /counter/create/producer_id>/<job_id>```<br>
+```response: <integer> 200 or 400 for other errors```
+
+>Counter for delete job<br>
+This method returns the number of delete calls to a job<br>
+```URI and payload, (GET): /counter/delete/producer_id>/<job_id>```<br>
+```response: <integer> 200 or 400 for other errors```
+
+>Counter for producer supervision<br>
+This method returns the number of supervision calls to a producer<br>
+```URI and payload, (GET): /counter/supervision/producer_id>```<br>
+```response: <integer> 200 or 400 for other errors```
+
+>Get internal db<br>
+This method dumps the internal db of producer and jobs as a json file<br>
+```URI and payload, (GET): /status```<br>
+```response: <json> 200 or 400 for other errors```
+
+>Reset<br>
+This method makes a full reset by removing all producers and jobs<br>
+```URI and payload, (GET or PUT or POST): /reset```<br>
+```response: <json> 200 or 400 for other errors```
 
 
 ### Build and start ###
 
 >Build image<br>
 
 
 ### Build and start ###
 
 >Build image<br>
-```docker build -t producer-stub .```
+```docker build --build-arg NEXUS_PROXY_REPO=nexus3.onap.org:10001/ -t producer-stub .```
 
 >Start the image on both http and https<br>
 
 >Start the image on both http and https<br>
-```docker run -it -p 8092:8092 -p 8093:8093 --name producer-stub producer-stub```
+```docker run --rm -it -p 8092:8092 -p 8093:8093 --name producer-stub producer-stub```
+
+It will listen to http 8092 port and https 8093 port(using default certificates) at the same time.
+
+>Start the image on http and https<br>
+By default, this image has default certificates under /usr/src/app/cert
+file "cert.crt" is the certificate file
+file "key.crt" is the key file
+file "generate_cert_and_key.sh" is a shell script to generate certificate and key
+file "pass" stores the password when you run the shell script
+
+Start the container without specifing external certificates:
+```docker run --rm -it --p 8092:8092 -p 8093:8093 producer-stub```
 
 It will listen to http 8092 port and https 8093 port(using default certificates) at the same time.
 
 
 It will listen to http 8092 port and https 8093 port(using default certificates) at the same time.
 
-TBD
+This certificates/key can be overriden by mounting a volume when using "docker run" or "docker-compose"
+In 'docker run', use field:
+--volume "$PWD/certificate:/usr/src/app/cert" a1test
+```docker run --rm -it --p 8092:8092 -p 8093:8093 -v "/PATH_TO_CERT/cert:/usr/src/app/cert" producer-stub```
+In 'docker-compose.yml', use field:
+volumes:
+      - ./certificate:/usr/src/app/cert:ro
+
+The script ```prodstub-build-start.sh``` do the build and docker run in one go. This starts the stub container in stand-alone mode for basic test.<br>If the producer-stub should be executed manually with the agent, replace docker run with this command to connect to the docker network with the correct service name (--name shall be the same as configured in consul for the read and write streams).
+```docker run --rm -it -p 8092:8092 -p 8093:8093 --name producer-stub producer-stub```
+
+
+### Basic test ###
+
+Basic test is made with the script ```basic_test.sh nonsecure|secure``` which tests all the available urls with a subset of the possible operations. Choose nonsecure for http and secure for https. Use the script ```prodstub-build-start.sh``` to start the producer-stub in a container first.
+
+
+
 
 ## License
 
 
 ## License
 
index 7323d3a..ea8b914 100644 (file)
@@ -27,6 +27,15 @@ from jsonschema import validate
 import threading
 import time
 import datetime
 import threading
 import time
 import datetime
+import logging
+
+# Disable all logging of GET on reading counters and status
+class AjaxFilter(logging.Filter):
+    def filter(self, record):
+        return ("/counter/" not in record.getMessage()) and ("/status" not in record.getMessage())
+
+log = logging.getLogger('werkzeug')
+log.addFilter(AjaxFilter())
 
 app = Flask(__name__)
 
 
 app = Flask(__name__)
 
@@ -37,13 +46,9 @@ app = Flask(__name__)
 HOST_IP = "::"
 HOST_PORT = 2222
 
 HOST_IP = "::"
 HOST_PORT = 2222
 
-# # Metrics vars
-# cntr_msg_callbacks=0
-# cntr_msg_fetched=0
-
 # Request and response constants
 # Request and response constants
-CALLBACK_CREATE_URL="/callbacks/create/<string:producer_id>"
-CALLBACK_DELETE_URL="/callbacks/delete/<string:producer_id>"
+CALLBACK_CREATE_URL="/callbacks/job/<string:producer_id>"
+CALLBACK_DELETE_URL="/callbacks/job/<string:producer_id>/<string:job_id>"
 CALLBACK_SUPERVISION_URL="/callbacks/supervision/<string:producer_id>"
 
 ARM_CREATE_RESPONSE="/arm/create/<string:producer_id>/<string:job_id>"
 CALLBACK_SUPERVISION_URL="/callbacks/supervision/<string:producer_id>"
 
 ARM_CREATE_RESPONSE="/arm/create/<string:producer_id>/<string:job_id>"
@@ -84,6 +89,12 @@ db={}
 #    armed response for delete
 #    create counter
 #    delete counter
 #    armed response for delete
 #    create counter
 #    delete counter
+#    delivering status
+
+# disable warning about unverified https requests
+from requests.packages import urllib3
+
+urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
 
 # Helper function to populate a callback dict with the basic structure
 # if job_id is None then only the producer level is setup and the producer dict is returned
 
 # Helper function to populate a callback dict with the basic structure
 # if job_id is None then only the producer level is setup and the producer dict is returned
@@ -117,7 +128,7 @@ def setup_callback_dict(producer_id, job_id):
         job_dict['json']=None
         job_dict['create_counter']=0
         job_dict['delete_counter']=0
         job_dict['json']=None
         job_dict['create_counter']=0
         job_dict['delete_counter']=0
-        job_dict['delivering']=False
+        job_dict['delivering']="stopped"
         job_dict['delivery_attempts']=0
     return job_dict
 
         job_dict['delivery_attempts']=0
     return job_dict
 
@@ -309,7 +320,7 @@ def disarm_type(producer_id, type_id):
 
 
 # Callback for create job
 
 
 # Callback for create job
-# URI and parameters (POST): /callbacks/create/<producer_id>
+# URI and parameters (POST): /callbacks/job/<producer_id>
 # response 201 at create, 200 at update or other configured response code
 @app.route(CALLBACK_CREATE_URL,
      methods=['POST'])
 # response 201 at create, 200 at update or other configured response code
 @app.route(CALLBACK_CREATE_URL,
      methods=['POST'])
@@ -343,12 +354,14 @@ def callback_create(producer_id):
         return_code=job_dict['create_response']
         if ((job_dict['create_response'] == 200) or (job_dict['create_response'] == 201)):
             job_dict['json']=req_json_dict
         return_code=job_dict['create_response']
         if ((job_dict['create_response'] == 200) or (job_dict['create_response'] == 201)):
             job_dict['json']=req_json_dict
-            job_dict['delivering']=True
+            job_dict['delivering']="delivering"
             if (job_dict['create_response'] == 201): #Set up next response code if create was ok
                 job_dict['create_response'] = 200
             if (job_dict['delete_response'] == 404):
                 job_dict['delete_response'] = 204
         else:
             if (job_dict['create_response'] == 201): #Set up next response code if create was ok
                 job_dict['create_response'] = 200
             if (job_dict['delete_response'] == 404):
                 job_dict['delete_response'] = 204
         else:
+            if(job_dict['delivering'] == "delivering"):
+                job_dict['delivering']="hold"
             return_msg=RETURNING_CONFIGURED_RESP
 
         job_dict['create_counter']=job_dict['create_counter']+1
             return_msg=RETURNING_CONFIGURED_RESP
 
         job_dict['create_counter']=job_dict['create_counter']+1
@@ -358,42 +371,29 @@ def callback_create(producer_id):
     return return_msg, return_code
 
 # Callback for delete job
     return return_msg, return_code
 
 # Callback for delete job
-# URI and parameters (POST): /callbacks/delete/<producer_id>
+# URI and parameters (DELETE): /callbacks/job/<producer_id>/<job_id>
 # response: 204 at delete or other configured response code
 @app.route(CALLBACK_DELETE_URL,
 # response: 204 at delete or other configured response code
 @app.route(CALLBACK_DELETE_URL,
-     methods=['POST'])
-def callback_delete(producer_id):
+     methods=['DELETE'])
+def callback_delete(producer_id, job_id):
 
 
-    req_json_dict=None
-    try:
-        req_json_dict = json.loads(request.data)
-        with open('job-schema.json') as f:
-            schema = json.load(f)
-            validate(instance=req_json_dict, schema=schema)
-    except Exception:
-        return JSON_CORRUPT,400
-
-    job_id=req_json_dict['ei_job_identity']
     job_dict=get_callback_dict(producer_id, job_id)
     if (job_dict is None):
         return PRODUCER_OR_JOB_NOT_FOUND,400
     return_code=0
     return_msg=""
     job_dict=get_callback_dict(producer_id, job_id)
     if (job_dict is None):
         return PRODUCER_OR_JOB_NOT_FOUND,400
     return_code=0
     return_msg=""
-    if (req_json_dict['ei_job_identity'] == job_id):
-        print("Delete callback received for producer: "+str(producer_id)+" and job: "+str(job_id))
-        return_code=job_dict['delete_response']
-        if (job_dict['delete_response'] == 204):
-            job_dict['json']=None
-            job_dict['delete_response']=404
-            job_dict['delivering']=False
-            if (job_dict['create_response'] == 200):
-                job_dict['create_response'] = 201 # reset create response if delete was ok
-        else:
-            return_msg=RETURNING_CONFIGURED_RESP
-
-        job_dict['delete_counter']=job_dict['delete_counter']+1
+    print("Delete callback received for producer: "+str(producer_id)+" and job: "+str(job_id))
+    return_code=job_dict['delete_response']
+    if (job_dict['delete_response'] == 204):
+        job_dict['json']=None
+        job_dict['delete_response']=404
+        job_dict['delivering']="stopped"
+        if (job_dict['create_response'] == 200):
+            job_dict['create_response'] = 201 # reset create response if delete was ok
     else:
     else:
-        return JOBID_NO_MATCH, 400
+        return_msg=RETURNING_CONFIGURED_RESP
+
+    job_dict['delete_counter']=job_dict['delete_counter']+1
 
     return return_msg, return_code
 
 
     return return_msg, return_code
 
@@ -437,6 +437,25 @@ def get_jobdata(producer_id, job_id):
     else:
         return json.dumps(job_dict['json']), 200
 
     else:
         return json.dumps(job_dict['json']), 200
 
+# Delete the job definition for a job
+# URI and parameters (DELETE): "/jobdata/<string:producer_id>/<string:job_id>"
+# response: 204
+@app.route(JOB_DATA,
+     methods=['DELETE'])
+def del_jobdata(producer_id, job_id):
+
+    print("Delete job data received for producer: "+str(producer_id)+" and job: "+str(job_id))
+
+    job_dict=get_callback_dict(producer_id, job_id)
+
+    if (job_dict is None):
+        return PRODUCER_OR_JOB_NOT_FOUND,400
+
+    job_dict['json']=None
+
+    return "",204
+
+
 # Start data delivery for a job, action : START or STOP
 # URI and parameters (POST): "/jobdata/<string:producer_id>/<string:job_id>?action=action"
 # response: 200 or 204
 # Start data delivery for a job, action : START or STOP
 # URI and parameters (POST): "/jobdata/<string:producer_id>/<string:job_id>?action=action"
 # response: 200 or 204
@@ -465,9 +484,9 @@ def start_jobdata(producer_id, job_id):
         return JOB_DATA_NOT_FOUND, 400
     else:
         if (action == "START"):
         return JOB_DATA_NOT_FOUND, 400
     else:
         if (action == "START"):
-            job_dict['delivering']=True
+            job_dict['delivering']="delivering"
         else:
         else:
-            job_dict['delivering']=False
+            job_dict['delivering']="stopped"
         return "",200
 
 
         return "",200
 
 
@@ -529,18 +548,18 @@ def datadelivery() :
             job_dicts=get_all_jobs()
             for key in job_dicts:
                 job=job_dicts[key]
             job_dicts=get_all_jobs()
             for key in job_dicts:
                 job=job_dicts[key]
-                if (job['delivering'] == True and job['json'] != None):
+                if (job['delivering'] == "delivering" and job['json'] != None):
                     url=job['json']['target_uri']
                     url=job['json']['target_uri']
-
-                    data={}
-                    data["date"]=str(datetime.datetime.now())
-                    data["job"]=""+key
-                    data["sequence_no"]=""+str(job['delivery_attempts'])
-                    data["value"]=str(100)
-                    print("Sending to "+url+" payload:"+json.dumps(data))
-
-                    requests.post(url, json=data, verify=False, timeout=2) #NOSONAR
-                    job['delivery_attempts'] += 1
+                    if (str(url).find("localhost:") == -1):   #Dont deliver to localhost...
+                        data={}
+                        data["date"]=str(datetime.datetime.now())
+                        data["job"]=""+key
+                        data["sequence_no"]=""+str(job['delivery_attempts'])
+                        data["value"]=str(100)
+                        print("Sending to "+url+" payload:"+json.dumps(data))
+
+                        requests.post(url, json=data, verify=False, timeout=2) #NOSONAR
+                        job['delivery_attempts'] += 1
         except Exception as err:
             print("Error during data delivery: "+ str(err))
         time.sleep(1)
         except Exception as err:
             print("Error during data delivery: "+ str(err))
         time.sleep(1)
index a17c804..18b7735 100755 (executable)
@@ -157,7 +157,7 @@ do_curl PUT /arm/create/prod-x/job-y?response=405 200
 ## check the db
 
 echo "=== status ==="
 ## check the db
 
 echo "=== status ==="
-RESULT="json:{\"prod-x\": {\"supervision_response\": 400, \"supervision_counter\": 2, \"types\": [\"10\", \"15\"], \"job-y\": {\"create_response\": 405, \"delete_response\": 404, \"json\": null, \"create_counter\": 0, \"delete_counter\": 0, \"delivering\": false, \"delivery_attempts\": 0}}}"
+RESULT="json:{\"prod-x\": {\"supervision_response\": 400, \"supervision_counter\": 2, \"types\": [\"10\", \"15\"], \"job-y\": {\"create_response\": 405, \"delete_response\": 404, \"json\": null, \"create_counter\": 0, \"delete_counter\": 0, \"delivering\": \"stopped\", \"delivery_attempts\": 0}}}"
 do_curl GET /status 200
 
 ## add delete response for job
 do_curl GET /status 200
 
 ## add delete response for job
@@ -169,7 +169,7 @@ do_curl PUT /arm/delete/prod-x/job-y?response=407 200
 ## check the db
 
 echo "=== status ==="
 ## check the db
 
 echo "=== status ==="
-RESULT="json:{\"prod-x\": {\"supervision_response\": 400, \"supervision_counter\": 2, \"types\": [\"10\", \"15\"], \"job-y\": {\"create_response\": 405, \"delete_response\": 407, \"json\": null, \"create_counter\": 0, \"delete_counter\": 0, \"delivering\": false, \"delivery_attempts\": 0}}}"
+RESULT="json:{\"prod-x\": {\"supervision_response\": 400, \"supervision_counter\": 2, \"types\": [\"10\", \"15\"], \"job-y\": {\"create_response\": 405, \"delete_response\": 407, \"json\": null, \"create_counter\": 0, \"delete_counter\": 0, \"delivering\": \"stopped\", \"delivery_attempts\": 0}}}"
 do_curl GET /status 200
 
 ## Get jobdata
 do_curl GET /status 200
 
 ## Get jobdata
@@ -188,12 +188,12 @@ do_curl PUT /arm/delete/prod-x/job-1 200
 echo "===  callback create job ==="
 RESULT=""
 echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
 echo "===  callback create job ==="
 RESULT=""
 echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
-do_curl POST /callbacks/create/prod-x 201 .p.json
+do_curl POST /callbacks/job/prod-x 201 .p.json
 
 echo "===  callback create job -update ==="
 RESULT=""
 echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
 
 echo "===  callback create job -update ==="
 RESULT=""
 echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
-do_curl POST /callbacks/create/prod-x 200 .p.json
+do_curl POST /callbacks/job/prod-x 200 .p.json
 
 ## Get jobdata
 echo "=== job data ==="
 
 ## Get jobdata
 echo "=== job data ==="
@@ -203,7 +203,7 @@ do_curl GET /jobdata/prod-x/job-1 200
 ## check the db
 
 echo "=== status ==="
 ## check the db
 
 echo "=== status ==="
-RESULT="json:{\"prod-x\": {\"supervision_response\": 400, \"supervision_counter\": 2, \"types\": [\"10\", \"15\"], \"job-y\": {\"create_response\": 405, \"delete_response\": 407, \"json\": null, \"create_counter\": 0, \"delete_counter\": 0, \"delivering\": false, \"delivery_attempts\": 0}, \"job-1\": {\"create_response\": 200, \"delete_response\": 204, \"json\": {\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\", \"ei_type_identity\": \"10\"}, \"create_counter\": 2, \"delete_counter\": 0, \"delivering\": false, \"delivery_attempts\": 0}}}"
+RESULT="json:{\"prod-x\": {\"supervision_response\": 400, \"supervision_counter\": 2, \"types\": [\"10\", \"15\"], \"job-y\": {\"create_response\": 405, \"delete_response\": 407, \"json\": null, \"create_counter\": 0, \"delete_counter\": 0, \"delivering\": \"stopped\", \"delivery_attempts\": 0}, \"job-1\": {\"create_response\": 200, \"delete_response\": 204, \"json\": {\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\", \"ei_type_identity\": \"10\"}, \"create_counter\": 2, \"delete_counter\": 0, \"delivering\": \"delivering\", \"delivery_attempts\": 0}}}"
 do_curl GET /status 200
 
 # create and delete job tests
 do_curl GET /status 200
 
 # create and delete job tests
@@ -214,7 +214,7 @@ do_curl PUT /arm/create/prod-x/job-1?response=404 200
 echo "===  callback create job -update ==="
 RESULT="returning configured response code"
 echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
 echo "===  callback create job -update ==="
 RESULT="returning configured response code"
 echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
-do_curl POST /callbacks/create/prod-x 404 .p.json
+do_curl POST /callbacks/job/prod-x 404 .p.json
 
 echo "===  set job delete response ==="
 RESULT=""
 
 echo "===  set job delete response ==="
 RESULT=""
@@ -223,7 +223,7 @@ do_curl PUT /arm/delete/prod-x/job-1?response=404 200
 echo "===  callback delete job==="
 RESULT="returning configured response code"
 echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
 echo "===  callback delete job==="
 RESULT="returning configured response code"
 echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
-do_curl POST /callbacks/delete/prod-x 404 .p.json
+do_curl DELETE /callbacks/job/prod-x/job-1 404 .p.json
 
 echo "===  set job delete response ==="
 RESULT=""
 
 echo "===  set job delete response ==="
 RESULT=""
@@ -232,12 +232,12 @@ do_curl PUT /arm/delete/prod-x/job-1 200
 echo "===  callback delete job==="
 RESULT=""
 echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
 echo "===  callback delete job==="
 RESULT=""
 echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
-do_curl POST /callbacks/delete/prod-x 204 .p.json
+do_curl DELETE /callbacks/job/prod-x/job-1 204 .p.json
 
 ## check the db
 
 echo "=== status ==="
 
 ## check the db
 
 echo "=== status ==="
-RESULT="json:{\"prod-x\": {\"supervision_response\": 400, \"supervision_counter\": 2, \"types\": [\"10\", \"15\"], \"job-y\": {\"create_response\": 405, \"delete_response\": 407, \"json\": null, \"create_counter\": 0, \"delete_counter\": 0, \"delivering\": false, \"delivery_attempts\": 0}, \"job-1\": {\"create_response\": 404, \"delete_response\": 404, \"json\": null, \"create_counter\": 3, \"delete_counter\": 2, \"delivering\": false, \"delivery_attempts\": 0}}}"
+RESULT="json:{\"prod-x\": {\"supervision_response\": 400, \"supervision_counter\": 2, \"types\": [\"10\", \"15\"], \"job-y\": {\"create_response\": 405, \"delete_response\": 407, \"json\": null, \"create_counter\": 0, \"delete_counter\": 0, \"delivering\": \"stopped\", \"delivery_attempts\": 0}, \"job-1\": {\"create_response\": 404, \"delete_response\": 404, \"json\": null, \"create_counter\": 3, \"delete_counter\": 2, \"delivering\": \"stopped\", \"delivery_attempts\": 0}}}"
 do_curl GET /status 200
 
 
 do_curl GET /status 200
 
 
@@ -250,7 +250,7 @@ do_curl PUT /arm/create/prod-x/job-1 200
 echo "===  callback create job ==="
 RESULT=""
 echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
 echo "===  callback create job ==="
 RESULT=""
 echo "{\"ei_job_identity\": \"job-1\", \"ei_job_data\": {}, \"target_uri\": \"http://localhost:80\",\"ei_type_identity\": \"10\"}" > .p.json
-do_curl POST /callbacks/create/prod-x 201 .p.json
+do_curl POST /callbacks/job/prod-x 201 .p.json
 
 echo "=== data delivery start ==="
 RESULT="job not found"
 
 echo "=== data delivery start ==="
 RESULT="job not found"
index b16e613..89cc967 100755 (executable)
@@ -22,8 +22,6 @@
 NAME="producer-stub-test"
 IMAGE_NAME="producer-stub-test-image"
 
 NAME="producer-stub-test"
 IMAGE_NAME="producer-stub-test-image"
 
-docker build -t $IMAGE_NAME .
+docker build --build-arg NEXUS_PROXY_REPO=nexus3.onap.org:10001/ -t $IMAGE_NAME .
 
 
-docker stop $NAME
-docker rm -f $NAME
-docker run -it -p 8992:8092 -p 8993:8093 --name $NAME $IMAGE_NAME
+docker run --rm -it -p 8992:8092 -p 8993:8093 --name $NAME $IMAGE_NAME
index 11cf810..824156e 100644 (file)
@@ -26,6 +26,8 @@ services:
       default:
         aliases:
           - ${ECS_APP_NAME_ALIAS}
       default:
         aliases:
           - ${ECS_APP_NAME_ALIAS}
+    volumes:
+    - ${ECS_HOST_MNT_DIR}:${ECS_CONTAINER_MNT_DIR}
     ports:
     - ${ECS_EXTERNAL_PORT}:${ECS_INTERNAL_PORT}
     - ${ECS_EXTERNAL_SECURE_PORT}:${ECS_INTERNAL_SECURE_PORT}
     ports:
     - ${ECS_EXTERNAL_PORT}:${ECS_INTERNAL_PORT}
     - ${ECS_EXTERNAL_SECURE_PORT}:${ECS_INTERNAL_SECURE_PORT}
diff --git a/test/simulator-group/ecs/mnt/.gitignore b/test/simulator-group/ecs/mnt/.gitignore
new file mode 100644 (file)
index 0000000..aa0d57e
--- /dev/null
@@ -0,0 +1 @@
+database
index 7d7ffdf..7a22026 100644 (file)
@@ -69,7 +69,7 @@ function getSimCtr(url, index, cb) {
     } catch(err) {
         cb("no response", index);
     }
     } catch(err) {
         cb("no response", index);
     }
-};
+}
 
 
 //Format a comma separated list of data to a html-safe string with fixed fieldsizes
 
 
 //Format a comma separated list of data to a html-safe string with fixed fieldsizes
@@ -121,9 +121,9 @@ function formatIdRowCompact(commaList) {
 }
 
 //Pad a string upto a certain size using a pad string
 }
 
 //Pad a string upto a certain size using a pad string
-function padding(val, fieldSize, pad) {
+function padding(val, size, pad) {
        var s=""+val;
        var s=""+val;
-       for(var i=s.length;i<fieldSize;i++) {
+       for(var i=s.length;i<size;i++) {
                s=s+pad
        }
        return s;
                s=s+pad
        }
        return s;
@@ -191,6 +191,8 @@ var ecs_producer_arr=new Array(0)
 var ecs_producer_type_arr=new Array(0)
 var ecs_producer_jobs_arr=new Array(0)
 var ecs_producer_status_arr=new Array(0)
 var ecs_producer_type_arr=new Array(0)
 var ecs_producer_jobs_arr=new Array(0)
 var ecs_producer_status_arr=new Array(0)
+var ecs_jobs=new Array(0)
+var ecs_job_status=new Array(0)
 
 //Status variables, for parameters values fetched from prodstub
 var ps2="", ps3="", ps4="", ps_types="-", ps_producers="-";
 
 //Status variables, for parameters values fetched from prodstub
 var ps2="", ps3="", ps4="", ps_types="-", ps_producers="-";
@@ -235,7 +237,7 @@ function fetchAllMetrics_pol() {
                 var sims=simulators.split(" ")
                 simnames=[]
                 simports=[]
                 var sims=simulators.split(" ")
                 simnames=[]
                 simports=[]
-                for(i=0;i<sims.length;i=i+2) {
+                for(var i=0;i<sims.length;i=i+2) {
                     simnames[i/2]=sims[i]
                     simports[i/2]=sims[i+1]
                 }
                     simnames[i/2]=sims[i]
                     simports[i/2]=sims[i+1]
                 }
@@ -247,80 +249,80 @@ function fetchAllMetrics_pol() {
         for(var index=0;index<simnames.length;index++) {
 
             if (checkFunctionFlag("simvar1_"+index)) {
         for(var index=0;index<simnames.length;index++) {
 
             if (checkFunctionFlag("simvar1_"+index)) {
-                getSimCtr(LOCALHOST+simports[index]+"/counter/num_instances", index, function(data, index) {
-                    simvar1[index] = data;
-                    clearFlag("simvar1_"+index)
+                getSimCtr(LOCALHOST+simports[index]+"/counter/num_instances", index, function(data, idx) {
+                    simvar1[idx] = data;
+                    clearFlag("simvar1_"+idx)
                 });
             }
             if (checkFunctionFlag("simvar2_"+index)) {
                 });
             }
             if (checkFunctionFlag("simvar2_"+index)) {
-                getSimCtr(LOCALHOST+simports[index]+"/counter/num_types", index, function(data,index) {
-                    simvar2[index] = data;
-                    clearFlag("simvar2_"+index)
+                getSimCtr(LOCALHOST+simports[index]+"/counter/num_types", index, function(data,idx) {
+                    simvar2[idx] = data;
+                    clearFlag("simvar2_"+idx)
                 });
             }
             if (checkFunctionFlag("simvar3_"+index)) {
                 });
             }
             if (checkFunctionFlag("simvar3_"+index)) {
-                getSimCtr(LOCALHOST+simports[index]+"/policytypes", index, function(data,index) {
+                getSimCtr(LOCALHOST+simports[index]+"/policytypes", index, function(data,idx) {
                     data=data.replace(/\[/g,'');
                     data=data.replace(/\]/g,'');
                     data=data.replace(/ /g,'');
                     data=data.replace(/\"/g,'');
                     data=data.replace(/\[/g,'');
                     data=data.replace(/\]/g,'');
                     data=data.replace(/ /g,'');
                     data=data.replace(/\"/g,'');
-                    simvar3[index] = data;
-                    clearFlag("simvar3_"+index)
+                    simvar3[idx] = data;
+                    clearFlag("simvar3_"+idx)
                 });
             }
             if (checkFunctionFlag("simvar4_"+index)) {
                 });
             }
             if (checkFunctionFlag("simvar4_"+index)) {
-                getSimCtr(LOCALHOST+simports[index]+"/counter/interface", index, function(data,index) {
-                    simvar4[index] = data;
-                    clearFlag("simvar4_"+index)
+                getSimCtr(LOCALHOST+simports[index]+"/counter/interface", index, function(data,idx) {
+                    simvar4[idx] = data;
+                    clearFlag("simvar4_"+idx)
                 });
             }
             if (checkFunctionFlag("simvar5_"+index)) {
                 });
             }
             if (checkFunctionFlag("simvar5_"+index)) {
-                getSimCtr(LOCALHOST+simports[index]+"/counter/remote_hosts", index, function(data,index) {
-                    simvar5[index] = data;
-                    clearFlag("simvar5_"+index)
+                getSimCtr(LOCALHOST+simports[index]+"/counter/remote_hosts", index, function(data,idx) {
+                    simvar5[idx] = data;
+                    clearFlag("simvar5_"+idx)
                 });
             }
             if (checkFunctionFlag("simvar6_"+index)) {
                 });
             }
             if (checkFunctionFlag("simvar6_"+index)) {
-                getSimCtr(LOCALHOST+simports[index]+"/counter/datadelivery", index, function(data,index) {
-                    simvar6[index] = data;
-                    clearFlag("simvar6_"+index)
+                getSimCtr(LOCALHOST+simports[index]+"/counter/datadelivery", index, function(data,idx) {
+                    simvar6[idx] = data;
+                    clearFlag("simvar6_"+idx)
                 });
             }
         }
 
         //MR - get metrics values from the MR stub
         if (checkFunctionFlag("mr1")) {
                 });
             }
         }
 
         //MR - get metrics values from the MR stub
         if (checkFunctionFlag("mr1")) {
-            getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/requests_submitted", 0, function(data, index) {
+            getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/requests_submitted", 0, function(data, idx) {
                 mr1 = data;
                 clearFlag("mr1")
             });
         }
         if (checkFunctionFlag("mr2")) {
                 mr1 = data;
                 clearFlag("mr1")
             });
         }
         if (checkFunctionFlag("mr2")) {
-            getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/requests_fetched", 0, function(data, index) {
+            getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/requests_fetched", 0, function(data, idx) {
                 mr2 = data;
                 clearFlag("mr2")
             });
         }
         if (checkFunctionFlag("mr3")) {
                 mr2 = data;
                 clearFlag("mr2")
             });
         }
         if (checkFunctionFlag("mr3")) {
-            getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/current_requests", 0, function(data, index) {
+            getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/current_requests", 0, function(data, idx) {
                 mr3 = data;
                 clearFlag("mr3")
             });
         }
         if (checkFunctionFlag("mr4")) {
                 mr3 = data;
                 clearFlag("mr3")
             });
         }
         if (checkFunctionFlag("mr4")) {
-            getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/responses_submitted", 0, function(data, index) {
+            getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/responses_submitted", 0, function(data, idx) {
                 mr4 = data;
                 clearFlag("mr4")
             });
         }
         if (checkFunctionFlag("mr5")) {
                 mr4 = data;
                 clearFlag("mr4")
             });
         }
         if (checkFunctionFlag("mr5")) {
-            getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/responses_fetched", 0, function(data, index) {
+            getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/responses_fetched", 0, function(data, idx) {
                 mr5 = data;
                 clearFlag("mr5")
             });
         }
         if (checkFunctionFlag("mr6")) {
                 mr5 = data;
                 clearFlag("mr5")
             });
         }
         if (checkFunctionFlag("mr6")) {
-            getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/current_responses", 0, function(data, index) {
+            getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/current_responses", 0, function(data, idx) {
                 mr6 = data;
                 clearFlag("mr6")
             });
                 mr6 = data;
                 clearFlag("mr6")
             });
@@ -328,32 +330,32 @@ function fetchAllMetrics_pol() {
 
         //CR - get metrics values from the callbackreceiver
         if (checkFunctionFlag("cr1")) {
 
         //CR - get metrics values from the callbackreceiver
         if (checkFunctionFlag("cr1")) {
-            getSimCtr(LOCALHOST+CR_PORT+"/counter/received_callbacks", 0, function(data, index) {
+            getSimCtr(LOCALHOST+CR_PORT+"/counter/received_callbacks", 0, function(data, idx) {
                 cr1 = data;
                 clearFlag("cr1")
             });
         }
         if (checkFunctionFlag("cr2")) {
                 cr1 = data;
                 clearFlag("cr1")
             });
         }
         if (checkFunctionFlag("cr2")) {
-            getSimCtr(LOCALHOST+CR_PORT+"/counter/fetched_callbacks", 0, function(data, index) {
+            getSimCtr(LOCALHOST+CR_PORT+"/counter/fetched_callbacks", 0, function(data, idx) {
                 cr2 = data;
                 clearFlag("cr2")
             });
         }
         if (checkFunctionFlag("cr3")) {
                 cr2 = data;
                 clearFlag("cr2")
             });
         }
         if (checkFunctionFlag("cr3")) {
-            getSimCtr(LOCALHOST+CR_PORT+"/counter/current_messages", 0, function(data, index) {
+            getSimCtr(LOCALHOST+CR_PORT+"/counter/current_messages", 0, function(data, idx) {
                 cr3 = data;
                 clearFlag("cr3")
             });
         }
         //Agent - more get metrics from the agent
         if (checkFunctionFlag("ag1")) {
                 cr3 = data;
                 clearFlag("cr3")
             });
         }
         //Agent - more get metrics from the agent
         if (checkFunctionFlag("ag1")) {
-            getSimCtr(LOCALHOST+AGENT_PORT+"/status", 0, function(data, index) {
+            getSimCtr(LOCALHOST+AGENT_PORT+"/status", 0, function(data, idx) {
                 ag1 = data;
                 clearFlag("ag1")
             });
         }
         if (checkFunctionFlag("ag2")) {
                 ag1 = data;
                 clearFlag("ag1")
             });
         }
         if (checkFunctionFlag("ag2")) {
-            getSimCtr(LOCALHOST+AGENT_PORT+"/services", 0, function(data, index) {
+            getSimCtr(LOCALHOST+AGENT_PORT+"/services", 0, function(data, idx) {
                 ag2="";
                 try {
                     var jd=JSON.parse(data);
                 ag2="";
                 try {
                     var jd=JSON.parse(data);
@@ -371,7 +373,7 @@ function fetchAllMetrics_pol() {
             });
         }
         if (checkFunctionFlag("ag3")) {
             });
         }
         if (checkFunctionFlag("ag3")) {
-            getSimCtr(LOCALHOST+AGENT_PORT+"/policy_types", 0, function(data, index) {
+            getSimCtr(LOCALHOST+AGENT_PORT+"/policy_types", 0, function(data, idx) {
                 ag3="";
                 try {
                     var jd=JSON.parse(data);
                 ag3="";
                 try {
                     var jd=JSON.parse(data);
@@ -390,7 +392,7 @@ function fetchAllMetrics_pol() {
         }
 
         if (checkFunctionFlag("ag4")) {
         }
 
         if (checkFunctionFlag("ag4")) {
-            getSimCtr(LOCALHOST+AGENT_PORT+"/policy_ids", 0, function(data, index) {
+            getSimCtr(LOCALHOST+AGENT_PORT+"/policy_ids", 0, function(data, idx) {
                 try {
                     var jd=JSON.parse(data);
                     ag4=""+jd.length
                 try {
                     var jd=JSON.parse(data);
                     ag4=""+jd.length
@@ -403,7 +405,7 @@ function fetchAllMetrics_pol() {
         }
 
         if (checkFunctionFlag("ag5")) {
         }
 
         if (checkFunctionFlag("ag5")) {
-            getSimCtr(LOCALHOST+AGENT_PORT+"/rics", 0, function(data, index) {
+            getSimCtr(LOCALHOST+AGENT_PORT+"/rics", 0, function(data, idx) {
                 try {
                     var jd=JSON.parse(data);
                     ag5=""+jd.length
                 try {
                     var jd=JSON.parse(data);
                     ag5=""+jd.length
@@ -434,10 +436,6 @@ function fetchAllMetrics_ecs() {
 
         if (checkFunctionFlag("ecs_stat")) {
             getSimCtr(LOCALHOST+ECS_PORT+"/status", 0, function(data, index) {
 
         if (checkFunctionFlag("ecs_stat")) {
             getSimCtr(LOCALHOST+ECS_PORT+"/status", 0, function(data, index) {
-                ecs1=""
-                ecs2=""
-                ecs3=""
-                ecs4=""
                 try {
                     var jd=JSON.parse(data);
                     ecs1=jd["status"]
                 try {
                     var jd=JSON.parse(data);
                     ecs1=jd["status"]
@@ -452,109 +450,167 @@ function fetchAllMetrics_ecs() {
                     ecs4="error response"
                 }
             });
                     ecs4="error response"
                 }
             });
-
+            clearFlag("ecs_stat")
+        }
+        if (checkFunctionFlag("ecs_types")) {
             getSimCtr(LOCALHOST+ECS_PORT+"/ei-producer/v1/eitypes", 0, function(data, index) {
             getSimCtr(LOCALHOST+ECS_PORT+"/ei-producer/v1/eitypes", 0, function(data, index) {
-                ecs_types="-"
+                var tmp_ecs_types="-"
                 try {
                     var jd=JSON.parse(data);
                     for(var i=0;i<jd.length;i++) {
                 try {
                     var jd=JSON.parse(data);
                     for(var i=0;i<jd.length;i++) {
-                        if (ecs_types.length == 1) {
-                            ecs_types=""
+                        if (tmp_ecs_types.length == 1) {
+                            tmp_ecs_types=""
                         }
                         }
-                        ecs_types=""+ecs_types+jd[i]+" "
+                        tmp_ecs_types=""+tmp_ecs_types+jd[i]+" "
                     }
                 }
                 catch (err) {
                     }
                 }
                 catch (err) {
-                    ecs_types="error response"
+                    tmp_ecs_types="error response"
                 }
                 }
+                ecs_types = tmp_ecs_types
             });
             });
-
+            clearFlag("ecs_types")
+        }
+        if (checkFunctionFlag("ecs_producers")) {
             getSimCtr(LOCALHOST+ECS_PORT+"/ei-producer/v1/eiproducers", 0, function(data, index) {
             getSimCtr(LOCALHOST+ECS_PORT+"/ei-producer/v1/eiproducers", 0, function(data, index) {
-                ecs_producers="-"
+                var tmp_ecs_producers="-"
                 try {
                     var jd=JSON.parse(data);
                     var tmp_ecs_producer_arr=new Array(jd.length)
                     for(var i=0;i<jd.length;i++) {
                 try {
                     var jd=JSON.parse(data);
                     var tmp_ecs_producer_arr=new Array(jd.length)
                     for(var i=0;i<jd.length;i++) {
-                        if (ecs_producers.length == 1) {
-                            ecs_producers=""
+                        if (tmp_ecs_producers.length == 1) {
+                            tmp_ecs_producers=""
                         }
                         }
-                        ecs_producers=""+ecs_producers+jd[i]+" "
+                        tmp_ecs_producers=""+tmp_ecs_producers+jd[i]+" "
                         tmp_ecs_producer_arr[i]=jd[i]
                     }
                     ecs_producer_arr = tmp_ecs_producer_arr
                         tmp_ecs_producer_arr[i]=jd[i]
                     }
                     ecs_producer_arr = tmp_ecs_producer_arr
+                    ecs_producers = tmp_ecs_producers
                 }
                 catch (err) {
                     ecs_producers="error response"
                     ecs_producer_arr=new Array(0)
                 }
             });
                 }
                 catch (err) {
                     ecs_producers="error response"
                     ecs_producer_arr=new Array(0)
                 }
             });
-
-            ecs_producer_type_arr = JSON.parse(JSON.stringify(ecs_producer_arr))
-            for(var x=0;x<ecs_producer_type_arr.length;x++) {
-                getSimCtr(LOCALHOST+ECS_PORT+"/ei-producer/v1/eiproducers/"+ecs_producer_type_arr[x], x, function(data, x) {
-                    var row=""+ecs_producer_type_arr[x]+" : "
-                    try {
-                        var jd=JSON.parse(data);
-                        var jda=jd["supported_ei_types"]
-                        for(var j=0;j<jda.length;j++) {
-                            row=""+row+jda[j]["ei_type_identity"]+" "
+            clearFlag("ecs_producers")
+        }
+        if (checkFunctionFlag("ecs_data")) {
+            try {
+                var tmp_ecs_producer_type_arr = JSON.parse(JSON.stringify(ecs_producer_arr))
+                for(var x=0;x<tmp_ecs_producer_type_arr.length;x++) {
+                    getSimCtr(LOCALHOST+ECS_PORT+"/ei-producer/v1/eiproducers/"+tmp_ecs_producer_type_arr[x], x, function(data, idx) {
+                        var row=""+tmp_ecs_producer_type_arr[idx]+" : "
+                        try {
+                            var jd=JSON.parse(data);
+                            var jda=jd["supported_ei_types"]
+                            for(var j=0;j<jda.length;j++) {
+                                row=""+row+jda[j]["ei_type_identity"]+" "
+                            }
+                            tmp_ecs_producer_type_arr[idx]=row
                         }
                         }
-                        ecs_producer_type_arr[x]=row
-                    }
-                    catch (err) {
-                        ecs_producer_type_arr=new Array(0)
-                    }
-                });
+                        catch (err) {
+                            tmp_ecs_producer_type_arr=new Array(0)
+                        }
+                    });
+                }
+                ecs_producer_type_arr = tmp_ecs_producer_type_arr
+            } catch (err) {
+                ecs_producer_type_arr=new Array(0)
             }
             }
-
-            ecs_producer_jobs_arr = JSON.parse(JSON.stringify(ecs_producer_arr))
-            for(var x=0;x<ecs_producer_jobs_arr.length;x++) {
-                getSimCtr(LOCALHOST+ECS_PORT+"/ei-producer/v1/eiproducers/"+ecs_producer_jobs_arr[x]+"/eijobs", x, function(data, x) {
-                    var row=""+ecs_producer_jobs_arr[x]+" : "
-                    try {
-                        var jd=JSON.parse(data);
-                        for(var j=0;j<jd.length;j++) {
-                            var jda=jd[j]
-                            row=""+row+jda["ei_job_identity"]+"("+jda["ei_type_identity"]+") "
+            try {
+                var tmp_ecs_producer_jobs_arr = JSON.parse(JSON.stringify(ecs_producer_arr))
+                for(x=0;x<tmp_ecs_producer_jobs_arr.length;x++) {
+                    getSimCtr(LOCALHOST+ECS_PORT+"/ei-producer/v1/eiproducers/"+tmp_ecs_producer_jobs_arr[x]+"/eijobs", x, function(data, idx) {
+                        var row=""+tmp_ecs_producer_jobs_arr[idx]+" : "
+                        try {
+                            var jd=JSON.parse(data);
+                            for(var j=0;j<jd.length;j++) {
+                                var jda=jd[j]
+                                row=""+row+jda["ei_job_identity"]+"("+jda["ei_type_identity"]+") "
+                            }
+                            tmp_ecs_producer_jobs_arr[idx]=row
                         }
                         }
-                        ecs_producer_jobs_arr[x]=row
-                    }
-                    catch (err) {
-                        ecs_producer_jobs_arr=new Array(0)
-                    }
-                });
+                        catch (err) {
+                            tmp_ecs_producer_jobs_arr=new Array(0)
+                        }
+                    });
+                }
+                ecs_producer_jobs_arr = tmp_ecs_producer_jobs_arr
+            } catch (err) {
+                ecs_producer_jobs_arr=new Array(0)
             }
 
             }
 
-            ecs_producer_status_arr = JSON.parse(JSON.stringify(ecs_producer_arr))
-            for(var x=0;x<ecs_producer_status_arr.length;x++) {
-                getSimCtr(LOCALHOST+ECS_PORT+"/ei-producer/v1/eiproducers/"+ecs_producer_status_arr[x]+"/status", x, function(data, x) {
-                    var row=""+ecs_producer_status_arr[x]+" : "
-                    try {
-                        var jd=JSON.parse(data);
-                        row=""+row+jd["operational_state"]
-                        ecs_producer_status_arr[x]=row
-                    }
-                    catch (err) {
-                        ecs_producer_status_arr=new Array(0)
+            try {
+                var tmp_ecs_producer_status_arr = JSON.parse(JSON.stringify(ecs_producer_arr))
+                for(x=0;x<tmp_ecs_producer_status_arr.length;x++) {
+                    getSimCtr(LOCALHOST+ECS_PORT+"/ei-producer/v1/eiproducers/"+tmp_ecs_producer_status_arr[x]+"/status", x, function(data, idx) {
+                        var row=""+tmp_ecs_producer_status_arr[idx]+" : "
+                        try {
+                            var jd=JSON.parse(data);
+                            row=""+row+jd["operational_state"]
+                            tmp_ecs_producer_status_arr[idx]=row
+                        }
+                        catch (err) {
+                            tmp_ecs_producer_status_arr=new Array(0)
+                        }
+                    });
+                }
+                ecs_producer_status_arr = tmp_ecs_producer_status_arr
+            } catch (err) {
+                ecs_producer_status_arr=new Array(0)
+            }
+            clearFlag("ecs_data")
+        }
+        if (checkFunctionFlag("ecs_jobs")) {
+            getSimCtr(LOCALHOST+ECS_PORT+"/A1-EI/v1/eijobs", 0, function(data, index) {
+                try {
+                    var jd=JSON.parse(data);
+                    var tmpArr=new Array(jd.length)
+                    for(var i=0;i<jd.length;i++) {
+                        tmpArr[i]=jd[i]
                     }
                     }
-                });
+                    ecs_jobs=tmpArr
+                }
+                catch (err) {
+                    ecs_jobs=new Array(0)
+                }
+            });
+            clearFlag("ecs_jobs")
+        }
+        if (checkFunctionFlag("ecs_job_status")) {
+            try {
+                var tmp_ecs_job_status= JSON.parse(JSON.stringify(ecs_jobs))
+                for(x=0;x<tmp_ecs_job_status.length;x++) {
+                    getSimCtr(LOCALHOST+ECS_PORT+"/A1-EI/v1/eijobs/"+tmp_ecs_job_status[x]+"/status", x, function(data, idx) {
+                        try {
+                            var jd=JSON.parse(data);
+                            tmp_ecs_job_status[idx]=""+tmp_ecs_job_status[idx]+":"+jd["eiJobStatus"]
+                        }
+                        catch (err) {
+                            tmp_ecs_job_status="-"
+                        }
+                    });
+                }
+                ecs_job_status = tmp_ecs_job_status
+            } catch (err) {
+                ecs_job_status="-"
             }
             }
-            clearFlag("ecs_stat")
+            clearFlag("ecs_job_status")
         }
         if (checkFunctionFlag("prodstub_stat")) {
         }
         if (checkFunctionFlag("prodstub_stat")) {
-            getSimCtr(LOCALHOST+PRODSTUB_PORT+"/status", x, function(data, x) {
+            getSimCtr(LOCALHOST+PRODSTUB_PORT+"/status", x, function(data, idx) {
                 var ctr2_map=new Map()
                 var ctr3_map=new Map()
                 var ctr2=0
                 var ctr4=0
                 var ctr2_map=new Map()
                 var ctr3_map=new Map()
                 var ctr2=0
                 var ctr4=0
-                ps_producers=""
-                ps_types=""
-                ps_producer_type_arr=new Array()
-                ps_producer_jobs_arr=new Array()
-                ps_producer_delivery_arr=new Array()
-                ps2=""
-                ps3=""
-                ps4=""
+                var tmp_ps_producers=""
+                var tmp_ps_types=""
+                var tmp_ps_producer_type_arr=new Array()
+                var tmp_ps_producer_jobs_arr=new Array()
+                var tmp_ps_producer_delivery_arr=new Array()
+                var tmp_ps2=""
+                var tmp_ps3=""
+                var tmp_ps4=""
                 try {
                     var jp=JSON.parse(data);
                     for(var prod_name in jp) {
                 try {
                     var jp=JSON.parse(data);
                     for(var prod_name in jp) {
@@ -564,7 +620,7 @@ function fetchAllMetrics_ecs() {
                         var row=""+prod_name+" : "
                         var rowj=""+prod_name+" : "
                         var rowd=""+prod_name+" : "
                         var row=""+prod_name+" : "
                         var rowj=""+prod_name+" : "
                         var rowd=""+prod_name+" : "
-                        ps_producers += prod_name + " "
+                        tmp_ps_producers += prod_name + " "
                         for(var ji in jj) {
                             if (ji == "types") {
                                 var ta=jj[ji]
                         for(var ji in jj) {
                             if (ji == "types") {
                                 var ta=jj[ji]
@@ -573,8 +629,11 @@ function fetchAllMetrics_ecs() {
                                     row += " "+ta[i]
                                 }
                             } else if (ji == "supervision_response") {
                                     row += " "+ta[i]
                                 }
                             } else if (ji == "supervision_response") {
+                                //Do nothing
                             } else if (ji == "supervision_counter") {
                             } else if (ji == "supervision_counter") {
+                                //Do nothing
                             } else if (ji == "types") {
                             } else if (ji == "types") {
+                                //Do nothing
                             } else {
                                 ctr4 += 1
                                 rowj += " "+ji
                             } else {
                                 ctr4 += 1
                                 rowj += " "+ji
@@ -586,19 +645,27 @@ function fetchAllMetrics_ecs() {
                                 rowd += "("+jj[ji]["delivery_attempts"]+")"
                             }
                         }
                                 rowd += "("+jj[ji]["delivery_attempts"]+")"
                             }
                         }
-                        ps_producer_type_arr[(ctr2-1)]=row
-                        ps_producer_jobs_arr[(ctr2-1)]=rowj
-                        ps_producer_delivery_arr[(ctr2-1)]=rowd
+                        tmp_ps_producer_type_arr[(ctr2-1)]=row
+                        tmp_ps_producer_jobs_arr[(ctr2-1)]=rowj
+                        tmp_ps_producer_delivery_arr[(ctr2-1)]=rowd
                     }
                     }
-                    ps2=""+ctr2_map.size
-                    ps3=""+ctr3_map.size
+                    tmp_ps2=""+ctr2_map.size
+                    tmp_ps3=""+ctr3_map.size
                     for(const [key, value] of ctr3_map.entries()) {
                     for(const [key, value] of ctr3_map.entries()) {
-                        ps_types += key + " "
+                        tmp_ps_types += key + " "
                     }
                     }
-                    ps4=""+ctr4
+                    tmp_ps4=""+ctr4
+
+                    ps_producers=tmp_ps_producers
+                    ps_types=tmp_ps_types
+                    ps_producer_type_arr=tmp_ps_producer_type_arr
+                    ps_producer_jobs_arr=tmp_ps_producer_jobs_arr
+                    ps_producer_delivery_arr=tmp_ps_producer_delivery_arr
+                    ps2=tmp_ps2
+                    ps3=tmp_ps3
+                    ps4=tmp_ps4
                 }
                 catch (err) {
                 }
                 catch (err) {
-                    console.error(err);
                     ps_producers="error response"
                     ps_types="error response"
                     ps_producer_type_arr=new Array()
                     ps_producers="error response"
                     ps_types="error response"
                     ps_producer_type_arr=new Array()
@@ -631,7 +698,6 @@ function fetchAllMetrics_cr() {
 
         if (checkFunctionFlag("cr_stat")) {
             getSimCtr(LOCALHOST+CR_PORT+"/db", 0, function(data, index) {
 
         if (checkFunctionFlag("cr_stat")) {
             getSimCtr(LOCALHOST+CR_PORT+"/db", 0, function(data, index) {
-                ecs4=""
                 try {
                     cr_db=JSON.parse(data);
                 }
                 try {
                     cr_db=JSON.parse(data);
                 }
@@ -696,10 +762,13 @@ app.get("/mon2",function(req, res){
             "<body>" +
             "<font size=\"-3\" face=\"summary\">"
             if (summary == "false") {
             "<body>" +
             "<font size=\"-3\" face=\"summary\">"
             if (summary == "false") {
-                htmlStr=htmlStr+"<p>Set query param '?summary' to true to only show summary statistics</p>"
+                htmlStr=htmlStr+"<p>Set query param '?summary' to true to only show summary statistics.</p>"
             } else {
                 htmlStr=htmlStr+"<p>Set query param '?summary' to false to only show full statistics</p>"
             }
             } else {
                 htmlStr=htmlStr+"<p>Set query param '?summary' to false to only show full statistics</p>"
             }
+            if (ecs_job_status.length > 10) {
+                htmlStr=htmlStr+"<div style=\"color:red\"> Avoid running the server for large number of producers and/or jobs</div>"
+            }
             htmlStr=htmlStr+"</font>" +
             "<h3>Enrichment Coordinator Service</h3>" +
             "<font face=\"monospace\">" +
             htmlStr=htmlStr+"</font>" +
             "<h3>Enrichment Coordinator Service</h3>" +
             "<font face=\"monospace\">" +
@@ -723,24 +792,34 @@ app.get("/mon2",function(req, res){
                     }
                 }
                 htmlStr=htmlStr+"<br>";
                     }
                 }
                 htmlStr=htmlStr+"<br>";
-                for(var i=0;i<ecs_producer_jobs_arr.length;i++) {
-                    var tmp=ecs_producer_jobs_arr[i]
+                for(i=0;i<ecs_producer_jobs_arr.length;i++) {
+                    tmp=ecs_producer_jobs_arr[i]
                     if (tmp != undefined) {
                     if (tmp != undefined) {
-                        var s = "Producer jobs....." + formatDataRow(ecs_producer_jobs_arr[i]) + "<br>"
+                        s = "Producer jobs....." + formatDataRow(ecs_producer_jobs_arr[i]) + "<br>"
                         htmlStr=htmlStr+s
                     }
                 }
                 htmlStr=htmlStr+"<br>";
                         htmlStr=htmlStr+s
                     }
                 }
                 htmlStr=htmlStr+"<br>";
-                for(var i=0;i<ecs_producer_status_arr.length;i++) {
-                    var tmp=ecs_producer_status_arr[i]
+                for(i=0;i<ecs_producer_status_arr.length;i++) {
+                    tmp=ecs_producer_status_arr[i]
                     if (tmp != undefined) {
                     if (tmp != undefined) {
-                        var s = "Producer status..." + formatDataRow(ecs_producer_status_arr[i]) + "<br>"
+                        s = "Producer status..." + formatDataRow(tmp) + "<br>"
+                        htmlStr=htmlStr+s
+                    }
+                }
+                htmlStr=htmlStr+"<br>";
+                for(i=0;i<ecs_job_status.length;i++) {
+                    tmp=ecs_job_status[i]
+                    console.log("tmp")
+                    if (tmp != undefined) {
+                        s = padding("Job", 18, ".") + formatDataRow(tmp) + "<br>"
                         htmlStr=htmlStr+s
                     }
                 }
                 htmlStr=htmlStr+"<br>"+"<br>" +
                 "</font>"
             }
                         htmlStr=htmlStr+s
                     }
                 }
                 htmlStr=htmlStr+"<br>"+"<br>" +
                 "</font>"
             }
+
             htmlStr=htmlStr+
             "<h3>Producer stub</h3>" +
             "<font face=\"monospace\">" +
             htmlStr=htmlStr+
             "<h3>Producer stub</h3>" +
             "<font face=\"monospace\">" +
@@ -755,26 +834,26 @@ app.get("/mon2",function(req, res){
                 "Producer ids:....." + formatDataRow(ps_producers) + "<br>" +
                 "Type ids:........." + formatDataRow(ps_types) + "<br>" +
                 "<br>";
                 "Producer ids:....." + formatDataRow(ps_producers) + "<br>" +
                 "Type ids:........." + formatDataRow(ps_types) + "<br>" +
                 "<br>";
-                for(var i=0;i<ps_producer_type_arr.length;i++) {
-                    var tmp=ps_producer_type_arr[i]
+                for(i=0;i<ps_producer_type_arr.length;i++) {
+                    tmp=ps_producer_type_arr[i]
                     if (tmp != undefined) {
                     if (tmp != undefined) {
-                        var s = "Producer types...." + formatDataRow(ps_producer_type_arr[i]) + "<br>"
+                        s = "Producer types...." + formatDataRow(ps_producer_type_arr[i]) + "<br>"
                         htmlStr=htmlStr+s
                     }
                 }
                 htmlStr=htmlStr+"<br>";
                         htmlStr=htmlStr+s
                     }
                 }
                 htmlStr=htmlStr+"<br>";
-                for(var i=0;i<ps_producer_jobs_arr.length;i++) {
-                    var tmp=ps_producer_jobs_arr[i]
+                for(i=0;i<ps_producer_jobs_arr.length;i++) {
+                    tmp=ps_producer_jobs_arr[i]
                     if (tmp != undefined) {
                     if (tmp != undefined) {
-                        var s = "Producer jobs....." + formatDataRow(ps_producer_jobs_arr[i]) + "<br>"
+                        s = "Producer jobs....." + formatDataRow(ps_producer_jobs_arr[i]) + "<br>"
                         htmlStr=htmlStr+s
                     }
                 }
                 htmlStr=htmlStr+"<br>";
                         htmlStr=htmlStr+s
                     }
                 }
                 htmlStr=htmlStr+"<br>";
-                for(var i=0;i<ps_producer_delivery_arr.length;i++) {
-                    var tmp=ps_producer_delivery_arr[i]
+                for(i=0;i<ps_producer_delivery_arr.length;i++) {
+                    tmp=ps_producer_delivery_arr[i]
                     if (tmp != undefined) {
                     if (tmp != undefined) {
-                        var s = "Producer delivery." + formatDataRow(ps_producer_delivery_arr[i]) + "<br>"
+                        s = "Producer delivery." + formatDataRow(ps_producer_delivery_arr[i]) + "<br>"
                         htmlStr=htmlStr+s
                     }
                 }
                         htmlStr=htmlStr+s
                     }
                 }