Thomas Vachuska | 4bd4bf1 | 2018-04-16 14:02:18 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | |
| 4 | # |
| 5 | # Copyright 2015-present Open Networking Foundation |
| 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 |
| 10 | # |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | # |
| 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 | # |
| 19 | |
| 20 | # ----------------------------------------------------------------------------- |
| 21 | # Utility for handling common REST API usage. |
| 22 | # ----------------------------------------------------------------------------- |
| 23 | |
| 24 | ONOS_WEB_USER=${ONOS_WEB_USER:-onos} # ONOS WEB User defaults to 'onos' |
| 25 | ONOS_WEB_PASS=${ONOS_WEB_PASS:-rocks} # ONOS WEB Password defaults to 'rocks' |
| 26 | ONOS_WEB_PORT=${ONOS_WEB_PORT:-8181} # REST API port defaults to '8181' |
| 27 | |
| 28 | port=${ONOS_WEB_PORT} |
| 29 | user=${ONOS_WEB_USER} |
| 30 | password=${ONOS_WEB_PASS} |
| 31 | fail="--fail" |
| 32 | |
| 33 | while getopts P:u:p:v?h o; do |
| 34 | case "$o" in |
| 35 | P) port=$OPTARG;; |
| 36 | u) user=$OPTARG;; |
| 37 | p) password=$OPTARG;; |
| 38 | v) fail="";; |
| 39 | *) usage;; |
| 40 | esac |
| 41 | done |
| 42 | |
| 43 | let OPC=$OPTIND-1 |
| 44 | shift $OPC |