2 # ============LICENSE_START=======================================================
4 # ================================================================================
5 # Copyright © 2018 AT&T Intellectual Property. All rights reserved.
6 # ================================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 # ============LICENSE_END=========================================================
20 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 PATH=/opt/app/datartr/bin:/bin:/usr/bin:$PATH
25 export PATH PROVSRVR PROVCMD NOPROXY
27 if [ ! -x /usr/bin/curl ]
29 echo provcmd: curl is required for this tool.
33 while [ -z "$optloop" ]
54 echo "provcmd: you need to specify the server, either via the -s option"
55 echo " or by setting and exporting PROVSRVR"
61 if [ "$CMD" == 'delete' ]
67 [ -n "$VERBOSE" ] && echo curl -4 -k -X DELETE "https://$PROVSRVR/internal/api/$1$NOPROXY"
68 curl -4 -k -X DELETE "https://$PROVSRVR/internal/api/$1$NOPROXY"
72 elif [ "$CMD" == 'create' ]
76 # create (with POST), then set the value
77 [ -n "$VERBOSE" ] && echo curl -4 -k -X POST --data '' "https://$PROVSRVR/internal/api/$1$NOPROXY"
78 curl -4 -k -X POST --data '' "https://$PROVSRVR/internal/api/$1$NOPROXY"
79 $PROVCMD set "$1" "$2"
82 elif [ "$CMD" == 'get' ]
87 [ -n "$VERBOSE" ] && echo curl -4 -k "https://$PROVSRVR/internal/api/$1$NOPROXY"
88 curl -4 -k "https://$PROVSRVR/internal/api/$1$NOPROXY" 2>/dev/null | tr '|' '\012' | sort
91 elif [ "$CMD" == 'set' ]
98 for i; do [ -n "$v" ] && v="$v|"; v="$v$i"; done
101 NOPROXY=`echo $NOPROXY | tr '?' '&'`
102 [ -n "$VERBOSE" ] && echo curl -4 -k -X PUT "https://$PROVSRVR/internal/api/$p?val=$ue$NOPROXY"
103 curl -4 -k -X PUT "https://$PROVSRVR/internal/api/$p?val=$ue$NOPROXY"
106 elif [ "$CMD" == 'append' ]
112 tmp=`curl -4 -k "https://$PROVSRVR/internal/api/$p$NOPROXY" 2>/dev/null`
113 $PROVCMD set "$p" "$tmp" "$@"
116 elif [ "$CMD" == 'remove' ]
122 $PROVCMD get "$p" | grep -v "^$rm\$" > /tmp/pc$$
124 $PROVCMD set "$p" `cat /tmp/pc$$`
130 # Some error somewhere - display usage
132 usage: provcmd [ -s server ] delete name1 [ name2 ... ]
133 provcmd [ -s server ] get name
134 provcmd [ -s server ] create name value
135 provcmd [ -s server ] set name value1 [ value2 ... ]
136 provcmd [ -s server ] append name value1 [ value2 ... ]
137 provcmd [ -s server ] remove name value
139 delete - remove the parameters named name1, name2 ...
140 get - displays the parameters' value
141 create - creates a new parameter
142 set - sets the value of an existing parameter
143 append - appends the value to a list-based parameter
144 remove - removes a value from a list based parameter
146 server - the provisioning server FQDN (feeds-drtr.web.att.com for production)
148 Standard Parameters Names:
149 ------------------------------
151 DELIVERY_INIT_RETRY_INTERVAL
153 DELIVERY_MAX_RETRY_INTERVAL