Thomas Vachuska | de563cf | 2015-04-01 00:28:50 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Forms ONOS cluster using REST API. |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 7 | . $ONOS_ROOT/tools/build/envDefaults |
| 8 | |
Thomas Vachuska | 3c831fa | 2015-08-17 18:44:15 -0700 | [diff] [blame] | 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 |
Phil Huang | 5f9603d | 2016-01-21 01:01:09 +0800 | [diff] [blame^] | 16 | ONOS_WEB_USER=${ONOS_WEB_USER:-onos} # ONOS WEB User defaults to 'onos' |
| 17 | ONOS_WEB_PASS=${ONOS_WEB_PASS:-rocks} # ONOS WEB Password defaults to 'rocks' |
| 18 | user=${user:-$ONOS_WEB_USER} |
| 19 | password=${password:-$ONOS_WEB_PASS} |
Thomas Vachuska | 3c831fa | 2015-08-17 18:44:15 -0700 | [diff] [blame] | 20 | let OPC=$OPTIND-1 |
| 21 | shift $OPC |
| 22 | |
Thomas Vachuska | 132001a | 2015-06-09 02:50:33 -0700 | [diff] [blame] | 23 | node=${1:-$OCI} |
Thomas Vachuska | de563cf | 2015-04-01 00:28:50 -0700 | [diff] [blame] | 24 | |
Thomas Vachuska | 132001a | 2015-06-09 02:50:33 -0700 | [diff] [blame] | 25 | if [ $node = "cell" ]; then |
Thomas Vachuska | 3c831fa | 2015-08-17 18:44:15 -0700 | [diff] [blame] | 26 | nodes=${ONOS_INSTANCES} |
Thomas Vachuska | 132001a | 2015-06-09 02:50:33 -0700 | [diff] [blame] | 27 | node=${OCI} |
Thomas Vachuska | de563cf | 2015-04-01 00:28:50 -0700 | [diff] [blame] | 28 | else |
Thomas Vachuska | 132001a | 2015-06-09 02:50:33 -0700 | [diff] [blame] | 29 | nodes="$@" |
Thomas Vachuska | de563cf | 2015-04-01 00:28:50 -0700 | [diff] [blame] | 30 | fi |
| 31 | |
Thomas Vachuska | 132001a | 2015-06-09 02:50:33 -0700 | [diff] [blame] | 32 | set -x |
Thomas Vachuska | de563cf | 2015-04-01 00:28:50 -0700 | [diff] [blame] | 33 | |
alshabib | 7bb0501 | 2015-08-05 10:15:09 -0700 | [diff] [blame] | 34 | ssh $ONOS_USER@$node $ONOS_INSTALL_DIR/bin/onos-form-cluster -u $user -p $password $nodes |