X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fcommon%2Fcr_api_functions.sh;h=a12b69e9ebc588647f634cb26cf358371cf9f25d;hb=542d2dbfd8df1fcb011fea3d69d539c5c5fe3667;hp=1b82ea02e0c9915186d1f41a331eb12db0013b6d;hpb=51f04f0977f9be139489f05dcfc45b10c461cf9c;p=nonrtric.git diff --git a/test/common/cr_api_functions.sh b/test/common/cr_api_functions.sh index 1b82ea02..a12b69e9 100644 --- a/test/common/cr_api_functions.sh +++ b/test/common/cr_api_functions.sh @@ -131,6 +131,12 @@ __CR_statisics_setup() { done } +# Check application requirements, e.g. helm, the the test needs. Exit 1 if req not satisfied +# args: - +__CR_test_requirements() { + : +} + ####################################################### ################ @@ -160,7 +166,7 @@ use_cr_https() { __cr_set_protocoll() { echo -e $BOLD"$CR_DISPLAY_NAME protocol setting"$EBOLD - echo -e " Using $BOLD http $EBOLD towards $CR_DISPLAY_NAME" + echo -e " Using $BOLD $1 $EBOLD towards $CR_DISPLAY_NAME" ## Access to Dmaap adapter for ((CR_INSTANCE=0; CR_INSTANCE<$MAX_CR_APP_COUNT; CR_INSTANCE++ )); do CR_DOCKER_INSTANCE=$(($CR_INSTANCE+1)) @@ -361,6 +367,27 @@ cr_equal() { fi } +# Tests if a variable value in the CR is equal to or greater than the target value and and optional timeout. +# Arg: - This test set pass or fail depending on if the variable is +# equal to the target or not. +# Arg: - This test waits up to the timeout seconds +# before setting pass or fail depending on if the variable value becomes equal to or greater than the target +# value or not. +# (Function for test scripts) +cr_greater_or_equal() { + if [ $# -eq 3 ] || [ $# -eq 4 ]; then + CR_SERVICE_PATH=$(__cr_get_service_path $1) + CR_ADAPTER=$CR_SERVICE_PATH + if [ $? -ne 0 ]; then + __print_err " missing or incorrect" $@ + return 1 + fi + __var_test "CR" "$CR_SERVICE_PATH/counter/" $2 ">=" $3 $4 + else + __print_err "Wrong args to cr_equal, needs three or four args: [ timeout ]" $@ + fi +} + # Tests if a variable value in the CR contains the target string and and optional timeout # Arg: - This test set pass or fail depending on if the variable contains # the target or not. @@ -385,7 +412,7 @@ cr_contains_str() { fi } -# Read a variable value from CR sim and send to stdout. Arg: +# Read a variable value from CR sim and send to stdout. Arg: cr_read() { CR_SERVICE_PATH=$(__cr_get_service_path $1) CR_ADAPTER=$CR_SERVICE_PATH @@ -393,7 +420,7 @@ cr_read() { __print_err " missing or incorrect" $@ return 1 fi - echo "$(__do_curl $CR_SERVICE_PATH/counter/$1)" + echo "$(__do_curl $CR_SERVICE_PATH/counter/$2)" } # Function to configure write delay on callbacks @@ -489,10 +516,10 @@ cr_api_check_all_sync_events() { return 0 } -# CR API: Check the contents of all current status events for one id from ECS +# CR API: Check the contents of all current status events for one id from ICS # [ EMPTY | ( )+ ] # (Function for test scripts) -cr_api_check_all_ecs_events() { +cr_api_check_all_ics_events() { __log_test_start $@ if [ $# -lt 3 ]; then @@ -546,10 +573,10 @@ cr_api_check_all_ecs_events() { return 0 } -# CR API: Check the contents of all current type subscription events for one id from ECS +# CR API: Check the contents of all current type subscription events for one id from ICS # [ EMPTY | ( )+ ] # (Function for test scripts) -cr_api_check_all_ecs_subscription_events() { +cr_api_check_all_ics_subscription_events() { __log_test_start $@ #Valid number of parameter 3,4,8,12 @@ -625,7 +652,7 @@ cr_api_check_all_ecs_subscription_events() { cr_api_reset() { __log_conf_start $@ - if [ $# -ne 0 ]; then + if [ $# -ne 1 ]; then __print_err "" $@ return 1 fi