From 3cc0b58e9a786f619af2af318ef2028179ed2dab Mon Sep 17 00:00:00 2001 From: BjornMagnussonXA Date: Mon, 30 Aug 2021 10:46:41 +0200 Subject: [PATCH] Added function test of ecs type subscriptions Corrected image tag for Rapp Catalogue in d-release test Issue-ID: NONRTRIC-573 Signed-off-by: BjornMagnussonXA Change-Id: I5fb935a04fac94085672ca9d1bc162e0e30ba875 --- test/auto-test/FTC1100.sh | 307 ++++++++++++++++++++++++++++----- test/auto-test/FTC1800.sh | 53 ++++++ test/auto-test/FTC2001.sh | 19 ++ test/common/README.md | 100 +++++++++++ test/common/cr_api_functions.sh | 84 +++++++++ test/common/ecs_api_functions.sh | 156 ++++++++++++++++- test/common/test_env-oran-d-release.sh | 8 +- test/common/test_env-oran-e-release.sh | 2 +- test/common/testcase_common.sh | 7 +- 9 files changed, 683 insertions(+), 53 deletions(-) diff --git a/test/auto-test/FTC1100.sh b/test/auto-test/FTC1100.sh index cbad2710..b6a2abb8 100755 --- a/test/auto-test/FTC1100.sh +++ b/test/auto-test/FTC1100.sh @@ -127,6 +127,76 @@ INFOSTATUS110="$CR_SERVICE_PATH/info-job110-status" INFOSTATUS150="$CR_SERVICE_PATH/info-job150-status" INFOSTATUS160="$CR_SERVICE_PATH/info-job160-status" +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + #Type registration status callbacks + TYPESTATUS1="$CR_SERVICE_PATH/type-status1" + TYPESTATUS2="$CR_SERVICE_PATH/type-status2" + + ecs_api_idc_put_subscription 201 subscription-id-1 owner1 $TYPESTATUS1 + + ecs_api_idc_get_subscription_ids 200 NOOWNER subscription-id-1 + + ecs_api_idc_get_subscription_ids 200 owner1 subscription-id-1 + + ecs_api_idc_get_subscription_ids 200 test EMPTY + + ecs_api_idc_get_subscription 200 subscription-id-1 owner1 $TYPESTATUS1 + + ecs_api_idc_get_subscription 404 test + + ecs_api_idc_put_subscription 200 subscription-id-1 owner1 $TYPESTATUS1 + + ecs_api_idc_put_subscription 200 subscription-id-1 owner1 $TYPESTATUS1 + + ecs_api_idc_put_subscription 201 subscription-id-2 owner2 $TYPESTATUS2 + + ecs_api_idc_get_subscription_ids 200 NOOWNER subscription-id-1 subscription-id-2 + + ecs_api_idc_get_subscription_ids 200 owner1 subscription-id-1 + + ecs_api_idc_get_subscription_ids 200 owner2 subscription-id-2 + + ecs_api_idc_get_subscription 200 subscription-id-1 owner1 $TYPESTATUS1 + ecs_api_idc_get_subscription 200 subscription-id-2 owner2 $TYPESTATUS2 + + ecs_api_idc_delete_subscription 204 subscription-id-2 + + ecs_api_idc_get_subscription_ids 200 NOOWNER subscription-id-1 + + ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json + + cr_equal received_callbacks 1 30 + cr_equal received_callbacks?id=type-status1 1 + cr_api_check_all_ecs_subscription_events 200 type-status1 type1 testdata/ecs/ei-type-1.json REGISTERED + + ecs_api_edp_delete_type_2 204 type1 + + cr_equal received_callbacks 2 30 + cr_equal received_callbacks?id=type-status1 2 + cr_api_check_all_ecs_subscription_events 200 type-status1 type1 testdata/ecs/ei-type-1.json DEREGISTERED + + ecs_api_idc_put_subscription 201 subscription-id-2 owner2 $TYPESTATUS2 + ecs_api_idc_get_subscription_ids 200 NOOWNER subscription-id-1 subscription-id-2 + + ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json + + cr_equal received_callbacks 4 30 + cr_equal received_callbacks?id=type-status1 3 + cr_equal received_callbacks?id=type-status2 1 + cr_api_check_all_ecs_subscription_events 200 type-status1 type1 testdata/ecs/ei-type-1.json REGISTERED + + ecs_api_idc_delete_subscription 204 subscription-id-2 + + ecs_api_edp_delete_type_2 204 type1 + + cr_equal received_callbacks 5 30 + cr_equal received_callbacks?id=type-status1 4 + cr_equal received_callbacks?id=type-status2 1 + cr_api_check_all_ecs_subscription_events 200 type-status1 type1 testdata/ecs/ei-type-1.json DEREGISTERED + + cr_api_reset +fi + ### Setup prodstub sim to accept calls for producers, types and jobs ## prod-a type1 ## prod-b type1 and type2 @@ -267,6 +337,14 @@ else ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 ecs_api_edp_put_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 + + if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 3 30 + cr_equal received_callbacks?id=type-status1 3 + cr_api_check_all_ecs_subscription_events 200 type-status1 type1 testdata/ecs/ei-type-1.json REGISTERED type1 testdata/ecs/ei-type-1.json DEREGISTERED type1 testdata/ecs/ei-type-1.json REGISTERED + else + cr_equal received_callbacks 0 + fi fi @@ -411,6 +489,13 @@ if [ $ECS_VERSION == "V1-1" ]; then else ecs_api_edp_put_type_2 201 type2 testdata/ecs/ei-type-2.json ecs_api_edp_put_producer_2 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 + if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 4 30 + cr_equal received_callbacks?id=type-status1 4 + cr_api_check_all_ecs_subscription_events 200 type-status1 type2 testdata/ecs/ei-type-2.json REGISTERED + else + cr_equal received_callbacks 0 + fi fi @@ -629,9 +714,16 @@ 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 +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 5 30 + cr_equal received_callbacks?id=type-status1 4 + cr_equal received_callbacks?id=job3-status 1 + cr_api_check_all_ecs_events 200 job3-status DISABLED +else + cr_equal received_callbacks 1 30 + cr_equal received_callbacks?id=job3-status 1 + cr_api_check_all_ecs_events 200 job3-status DISABLED +fi # Re-create the producer if [ $ECS_VERSION == "V1-1" ]; then @@ -648,9 +740,16 @@ 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 +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 6 30 + cr_equal received_callbacks?id=type-status1 4 + cr_equal received_callbacks?id=job3-status 2 + cr_api_check_all_ecs_events 200 job3-status ENABLED +else + cr_equal received_callbacks 2 30 + cr_equal received_callbacks?id=job3-status 2 + cr_api_check_all_ecs_events 200 job3-status ENABLED +fi if [ $ECS_VERSION == "V1-1" ]; then prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json @@ -666,10 +765,16 @@ fi if [ $ECS_VERSION == "V1-1" ]; then ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json else - ecs_api_edp_put_type_2 201 type4 testdata/ecs/ei-type-1.json + ecs_api_edp_put_type_2 201 type4 testdata/ecs/ei-type-4.json ecs_api_edp_put_producer_2 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 fi +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 7 30 + cr_equal received_callbacks?id=type-status1 5 + cr_api_check_all_ecs_subscription_events 200 type-status1 type4 testdata/ecs/ei-type-4.json REGISTERED +fi + ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY if [ -z "$FLAT_A1_EI" ]; then @@ -719,9 +824,16 @@ 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 +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 8 30 + cr_equal received_callbacks?id=type-status1 5 + cr_equal received_callbacks?id=job8-status 1 + cr_api_check_all_ecs_events 200 job8-status DISABLED +else + cr_equal received_callbacks 3 30 + cr_equal received_callbacks?id=job8-status 1 + cr_api_check_all_ecs_events 200 job8-status DISABLED +fi prodstub_equal create/prod-d/job8 1 prodstub_equal delete/prod-d/job8 0 @@ -752,14 +864,22 @@ 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 +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 10 30 + cr_equal received_callbacks?id=type-status1 6 + cr_api_check_all_ecs_subscription_events 200 type-status1 type4 testdata/ecs/ei-type-4.json REGISTERED + + cr_equal received_callbacks?id=job8-status 2 + cr_api_check_all_ecs_events 200 job8-status ENABLED +else + cr_equal received_callbacks 4 30 + cr_equal received_callbacks?id=job8-status 2 + cr_api_check_all_ecs_events 200 job8-status ENABLED +fi prodstub_equal create/prod-d/job8 2 prodstub_equal delete/prod-d/job8 0 - ## Setup prod-e if [ $ECS_VERSION == "V1-1" ]; then ecs_api_edp_put_producer 201 prod-e $CB_JOB/prod-e $CB_SV/prod-e type6 testdata/ecs/ei-type-6.json @@ -768,6 +888,12 @@ else ecs_api_edp_put_producer_2 201 prod-e $CB_JOB/prod-e $CB_SV/prod-e type6 fi +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 11 30 + cr_equal received_callbacks?id=type-status1 7 + cr_api_check_all_ecs_subscription_events 200 type-status1 type6 testdata/ecs/ei-type-6.json REGISTERED +fi + ecs_api_a1_get_job_ids 200 type6 NOWNER EMPTY if [ -z "$FLAT_A1_EI" ]; then @@ -805,6 +931,12 @@ else ecs_api_edp_put_producer_2 201 prod-f $CB_JOB/prod-f $CB_SV/prod-f type6 fi +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 12 30 + cr_equal received_callbacks?id=type-status1 8 + cr_api_check_all_ecs_subscription_events 200 type-status1 type6 testdata/ecs/ei-type-6.json REGISTERED +fi + ecs_api_a1_get_job_ids 200 type6 NOWNER job10 if [ $ECS_VERSION == "V1-1" ]; then @@ -978,7 +1110,12 @@ else ecs_api_a1_get_job_status 200 job10 ENABLED fi -cr_equal received_callbacks 6 30 +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 14 30 +else + cr_equal received_callbacks 6 30 +fi + cr_equal received_callbacks?id=job1-status 1 cr_equal received_callbacks?id=job2-status 1 @@ -1089,7 +1226,11 @@ else ecs_api_a1_get_job_status 200 job10 ENABLED fi -cr_equal received_callbacks 6 +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 14 30 +else + cr_equal received_callbacks 6 30 +fi if [[ "$ECS_FEATURE_LEVEL" != *"INFO-TYPES"* ]]; then @@ -1223,9 +1364,13 @@ ecs_api_edp_put_producer_2 200 prod-ia $CB_JOB/prod-ia $CB_SV/prod-ia type101 ecs_api_edp_delete_type_2 406 type101 - -#ecs_api_idc_get_type_ids 200 type101 -#ecs_api_idc_get_type 200 type101 testdata/ecs/empty-type.json +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 17 30 + cr_equal received_callbacks?id=type-status1 11 + cr_api_check_all_ecs_subscription_events 200 type-status1 type101 testdata/ecs/info-type-1.json REGISTERED type101 testdata/ecs/info-type-1.json DEREGISTERED type101 testdata/ecs/info-type-1.json REGISTERED +else + cr_equal received_callbacks 6 +fi ecs_api_edp_get_type_ids 200 type101 type1 type2 type4 type6 ecs_api_edp_get_type_2 200 type101 testdata/ecs/info-type-1.json @@ -1290,12 +1435,25 @@ ecs_api_edp_get_producer_jobs_2 200 prod-ia job101 type101 $TARGET101 info-owner ecs_api_edp_put_type_2 201 type102 testdata/ecs/info-type-2.json ecs_api_edp_put_producer_2 201 prod-ib $CB_JOB/prod-ib $CB_SV/prod-ib type102 +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 18 30 + cr_equal received_callbacks?id=type-status1 12 + cr_api_check_all_ecs_subscription_events 200 type-status1 type102 testdata/ecs/info-type-2.json REGISTERED +else + cr_equal received_callbacks 6 +fi ecs_api_idc_get_type_ids 200 type101 type102 type1 type2 type4 type6 -ecs_api_idc_get_type 200 type101 testdata/ecs/info-type-1.json +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + ecs_api_idc_get_type 200 type101 testdata/ecs/info-type-1.json ENABLED 1 -ecs_api_idc_get_type 200 type102 testdata/ecs/info-type-2.json + ecs_api_idc_get_type 200 type102 testdata/ecs/info-type-2.json ENABLED 1 +else + ecs_api_idc_get_type 200 type101 testdata/ecs/info-type-1.json + + ecs_api_idc_get_type 200 type102 testdata/ecs/info-type-2.json +fi ecs_api_edp_get_type_ids 200 type101 type102 type1 type2 type4 type6 ecs_api_edp_get_type_2 200 type101 testdata/ecs/info-type-1.json @@ -1391,9 +1549,16 @@ ecs_api_edp_get_producer_ids_2 200 NOTYPE prod-ia prod-ic prod-b prod-c prod-d p 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 -cr_api_check_all_ecs_events 200 info-job103-status DISABLED +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 19 30 + + cr_equal received_callbacks?id=info-job103-status 1 + cr_api_check_all_ecs_events 200 info-job103-status DISABLED +else + cr_equal received_callbacks 7 30 + cr_equal received_callbacks?id=info-job103-status 1 + cr_api_check_all_ecs_events 200 info-job103-status DISABLED +fi # Re-create the producer ecs_api_edp_put_producer_2 201 prod-ib $CB_JOB/prod-ib $CB_SV/prod-ib type102 @@ -1402,9 +1567,15 @@ ecs_api_edp_get_producer_status 200 prod-ib 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 -cr_api_check_all_ecs_events 200 info-job103-status ENABLED +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 20 30 + cr_equal received_callbacks?id=info-job103-status 2 + cr_api_check_all_ecs_events 200 info-job103-status ENABLED +else + cr_equal received_callbacks 8 30 + cr_equal received_callbacks?id=info-job103-status 2 + cr_api_check_all_ecs_events 200 info-job103-status ENABLED +fi prodstub_check_jobdata_3 200 prod-ib job103 type102 $TARGET103 info-owner-3 testdata/ecs/job-template2.json @@ -1433,9 +1604,18 @@ ecs_api_idc_get_job_ids 200 NOTYPE NOWNER job101 job102 job103 job108 job1 job2 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 -cr_api_check_all_ecs_events 200 info-job108-status DISABLED +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 22 30 + cr_equal received_callbacks?id=type-status1 13 + cr_api_check_all_ecs_subscription_events 200 type-status1 type104 testdata/ecs/info-type-4.json REGISTERED + + cr_equal received_callbacks?id=info-job108-status 1 + cr_api_check_all_ecs_events 200 info-job108-status DISABLED +else + cr_equal received_callbacks 9 30 + cr_equal received_callbacks?id=info-job108-status 1 + cr_api_check_all_ecs_events 200 info-job108-status DISABLED +fi prodstub_equal create/prod-id/job108 1 prodstub_equal delete/prod-id/job108 0 @@ -1444,6 +1624,7 @@ prodstub_equal delete/prod-id/job108 0 ecs_api_edp_put_type_2 200 type104 testdata/ecs/info-type-4.json ecs_api_edp_put_producer_2 200 prod-id $CB_JOB/prod-id $CB_SV/prod-id type104 + 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 @@ -1454,9 +1635,19 @@ ecs_api_edp_get_producer_status 200 prod-ib ENABLED ecs_api_edp_get_producer_status 200 prod-ic ENABLED ecs_api_edp_get_producer_status 200 prod-id ENABLED -cr_equal received_callbacks 10 30 -cr_equal received_callbacks?id=info-job108-status 2 -cr_api_check_all_ecs_events 200 info-job108-status ENABLED +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 24 30 + + cr_equal received_callbacks?id=type-status1 14 + cr_api_check_all_ecs_subscription_events 200 type-status1 type104 testdata/ecs/info-type-4.json REGISTERED + + cr_equal received_callbacks?id=info-job108-status 2 + cr_api_check_all_ecs_events 200 info-job108-status ENABLED +else + cr_equal received_callbacks 10 30 + cr_equal received_callbacks?id=info-job108-status 2 + cr_api_check_all_ecs_events 200 info-job108-status ENABLED +fi prodstub_equal create/prod-id/job108 2 prodstub_equal delete/prod-id/job108 0 @@ -1483,6 +1674,14 @@ ecs_api_idc_get_job_status2 200 job110 ENABLED 1 prod-ie ecs_api_edp_put_type_2 200 type106 testdata/ecs/info-type-6.json ecs_api_edp_put_producer_2 201 prod-if $CB_JOB/prod-if $CB_SV/prod-if type106 +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 26 30 + + cr_equal received_callbacks?id=type-status1 16 + cr_api_check_all_ecs_subscription_events 200 type-status1 type106 testdata/ecs/info-type-6.json REGISTERED type106 testdata/ecs/info-type-6.json REGISTERED +fi + + ecs_api_idc_get_job_ids 200 type106 NOWNER job110 prodstub_check_jobdata_3 200 prod-if job110 type106 $TARGET110 info-owner-4 testdata/ecs/job-template.json @@ -1592,12 +1791,22 @@ 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 -cr_equal received_callbacks?id=info-job102-status 1 -cr_api_check_all_ecs_events 200 info-job101-status DISABLED -cr_api_check_all_ecs_events 200 info-job102-status DISABLED +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 28 30 + + cr_equal received_callbacks?id=info-job101-status 1 + cr_equal received_callbacks?id=info-job102-status 1 + cr_api_check_all_ecs_events 200 info-job101-status DISABLED + cr_api_check_all_ecs_events 200 info-job102-status DISABLED +else + cr_equal received_callbacks 12 30 + + cr_equal received_callbacks?id=info-job101-status 1 + cr_equal received_callbacks?id=info-job102-status 1 + cr_api_check_all_ecs_events 200 info-job101-status DISABLED + cr_api_check_all_ecs_events 200 info-job102-status DISABLED +fi # Arm producer prod-ie for supervision failure @@ -1663,8 +1872,11 @@ 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 - +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 28 +else + cr_equal received_callbacks 12 +fi ### Test of pre and post validation ecs_api_idc_get_type_ids 200 type1 type2 type4 type6 type101 type102 type104 type106 @@ -1710,6 +1922,14 @@ prodstub_arm_type 200 prod-ig type150 ecs_api_edp_put_type_2 201 type150 testdata/ecs/info-type-50.json ecs_api_idc_get_type_ids 200 type1 type2 type4 type6 type101 type102 type104 type106 type160 type150 +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 30 30 + cr_equal received_callbacks?id=type-status1 18 + cr_api_check_all_ecs_subscription_events 200 type-status1 type160 testdata/ecs/info-type-60.json REGISTERED type150 testdata/ecs/info-type-50.json REGISTERED +else + cr_equal received_callbacks 12 +fi + ecs_api_edp_put_producer_2 200 prod-ig $CB_JOB/prod-ig $CB_SV/prod-ig type160 type150 ecs_api_edp_get_producer_status 200 prod-ig ENABLED 360 @@ -1723,7 +1943,12 @@ ecs_api_idc_put_job 201 job150 type150 $TARGET150 info-owner-1 $INFOSTATUS150 te 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 +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 30 30 + cr_equal received_callbacks?id=type-status1 18 +else + cr_equal received_callbacks 12 +fi check_ecs_logs diff --git a/test/auto-test/FTC1800.sh b/test/auto-test/FTC1800.sh index eebed142..8ad142c0 100755 --- a/test/auto-test/FTC1800.sh +++ b/test/auto-test/FTC1800.sh @@ -88,6 +88,21 @@ if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then NUM_JOBS=5000 # 5K ei jobs and 5K info jobs fi +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + #Type registration status callbacks + TYPESTATUS1="$CR_SERVICE_PATH/type-status1" + TYPESTATUS2="$CR_SERVICE_PATH/type-status2" + + ecs_api_idc_put_subscription 201 subscription-id-1 owner1 $TYPESTATUS1 + + ecs_api_idc_get_subscription_ids 200 owner1 subscription-id-1 + + ecs_api_idc_put_subscription 201 subscription-id-2 owner2 $TYPESTATUS2 + + ecs_api_idc_get_subscription_ids 200 owner2 subscription-id-2 + +fi + # Setup prodstub sim to accept calls for producers, types and jobs prodstub_arm_producer 200 prod-a prodstub_arm_producer 200 prod-b @@ -309,12 +324,44 @@ if [ $use_info_jobs ]; then ecs_equal json:data-consumer/v1/info-jobs?infoTypeId=type105 $(($NUM_JOBS/5)) fi +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 20 30 + +else + cr_equal received_callbacks 0 30 + +fi + stop_ecs +cr_api_reset + start_stopped_ecs set_ecs_trace + +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + + ecs_api_idc_get_subscription_ids 200 NOOWNER EMPTY + ecs_api_idc_get_subscription_ids 200 NOOWNER EMPTY + + if [ $use_info_jobs ]; then + ecs_equal json:data-producer/v1/info-types 10 1000 + else + ecs_equal json:ei-producer/v1/eitypes 5 1000 + fi + + ecs_api_idc_put_subscription 201 subscription-id-1 owner1 $TYPESTATUS1 + + ecs_api_idc_get_subscription_ids 200 owner1 subscription-id-1 + + ecs_api_idc_put_subscription 201 subscription-id-2 owner2 $TYPESTATUS2 + + ecs_api_idc_get_subscription_ids 200 owner2 subscription-id-2 + +fi + for ((i=1; i<=$NUM_JOBS; i++)) do if [ $(($i%5)) -eq 0 ]; then @@ -688,6 +735,12 @@ if [ $use_info_jobs ]; then ecs_equal json:data-consumer/v1/info-jobs?infoTypeId=type105 0 fi +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 0 30 +else + cr_equal received_callbacks 0 30 +fi + check_ecs_logs store_logs END diff --git a/test/auto-test/FTC2001.sh b/test/auto-test/FTC2001.sh index d174ef1c..fffef911 100755 --- a/test/auto-test/FTC2001.sh +++ b/test/auto-test/FTC2001.sh @@ -195,6 +195,15 @@ prodstub_arm_job_create 200 prod-a job2 ### ecs status ecs_api_service_status 200 +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + #Type registration status callbacks + TYPESTATUS1="$CR_SERVICE_PATH/type-status1" + + ecs_api_idc_put_subscription 201 subscription-id-1 owner1 $TYPESTATUS1 + + ecs_api_idc_get_subscription_ids 200 owner1 subscription-id-1 +fi + ## Setup prod-a if [ $ECS_VERSION == "V1-1" ]; then ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json @@ -262,6 +271,16 @@ else ecs_equal json:ei-producer/v1/eiproducers 0 1000 fi +if [[ "$ECS_FEATURE_LEVEL" == *"TYPE-SUBSCRIPTIONS"* ]]; then + cr_equal received_callbacks 3 30 + cr_api_check_all_ecs_subscription_events 200 type-status1 type1 testdata/ecs/ei-type-1.json REGISTERED + cr_api_check_all_ecs_events 200 job1-status DISABLED + cr_api_check_all_ecs_events 200 job2-status DISABLED +else + cr_equal received_callbacks 2 30 + cr_api_check_all_ecs_events 200 job1-status DISABLED + cr_api_check_all_ecs_events 200 job2-status DISABLED +fi echo -e $YELLOW"Verify that ECS has send status notification to the callback recevier"$EYELLOW echo -e $YELLOW"and check the source of the call in the log to be from the httpproxy"$EYELLOW diff --git a/test/common/README.md b/test/common/README.md index 8f373776..6c277bd5 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -1038,6 +1038,48 @@ Check the contents of all ric events received for a callback id. | `EMPTY` | Indicator for an empty list | | `` | Id of the ric | +## Function: cr_api_check_all_ecs_events() ## + +Check the contents of all current status events for one id from ECS + +| arg list | +|--| +| ` [ EMPTY \| ( )+ ]` | + +| parameter | description | +| --------- | ----------- | +| `` | Expected http response code | +| `` | Id of the callback destination | +| `EMPTY` | Indicator for an empty list | +| `` | Status string | + +## Function: cr_api_check_all_ecs_subscription_events() ## + +Check the contents of all current subscription events for one id from ECS + +| arg list | +|--| +| ` [ EMPTY | ( )+ ]` | + +| parameter | description | +| --------- | ----------- | +| `` | Expected http response code | +| `` | Id of the callback destination | +| `EMPTY` | Indicator for an empty list | +| `` | Id of the data type | +| `` | Path to typeschema file | +| `` | Status string | + + +## Function: cr_api_reset() ## + +Reset the callback receiver + +| arg list | +|--| +| - | + + # Description of functions in ecs_api_functions.sh # ## Function: use_ecs_rest_http ## @@ -1662,6 +1704,64 @@ To also test the response payload add the expected status. | `` |Id of the producer | | `` | Timeout | + +## Function: ecs_api_idc_get_subscription_ids() ## +Test of GET '/data-consumer/v1/info-type-subscription' with the returned list of subscription ids + +| arg list | +|--| +| ` |NOOWNER [ EMPTY | +]` | + +| parameter | description | +| --------- | ----------- | +| `` | Expected http response code | +| `` | Id of the owner | +| `` | Indicator for empty owner | +| `` | Indicated for empty list of subscription ids | +| `` |Id of the subscription | + +## Function: ecs_api_idc_get_subscription() ## +Test of GET '/data-consumer/v1/info-type-subscription/{subscriptionId}' with the subscription information + +| arg list | +|--| +| ` [ ]` | + +| parameter | description | +| --------- | ----------- | +| `` | Expected http response code | +| `` |Id of the subscription | +| `` | Id of the owner | +| `` | Url for status notifications | + + +## Function: ecs_api_idc_put_subscription() ## +Test of PUT '/data-consumer/v1/info-type-subscription/{subscriptionId}' with the subscription information + +| arg list | +|--| +| ` ` | + +| parameter | description | +| --------- | ----------- | +| `` | Expected http response code | +| `` |Id of the subscription | +| `` | Id of the owner | +| `` | Url for status notifications | + +## Function: ecs_api_idc_delete_subscription() ## +Test of DELETE /data-consumer/v1/info-type-subscription/{subscriptionId} + +| arg list | +|--| +| ` ` | + +| parameter | description | +| --------- | ----------- | +| `` | Expected http response code | +| `` |Id of the subscription | + + ## Function: ecs_api_admin_reset() ## Test of GET '/status'. diff --git a/test/common/cr_api_functions.sh b/test/common/cr_api_functions.sh index 134f50c3..c19797a0 100644 --- a/test/common/cr_api_functions.sh +++ b/test/common/cr_api_functions.sh @@ -390,4 +390,88 @@ cr_api_check_all_ecs_events() { fi __log_test_pass return 0 +} + +# CR API: Check the contents of all current type subscription events for one id from ECS +# [ EMPTY | ( )+ ] +# (Function for test scripts) +cr_api_check_all_ecs_subscription_events() { + __log_test_start $@ + + #Valid number of parameter 2,3,7,11 + paramError=1 + if [ $# -eq 2 ]; then + paramError=0 + fi + if [ $# -eq 3 ] && [ "$3" == "EMPTY" ]; then + paramError=0 + fi + variablecount=$(($#-2)) + if [ $# -gt 3 ] && [ $(($variablecount%3)) -eq 0 ]; then + paramError=0 + fi + if [ $paramError -eq 1 ]; then + __print_err " [ EMPTY | ( )+ ]" $@ + 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} + targetJson="[" + if [ $# -gt 3 ]; then + arr=(${@:3}) + for ((i=0; i<$(($#-3)); i=i+3)); do + if [ "$targetJson" != "[" ]; then + targetJson=$targetJson"," + fi + if [ -f ${arr[$i+1]} ]; then + jobfile=$(cat ${arr[$i+1]}) + else + __log_test_fail_general "Job schema file "${arr[$i+1]}", does not exist" + return 1 + fi + targetJson=$targetJson"{\"info_type_id\":\"${arr[$i]}\",\"job_data_schema\":$jobfile,\"status\":\"${arr[$i+2]}\"}" + 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 + + __log_test_pass + return 0 +} + + +# CR API: Reset all events and counters +# Arg: - +# (Function for test scripts) +cr_api_reset() { + __log_conf_start $@ + + res="$(__do_curl_to_api CR GET /reset)" + status=${res:${#res}-3} + + if [ $status -ne 200 ]; then + __log_conf_fail_status_code $1 $status + return 1 + fi + + __log_conf_ok + return 0 } \ No newline at end of file diff --git a/test/common/ecs_api_functions.sh b/test/common/ecs_api_functions.sh index 5ad1b98e..805fae4c 100644 --- a/test/common/ecs_api_functions.sh +++ b/test/common/ecs_api_functions.sh @@ -2017,13 +2017,13 @@ ecs_api_idc_delete_job() { } # API Test function: GET ​/data-consumer/v1/info-types/{infoTypeId} -# args: [] +# args: [ [ []" $@ + if [ $# -lt 2 ] || [ $# -gt 5 ]; then + __print_err " [ [ > $HTTPLOG res=$(python3 ../common/compare_json.py "$targetJson" "$body") @@ -2222,6 +2226,148 @@ ecs_api_idc_get_job_status2() { return 0 } +########################################## +#### Type subscriptions #### +########################################## + +# API Test function: GET /data-consumer/v1/info-type-subscription +# args: |NOOWNER [ EMPTY | +] +# (Function for test scripts) +ecs_api_idc_get_subscription_ids() { + __log_test_start $@ + + if [ $# -lt 3 ]; then + __print_err " |NOOWNER [ EMPTY | +]" $@ + return 1 + fi + + query="/data-consumer/v1/info-type-subscription" + search="" + if [ $2 != "NOOWNER" ]; then + search="?owner="$2 + fi + + res="$(__do_curl_to_api ECS GET $query$search)" + 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} + targetJson="[" + if [ $3 != "EMPTY" ]; then + for pid in ${@:3} ; do + if [ "$targetJson" != "[" ]; then + targetJson=$targetJson"," + fi + targetJson=$targetJson"\"$pid\"" + 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 + + __log_test_pass + return 0 +} + +# API Test function: GET /data-consumer/v1/info-type-subscription/{subscriptionId} +# args: [ ] +# (Function for test scripts) +ecs_api_idc_get_subscription() { + __log_test_start $@ + + if [ $# -ne 2 ] && [ $# -ne 4 ]; then + __print_err " [ ]" $@ + return 1 + fi + + query="/data-consumer/v1/info-type-subscription/$2" + res="$(__do_curl_to_api ECS 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} + targetJson="{\"owner\":\"$3\",\"status_result_uri\":\"$4\"}" + 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 +} + +# API Test function: PUT /data-consumer/v1/info-type-subscription/{subscriptionId} +# args: +# (Function for test scripts) +ecs_api_idc_put_subscription() { + __log_test_start $@ + + if [ $# -ne 4 ]; then + __print_err " " $@ + return 1 + fi + + inputJson="{\"owner\": \"$3\",\"status_result_uri\": \"$4\"}" + file="./tmp/.p.json" + echo "$inputJson" > $file + + query="/data-consumer/v1/info-type-subscription/$2" + res="$(__do_curl_to_api ECS 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: DELETE /data-consumer/v1/info-type-subscription/{subscriptionId} +# args: +# (Function for test scripts) +ecs_api_idc_delete_subscription() { + __log_test_start $@ + + if [ $# -ne 2 ]; then + __print_err " " $@ + return 1 + fi + + query="/data-consumer/v1/info-type-subscription/$2" + res="$(__do_curl_to_api ECS DELETE $query)" + status=${res:${#res}-3} + + if [ $status -ne $1 ]; then + __log_test_fail_status_code $1 $status + return 1 + fi + + __log_test_pass + return 0 +} + ########################################## #### Reset jobs #### ########################################## diff --git a/test/common/test_env-oran-d-release.sh b/test/common/test_env-oran-d-release.sh index 77907d3f..399f3620 100755 --- a/test/common/test_env-oran-d-release.sh +++ b/test/common/test_env-oran-d-release.sh @@ -116,10 +116,10 @@ SDNC_DB_IMAGE_TAG_REMOTE_PROXY="10.5" # RAPP Catalogue image and tags RAPP_CAT_IMAGE_BASE="o-ran-sc/nonrtric-r-app-catalogue" -RAPP_CAT_IMAGE_TAG_LOCAL="1.1.0-SNAPSHOT" -RAPP_CAT_IMAGE_TAG_REMOTE_SNAPSHOT="1.1.0-SNAPSHOT" -RAPP_CAT_IMAGE_TAG_REMOTE="1.1.0" -RAPP_CAT_IMAGE_TAG_REMOTE_RELEASE="1.1.0" +RAPP_CAT_IMAGE_TAG_LOCAL="1.0.1-SNAPSHOT" +RAPP_CAT_IMAGE_TAG_REMOTE_SNAPSHOT="1.0.1-SNAPSHOT" +RAPP_CAT_IMAGE_TAG_REMOTE="1.0.1" +RAPP_CAT_IMAGE_TAG_REMOTE_RELEASE="1.0.1" # Near RT RIC Simulator image and tags - same version as cherry diff --git a/test/common/test_env-oran-e-release.sh b/test/common/test_env-oran-e-release.sh index be6c0df0..e468d034 100755 --- a/test/common/test_env-oran-e-release.sh +++ b/test/common/test_env-oran-e-release.sh @@ -247,7 +247,7 @@ ECS_COMPOSE_DIR="ecs" # Dir in simulator_grou ECS_CONFIG_MOUNT_PATH=/opt/app/enrichment-coordinator-service/config # Internal container path for configuration ECS_CONFIG_FILE=application.yaml # Config file name ECS_VERSION="V1-2" # Version where the types are decoupled from the producer registration -ECS_FEATURE_LEVEL="INFO-TYPES" # Space separated list of features +ECS_FEATURE_LEVEL="INFO-TYPES TYPE-SUBSCRIPTIONS" # Space separated list of features MR_DMAAP_APP_NAME="dmaap-mr" # Name for the Dmaap MR MR_STUB_APP_NAME="mr-stub" # Name of the MR stub diff --git a/test/common/testcase_common.sh b/test/common/testcase_common.sh index 7b1201df..5f1b097f 100755 --- a/test/common/testcase_common.sh +++ b/test/common/testcase_common.sh @@ -229,7 +229,7 @@ __log_test_start() { # Function to print current statistics __print_current_stats() { if [ $PRINT_CURRENT_STATS -ne 0 ]; then - echo " Currrent stats - tests, passes, fails, conf fails, deviations: $RES_TEST, $RES_PASS, $RES_FAIL, $RES_CONF_FAIL, $RES_DEVIATION" + echo " Current stats - exe-time, tests, passes, fails, conf fails, deviations: $(($SECONDS-$TCTEST_START)), $RES_TEST, $RES_PASS, $RES_FAIL, $RES_CONF_FAIL, $RES_DEVIATION" fi } @@ -2500,13 +2500,15 @@ __do_curl() { __var_test() { checkjsonarraycount=0 - + TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S") if [ $# -eq 6 ]; then if [[ $3 == "json:"* ]]; then checkjsonarraycount=1 fi echo -e $BOLD"TEST $TEST_SEQUENCE_NR (${BASH_LINENO[1]}): ${1}, ${3} ${4} ${5} within ${6} seconds"$EBOLD + echo "TEST $TEST_SEQUENCE_NR - ${TIMESTAMP}: (${BASH_LINENO[1]}): ${1}, ${3} ${4} ${5} within ${6} seconds" >> $HTTPLOG + ((RES_TEST++)) ((TEST_SEQUENCE_NR++)) start=$SECONDS @@ -2575,6 +2577,7 @@ __var_test() { fi echo -e $BOLD"TEST $TEST_SEQUENCE_NR (${BASH_LINENO[1]}): ${1}, ${3} ${4} ${5}"$EBOLD + echo "TEST $TEST_SEQUENCE_NR - ${TIMESTAMP}: (${BASH_LINENO[1]}): ${1}, ${3} ${4} ${5}" >> $HTTPLOG ((RES_TEST++)) ((TEST_SEQUENCE_NR++)) if [ $checkjsonarraycount -eq 0 ]; then -- 2.16.6