blob: d0672db4cad209573d0da2631b82a8a1760e8390 [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
Phil Huang5f9603d2016-01-21 01:01:09 +080016ONOS_WEB_USER=${ONOS_WEB_USER:-onos} # ONOS WEB User defaults to 'onos'
17ONOS_WEB_PASS=${ONOS_WEB_PASS:-rocks} # ONOS WEB Password defaults to 'rocks'
18user=${user:-$ONOS_WEB_USER}
19password=${password:-$ONOS_WEB_PASS}
Thomas Vachuska3c831fa2015-08-17 18:44:15 -070020let OPC=$OPTIND-1
21shift $OPC
22
Thomas Vachuska132001a2015-06-09 02:50:33 -070023node=${1:-$OCI}
Thomas Vachuskade563cf2015-04-01 00:28:50 -070024
Thomas Vachuska132001a2015-06-09 02:50:33 -070025if [ $node = "cell" ]; then
Thomas Vachuska3c831fa2015-08-17 18:44:15 -070026 nodes=${ONOS_INSTANCES}
Thomas Vachuska132001a2015-06-09 02:50:33 -070027 node=${OCI}
Thomas Vachuskade563cf2015-04-01 00:28:50 -070028else
Thomas Vachuska132001a2015-06-09 02:50:33 -070029 nodes="$@"
Thomas Vachuskade563cf2015-04-01 00:28:50 -070030fi
31
Thomas Vachuska132001a2015-06-09 02:50:33 -070032set -x
Thomas Vachuskade563cf2015-04-01 00:28:50 -070033
alshabib7bb05012015-08-05 10:15:09 -070034ssh $ONOS_USER@$node $ONOS_INSTALL_DIR/bin/onos-form-cluster -u $user -p $password $nodes