X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fcommon%2Fapi_curl.sh;h=c7e5c90814ee91755747abff755f2c12cba8fcda;hb=120ac9e1d25dcb1ee1de13d205ec5b2f303db141;hp=2aff131f9c48f9eb462c33d23783c8ed5caf2bbd;hpb=5d97a401dc1e26f64ad57daab90f924da9c12c64;p=nonrtric.git diff --git a/test/common/api_curl.sh b/test/common/api_curl.sh index 2aff131f..c7e5c908 100644 --- a/test/common/api_curl.sh +++ b/test/common/api_curl.sh @@ -23,10 +23,11 @@ # one for sending the requests and one for receiving the response # but only when using the DMAAP interface # REST or DMAAP is controlled of the base url of $ADAPTER -# arg: (PA|ECS GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH []) | (PA|ECS RESPONSE ) +# arg: (PA|ECS|CR|RC GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH []) | (PA|ECS RESPONSE ) # (Not for test scripts) __do_curl_to_api() { - echo "(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG + TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S") + echo " (${BASH_LINENO[0]}) - ${TIMESTAMP}: ${FUNCNAME[0]}" $@ >> $HTTPLOG paramError=0 if [ $# -gt 0 ]; then @@ -40,6 +41,16 @@ __do_curl_to_api() { __RESTBASE=$ECS_RESTBASE __RESTBASE_SECURE=$ECS_RESTBASE_SECURE __RETRY_CODES=$ECS_RETRY_CODES + elif [ $1 == "CR" ]; then + __ADAPTER=$CR_ADAPTER + __RESTBASE=$CR_RESTBASE + __RESTBASE_SECURE=$CR_RESTBASE_SECURE + __RETRY_CODES="" + elif [ $1 == "RC" ]; then + __ADAPTER=$RC_ADAPTER + __RESTBASE=$RC_RESTBASE + __RESTBASE_SECURE=$RC_RESTBASE_SECURE + __RETRY_CODES="" else paramError=1 fi @@ -97,7 +108,7 @@ __do_curl_to_api() { if [ $paramError -eq 1 ]; then ((RES_CONF_FAIL++)) - echo "-Incorrect number of parameters to __do_curl_agent " $@ >> $HTTPLOG + echo "-Incorrect number of parameters to __do_curl_to_api " $@ >> $HTTPLOG echo "-Expected: (PA|ECS GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH []) | (PA|ECS RESPONSE )" >> $HTTPLOG echo "-Returning response 000" >> $HTTPLOG echo "-000" @@ -150,6 +161,8 @@ __do_curl_to_api() { payload="$(cat $4 | tr -d '\n' | tr -d ' ' )" echo "payload: "$payload >> $HTTPLOG file=" --data-binary "$payload + elif [ $# -eq 4 ]; then + echo " FILE: $(cat $4)" >> $HTTPLOG fi #urlencode the request url since it will be carried by send-request url requestUrl=$(python3 -c "from __future__ import print_function; import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "$3")