helper function to get vsg_id from subscriber
diff --git a/xos/api/examples/util.sh b/xos/api/examples/util.sh
index 8373498..b3d3060 100644
--- a/xos/api/examples/util.sh
+++ b/xos/api/examples/util.sh
@@ -29,4 +29,24 @@
# echo "(found volt id %1)" >&2
echo $ID
-}
\ No newline at end of file
+}
+
+function lookup_subscriber_vsg {
+ JSON=`curl -f -s -u $AUTH -X GET $HOST/api/tenant/cord/subscriber/$1/`
+ if [[ $? != 0 ]]; then
+ echo "function lookup_subscriber_vsg failed to read subscriber with arg $1" >&2
+ echo "See CURL output below:" >&2
+ curl -s -u $AUTH -X GET $HOST/api/tenant/cord/account_num_lookup/$1/ >&2
+ exit -1
+ fi
+ ID=`echo $JSON | python -c "import json,sys; print json.load(sys.stdin)['related'].get('vsg_id','')"`
+ if [[ $ID == "" ]]; then
+ echo "there is no volt for this subscriber" >&2
+ exit -1
+ fi
+
+ # echo "(found vsg id %1)" >&2
+
+ echo $ID
+}
+