| # ----------------------------------------------------------------------------- |
| # Forms ONOS cluster using REST API. |
| # ----------------------------------------------------------------------------- |
| [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| . $ONOS_ROOT/tools/build/envDefaults |
| if [ $ip = "cell" ]; then |
| nodes=$(env | grep "OC[0-9]*=" | grep -v "OC1=" | cut -d= -f2) |
| 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 -X POST http://$node:8181/onos/v1/cluster/configuration -d @$aux |