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
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
#
-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
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER"
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
clean_containers
if [ $__httpx == "HTTPS" ]; then
+ use_cr_https
use_agent_rest_https
else
use_agent_rest_http
+ use_cr_http
fi
start_policy_agent
if [ $__httpx == "HTTPS" ]; then
- use_cr_https
use_simulator_https
use_mr_https
if [[ $interface = *"SDNC"* ]]; then
use_agent_rest_https
fi
else
- use_cr_http
use_simulator_http
use_mr_http
if [[ $interface = *"SDNC"* ]]; 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
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
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
#
-TC_ONELINE_DESCR="Experimental ECS test case"
+TC_ONELINE_DESCR="ECS full intefaces walkthrough"
#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/cr_api_functions.sh
#### TEST BEGIN ####
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
-set_ecs_debug
-
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-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-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_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-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
-# 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
-# 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_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_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_jobs 200 prod-a EMPTY
-
-#job1 - prod-a
+## Create a job for prod-a
+## job1 - prod-a
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
- 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
-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 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
- 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 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_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
- 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
- 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
-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 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
- 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 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_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_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
- 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
- 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
-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 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
- 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 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_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 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
+
+## 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
+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_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_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
- 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
-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
-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
- 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
+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
+## 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
- 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
- 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
+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
#### TEST COMPLETE ####
-
print_result
auto_clean_containers
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
--- /dev/null
+#!/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
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
#
-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
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER"
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
#### 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 ####
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
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
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
# ============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
-SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
+SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER"
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
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
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
#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
-use_agent_rest_https
-use_sdnc_https
-use_simulator_https
-
clean_containers
OSC_NUM_RICS=6
start_control_panel
-start_control_panel
-
start_sdnc
start_consul_cbs
--- /dev/null
+#!/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
--- /dev/null
+{
+ "$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
--- /dev/null
+{
+ "$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
--- /dev/null
+{
+ "$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
--- /dev/null
+{
+ "$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
| 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 |
+| `STD2` | Indicator of status of Standarized A1 version 2 |
| `<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 |
| `<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 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.
| 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 |
-| `<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 |
| `<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.
return 0
fi
fi
-
- ((RES_CONF_FAIL++))
__print_err "needs two or three args: json:<json-array-param> <target-value> [ timeout ]" $@
return 1
}
# 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
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
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
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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# (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
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
#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=$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
- echo -e $RED" FAIL, returned body not correct"$ERED
- ((RES_FAIL++))
- __check_stop_at_error
+ __log_test_fail_body
return 1
fi
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
- return 1
+ __log_test_fail_body
fi
fi
fi
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
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
done
echo ""
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# (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 [ $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}
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
echo ""
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
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
- 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
}
# 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 [ $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
done
echo ""
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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 [ $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}
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
echo ""
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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>" $@
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
- 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
}
# 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)" $@
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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
- echo -e $RED" FAIL, function not supported"$ERED
- ((RES_FAIL++))
- __check_stop_at_error
+ __log_test_fail_not_supported
return 1
fi
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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
- echo -e $RED" FAIL, function not supported"$ERED
- ((RES_FAIL++))
- __check_stop_at_error
+ __log_test_fail_not_supported
return 1
fi
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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
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
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
- ((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
-# 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() {
- 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
- __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
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
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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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>]*]]" $@
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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# (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
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
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
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
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
- echo -e $RED" FAIL, returned body not correct"$ERED
- ((RES_FAIL++))
- __check_stop_at_error
+ __log_test_fail_body
return 1
fi
fi
fi
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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>]" $@
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
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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
#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
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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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>]*" $@
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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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>" $@
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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>" $@
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
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
# 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
# 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
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
- 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}
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
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
- 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}
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
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
- 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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
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
- 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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
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
- 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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
\ No newline at end of file
if [ $# -eq 2 ] || [ $# -eq 3 ]; then
__var_test "CR" "$LOCALHOST$CR_EXTERNAL_PORT/counter/" $1 "=" $2 $3
else
- ((RES_CONF_FAIL++))
__print_err "Wrong args to cr_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
fi
}
-# CR API: Check the contents of all current ric sync events from PMS
+# 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() {
- 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
- echo -e $RED" FAIL, function not supported"$ERED
- ((RES_FAIL++))
- __check_stop_at_error
+ __log_test_fail_not_supported
return 1
fi
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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
\ No newline at end of file
# 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
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
. ../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
# 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
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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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>]" $@
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 [ -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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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>]+) ]" $@
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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
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
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
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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
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
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}"
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
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
- 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 -e $RED" FAIL, returned body not correct"$ERED
- ((RES_FAIL++))
- __check_stop_at_error
+ __log_test_fail_body
return 1
fi
fi
fi
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
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
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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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>+]" $@
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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
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() {
- 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"
- 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
+ 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
}
# 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>+]" $@
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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
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
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
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
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() {
- 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
- if [ $# -eq 6 ] && [ "$6" == "EMPTY" ]; then
+ if [ $# -eq 5 ] && [ "$5" == "EMPTY" ]; then
paramError=0
fi
- variablecount=$(($#-5))
+ variablecount=$(($#-4))
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
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="["
- 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
- 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
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
- echo -e $RED" FAIL, returned body not correct"$ERED
- ((RES_FAIL++))
- __check_stop_at_error
+ __log_test_fail_body
return 1
fi
fi
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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>" $@
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
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() {
- 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
- if [ $# -eq 6 ] && [ "$6" == "NOTYPE" ]; then
+ if [ $# -eq 5 ] && [ "$5" == "NOTYPE" ]; then
paramError=0
- elif [ $# -gt 6 ] && [ $(($#%2)) -eq 1 ]; then
+ elif [ $# -gt 5 ] && [ $(($#%2)) -eq 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="["
- 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
- 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}"
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"}"
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
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
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}"
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
- ((RES_PASS++))
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
return 0
}
# 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
-
- ((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
# 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 " 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}
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
- echo -e $GREEN" PASS"$EGREEN
+ __log_test_pass
else
- echo -e $GREEN" OK"$EGREEN
+ __log_conf_ok
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
}
# <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
- ((RES_CONF_FAIL++))
__print_err "<response-code> <producer-id> [<forced_response_code>]" $@
return 1
fi
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() {
- 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
- ((RES_CONF_FAIL++))
__print_err "<response-code> <producer-id> <job-id> [<forced_response_code>]" $@
return 1
fi
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() {
- 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
- ((RES_CONF_FAIL++))
__print_err "<response-code> <producer-id> <job-id> [<forced_response_code>]" $@
return 1
fi
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() {
- 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
- ((RES_CONF_FAIL++))
__print_err "<response-code> <producer-id> <type-id>" $@
return 1
fi
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() {
- 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
- ((RES_CONF_FAIL++))
__print_err "<response-code> <producer-id> <type-id>" $@
return 1
fi
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() {
- 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
- ((RES_FAIL++))
__print_err "<response-code> <producer-id> <job-id> <type-id> <target-url> <template-job-file>" $@
return 1
fi
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}"
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.
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
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
- ((RES_CONF_FAIL++))
__print_err "needs three or four args: <ric-id> <sim-param> <target-value> [ timeout ]"
return 1
fi
sim_print() {
if [ $# != 2 ]; then
- ((RES_CONF_FAIL++))
__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
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
- ((RES_CONF_FAIL++))
__print_err "needs three or four args: <ric-id> <sim-param> <target-value> [ timeout ]"
return 1
fi
# 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
- ((RES_CONF_FAIL++))
__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
-
__execute_curl_to_sim $1 "$curlString"
return $?
}
# <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
- ((RES_CONF_FAIL++))
__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
-
__execute_curl_to_sim $1 "$curlString"
return $?
}
# <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
- ((RES_CONF_FAIL++))
__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"
-
__execute_curl_to_sim $1 "$curlString"
return $?
}
# <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
- ((RES_CONF_FAIL++))
__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"
-
__execute_curl_to_sim $1 "$curlString"
return $?
}
# <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
- ((RES_CONF_FAIL++))
__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
-
__execute_curl_to_sim $1 "$curlString"
return $?
}
# <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
- ((RES_CONF_FAIL++))
__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
-
__execute_curl_to_sim $1 "$curlString"
return $?
}
\ No newline at end of file
# limitations under the License.
# ============LICENSE_END=================================================
#
-
+#Profile for ONAP guilin release
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.
# 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
#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
#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
# limitations under the License.
# ============LICENSE_END=================================================
#
-
+#Profile for 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.
#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
#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
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
# limitations under the License.
# ============LICENSE_END=================================================
#
-
+#Profile for 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.
#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
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="consul"
+CONSUL_REMOTE_IMAGE=$NEXUS_PROXY_REPO"consul"
CONSUL_REMOTE_IMAGE_TAG="1.7.2"
#No local image for Consul, remote image always used
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
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
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
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
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
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
}
if [ $# -gt 1 ]; then
echo -e $RED" Got: "${FUNCNAME[1]} ${@:2} $ERED
fi
+ ((RES_CONF_FAIL++))
}
###########################
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
}
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
}
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
}
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
}
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
}
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
}
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
}
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
}
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
}
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
# 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 ""
}
# 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
# 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
# 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
# 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"
# 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"
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"
# 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" $@
# 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 ""
}
# 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
# 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
# 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
# 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
# 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
echo "<no-response-from-server>"
return 1
else
- echo "X2" >> $HTTPLOG
return 0
fi
else
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++))
+ ((TEST_SEQUENCE_NR++))
start=$SECONDS
ctr=0
for (( ; ; )); do
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++))
+ ((TEST_SEQUENCE_NR++))
if [ $checkjsonarraycount -eq 0 ]; then
result="$(__do_curl $2$3)"
retcode=$?
# ============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
### 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>
-```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.
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
-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>
-```docker run -it -p 8090:8090 callback-receiver```
+```docker run --rm -it -p 8090:8090 callback-receiver```
### Basic test ###
from flask import Flask, request, Response
from time import sleep
import time
-import datetime
+from datetime import datetime
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__)
MIME_JSON="application/json"
CAUGHT_EXCEPTION="Caught exception: "
SERVER_ERROR="Server error :"
+TIME_STAMP="cr-timestamp"
#I'm alive function
@app.route('/',
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)
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)
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:
global msg_callbacks
global cntr_msg_fetched
global cntr_msg_callbacks
+ global cntr_callbacks
msg_callbacks={}
cntr_msg_fetched=0
cntr_msg_callbacks=0
+ cntr_callbacks={}
return Response('OK', status=200, mimetype=MIME_TEXT)
#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
+tmp
.tmp.json
.dockererr
nginx_wsgi_flask/__init__.py
# ============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/
### 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>
-```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
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
-```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).
-```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 ###
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()
#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
# ============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/
## 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
-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 |
+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 ###
-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>
-```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>
-```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.
-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
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__)
HOST_IP = "::"
HOST_PORT = 2222
-# # Metrics vars
-# cntr_msg_callbacks=0
-# cntr_msg_fetched=0
-
# 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>"
# 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
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
# 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'])
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['delivering'] == "delivering"):
+ job_dict['delivering']="hold"
return_msg=RETURNING_CONFIGURED_RESP
job_dict['create_counter']=job_dict['create_counter']+1
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,
- 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=""
- 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:
- return JOBID_NO_MATCH, 400
+ return_msg=RETURNING_CONFIGURED_RESP
+
+ job_dict['delete_counter']=job_dict['delete_counter']+1
return return_msg, return_code
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
return JOB_DATA_NOT_FOUND, 400
else:
if (action == "START"):
- job_dict['delivering']=True
+ job_dict['delivering']="delivering"
else:
- job_dict['delivering']=False
+ job_dict['delivering']="stopped"
return "",200
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']
-
- 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)
## 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
## 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
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
-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 ==="
## 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
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 "=== 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 "=== 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 ==="
-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
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"
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
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}
} catch(err) {
cb("no response", index);
}
-};
+}
//Format a comma separated list of data to a html-safe string with fixed fieldsizes
}
//Pad a string upto a certain size using a pad string
-function padding(val, fieldSize, pad) {
+function padding(val, size, pad) {
var s=""+val;
- for(var i=s.length;i<fieldSize;i++) {
+ for(var i=s.length;i<size;i++) {
s=s+pad
}
return s;
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="-";
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]
}
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)) {
- 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)) {
- 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,'');
- simvar3[index] = data;
- clearFlag("simvar3_"+index)
+ simvar3[idx] = data;
+ clearFlag("simvar3_"+idx)
});
}
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)) {
- 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)) {
- 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")) {
- 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")) {
- 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")) {
- 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")) {
- 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")) {
- 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")) {
- 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")
});
//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")) {
- 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")) {
- 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")) {
- 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")) {
- 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);
});
}
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);
}
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
}
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
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"]
ecs4="error response"
}
});
-
+ clearFlag("ecs_stat")
+ }
+ if (checkFunctionFlag("ecs_types")) {
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++) {
- 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) {
- 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) {
- 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++) {
- 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
+ ecs_producers = tmp_ecs_producers
}
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")) {
- 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
- 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) {
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]
row += " "+ta[i]
}
} else if (ji == "supervision_response") {
+ //Do nothing
} else if (ji == "supervision_counter") {
+ //Do nothing
} else if (ji == "types") {
+ //Do nothing
} else {
ctr4 += 1
rowj += " "+ji
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()) {
- 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) {
- console.error(err);
ps_producers="error response"
ps_types="error response"
ps_producer_type_arr=new Array()
if (checkFunctionFlag("cr_stat")) {
getSimCtr(LOCALHOST+CR_PORT+"/db", 0, function(data, index) {
- ecs4=""
try {
cr_db=JSON.parse(data);
}
"<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>"
}
+ 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+"<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) {
- 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>";
- 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) {
- 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+
"<h3>Producer stub</h3>" +
"<font face=\"monospace\">" +
"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) {
- 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>";
- 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) {
- 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>";
- 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) {
- var s = "Producer delivery." + formatDataRow(ps_producer_delivery_arr[i]) + "<br>"
+ s = "Producer delivery." + formatDataRow(ps_producer_delivery_arr[i]) + "<br>"
htmlStr=htmlStr+s
}
}