Alinged tests of producer info - including owner 99/5199/1
authorBjornMagnussonXA <bjorn.magnusson@est.tech>
Mon, 30 Nov 2020 20:17:32 +0000 (21:17 +0100)
committerBjornMagnussonXA <bjorn.magnusson@est.tech>
Mon, 30 Nov 2020 20:17:42 +0000 (21:17 +0100)
Only function test impacted by this change - no impact on delivered images

Issue-ID: NONRTRIC-173

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

test/auto-test/FTC1100.sh
test/auto-test/FTC1800.sh
test/auto-test/PM_EI_DEMO.sh
test/common/README.md
test/common/ecs_api_functions.sh
test/common/prodstub_api_functions.sh

index 9921108..4672cb2 100755 (executable)
@@ -219,7 +219,7 @@ else
 fi
 
 # Check the job data in the producer
-prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 testdata/ecs/job-template.json
+prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
 
 ecs_api_a1_get_job_ids 200 type1 NOWNER job1
 ecs_api_a1_get_job_ids 200 type1 ricsim_g3_1 job1
@@ -240,7 +240,7 @@ fi
 
 prodstub_equal create/prod-a/job1 1
 
-ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 testdata/ecs/job-template.json
+ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
 
 ## Create a second job for prod-a
 ## job2 - prod-a
@@ -251,7 +251,7 @@ else
 fi
 
 # Check the job data in the producer
-prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 testdata/ecs/job-template.json
+prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
 
 ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
 ecs_api_a1_get_job_ids 200 type1 ricsim_g3_1 job1
@@ -272,7 +272,7 @@ fi
 
 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
+ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.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
@@ -309,7 +309,7 @@ fi
 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
+prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 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
@@ -327,8 +327,8 @@ else
     ecs_api_a1_get_job_status 200 job3 ENABLED
 fi
 
-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
+ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
+ecs_api_edp_get_producer_jobs 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
 
 
 ## Setup prod-c (no types)
@@ -387,7 +387,7 @@ else
     ecs_api_a1_get_job_status 200 job3 ENABLED
 fi
 
-prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 testdata/ecs/job-template2.json
+prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 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
@@ -428,7 +428,7 @@ cr_equal received_callbacks 2 30
 cr_equal received_callbacks?id=job3-status 2
 cr_api_check_all_ecs_events 200 job3-status ENABLED
 
-prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 testdata/ecs/job-template2.json
+prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json
 
 
 ## Setup prod-d
@@ -442,7 +442,7 @@ else
     ecs_api_a1_put_job 201 job8 type4 $TARGET8 ricsim_g3_4 $STATUS8 testdata/ecs/job-template.json
 fi
 
-prodstub_check_jobdata 200 prod-d job8 type4 $TARGET8 testdata/ecs/job-template.json
+prodstub_check_jobdata 200 prod-d job8 type4 $TARGET8 ricsim_g3_4 testdata/ecs/job-template.json
 
 prodstub_equal create/prod-d/job8 1
 prodstub_equal delete/prod-d/job8 0
@@ -518,7 +518,7 @@ else
     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_check_jobdata 200 prod-e job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template.json
 
 prodstub_equal create/prod-e/job10 1
 prodstub_equal delete/prod-e/job10 0
@@ -536,7 +536,7 @@ ecs_api_edp_put_producer 201 prod-f $CB_JOB/prod-f $CB_SV/prod-f type6 testdata/
 
 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_check_jobdata 200 prod-f job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template.json
 
 prodstub_equal create/prod-f/job10 1
 prodstub_equal delete/prod-f/job10 0
@@ -729,8 +729,8 @@ 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_check_jobdata 200 prod-e job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template2.json
+prodstub_check_jobdata 200 prod-f job10 type6 $TARGET10 ricsim_g3_4 testdata/ecs/job-template2.json
 
 prodstub_arm_producer 200 prod-f 400
 
index 048a011..caec939 100755 (executable)
@@ -312,22 +312,22 @@ 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
+        prodstub_check_jobdata 200 prod-a job$i type1 $TARGET ric1 testdata/ecs/job-template.json
+        prodstub_check_jobdata 200 prod-b job$i type1 $TARGET ric1 testdata/ecs/job-template.json
+        prodstub_check_jobdata 200 prod-c job$i type1 $TARGET ric1 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
+        prodstub_check_jobdata 200 prod-b job$i type2 $TARGET ric1 testdata/ecs/job-template.json
+        prodstub_check_jobdata 200 prod-c job$i type2 $TARGET ric1 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
+        prodstub_check_jobdata 200 prod-c job$i type3 $TARGET ric1 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
+        prodstub_check_jobdata 200 prod-d job$i type4 $TARGET ric1 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
+        prodstub_check_jobdata 200 prod-d job$i type5 $TARGET ric1 testdata/ecs/job-template.json
     fi
 done
 
index bb33025..2915b02 100755 (executable)
@@ -183,7 +183,7 @@ else
 fi
 
 # Check the job data in the producer
-prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 testdata/ecs/job-template.json
+prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
 
 
 ## Create a second job for prod-a
@@ -195,7 +195,7 @@ else
 fi
 
 # Check the job data in the producer
-prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 testdata/ecs/job-template.json
+prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
 
 
 
index a434ad8..21475c0 100644 (file)
@@ -1393,7 +1393,7 @@ To also test the response payload add the remaining parameters.
 
 | arg list |
 |--|
