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 |
| 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 | |
Thomas Vachuska | 132001a | 2015-06-09 02:50:33 -0700 | [diff] [blame] | 21 | node=${1:-$OCI} |
Thomas Vachuska | de563cf | 2015-04-01 00:28:50 -0700 | [diff] [blame] | 22 | |
Thomas Vachuska | 132001a | 2015-06-09 02:50:33 -0700 | [diff] [blame] | 23 | if [ $node = "cell" ]; then |
Thomas Vachuska | 3c831fa | 2015-08-17 18:44:15 -0700 | [diff] [blame] | 24 | nodes=${ONOS_INSTANCES} |
Thomas Vachuska | 132001a | 2015-06-09 02:50:33 -0700 | [diff] [blame] | 25 | node=${OCI} |
Thomas Vachuska | de563cf | 2015-04-01 00:28:50 -0700 | [diff] [blame] | 26 | else |
Thomas Vachuska | 132001a | 2015-06-09 02:50:33 -0700 | [diff] [blame] | 27 | nodes="$@" |
Thomas Vachuska | de563cf | 2015-04-01 00:28:50 -0700 | [diff] [blame] | 28 | fi |
| 29 | |
Thomas Vachuska | 132001a | 2015-06-09 02:50:33 -0700 | [diff] [blame] | 30 | set -x |
Thomas Vachuska | de563cf | 2015-04-01 00:28:50 -0700 | [diff] [blame] | 31 | |
alshabib | 7bb0501 | 2015-08-05 10:15:09 -0700 | [diff] [blame^] | 32 | ssh $ONOS_USER@$node $ONOS_INSTALL_DIR/bin/onos-form-cluster -u $user -p $password $nodes |