Phil Huang
Committed by Gerrit Code Review

Support validate JSON file in onos-netcfg

Validate network configuration is JSON format before POST

Change-Id: I6538bba27252c2c06f387804dabe15542988bfa1
......@@ -17,6 +17,11 @@ url="${3}"
method="POST"
[ $file == "delete" ] && method="DELETE"
# Validate JSON
if [ $method == "POST" ]; then
cat $file | python -m json.tool >> /dev/null || echo "Not valid JSON File"; exit 1
fi
curl $fail -sSL --user $ONOS_WEB_USER:$ONOS_WEB_PASS \
-X $method -H 'Content-Type:application/json' \
http://$node:8181/onos/v1/network/configuration/${url} -d@$file
......