Scott Baker | 4746d48 | 2016-03-31 14:57:04 -0700 | [diff] [blame] | 1 | source ./config.sh |
| 2 | |
| 3 | function 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 Baker | 0b518f6 | 2016-03-31 16:13:25 -0700 | [diff] [blame^] | 14 | |
| 15 | function 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 | } |