Fixing a few tools to work with the new REST security stuff.
Change-Id: I1fcff24bf57e3198c16df5a6e42d721a004e9097
Showing
9 changed files
with
40 additions
and
12 deletions
... | @@ -105,6 +105,8 @@ function cell { | ... | @@ -105,6 +105,8 @@ function cell { |
105 | unset ONOS_CELL ONOS_NIC ONOS_IP ONOS_APPS ONOS_BOOT_FEATURES | 105 | unset ONOS_CELL ONOS_NIC ONOS_IP ONOS_APPS ONOS_BOOT_FEATURES |
106 | unset OCI OCN OCT ONOS_INSTANCES ONOS_USER ONOS_GROUP ONOS_FEATURES | 106 | unset OCI OCN OCT ONOS_INSTANCES ONOS_USER ONOS_GROUP ONOS_FEATURES |
107 | unset $(env | sed -n 's:\(^OC[0-9]\{1,\}\)=.*:\1 :g p') | 107 | unset $(env | sed -n 's:\(^OC[0-9]\{1,\}\)=.*:\1 :g p') |
108 | + export ONOS_WEB_USER=onos | ||
109 | + export ONOS_WEB_PASS=rocks | ||
108 | export ONOS_CELL=$1 | 110 | export ONOS_CELL=$1 |
109 | . $ONOS_ROOT/tools/test/cells/$1 | 111 | . $ONOS_ROOT/tools/test/cells/$1 |
110 | export ONOS_INSTANCES=$(env | grep 'OC[0-9]*=' | sort | cut -d= -f2) | 112 | export ONOS_INSTANCES=$(env | grep 'OC[0-9]*=' | sort | cut -d= -f2) |
... | @@ -115,7 +117,7 @@ function cell { | ... | @@ -115,7 +117,7 @@ function cell { |
115 | env | egrep "OCI" | 117 | env | egrep "OCI" |
116 | env | egrep "OC[0-9]+" | sort | 118 | env | egrep "OC[0-9]+" | sort |
117 | env | egrep "OC[NT]" | 119 | env | egrep "OC[NT]" |
118 | - env | egrep "ONOS_" | egrep -v 'ONOS_ROOT|ONOS_CELL|ONOS_INSTANCES' | 120 | + env | egrep "ONOS_" | egrep -v 'ONOS_ROOT|ONOS_CELL|ONOS_INSTANCES' | sort |
119 | fi | 121 | fi |
120 | } | 122 | } |
121 | 123 | ... | ... |
... | @@ -9,7 +9,7 @@ app=${3} | ... | @@ -9,7 +9,7 @@ app=${3} |
9 | 9 | ||
10 | export URL=http://$node:8181/onos/v1/applications | 10 | export URL=http://$node:8181/onos/v1/applications |
11 | export HDR="-HContent-Type:application/octet-stream" | 11 | export HDR="-HContent-Type:application/octet-stream" |
12 | -export curl="curl -sS" | 12 | +export curl="curl -sS --user $ONOS_WEB_USER:$ONOS_WEB_PASS" |
13 | 13 | ||
14 | # Prints usage help | 14 | # Prints usage help |
15 | function usage { | 15 | function usage { | ... | ... |
... | @@ -5,6 +5,18 @@ | ... | @@ -5,6 +5,18 @@ |
5 | 5 | ||
6 | [ $# -lt 2 ] && echo "usage: $(basename $0) ip1 ip2..." && exit 1 | 6 | [ $# -lt 2 ] && echo "usage: $(basename $0) ip1 ip2..." && exit 1 |
7 | 7 | ||
8 | +# Scan arguments for user/password or other options... | ||
9 | +while getopts u:p: o; do | ||
10 | + case "$o" in | ||
11 | + u) user=$OPTARG;; | ||
12 | + p) password=$OPTARG;; | ||
13 | + esac | ||
14 | +done | ||
15 | +user=${user:-onos} # user defaults to 'onos' | ||
16 | +password=${password:-$user} # password defaults to user name if not specified | ||
17 | +let OPC=$OPTIND-1 | ||
18 | +shift $OPC | ||
19 | + | ||
8 | ip=$1 | 20 | ip=$1 |
9 | shift | 21 | shift |
10 | nodes=$* | 22 | nodes=$* |
... | @@ -22,5 +34,6 @@ echo "], \"ipPrefix\": \"$ipPrefix.*\" }" >> $aux | ... | @@ -22,5 +34,6 @@ echo "], \"ipPrefix\": \"$ipPrefix.*\" }" >> $aux |
22 | 34 | ||
23 | for node in $ip $nodes; do | 35 | for node in $ip $nodes; do |
24 | echo "Forming cluster on $node..." | 36 | echo "Forming cluster on $node..." |
25 | - curl -X POST http://$node:8181/onos/v1/cluster/configuration -d @$aux | 37 | + curl --user $user:$password -X POST \ |
38 | + http://$node:8181/onos/v1/cluster/configuration -d @$aux | ||
26 | done | 39 | done |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -7,14 +7,14 @@ rm -f $(dirname $0)/onos | ... | @@ -7,14 +7,14 @@ rm -f $(dirname $0)/onos |
7 | 7 | ||
8 | set -e | 8 | set -e |
9 | 9 | ||
10 | -# Scan argument for user/password or other options... | 10 | +# Scan arguments for user/password or other options... |
11 | while getopts u:p: o; do | 11 | while getopts u:p: o; do |
12 | case "$o" in | 12 | case "$o" in |
13 | u) user=$OPTARG;; | 13 | u) user=$OPTARG;; |
14 | p) password=$OPTARG;; | 14 | p) password=$OPTARG;; |
15 | esac | 15 | esac |
16 | done | 16 | done |
17 | -password=${password:-user} # password defaults to the user name if not specified | 17 | +password=${password:-$user} # password defaults to the user if not specified |
18 | let OPC=$OPTIND-1 | 18 | let OPC=$OPTIND-1 |
19 | shift $OPC | 19 | shift $OPC |
20 | 20 | ... | ... |
... | @@ -11,7 +11,7 @@ | ... | @@ -11,7 +11,7 @@ |
11 | 11 | ||
12 | [ -n "$1" ] && OCI=$(find_node $1) && shift | 12 | [ -n "$1" ] && OCI=$(find_node $1) && shift |
13 | 13 | ||
14 | -if which client 2>/dev/null && [ -z "$ONOS_USE_SSH" ]; then | 14 | +if which client 1>/dev/null 2>&1 && [ -z "$ONOS_USE_SSH" ]; then |
15 | # Use Karaf client only if we can and are allowed to | 15 | # Use Karaf client only if we can and are allowed to |
16 | unset KARAF_HOME | 16 | unset KARAF_HOME |
17 | client -h $OCI -u karaf "$@" 2>/dev/null | 17 | client -h $OCI -u karaf "$@" 2>/dev/null | ... | ... |
... | @@ -6,10 +6,22 @@ | ... | @@ -6,10 +6,22 @@ |
6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
7 | . $ONOS_ROOT/tools/build/envDefaults | 7 | . $ONOS_ROOT/tools/build/envDefaults |
8 | 8 | ||
9 | +# Scan arguments for user/password or other options... | ||
10 | +while getopts u:p: o; do | ||
11 | + case "$o" in | ||
12 | + u) user=$OPTARG;; | ||
13 | + p) password=$OPTARG;; | ||
14 | + esac | ||
15 | +done | ||
16 | +user=${user:-onos} # user defaults to 'onos' | ||
17 | +password=${password:-$user} # password defaults to user name if not specified | ||
18 | +let OPC=$OPTIND-1 | ||
19 | +shift $OPC | ||
20 | + | ||
9 | node=${1:-$OCI} | 21 | node=${1:-$OCI} |
10 | 22 | ||
11 | if [ $node = "cell" ]; then | 23 | if [ $node = "cell" ]; then |
12 | - nodes=$(env | grep "OC[0-9]*=" | cut -d= -f2) | 24 | + nodes=${ONOS_INSTANCES} |
13 | node=${OCI} | 25 | node=${OCI} |
14 | else | 26 | else |
15 | nodes="$@" | 27 | nodes="$@" |
... | @@ -17,4 +29,4 @@ fi | ... | @@ -17,4 +29,4 @@ fi |
17 | 29 | ||
18 | set -x | 30 | set -x |
19 | 31 | ||
20 | -ssh $ONOS_USER@$node /tmp/$ONOS_BITS/bin/onos-form-cluster $nodes | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
32 | +ssh $ONOS_USER@$node /tmp/$ONOS_BITS/bin/onos-form-cluster -u $user -p $password $nodes | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -9,5 +9,6 @@ | ... | @@ -9,5 +9,6 @@ |
9 | node="${1:-$OCI}" | 9 | node="${1:-$OCI}" |
10 | file="${2:-$ONOS_ROOT/tools/test/topos/oe-linear-3.json}" | 10 | file="${2:-$ONOS_ROOT/tools/test/topos/oe-linear-3.json}" |
11 | 11 | ||
12 | -curl -sS --fail -L -X POST -H 'Content-Type:application/json' \ | 12 | +curl -sS --fail -L --user $ONOS_WEB_USER:$ONOS_WEB_PASS \ |
13 | + -X POST -H 'Content-Type:application/json' \ | ||
13 | http://$node:8181/onos/v1/config/topology -d@$file | 14 | http://$node:8181/onos/v1/config/topology -d@$file | ... | ... |
... | @@ -16,7 +16,7 @@ | ... | @@ -16,7 +16,7 @@ |
16 | <scenario name="setup" description="ONOS cluster setup"> | 16 | <scenario name="setup" description="ONOS cluster setup"> |
17 | <group name="Setup"> | 17 | <group name="Setup"> |
18 | <step name="Push-Bits" exec="onos-push-bits-through-proxy" if="${OCT}"/> | 18 | <step name="Push-Bits" exec="onos-push-bits-through-proxy" if="${OCT}"/> |
19 | - <step name="Secure-SSH" exec="onos-secure-ssh -u onos -p rocks" if="${ONOS_USE_SSH}"/> | 19 | + <step name="Secure-SSH" exec="onos-secure-ssh -u ${ONOS_WEB_USER} -p ${ONOS_WEB_PASS}" if="${ONOS_USE_SSH}"/> |
20 | 20 | ||
21 | <parallel var="${OC#}"> | 21 | <parallel var="${OC#}"> |
22 | <step name="Push-Bits-${#}" exec="onos-push-bits ${OC#}" | 22 | <step name="Push-Bits-${#}" exec="onos-push-bits ${OC#}" | ... | ... |
... | @@ -16,7 +16,7 @@ | ... | @@ -16,7 +16,7 @@ |
16 | <scenario name="tar-setup" description="ONOS cluster setup via onos.tar.gz"> | 16 | <scenario name="tar-setup" description="ONOS cluster setup via onos.tar.gz"> |
17 | <group name="Setup-Instances"> | 17 | <group name="Setup-Instances"> |
18 | <step name="Push-Bits" exec="onos-push-bits-through-proxy" if="${OCT}"/> | 18 | <step name="Push-Bits" exec="onos-push-bits-through-proxy" if="${OCT}"/> |
19 | - <step name="Secure-SSH" exec="onos-secure-ssh" if="${ONOS_USE_SSH}"/> | 19 | + <step name="Secure-SSH" exec="onos-secure-ssh -u ${ONOS_WEB_USER} -p ${ONOS_WEB_PASS}" if="${ONOS_USE_SSH}"/> |
20 | 20 | ||
21 | <parallel var="${OC#}"> | 21 | <parallel var="${OC#}"> |
22 | <step name="Push-Bits-${#}" exec="onos-push-bits ${OC#}" unless="${OCT}"/> | 22 | <step name="Push-Bits-${#}" exec="onos-push-bits ${OC#}" unless="${OCT}"/> |
... | @@ -44,7 +44,7 @@ | ... | @@ -44,7 +44,7 @@ |
44 | </group> | 44 | </group> |
45 | 45 | ||
46 | <group name="Setup-Cluster" requires="Setup-Instances" unless="${NO_CLUSTER}"> | 46 | <group name="Setup-Cluster" requires="Setup-Instances" unless="${NO_CLUSTER}"> |
47 | - <step name="Form-Cluster" exec="onos-form-cluster cell"/> | 47 | + <step name="Form-Cluster" exec="onos-form-cluster -u ${ONOS_WEB_USER} -p ${ONOS_WEB_PASS} cell"/> |
48 | <parallel var="${OC#}"> | 48 | <parallel var="${OC#}"> |
49 | <step name="Wait-for-Start-Again-${#}" exec="onos-wait-for-start ${OC#}" | 49 | <step name="Wait-for-Start-Again-${#}" exec="onos-wait-for-start ${OC#}" |
50 | requires="Form-Cluster"/> | 50 | requires="Form-Cluster"/> | ... | ... |
-
Please register or login to post a comment