body=$(echo "$3" | sed 's/"/\\"/g')
json='{"input":{"near-rt-ric-url":"'$2'","body":"'"$body"'"}}'
fi
- echo "$json" > .sndc.payload.json
- echo " FILE: $json" >> $HTTPLOG
- curlString="curl -skw %{http_code} -X POST $SDNC_HTTPX://$SDNC_USER:$SDNC_PWD@localhost:$SDNC_LOCAL_PORT$SDNC_API_URL$1 -H accept:application/json -H Content-Type:application/json --data-binary @.sndc.payload.json"
+ payload="./tmp/.sdnc.payload.json"
+ echo "$json" > $payload
+ echo " FILE ($payload) : $json" >> $HTTPLOG
+ curlString="curl -skw %{http_code} -X POST $SDNC_HTTPX://$SDNC_USER:$SDNC_PWD@localhost:$SDNC_LOCAL_PORT$SDNC_API_URL$1 -H accept:application/json -H Content-Type:application/json --data-binary @$payload"
echo " CMD: "$curlString >> $HTTPLOG
res=$($curlString)
retcode=$?
fi
body=${res:0:${#res}-3}
echo " JSON: "$body >> $HTTPLOG
- echo "$body" > .sdnc-reply.json
- res=$(python3 ../common/extract_sdnc_reply.py .sdnc-reply.json)
+ reply="./tmp/.sdnc-reply.json"
+ echo "$body" > $reply
+ res=$(python3 ../common/extract_sdnc_reply.py $reply)
echo " EXTRACED BODY+CODE: "$res >> $HTTPLOG
echo "$res"
return 0
paramError=1
if [ $# -gt 3 ] && [ $2 == "OSC" ]; then
- url="http://$3:$RIC_SIM_INTERNAL_PORT/a1-p/policytypes/$4/policies"
+ url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/a1-p/policytypes/$4/policies"
paramError=0
elif [ $# -gt 2 ] && [ $2 == "STD" ]; then
- url="http://$3:$RIC_SIM_INTERNAL_PORT/A1-P/v1/policies"
+ url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/A1-P/v1/policies"
paramError=0
fi
if [ $? -ne 0 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$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
body=${res:0:${#res}-3}
if [ "$targetJson" != "[" ]; then
targetJson=$targetJson","
fi
- targetJson=$targetJson"\"$pid\""
+ targetJson=$targetJson"\"$UUID$pid\""
done
targetJson=$targetJson"]"
if [ $res -ne 0 ]; then
echo -e $RED" FAIL, returned body not correct"$ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
paramError=1
if [ $# -gt 3 ] && [ $2 == "OSC" ]; then
- url="http://$3:$RIC_SIM_INTERNAL_PORT/a1-p/policytypes/$4"
+ url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/a1-p/policytypes/$4"
paramError=0
fi
if [ $? -ne 0 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$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
body=${res:0:${#res}-3}
if [ $res -ne 0 ]; then
echo -e $RED" FAIL, returned body not correct"$ERED
((RES_FAIL++))
+ __check_stop_at_error
return 1
fi
fi
paramError=1
if [ $# -eq 5 ] && [ $2 == "OSC" ]; then
- url="http://$3:$RIC_SIM_INTERNAL_PORT/a1-p/policytypes/$4/policies/$5"
+ url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/a1-p/policytypes/$4/policies/$UUID$5"
paramError=0
elif [ $# -eq 4 ] && [ $2 == "STD" ]; then
- url="http://$3:$RIC_SIM_INTERNAL_PORT/A1-P/v1/policies/$4"
+ url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/A1-P/v1/policies/$UUID$4"
paramError=0
fi
if [ $? -ne 0 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$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
paramError=1
if [ $# -eq 6 ] && [ $2 == "OSC" ]; then
- url="http://$3:$RIC_SIM_INTERNAL_PORT/a1-p/policytypes/$4/policies/$5"
+ url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/a1-p/policytypes/$4/policies/$UUID$5"
body=$(sed 's/XXX/'${5}'/g' $6)
paramError=0
elif [ $# -eq 5 ] && [ $2 == "STD" ]; then
- url="http://$3:$RIC_SIM_INTERNAL_PORT/A1-P/v1/policies/$4"
+ url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/A1-P/v1/policies/$UUID$4"
body=$(sed 's/XXX/'${4}'/g' $5)
paramError=0
fi
if [ $? -ne 0 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$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
targetJson=""
paramError=1
if [ $# -ge 5 ] && [ $2 == "OSC" ]; then
- url="http://$3:$RIC_SIM_INTERNAL_PORT/a1-p/policytypes/$4/policies/$5/status"
+ url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/a1-p/policytypes/$4/policies/$UUID$5/status"
if [ $# -gt 5 ]; then
targetJson="{\"instance_status\":\"$6\""
targetJson=$targetJson",\"has_been_deleted\":\"$7\""
fi
paramError=0
elif [ $# -ge 4 ] && [ $2 == "STD" ]; then
- url="http://$3:$RIC_SIM_INTERNAL_PORT/A1-P/v1/policies/$4/status"
+ url="$RIC_SIM_HTTPX://$3:$RIC_SIM_PORT/A1-P/v1/policies/$UUID$4/status"
if [ $# -gt 4 ]; then
targetJson="{\"enforceStatus\":\"$5\""
if [ $# -eq 6 ]; then
if [ $? -ne 0 ]; then
echo -e $RED" FAIL. Exepected status "$1", got "$status "(likely remote server error)"$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