Shell tool to interface to the ONOS component config REST API

Part of ONOS-6597

Change-Id: I0787467c25569dae06878715e05e468e5fa7a440
diff --git a/tools/package/runtime/bin/onos-netcfg b/tools/package/runtime/bin/onos-netcfg
index fe19d8e..4b57162 100755
--- a/tools/package/runtime/bin/onos-netcfg
+++ b/tools/package/runtime/bin/onos-netcfg
@@ -28,6 +28,7 @@
 ONOS_WEB_PASS=${ONOS_WEB_PASS:-rocks} # ONOS WEB Password defaults to 'rocks'
 
 . ${ONOS_HOME}/bin/_find-node
+. ${ONOS_HOME}/bin/_check-json
 
 fail="--fail"
 [ "$1" == "-v" ] && shift && fail=""
@@ -45,11 +46,7 @@
 [ $(echo $file | awk '{print tolower($0)}') == "delete" ] && method="DELETE"
 
 if [ $method == "POST" ]; then
-    # Validate JSON
-    cat $file | python -m json.tool >> /dev/null
-    if [ "$?" -ne "0" ]; then
-        echo "Not valid JSON File" && exit 1
-    fi
+    checkJson $file
     curl $fail -sSL --user $ONOS_WEB_USER:$ONOS_WEB_PASS \
         -X POST -H 'Content-Type:application/json' \
         http://$node:8181/onos/v1/network/configuration/${url} -d@$file