#!/bin/bash


#
# Copyright 2015-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# -----------------------------------------------------------------------------
# Utility for handling common REST API usage.
# -----------------------------------------------------------------------------

ONOS_WEB_USER=${ONOS_WEB_USER:-onos}  # ONOS WEB User defaults to 'onos'
ONOS_WEB_PASS=${ONOS_WEB_PASS:-rocks} # ONOS WEB Password defaults to 'rocks'
ONOS_WEB_PORT=${ONOS_WEB_PORT:-8181}  # REST API port defaults to '8181'

port=${ONOS_WEB_PORT}
user=${ONOS_WEB_USER}
password=${ONOS_WEB_PASS}
fail="--fail"

while getopts P:u:p:v?h o; do
    case "$o" in
        P) port=$OPTARG;;
        u) user=$OPTARG;;
        p) password=$OPTARG;;
        v) fail="";;
        *) usage;;
    esac
done

let OPC=$OPTIND-1
shift $OPC
