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 |
Scott Baker | e4e5a8b | 2016-04-05 09:56:48 -0700 | [diff] [blame^] | 32 | } |
| 33 | |
| 34 | function lookup_subscriber_vsg { |
| 35 | JSON=`curl -f -s -u $AUTH -X GET $HOST/api/tenant/cord/subscriber/$1/` |
| 36 | if [[ $? != 0 ]]; then |
| 37 | echo "function lookup_subscriber_vsg failed to read subscriber with arg $1" >&2 |
| 38 | echo "See CURL output below:" >&2 |
| 39 | curl -s -u $AUTH -X GET $HOST/api/tenant/cord/account_num_lookup/$1/ >&2 |
| 40 | exit -1 |
| 41 | fi |
| 42 | ID=`echo $JSON | python -c "import json,sys; print json.load(sys.stdin)['related'].get('vsg_id','')"` |
| 43 | if [[ $ID == "" ]]; then |
| 44 | echo "there is no volt for this subscriber" >&2 |
| 45 | exit -1 |
| 46 | fi |
| 47 | |
| 48 | # echo "(found vsg id %1)" >&2 |
| 49 | |
| 50 | echo $ID |
| 51 | } |
| 52 | |