tom | 5ca3437 | 2014-09-19 17:43:41 -0700 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- |
| 3 | # Remotely configures & starts ONOS for the first time. |
| 4 | #------------------------------------------------------------------------------- |
| 5 | |
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 7 | . $ONOS_ROOT/tools/build/envDefaults |
| 8 | |
| 9 | remote=$ONOS_USER@${1:-$OCI} |
| 10 | |
| 11 | LOG=$ONOS_INSTALL_DIR/config.log |
| 12 | onos=$ONOS_INSTALL_DIR/bin/onos |
| 13 | |
| 14 | ssh $remote " |
| 15 | echo 'Starting...' |
| 16 | nohup $ONOS_INSTALL_DIR/bin/onos-ctl server </dev/null | 1>/opt/onos/svc.log 2>&1 & |
| 17 | |
| 18 | # Wait until we reach the run-level 100 |
| 19 | echo 'Waiting for cluster bootstrap...' |
| 20 | running="" |
| 21 | while [ -z \$running ]; do |
| 22 | $onos bundle:list 2>>$LOG | grep -q 'START LEVEL 100' && running=1 || sleep 2 |
| 23 | done |
| 24 | |
| 25 | # Now create group onos and join it, while quitting the default one |
| 26 | if ! $onos cluster:group-list 2>>$LOG | cut -d \\ -f3 | grep -q onos; then |
| 27 | echo 'Creating ONOS group...' |
| 28 | installRole=primary |
| 29 | $onos cluster:group-create onos 1>>$LOG 2>&1 |
| 30 | fi |
| 31 | |
| 32 | echo 'Configuring group membership...' |
| 33 | node=\$($onos cluster:node-list 2>>$LOG | grep '^x' | cut -d \\ -f3) |
| 34 | $onos cluster:group-join onos \$node 1>>$LOG 2>&1 |
| 35 | $onos cluster:group-quit default \$node 1>>$LOG 2>&1 |
| 36 | |
| 37 | if [ X\$installRole = Xprimary ]; then |
| 38 | echo 'Installing ONOS bundles...' |
| 39 | $onos cluster:feature-install onos onos-api 1>>$LOG 2>&1 |
| 40 | $onos cluster:feature-install onos onos-core 1>>$LOG 2>&1 |
| 41 | $onos cluster:feature-install onos onos-openflow 1>>$LOG 2>&1 |
| 42 | $onos cluster:feature-install onos onos-cli 1>>$LOG 2>&1 |
| 43 | # $onos cluster:feature-install onos onos-gui 1>>$LOG 2>&1 |
| 44 | # $onos cluster:feature-install onos onos-rest 1>>$LOG 2>&1 |
| 45 | $onos cluster:feature-install onos onos-app-tvue 1>>$LOG 2>&1 |
| 46 | $onos cluster:feature-install onos onos-app-fwd 1>>$LOG 2>&1 |
| 47 | fi |
| 48 | |
| 49 | echo 'Started...' |
| 50 | " |