Merge "Add httpHeader in apex policy for authorization to SDNR"
diff --git a/test/auto-test/FTC1100.sh b/test/auto-test/FTC1100.sh
index c210417..14652d0 100755
--- a/test/auto-test/FTC1100.sh
+++ b/test/auto-test/FTC1100.sh
@@ -1191,7 +1191,7 @@
ecs_api_idc_get_job 404 test-job
-ecs_api_idc_get_job_status 404 test-job
+ecs_api_idc_get_job_status2 404 test-job
ecs_api_idc_delete_job 404 test-job
@@ -1243,7 +1243,7 @@
ecs_api_idc_get_job 404 test-job
-ecs_api_idc_get_job_status 404 test-job
+ecs_api_idc_get_job_status2 404 test-job
ecs_api_edp_get_producer_jobs_2 200 prod-ia EMPTY
## Create a job for prod-ia
@@ -1260,7 +1260,7 @@
ecs_api_idc_get_job 200 job101 type101 $TARGET101 info-owner-1 $INFOSTATUS101 testdata/ecs/job-template.json
-ecs_api_idc_get_job_status 200 job101 ENABLED
+ecs_api_idc_get_job_status2 200 job101 ENABLED 1 prod-ia
prodstub_equal create/prod-ia/job101 1
@@ -1279,7 +1279,7 @@
ecs_api_idc_get_job 200 job102 type101 $TARGET102 info-owner-2 $INFOSTATUS102 testdata/ecs/job-template.json
-ecs_api_idc_get_job_status 200 job102 ENABLED
+ecs_api_idc_get_job_status2 200 job102 ENABLED 1 prod-ia
prodstub_equal create/prod-ia/job102 1
@@ -1325,7 +1325,7 @@
ecs_api_idc_get_job 200 job103 type102 $TARGET103 info-owner-3 $INFOSTATUS103 testdata/ecs/job-template.json
-ecs_api_idc_get_job_status 200 job103 ENABLED
+ecs_api_idc_get_job_status2 200 job103 ENABLED 1 prod-ib
ecs_api_edp_get_producer_jobs_2 200 prod-ia job101 type101 $TARGET101 info-owner-1 testdata/ecs/job-template.json job102 type101 $TARGET102 info-owner-2 testdata/ecs/job-template.json
ecs_api_edp_get_producer_jobs_2 200 prod-ib job103 type102 $TARGET103 info-owner-3 testdata/ecs/job-template.json
@@ -1363,7 +1363,7 @@
prodstub_equal delete/prod-ib/job103 1
ecs_api_idc_put_job 201 job103 type102 $TARGET103 info-owner-3 $INFOSTATUS103 testdata/ecs/job-template.json VALIDATE
-ecs_api_idc_get_job_status 200 job103 DISABLED
+ecs_api_idc_get_job_status2 200 job103 DISABLED EMPTYPROD
# Put producer then job
ecs_api_edp_put_producer_2 201 prod-ib $CB_JOB/prod-ib $CB_SV/prod-ib type102
@@ -1371,7 +1371,7 @@
ecs_api_edp_get_producer_status 200 prod-ib ENABLED
ecs_api_idc_put_job 200 job103 type102 $TARGET103 info-owner-3 $INFOSTATUS103 testdata/ecs/job-template2.json VALIDATE
-ecs_api_idc_get_job_status 200 job103 ENABLED
+ecs_api_idc_get_job_status2 200 job103 ENABLED 1 prod-ib
prodstub_check_jobdata_3 200 prod-ib job103 type102 $TARGET103 info-owner-3 testdata/ecs/job-template2.json
@@ -1389,7 +1389,7 @@
ecs_api_idc_get_job_ids 200 NOTYPE NOWNER job101 job102 job103 job1 job2 job3 job8 job10
ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ia prod-ic prod-b prod-c prod-d prod-e
-ecs_api_idc_get_job_status 200 job103 DISABLED
+ecs_api_idc_get_job_status2 200 job103 DISABLED EMPTYPROD
cr_equal received_callbacks 7 30
cr_equal received_callbacks?id=info-job103-status 1
@@ -1400,7 +1400,7 @@
ecs_api_edp_get_producer_status 200 prod-ib ENABLED
-ecs_api_idc_get_job_status 200 job103 ENABLED
+ecs_api_idc_get_job_status2 200 job103 ENABLED 1 prod-ib
cr_equal received_callbacks 8 30
cr_equal received_callbacks?id=info-job103-status 2
@@ -1423,7 +1423,7 @@
ecs_api_idc_get_job_ids 200 type104 NOWNER job108
-ecs_api_idc_get_job_status 200 job108 ENABLED
+ecs_api_idc_get_job_status2 200 job108 ENABLED 1 prod-id
# Re-PUT the producer with zero types
ecs_api_edp_put_producer_2 200 prod-id $CB_JOB/prod-id $CB_SV/prod-id NOTYPE
@@ -1431,7 +1431,7 @@
ecs_api_idc_get_job_ids 200 type104 NOWNER job108
ecs_api_idc_get_job_ids 200 NOTYPE NOWNER job101 job102 job103 job108 job1 job2 job3 job8 job10
-ecs_api_idc_get_job_status 200 job108 DISABLED
+ecs_api_idc_get_job_status2 200 job108 DISABLED EMPTYPROD
cr_equal received_callbacks 9 30
cr_equal received_callbacks?id=info-job108-status 1
@@ -1447,7 +1447,7 @@
ecs_api_idc_get_job_ids 200 type104 NOWNER job108
ecs_api_idc_get_job_ids 200 NOTYPE NOWNER job101 job102 job103 job108 job1 job2 job3 job8 job10
-ecs_api_idc_get_job_status 200 job108 ENABLED
+ecs_api_idc_get_job_status2 200 job108 ENABLED 1 prod-id
ecs_api_edp_get_producer_status 200 prod-ia ENABLED
ecs_api_edp_get_producer_status 200 prod-ib ENABLED
@@ -1477,7 +1477,7 @@
ecs_api_idc_get_job_ids 200 type106 NOWNER job110
-ecs_api_idc_get_job_status 200 job110 ENABLED
+ecs_api_idc_get_job_status2 200 job110 ENABLED 1 prod-ie
## Setup prod-if
ecs_api_edp_put_type_2 200 type106 testdata/ecs/info-type-6.json
@@ -1492,7 +1492,7 @@
ecs_api_idc_get_job_ids 200 type106 NOWNER job110
-ecs_api_idc_get_job_status 200 job110 ENABLED
+ecs_api_idc_get_job_status2 200 job110 ENABLED 2 prod-ie prod-if
## Status updates prod-ia and jobs
@@ -1521,11 +1521,11 @@
ecs_api_edp_get_producer_status 200 prod-if ENABLED
-ecs_api_idc_get_job_status 200 job101 ENABLED
-ecs_api_idc_get_job_status 200 job102 ENABLED
-ecs_api_idc_get_job_status 200 job103 ENABLED
-ecs_api_idc_get_job_status 200 job108 ENABLED
-ecs_api_idc_get_job_status 200 job110 ENABLED
+ecs_api_idc_get_job_status2 200 job101 ENABLED 1 prod-ia
+ecs_api_idc_get_job_status2 200 job102 ENABLED 1 prod-ia
+ecs_api_idc_get_job_status2 200 job103 ENABLED 1 prod-ib
+ecs_api_idc_get_job_status2 200 job108 ENABLED 1 prod-id
+ecs_api_idc_get_job_status2 200 job110 ENABLED 2 prod-ie prod-if
# Arm producer prod-ia for supervision
prodstub_arm_producer 200 prod-ia 200
@@ -1542,11 +1542,11 @@
ecs_api_edp_get_producer_status 200 prod-ie ENABLED
ecs_api_edp_get_producer_status 200 prod-if ENABLED
-ecs_api_idc_get_job_status 200 job101 ENABLED
-ecs_api_idc_get_job_status 200 job102 ENABLED
-ecs_api_idc_get_job_status 200 job103 ENABLED
-ecs_api_idc_get_job_status 200 job108 ENABLED
-ecs_api_idc_get_job_status 200 job110 ENABLED
+ecs_api_idc_get_job_status2 200 job101 ENABLED 1 prod-ia
+ecs_api_idc_get_job_status2 200 job102 ENABLED 1 prod-ia
+ecs_api_idc_get_job_status2 200 job103 ENABLED 1 prod-ib
+ecs_api_idc_get_job_status2 200 job108 ENABLED 1 prod-id
+ecs_api_idc_get_job_status2 200 job110 ENABLED 2 prod-ie prod-if
# Arm producer prod-ia for supervision failure
prodstub_arm_producer 200 prod-ia 400
@@ -1563,11 +1563,11 @@
ecs_api_edp_get_producer_status 200 prod-ie ENABLED
ecs_api_edp_get_producer_status 200 prod-if ENABLED
-ecs_api_idc_get_job_status 200 job101 ENABLED
-ecs_api_idc_get_job_status 200 job102 ENABLED
-ecs_api_idc_get_job_status 200 job103 ENABLED
-ecs_api_idc_get_job_status 200 job108 ENABLED
-ecs_api_idc_get_job_status 200 job110 ENABLED
+ecs_api_idc_get_job_status2 200 job101 ENABLED 1 prod-ia
+ecs_api_idc_get_job_status2 200 job102 ENABLED 1 prod-ia
+ecs_api_idc_get_job_status2 200 job103 ENABLED 1 prod-ib
+ecs_api_idc_get_job_status2 200 job108 ENABLED 1 prod-id
+ecs_api_idc_get_job_status2 200 job110 ENABLED 2 prod-ie prod-if
# Wait for producer prod-ia to be removed
if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
@@ -1586,11 +1586,11 @@
ecs_api_edp_get_producer_status 200 prod-ie ENABLED
ecs_api_edp_get_producer_status 200 prod-if ENABLED
-ecs_api_idc_get_job_status 200 job101 DISABLED
-ecs_api_idc_get_job_status 200 job102 DISABLED
-ecs_api_idc_get_job_status 200 job103 ENABLED
-ecs_api_idc_get_job_status 200 job108 ENABLED
-ecs_api_idc_get_job_status 200 job110 ENABLED
+ecs_api_idc_get_job_status2 200 job101 DISABLED EMPTYPROD
+ecs_api_idc_get_job_status2 200 job102 DISABLED EMPTYPROD
+ecs_api_idc_get_job_status2 200 job103 ENABLED 1 prod-ib
+ecs_api_idc_get_job_status2 200 job108 ENABLED 1 prod-id
+ecs_api_idc_get_job_status2 200 job110 ENABLED 2 prod-ie prod-if
cr_equal received_callbacks 12 30
cr_equal received_callbacks?id=info-job101-status 1
@@ -1614,11 +1614,11 @@
ecs_api_edp_get_producer_status 200 prod-ie DISABLED
ecs_api_edp_get_producer_status 200 prod-if ENABLED
-ecs_api_idc_get_job_status 200 job101 DISABLED
-ecs_api_idc_get_job_status 200 job102 DISABLED
-ecs_api_idc_get_job_status 200 job103 ENABLED
-ecs_api_idc_get_job_status 200 job108 ENABLED
-ecs_api_idc_get_job_status 200 job110 ENABLED
+ecs_api_idc_get_job_status2 200 job101 DISABLED EMPTYPROD
+ecs_api_idc_get_job_status2 200 job102 DISABLED EMPTYPROD
+ecs_api_idc_get_job_status2 200 job103 ENABLED 1 prod-ib
+ecs_api_idc_get_job_status2 200 job108 ENABLED 1 prod-id
+ecs_api_idc_get_job_status2 200 job110 ENABLED 2 prod-ie prod-if
#Disable create for job110 in prod-ie
prodstub_arm_job_create 200 prod-ie job110 400
@@ -1657,11 +1657,11 @@
ecs_api_edp_get_producer_status 200 prod-ie ENABLED
ecs_api_edp_get_producer_status 404 prod-if
-ecs_api_idc_get_job_status 200 job101 DISABLED
-ecs_api_idc_get_job_status 200 job102 DISABLED
-ecs_api_idc_get_job_status 200 job103 ENABLED
-ecs_api_idc_get_job_status 200 job108 ENABLED
-ecs_api_idc_get_job_status 200 job110 ENABLED
+ecs_api_idc_get_job_status2 200 job101 DISABLED EMPTYPROD
+ecs_api_idc_get_job_status2 200 job102 DISABLED EMPTYPROD
+ecs_api_idc_get_job_status2 200 job103 ENABLED 1 prod-ib
+ecs_api_idc_get_job_status2 200 job108 ENABLED 1 prod-id
+ecs_api_idc_get_job_status2 200 job110 ENABLED 1 prod-ie
cr_equal received_callbacks 12
@@ -1671,8 +1671,8 @@
ecs_api_idc_put_job 404 job150 type150 $TARGET150 info-owner-1 $INFOSTATUS150 testdata/ecs/job-template.json VALIDATE
ecs_api_idc_put_job 201 job160 type160 $TARGET160 info-owner-1 $INFOSTATUS160 testdata/ecs/job-template.json
-ecs_api_idc_get_job_status 404 job150
-ecs_api_idc_get_job_status 200 job160 DISABLED 60
+ecs_api_idc_get_job_status2 404 job150
+ecs_api_idc_get_job_status2 200 job160 DISABLED EMPTYPROD 60
prodstub_arm_producer 200 prod-ig
prodstub_arm_job_create 200 prod-ig job150
@@ -1683,8 +1683,8 @@
ecs_api_edp_get_producer_2 200 prod-ig $CB_JOB/prod-ig $CB_SV/prod-ig EMPTY
-ecs_api_idc_get_job_status 404 job150
-ecs_api_idc_get_job_status 200 job160 DISABLED 60
+ecs_api_idc_get_job_status2 404 job150
+ecs_api_idc_get_job_status2 200 job160 DISABLED EMPTYPROD 60
prodstub_arm_type 200 prod-ig type160
@@ -1697,8 +1697,8 @@
ecs_api_idc_put_job 404 job150 type150 $TARGET150 info-owner-1 $INFOSTATUS150 testdata/ecs/job-template.json VALIDATE
-ecs_api_idc_get_job_status 404 job150
-ecs_api_idc_get_job_status 200 job160 ENABLED 60
+ecs_api_idc_get_job_status2 404 job150
+ecs_api_idc_get_job_status2 200 job160 ENABLED 1 prod-ig 60
prodstub_check_jobdata_3 200 prod-ig job160 type160 $TARGET160 info-owner-1 testdata/ecs/job-template.json
@@ -1715,13 +1715,13 @@
ecs_api_edp_get_producer_2 200 prod-ig $CB_JOB/prod-ig $CB_SV/prod-ig type160 type150
-ecs_api_idc_get_job_status 404 job150
-ecs_api_idc_get_job_status 200 job160 ENABLED
+ecs_api_idc_get_job_status2 404 job150
+ecs_api_idc_get_job_status2 200 job160 ENABLED 1 prod-ig
ecs_api_idc_put_job 201 job150 type150 $TARGET150 info-owner-1 $INFOSTATUS150 testdata/ecs/job-template.json VALIDATE
-ecs_api_idc_get_job_status 200 job150 ENABLED 60
-ecs_api_idc_get_job_status 200 job160 ENABLED
+ecs_api_idc_get_job_status2 200 job150 ENABLED 1 prod-ig 60
+ecs_api_idc_get_job_status2 200 job160 ENABLED 1 prod-ig
cr_equal received_callbacks 12
diff --git a/test/auto-test/FTC1800.sh b/test/auto-test/FTC1800.sh
index fd50bc9..cbb7870 100755
--- a/test/auto-test/FTC1800.sh
+++ b/test/auto-test/FTC1800.sh
@@ -82,7 +82,6 @@
TARGET="http://localhost:80/target" # Dummy target
NUM_JOBS=10000
-
use_info_jobs=false #Set flag if interface supporting info-types is used
if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
use_info_jobs=true
@@ -236,7 +235,7 @@
fi
if [ $use_info_jobs ]; then
ecs_api_idc_put_job 201 job$(($i+$NUM_JOBS)) type101 $TARGET info-owner $CR_SERVICE_PATH/job_status_info-owner testdata/ecs/job-template.json VALIDATE
- ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120
+ ecs_api_idc_get_job_status2 200 job$(($i+$NUM_JOBS)) ENABLED 3 prod-a prod-b prod-c 120
fi
fi
if [ $(($i%5)) -eq 1 ]; then
@@ -248,7 +247,7 @@
fi
if [ $use_info_jobs ]; then
ecs_api_idc_put_job 201 job$(($i+$NUM_JOBS)) type102 $TARGET info-owner $CR_SERVICE_PATH/job_status_info-owner testdata/ecs/job-template.json VALIDATE
- ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120
+ ecs_api_idc_get_job_status2 200 job$(($i+$NUM_JOBS)) ENABLED 2 prod-b prod-c 120
fi
fi
if [ $(($i%5)) -eq 2 ]; then
@@ -260,7 +259,7 @@
fi
if [ $use_info_jobs ]; then
ecs_api_idc_put_job 201 job$(($i+$NUM_JOBS)) type103 $TARGET info-owner $CR_SERVICE_PATH/job_status_info-owner testdata/ecs/job-template.json VALIDATE
- ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120
+ ecs_api_idc_get_job_status2 200 job$(($i+$NUM_JOBS)) ENABLED 1 prod-c 120
fi
fi
if [ $(($i%5)) -eq 3 ]; then
@@ -272,7 +271,7 @@
fi
if [ $use_info_jobs ]; then
ecs_api_idc_put_job 201 job$(($i+$NUM_JOBS)) type104 $TARGET info-owner $CR_SERVICE_PATH/job_status_info-owner testdata/ecs/job-template.json VALIDATE
- ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120
+ ecs_api_idc_get_job_status2 200 job$(($i+$NUM_JOBS)) ENABLED 1 prod-d 120
fi
fi
if [ $(($i%5)) -eq 4 ]; then
@@ -284,7 +283,7 @@
fi
if [ $use_info_jobs ]; then
ecs_api_idc_put_job 201 job$(($i+$NUM_JOBS)) type105 $TARGET info-owner $CR_SERVICE_PATH/job_status_info-owner testdata/ecs/job-template.json VALIDATE
- ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120
+ ecs_api_idc_get_job_status2 200 job$(($i+$NUM_JOBS)) ENABLED 1 prod-d 120
fi
fi
done
@@ -370,7 +369,7 @@
ecs_api_a1_get_job_status 200 job$i DISABLED 120
fi
if [ $use_info_jobs ]; then
- ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) DISABLED 120
+ ecs_api_idc_get_job_status2 200 job$(($i+$NUM_JOBS)) DISABLED EMPTYPROD 120
fi
fi
if [ $(($i%5)) -eq 1 ]; then
@@ -380,7 +379,7 @@
ecs_api_a1_get_job_status 200 job$i DISABLED 120
fi
if [ $use_info_jobs ]; then
- ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) DISABLED 120
+ ecs_api_idc_get_job_status2 200 job$(($i+$NUM_JOBS)) DISABLED EMPTYPROD 120
fi
fi
if [ $(($i%5)) -eq 2 ]; then
@@ -390,7 +389,7 @@
ecs_api_a1_get_job_status 200 job$i DISABLED 120
fi
if [ $use_info_jobs ]; then
- ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) DISABLED 120
+ ecs_api_idc_get_job_status2 200 job$(($i+$NUM_JOBS)) DISABLED EMPTYPROD 120
fi
fi
if [ $(($i%5)) -eq 3 ]; then
@@ -400,7 +399,7 @@
ecs_api_a1_get_job_status 200 job$i DISABLED 120
fi
if [ $use_info_jobs ]; then
- ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) DISABLED 120
+ ecs_api_idc_get_job_status2 200 job$(($i+$NUM_JOBS)) DISABLED EMPTYPROD 120
fi
fi
if [ $(($i%5)) -eq 4 ]; then
@@ -410,7 +409,7 @@
ecs_api_a1_get_job_status 200 job$i DISABLED 120
fi
if [ $use_info_jobs ]; then
- ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) DISABLED 120
+ ecs_api_idc_get_job_status2 200 job$(($i+$NUM_JOBS)) DISABLED EMPTYPROD 120
fi
fi
done
@@ -466,7 +465,7 @@
ecs_api_a1_get_job_status 200 job$i ENABLED 120
fi
if [ $use_info_jobs ]; then
- ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120
+ ecs_api_idc_get_job_status2 200 job$(($i+$NUM_JOBS)) ENABLED 3 prod-a prod-b prod-c 120
fi
fi
if [ $(($i%5)) -eq 1 ]; then
@@ -476,7 +475,7 @@
ecs_api_a1_get_job_status 200 job$i ENABLED 120
fi
if [ $use_info_jobs ]; then
- ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120
+ ecs_api_idc_get_job_status2 200 job$(($i+$NUM_JOBS)) ENABLED 2 prod-b prod-c 120
fi
fi
if [ $(($i%5)) -eq 2 ]; then
@@ -486,7 +485,7 @@
ecs_api_a1_get_job_status 200 job$i ENABLED 120
fi
if [ $use_info_jobs ]; then
- ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120
+ ecs_api_idc_get_job_status2 200 job$(($i+$NUM_JOBS)) ENABLED 1 prod-c 120
fi
fi
if [ $(($i%5)) -eq 3 ]; then
@@ -496,7 +495,7 @@
ecs_api_a1_get_job_status 200 job$i ENABLED 120
fi
if [ $use_info_jobs ]; then
- ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120
+ ecs_api_idc_get_job_status2 200 job$(($i+$NUM_JOBS)) ENABLED 1 prod-d 120
fi
fi
if [ $(($i%5)) -eq 4 ]; then
@@ -506,7 +505,7 @@
ecs_api_a1_get_job_status 200 job$i ENABLED 120
fi
if [ $use_info_jobs ]; then
- ecs_api_idc_get_job_status 200 job$(($i+$NUM_JOBS)) ENABLED 120
+ ecs_api_idc_get_job_status2 200 job$(($i+$NUM_JOBS)) ENABLED 1 prod-d 120
fi
fi
done
diff --git a/test/common/README.md b/test/common/README.md
index 4edfcbb..a267a49 100644
--- a/test/common/README.md
+++ b/test/common/README.md
@@ -1626,20 +1626,40 @@
## Function: ecs_api_idc_get_job_status() ##
-Test of GET '/data-consumer/v1/info-jobs/{infoJobId}/status' and optional check of the returned status.
-To test the response code only, provide the response code, type id and job id.
+Test of GET '/data-consumer/v1/info-jobs/{infoJobId}/status' and optional check of the returned status and timeout.
+To test the response code only, provide the response code and job id.
To also test the response payload add the expected status.
| arg list |
|--|
-| `<response-code> <type-id> <job-id> [<status>]` |
+| `<response-code> <job-id> [<status> [ <timeout>]]` |
| parameter | description |
| --------- | ----------- |
| `<response-code>` | Expected http response code |
-| `<type-id>` | Id of the Info type |
| `<job-id>` | Id of the job |
| `<status>` | Expected status |
+| `<timeout>` | Timeout |
+
+## Function: ecs_api_idc_get_job_status2() ##
+
+Test of GET '/data-consumer/v1/info-jobs/{infoJobId}/status' with returned producers and optional check of the returned status and timeout.
+To test the response code only, provide the response code and job id.
+To also test the response payload add the expected status.
+
+| arg list |
+|--|
+| `<response-code> <job-id> [<status> EMPTYPROD|( <prod-count> <producer-id>+ ) [<timeout>]]` |
+
+| parameter | description |
+| --------- | ----------- |
+| `<response-code>` | Expected http response code |
+| `<job-id>` | Id of the job |
+| `<status>` | Expected status |
+| `<EMPTYPROD>` | Indicated for empty list of producer |
+| `<prod-count>` | Number of expected producer |
+| `<producer-id>` |Id of the producer |
+| `<timeout>` | Timeout |
## Function: ecs_api_admin_reset() ##
diff --git a/test/common/ecs_api_functions.sh b/test/common/ecs_api_functions.sh
index 36b1f43..5ad1b98 100644
--- a/test/common/ecs_api_functions.sh
+++ b/test/common/ecs_api_functions.sh
@@ -2059,6 +2059,7 @@
}
# API Test function: GET /data-consumer/v1/info-jobs/{infoJobId}/status
+# This test only status during an optional timeout. No test of the list of producers
# args: <response-code> <job-id> [<status> [<timeout>]]
# (Function for test scripts)
ecs_api_idc_get_job_status() {
@@ -2123,6 +2124,103 @@
return 0
}
+# API Test function: GET /data-consumer/v1/info-jobs/{infoJobId}/status
+# This function test status and the list of producers with and optional timeout
+# args: <response-code> <job-id> [<status> EMPTYPROD|( <prod-count> <producer-id>+ ) [<timeout>]]
+# (Function for test scripts)
+ecs_api_idc_get_job_status2() {
+
+ __log_test_start $@
+ param_error=0
+ if [ $# -lt 2 ]; then
+ param_error=1
+ fi
+ args=("$@")
+ timeout=0
+ if [ $# -gt 2 ]; then
+ if [ $# -lt 4 ]; then
+ param_error=1
+ fi
+ targetJson="{\"info_job_status\": \"$3\""
+ if [ "$4" == "EMPTYPROD" ]; then
+ targetJson=$targetJson",\"producers\": []}"
+ if [ $# -gt 4 ]; then
+ timeout=$5
+ fi
+ else
+ targetJson=$targetJson",\"producers\": ["
+ if [ $# -eq $(($4+5)) ]; then
+ idx=$(($4+4))
+ timeout=${args[$idx]}
+ fi
+ for ((ecs_i = 0 ; ecs_i < $4 ; ecs_i++)); do
+ idx=$(($ecs_i+4))
+ if [ $ecs_i -gt 0 ]; then
+ targetJson=$targetJson","
+ fi
+ targetJson=$targetJson"\""${args[$idx]}"\""
+ done
+ targetJson=$targetJson"]}"
+ fi
+ fi
+
+ if [ $param_error -ne 0 ]; then
+ __print_err "<response-code> <job-id> [<status> EMPTYPROD|( <prod-count> <producer-id>+ ) [<timeout>]]" $@
+ return 1
+ fi
+
+ query="/data-consumer/v1/info-jobs/$2/status"
+
+ start=$SECONDS
+ for (( ; ; )); do
+ res="$(__do_curl_to_api ECS GET $query)"
+ status=${res:${#res}-3}
+
+ if [ $# -gt 2 ]; then
+ duration=$((SECONDS-start))
+ echo -ne " Response=${status} after ${duration} seconds, waiting for ${3} ${SAMELINE}"
+ if [ $duration -gt $timeout ]; then
+ echo ""
+ duration=-1 #Last iteration
+ fi
+ else
+ duration=-1 #single test, no wait
+ fi
+
+ if [ $status -ne $1 ]; then
+ if [ $duration -eq -1 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
+ fi
+ if [ $# -gt 2 ] && [ $status -eq $1 ]; then
+ body=${res:0:${#res}-3}
+ echo " TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+ 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
+
+ __log_test_pass
+ return 0
+}
##########################################
#### Reset jobs ####
diff --git a/test/usecases/oruclosedlooprecovery/scriptversion/app/main.py b/test/usecases/oruclosedlooprecovery/scriptversion/app/main.py
index efd45e7..8f5b244 100644
--- a/test/usecases/oruclosedlooprecovery/scriptversion/app/main.py
+++ b/test/usecases/oruclosedlooprecovery/scriptversion/app/main.py
@@ -61,18 +61,21 @@
return link_failure_clear
-def handle_link_failure(message, o_ru_to_o_du_map, sdnr_address):
+def handle_link_failure(message, o_ru_to_o_du_map, sdnr_address, sdnr_user, sdnr_pwd):
verboseprint("Got a link failure: ")
alarm_msg_as_json = json.loads(message)
event_headers = alarm_msg_as_json["event"]["commonEventHeader"]
o_ru_id = event_headers["sourceName"]
verboseprint("O-RU ID: " + o_ru_id)
- o_du_id = o_ru_to_o_du_map[o_ru_id]
- verboseprint("O-DU ID: " + o_du_id)
- unlock_msg = json.loads(json.dumps(UNLOCK_MESSAGE))
- unlock_msg["o-ran-sc-du-hello-world:du-to-ru-connection"][0]["name"] = o_ru_id
- send_path = SDNR_PATH.replace("[O-DU-ID]", o_du_id).replace("[O-RU-ID]", o_ru_id)
- requests.post(sdnr_address + send_path, json=unlock_msg)
+ if o_ru_id in o_ru_to_o_du_map:
+ o_du_id = o_ru_to_o_du_map[o_ru_id]
+ verboseprint("O-DU ID: " + o_du_id)
+ unlock_msg = json.loads(json.dumps(UNLOCK_MESSAGE))
+ unlock_msg["o-ran-sc-du-hello-world:du-to-ru-connection"][0]["name"] = o_ru_id
+ send_path = SDNR_PATH.replace("[O-DU-ID]", o_du_id).replace("[O-RU-ID]", o_ru_id)
+ requests.put(sdnr_address + send_path, auth=(sdnr_user, sdnr_pwd), json=unlock_msg)
+ else:
+ print("ERROR: No mapping for O-RU ID: " + o_ru_id)
def handle_clear_link_failure(message):
@@ -90,7 +93,7 @@
return dictionary
-def poll_and_handle_messages(mr_address, sdnr_address):
+def poll_and_handle_messages(mr_address, sdnr_address, sdnr_user, sdnr_pwd):
while True:
try:
verboseprint("Polling")
@@ -98,7 +101,7 @@
messages = response.json()
for message in messages:
if (is_message_new_link_failure(message)):
- handle_link_failure(message, o_ru_to_o_du_map, sdnr_address)
+ handle_link_failure(message, o_ru_to_o_du_map, sdnr_address, sdnr_user, sdnr_pwd)
elif (is_message_clear_link_failure(message)):
handle_clear_link_failure(message)
except Exception as inst:
@@ -114,6 +117,8 @@
parser.add_argument('--mrTopic', help='The topic to poll messages from (default: %(default)s)', default="unauthenticated.SEC_FAULT_OUTPUT")
parser.add_argument('--sdnrHost', help='The URL of the SNDR host (default: %(default)s)', default="http://localhost")
parser.add_argument('--sdnrPort', help='The port of the SDNR host (default: %(default)d)', type=int, default=9990)
+ parser.add_argument('--sdnrUser', help='Username for SDNR', default="admin")
+ parser.add_argument('--sdnrPwd', help='Password for SDNR', default="Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U")
parser.add_argument('--oRuTooDuMapFile', help='A file with the mapping between O-RU ID and O-DU ID as a dictionary (default: %(default)s)', default="o-ru-to-o-du-map.txt")
parser.add_argument('--pollTime', help='The time between polls (default: %(default)d)', type=int, default=10)
parser.add_argument('-v', '--verbose', action='store_true', help='Turn on verbose printing')
@@ -136,6 +141,14 @@
if os.getenv("SDNR-PORT") is not None:
sdnr_port = os.getenv("SDNR-PORT")
print("Using SNDR Host from os: " + sdnr_port)
+ sdnr_user = args["sdnrUser"]
+ if os.getenv("SDNR-USER") is not None:
+ sdnr_user = os.getenv("SDNR-USER")
+ print("Using SNDR User from os: " + sdnr_user)
+ sdnr_pwd = args["sdnrPwd"]
+ if os.getenv("SDNR-PWD") is not None:
+ sdnr_pwd = os.getenv("SDNR-PWD")
+ print("Using SNDR Password from os: " + sdnr_pwd)
o_ru_to_o_du_map = read_o_ru_to_o_du_map_from_file(args["oRuTooDuMapFile"])
pollTime = args["pollTime"]
@@ -153,4 +166,4 @@
mr_address = mr_host + ":" + str(mr_port) + MR_PATH.replace("[TOPIC]", mr_topic)
sdnr_address = sdnr_host + ":" + str(sdnr_port)
- poll_and_handle_messages(mr_address, sdnr_address)
+ poll_and_handle_messages(mr_address, sdnr_address, sdnr_user, sdnr_pwd)
diff --git a/test/usecases/oruclosedlooprecovery/scriptversion/simulators/requirements.txt b/test/usecases/oruclosedlooprecovery/scriptversion/simulators/requirements.txt
index 0f4960e..589d97a 100644
--- a/test/usecases/oruclosedlooprecovery/scriptversion/simulators/requirements.txt
+++ b/test/usecases/oruclosedlooprecovery/scriptversion/simulators/requirements.txt
@@ -2,6 +2,7 @@
chardet==4.0.0
click==7.1.2
Flask==1.1.2
+Flask-HTTPAuth==4.4.0
idna==2.10
itsdangerous==1.1.0
Jinja2==2.11.3
diff --git a/test/usecases/oruclosedlooprecovery/scriptversion/simulators/sdnr_simulator.py b/test/usecases/oruclosedlooprecovery/scriptversion/simulators/sdnr_simulator.py
index 888fad6..535c3ee 100644
--- a/test/usecases/oruclosedlooprecovery/scriptversion/simulators/sdnr_simulator.py
+++ b/test/usecases/oruclosedlooprecovery/scriptversion/simulators/sdnr_simulator.py
@@ -18,6 +18,7 @@
from flask import Flask
from flask import Response
+from flask_httpauth import HTTPBasicAuth
import json
import os
import random
@@ -29,6 +30,7 @@
# Stores the ID of the O-DU and randomly, after between 0 and 10 seconds, sends an Alarm Notification that clears the
# "CUS Link Failure" alarm event to MR.
app = Flask(__name__)
+auth = HTTPBasicAuth()
mr_host = "http://localhost"
mr_port = "3904"
@@ -39,6 +41,9 @@
HOST_PORT = 9990
APP_URL = "/rests/data/network-topology:network-topology/topology=topology-netconf/node=<string:o_du_id>/yang-ext:mount/o-ran-sc-du-hello-world:network-function/du-to-ru-connection=<string:o_ru_id>"
+USERNAME = "admin"
+PASSWORD = "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"
+
FAULT_ID = "28"
linkFailureMessage = {
@@ -104,8 +109,15 @@
return 'OK', 200
+@auth.verify_password
+def verify_password(username, password):
+ if username == USERNAME and password == PASSWORD:
+ return username
+
+
@app.route(APP_URL,
- methods=['POST'])
+ methods=['PUT'])
+@auth.login_required
def sendrequest(o_du_id, o_ru_id):
print("Got request with O-DU ID: " + o_du_id + " and O-RU ID: " + o_ru_id)
random_time = int(10 * random.random())