blob: 8373498f3e3f47e4ec7f2a5fe28c825ce3de4b67 [file] [log] [blame]
Scott Baker4746d482016-03-31 14:57:04 -07001source ./config.sh
2
3function lookup_account_num {
4 ID=`curl -f -s -u $AUTH -X GET $HOST/api/tenant/cord/account_num_lookup/$1/`
5 if [[ $? != 0 ]]; then
6 echo "function lookup_account_num with arguments $1 failed" >&2
7 echo "See CURL output below:" >&2
8 curl -s -u $AUTH -X GET $HOST/api/tenant/cord/account_num_lookup/$1/ >&2
9 exit -1
10 fi
11 # echo "(mapped account_num $1 to id $ID)" >&2
12 echo $ID
13}
Scott Baker0b518f62016-03-31 16:13:25 -070014
15function lookup_subscriber_volt {
16 JSON=`curl -f -s -u $AUTH -X GET $HOST/api/tenant/cord/subscriber/$1/`
17 if [[ $? != 0 ]]; then
18 echo "function lookup_subscriber_volt failed to read subscriber with arg $1" >&2
19 echo "See CURL output below:" >&2
20 curl -s -u $AUTH -X GET $HOST/api/tenant/cord/account_num_lookup/$1/ >&2
21 exit -1
22 fi
23 ID=`echo $JSON | python -c "import json,sys; print json.load(sys.stdin)['related'].get('volt_id','')"`
24 if [[ $ID == "" ]]; then
25 echo "there is no volt for this subscriber" >&2
26 exit -1
27 fi
28
29 # echo "(found volt id %1)" >&2
30
31 echo $ID
32}