X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=test%2Fcommon%2Fecs_api_functions.sh;h=9bde835e8c5ed0515138210d84f2b4f15e3d680e;hb=84ffd4a403baee1b7aa86f9986f0c1659a5a0881;hp=805fae4c93d94819e7a77f109ffd633ee3ea8f43;hpb=c9b469c6f038725d47b9622c5d11495c2194f581;p=nonrtric.git diff --git a/test/common/ecs_api_functions.sh b/test/common/ecs_api_functions.sh index 805fae4c..9bde835e 100644 --- a/test/common/ecs_api_functions.sh +++ b/test/common/ecs_api_functions.sh @@ -1225,7 +1225,7 @@ ecs_api_edp_get_type() { # API Test function: GET /ei-producer/v1/eitypes/{eiTypeId} # API Test function: GET /data-producer/v1/info-types/{infoTypeId} -# args: (v1_2) [ ] +# args: (v1_2) [ [ ]] # (Function for test scripts) ecs_api_edp_get_type_2() { __log_test_start $@ @@ -1237,8 +1237,13 @@ ecs_api_edp_get_type_2() { if [ $# -eq 3 ]; then paramError=0 fi + if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPE-INFO"* ]]; then + if [ $# -eq 4 ]; then + paramError=0 + fi + fi if [ $paramError -ne 0 ]; then - __print_err " [ ]" $@ + __print_err " [ [ ]]" $@ return 1 fi if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then @@ -1254,7 +1259,7 @@ ecs_api_edp_get_type_2() { __log_test_fail_status_code $1 $status return 1 fi - if [ $# -eq 3 ]; then + if [ $# -ge 3 ]; then body=${res:0:${#res}-3} if [ -f $3 ]; then @@ -1263,8 +1268,18 @@ ecs_api_edp_get_type_2() { __log_test_fail_general "Job template file "$3", does not exist" return 1 fi + info_data="" + if [ $# -gt 3 ]; then + if [ -f $4 ]; then + info_data=$(cat $4) + else + __log_test_fail_general "Info-data file "$4", does not exist" + return 1 + fi + info_data=",\"info_type_information\":$info_data" + fi if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then - targetJson="{\"info_job_data_schema\":$schema}" + targetJson="{\"info_job_data_schema\":$schema $info_data}" else targetJson="{\"ei_job_data_schema\":$schema}" fi @@ -1283,23 +1298,42 @@ ecs_api_edp_get_type_2() { # API Test function: PUT /ei-producer/v1/eitypes/{eiTypeId} # API Test function: PUT /data-producer/v1/info-types/{infoTypeId} -# args: (v1_2) +# args: (v1_2) [ ] # (Function for test scripts) ecs_api_edp_put_type_2() { __log_test_start $@ - if [ $# -ne 3 ]; then - __print_err " " $@ - return 1 + if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPE-INFO"* ]]; then + if [ $# -lt 3 ] || [ $# -gt 4 ]; then + __print_err " [ ]" $@ + return 1 + fi + else + if [ $# -ne 3 ]; then + __print_err " " $@ + return 1 + fi fi if [ ! -f $3 ]; then __log_test_fail_general "Job schema file "$3", does not exist" return 1 fi + + info_data="" + if [ $# -gt 3 ]; then + if [ -f $4 ]; then + info_data=$(cat $4) + else + __log_test_fail_general "Info-data file "$4", does not exist" + return 1 + fi + info_data=",\"info_type_information\":$info_data" + fi + if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then schema=$(cat $3) - input_json="{\"info_job_data_schema\":$schema}" + input_json="{\"info_job_data_schema\":$schema $info_data}" file="./tmp/put_type.json" echo $input_json > $file