if [ $# -ne 2 ]; then
paramError=1
fi
- if ! [ $ADAPTER == $DMAAPBASE ]; then
+ if [ $ADAPTER == $RESTBASE ] || [ $ADAPTER == $RESTBASE_SECURE ]; then
paramError=1
fi
else
#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]))" "$2")
url=" "${ADAPTER}"/send-request?url="${requestUrl}"&operation="${oper}
- curlString="curl -X POST${timeout}${httpcode}${content}${url}${file}"
+ curlString="curl -k -X POST${timeout}${httpcode}${content}${url}${file}"
echo " CMD: "$curlString >> $HTTPLOG
res=$($curlString)
retcode=$?
cid=$2
fi
url=" "${ADAPTER}"/receive-response?correlationid="${cid}
- curlString="curl -X GET"${timeout}${httpcode}${url}
+ curlString="curl -k -X GET"${timeout}${httpcode}${url}
echo " CMD: "$curlString >> $HTTPLOG
res=$($curlString)
retcode=$?
fi
if [ $paramError -ne 0 ]; then
- __print_err "<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-ype-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <template-file>]*]" $@
+ __print_err "<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <policy-type-id>|NOTYPE [ NOID | [<policy-id> <ric-id> <service-id> EMPTY|<policy-type-id> <template-file>]*]" $@
return 1
fi
queryparams=""
if [ $status -ne $1 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
if [ "$targetJson" != "[" ]; then
targetJson=$targetJson","
fi
- targetJson=$targetJson"{\"id\":\"${arr[$i]}\",\"lastModified\":\"????\",\"ric\":\"${arr[$i+1]}\",\"service\":\"${arr[$i+2]}\",\"type\":"
+ targetJson=$targetJson"{\"id\":\"$UUID${arr[$i]}\",\"lastModified\":\"????\",\"ric\":\"${arr[$i+1]}\",\"service\":\"${arr[$i+2]}\",\"type\":"
if [ "${arr[$i+3]}" == "EMPTY" ]; then
targetJson=$targetJson"\"\","
else
if [ $res -ne 0 ]; then
echo -e $RED" FAIL, returned body not correct"$ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
fi
return 1
fi
- query="/policy?id=$2"
+ query="/policy?id=$UUID$2"
res="$(__do_curl_to_agent GET $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
if [ $res -ne 0 ]; then
echo -e $RED" FAIL, returned body not correct"$ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
fi
((RES_TEST++))
if [ $# -lt 7 ] || [ $# -gt 8 ]; then
- __print_err "<response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient> <template-file> [<count>]" $@
+ __print_err "<response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient>|NOTRANSIENT <template-file> [<count>]" $@
return 1
fi
file=$7
while [ $count -lt $max ]; do
- query="/policy?id=$pid&ric=$ric&service=$2"
+ query="/policy?id=$UUID$pid&ric=$ric&service=$2"
if [ $4 != "NOTYPE" ]; then
query=$query"&type=$4"
status=${res:${#res}-3}
echo -ne " Creating "$count"("$max")${SAMELINE}"
if [ $status -ne $1 ]; then
- let pid=$pid+1
echo " Created "$count"?("$max")"
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
file=$7
ARR=""
while [ $count -lt $max ]; do
- query="/policy?id=$pid&ric=$ric&service=$2"
+ query="/policy?id=$UUID$pid&ric=$ric&service=$2"
if [ $4 != "NOTYPE" ]; then
query=$query"&type=$4"
echo -ne " Requested(batch) "$count"("$max")${SAMELINE}"
if [ $status -ne 200 ]; then
- let pid=$pid+1
echo " Requested(batch) "$count"?("$max")"
echo -e $RED" FAIL. Exepected status 200 (in request), got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
cid=${res:0:${#res}-3}
echo -ne " Created(batch) "$count"("$max")${SAMELINE}"
if [ $status -ne $1 ]; then
- let pid=$pid+1
echo " Created(batch) "$count"?("$max")"
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
for ((i=1; i<=$pids; i++))
do
+ uuid=$UUID
+ if [ -z "$uuid" ]; then
+ uuid="NOUUID"
+ fi
echo "" > ".pid${i}.res.txt"
- echo $resp_code $urlbase $ric_base $num_rics $start_id $template $count $pids $i > ".pid${i}.txt"
+ echo $resp_code $urlbase $ric_base $num_rics $uuid $start_id $template $count $pids $i > ".pid${i}.txt"
echo $i
done | xargs -n 1 -I{} -P $pids bash -c '{
arg=$(echo {})
echo -e $RED" FAIL. One of more processes failed to execute" $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
}
pid=$2
while [ $count -lt $max ]; do
- query="/policy?id="$pid
+ query="/policy?id="$UUID$pid
res="$(__do_curl_to_agent DELETE $query)"
status=${res:${#res}-3}
echo -ne " Deleting "$count"("$max")${SAMELINE}"
echo " Deleted "$count"?("$max")"
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
let pid=$pid+1
pid=$2
ARR=""
while [ $count -lt $max ]; do
- query="/policy?id="$pid
+ query="/policy?id="$UUID$pid
res="$(__do_curl_to_agent DELETE_BATCH $query)"
status=${res:${#res}-3}
echo -ne " Requested(batch) "$count"("$max")${SAMELINE}"
if [ $status -ne 200 ]; then
- let pid=$pid+1
echo " Requested(batch) "$count"?("$max")"
echo -e $RED" FAIL. Exepected status 200 (in request), got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
cid=${res:0:${#res}-3}
echo -ne " Deleted(batch) "$count"("$max")${SAMELINE}"
if [ $status -ne $1 ]; then
- let pid=$pid+1
echo " Deleted(batch) "$count"?("$max")"
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
for ((i=1; i<=$pids; i++))
do
+ uuid=$UUID
+ if [ -z "$uuid" ]; then
+ uuid="NOUUID"
+ fi
echo "" > ".pid${i}.del.res.txt"
- echo $resp_code $urlbase $num_rics $start_id $count $pids $i > ".pid${i}.del.txt"
+ echo $resp_code $urlbase $num_rics $uuid $start_id $count $pids $i > ".pid${i}.del.txt"
echo $i
done | xargs -n 1 -I{} -P $pids bash -c '{
arg=$(echo {})
echo -e $RED" FAIL. One of more processes failed to execute" $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
}
if [ $status -ne $1 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
targetJson=$targetJson","
fi
if [ $pid != "NOID" ]; then
- targetJson=$targetJson"\"$pid\""
+ targetJson=$targetJson"\"$UUID$pid\""
fi
done
if [ $res -ne 0 ]; then
echo -e $RED" FAIL, returned body not correct"$ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
fi
if [ $status -ne $1 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
if [ $res -ne 0 ]; then
echo -e $RED" FAIL, returned body not correct"$ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
fi
if [ $status -ne $1 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
if [ $res -ne 0 ]; then
echo -e $RED" FAIL, returned body not correct"$ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
fi
return 1
fi
- query="/policy_status?id="$2
+ query="/policy_status?id="$UUID$2
res="$(__do_curl_to_agent GET $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
if [ $res -ne 0 ]; then
echo -e $RED" FAIL, returned body not correct"$ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
if [ $status -ne $1 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
if [ $res -ne 0 ]; then
echo -e $RED" FAIL, returned body not correct"$ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
fi
if [ $status -ne $1 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
if [ $status -ne $1 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
if [ "$body" != "$3" ]; then
echo -e $RED" FAIL, returned body not correct"$ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
fi
if [ $status -ne $1 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
if [ $res -ne 0 ]; then
echo -e $RED" FAIL, could not create target ric info json"$ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
if [ $res -ne 0 ]; then
echo -e $RED" FAIL, returned body not correct"$ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
fi
if [ $status -ne $1 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
if [ $status -ne $1 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
if [ $res -ne 0 ]; then
echo -e $RED" FAIL, returned body not correct"$ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
fi
if [ $status -ne $1 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
if [ $res -ne 0 ]; then
echo -e $RED" FAIL, returned body not correct"$ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
if [ $status -ne $1 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
if [ $status -ne $1 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi