X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fcommon%2Fcr_api_functions.sh;fp=test%2Fcommon%2Fcr_api_functions.sh;h=a12b69e9ebc588647f634cb26cf358371cf9f25d;hb=8fbb226ef10720895adb98e6ca7ac1cae39f0103;hp=40ef7ea79be9b8aa1caebf5f5e59b955d197850d;hpb=0730e0f4c246b0084038ad87fb4ea8246b7c2a94;p=nonrtric.git diff --git a/test/common/cr_api_functions.sh b/test/common/cr_api_functions.sh index 40ef7ea7..a12b69e9 100644 --- a/test/common/cr_api_functions.sh +++ b/test/common/cr_api_functions.sh @@ -367,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. @@ -391,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 @@ -399,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