-| `<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <template-job-file>]+)` |
+| `<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)` |
 
 | parameter | description |
 | --------- | ----------- |
@@ -1402,6 +1402,7 @@ To also test the response payload add the remaining parameters.
 | `<job-id>` | Id of the job  |
 | `<type-id>` | Id of the EI type  |
 | `<target-url>` | Target url for data delivery  |
+| `<job-owner>` | Id of the job owner  |
 | `<template-job-file>` | Path to a job template file  |
 | `EMPTY` | The list of job/type/target/job-file tuples is empty  |
 
@@ -1489,7 +1490,7 @@ Check a job in the prodstub towards the list of provided parameters.
 
 | arg list |
 |--|
-| `<response-code> <producer-id> <job-id> <type-id> <target-url> <template-job-file>` |
+| `<response-code> <producer-id> <job-id> <type-id> <target-url> <job-owner> <template-job-file>` |
 
 | parameter | description |
 | --------- | ----------- |
@@ -1498,6 +1499,7 @@ Check a job in the prodstub towards the list of provided parameters.
 | `<job-id>` | Id of the job  |
 | `<type-id>` | Id of the type  |
 | `<target-url>` | Target url for data delivery  |
+| `<job-owner>` | Id of the job owner  |
 | `<template-job-file>` | Path to a job template file  |
 
 ## Function: prodstub_delete_jobdata() ##
index 56c2a2e..6c43173 100644 (file)
@@ -806,12 +806,12 @@ ecs_api_edp_put_producer() {
 }
 
 # API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/eijobs
-# args: <response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <template-job-file>]+)
+# args: <response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)
 # (Function for test scripts)
 ecs_api_edp_get_producer_jobs() {
        __log_test_start $@
 
-       #Valid number of parameter 2,3,6,10
+       #Valid number of parameter 2,3,7,11
        paramError=1
        if [ $# -eq 2 ]; then
                paramError=0
@@ -820,11 +820,11 @@ ecs_api_edp_get_producer_jobs() {
                paramError=0
        fi
        variablecount=$(($#-2))
-       if [ $# -gt 3 ] && [ $(($variablecount%4)) -eq 0 ]; then
+       if [ $# -gt 3 ] && [ $(($variablecount%5)) -eq 0 ]; then
                paramError=0
        fi
        if [ $paramError -eq 1 ]; then
-               __print_err "<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <template-job-file>]+)" $@
+               __print_err "<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)" $@
                return 1
        fi
 
@@ -840,18 +840,18 @@ ecs_api_edp_get_producer_jobs() {
                targetJson="["
                if [ $# -gt 3 ]; then
                        arr=(${@:3})
-                       for ((i=0; i<$(($#-3)); i=i+4)); do
+                       for ((i=0; i<$(($#-3)); i=i+5)); do
                                if [ "$targetJson" != "[" ]; then
                                        targetJson=$targetJson","
                                fi
-                               if [ -f ${arr[$i+3]} ]; then
-                                       jobfile=$(cat ${arr[$i+3]})
+                               if [ -f ${arr[$i+4]} ]; then
+                                       jobfile=$(cat ${arr[$i+4]})
                                        jobfile=$(echo "$jobfile" | sed "s/XXXX/${arr[$i]}/g")
                                else
-                                       _log_test_fail_general "Job template file "${arr[$i+3]}", does not exist"
+                                       _log_test_fail_general "Job template file "${arr[$i+4]}", 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}"
+                               targetJson=$targetJson"{\"ei_job_identity\":\"${arr[$i]}\",\"ei_type_identity\":\"${arr[$i+1]}\",\"target_uri\":\"${arr[$i+2]}\",\"owner\":\"${arr[$i+3]}\",\"ei_job_data\":$jobfile}"
                        done
                fi
                targetJson=$targetJson"]"
index f974df7..a27f3b4 100644 (file)
@@ -155,22 +155,22 @@ prodstub_disarm_type() {
 }
 
 # 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>
+# <response-code> <producer-id> <job-id> <type-id> <target-url> <job-owner> <template-job-file>
 # (Function for test scripts)
 prodstub_check_jobdata() {
        __log_test_start $@
-       if [ $# -ne 6 ]; then
-               __print_err "<response-code> <producer-id> <job-id> <type-id> <target-url> <template-job-file>" $@
+       if [ $# -ne 7 ]; then
+               __print_err "<response-code> <producer-id> <job-id> <type-id> <target-url> <job-owner> <template-job-file>" $@
                return 1
        fi
-    if [ -f $6 ]; then
-        jobfile=$(cat $6)
+    if [ -f $7 ]; then
+        jobfile=$(cat $7)
         jobfile=$(echo "$jobfile" | sed "s/XXXX/$3/g")
     else
-        _log_test_fail_general "Template file "$6" for jobdata, does not exist"
+        _log_test_fail_general "Template file "$7" for jobdata, does not exist"
         return 1
     fi
-    targetJson="{\"ei_job_identity\":\"$3\",\"ei_type_identity\":\"$4\",\"target_uri\":\"$5\",\"ei_job_data\":$jobfile}"
+    targetJson="{\"ei_job_identity\":\"$3\",\"ei_type_identity\":\"$4\",\"target_uri\":\"$5\",\"owner\":\"$6\", \"ei_job_data\":$jobfile}"
     file="./tmp/.p.json"
        echo "$targetJson" > $file