blob: daca34cca7eee76933832754a490cecf3d317093 [file] [log] [blame]
Thomas Vachuskade563cf2015-04-01 00:28:50 -07001#!/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 Vachuska3c831fa2015-08-17 18:44:15 -07009# Scan arguments for user/password or other options...
10while getopts u:p: o; do
11 case "$o" in
12 u) user=$OPTARG;;
13 p) password=$OPTARG;;
14 esac
15done
16user=${user:-onos} # user defaults to 'onos'
17password=${password:-$user} # password defaults to user name if not specified
18let OPC=$OPTIND-1
19shift $OPC
20
Thomas Vachuska132001a2015-06-09 02:50:33 -070021node=${1:-$OCI}
Thomas Vachuskade563cf2015-04-01 00:28:50 -070022
Thomas Vachuska132001a2015-06-09 02:50:33 -070023if [ $node = "cell" ]; then
Thomas Vachuska3c831fa2015-08-17 18:44:15 -070024 nodes=${ONOS_INSTANCES}
Thomas Vachuska132001a2015-06-09 02:50:33 -070025 node=${OCI}
Thomas Vachuskade563cf2015-04-01 00:28:50 -070026else
Thomas Vachuska132001a2015-06-09 02:50:33 -070027 nodes="$@"
Thomas Vachuskade563cf2015-04-01 00:28:50 -070028fi
29
Thomas Vachuska132001a2015-06-09 02:50:33 -070030set -x
Thomas Vachuskade563cf2015-04-01 00:28:50 -070031
alshabib7bb05012015-08-05 10:15:09 -070032ssh $ONOS_USER@$node $ONOS_INSTALL_DIR/bin/onos-form-cluster -u $user -p $password $nodes