| # ----------------------------------------------------------------------------- |
| # Forms ONOS cluster using REST API of each separate instance. |
| # ----------------------------------------------------------------------------- |
| [ $# -lt 2 ] && echo "usage: $(basename $0) ip1 ip2..." && exit 1 |
| # Scan arguments for user/password or other options... |
| user=${user:-onos} # user defaults to 'onos' |
| password=${password:-$user} # password defaults to user name if not specified |
| aux=/tmp/${ipPrefix}.cluster.json |
| echo "{ \"nodes\": [ { \"ip\": \"$ip\" }" > $aux |
| echo ", { \"ip\": \"$node\" }" >> $aux |
| echo "], \"ipPrefix\": \"$ipPrefix.*\" }" >> $aux |
| for node in $ip $nodes; do |
| echo "Forming cluster on $node..." |
| curl --user $user:$password -X POST \ |
| http://$node:8181/onos/v1/cluster/configuration -d @$aux |