tom | 5ca3437 | 2014-09-19 17:43:41 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Pavlin Radoslavov | 9141379 | 2014-10-15 11:00:32 -0700 | [diff] [blame] | 2 | # ----------------------------------------------------------------------------- |
tom | 5ca3437 | 2014-09-19 17:43:41 -0700 | [diff] [blame] | 3 | # Remotely configures & starts ONOS for the first time. |
Pavlin Radoslavov | 9141379 | 2014-10-15 11:00:32 -0700 | [diff] [blame] | 4 | # ----------------------------------------------------------------------------- |
tom | 5ca3437 | 2014-09-19 17:43:41 -0700 | [diff] [blame] | 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 | |
tom | defed6f | 2014-09-29 11:37:02 -0700 | [diff] [blame] | 11 | # Generate a cluster.json from the ON* environment variables |
| 12 | CDEF_FILE=/tmp/cluster.json |
| 13 | echo "{ \"nodes\":[" > $CDEF_FILE |
| 14 | for node in $(env | sort | egrep "OC[2-9]+" | cut -d= -f2); do |
| 15 | echo " { \"id\": \"$node\", \"ip\": \"$node\", \"tcpPort\": 9876 }," >> $CDEF_FILE |
| 16 | done |
| 17 | echo " { \"id\": \"$OC1\", \"ip\": \"$OC1\", \"tcpPort\": 9876 }" >> $CDEF_FILE |
| 18 | echo "]}" >> $CDEF_FILE |
| 19 | |
tom | 0768a02 | 2014-09-24 16:16:16 -0700 | [diff] [blame] | 20 | ssh $remote " |
| 21 | sudo perl -pi.bak -e \"s/ <interface>.*</ <interface>${ONOS_NIC:-192.168.56.*}</g\" \ |
| 22 | $ONOS_INSTALL_DIR/$KARAF_DIST/etc/hazelcast.xml |
Yuta HIGUCHI | 673aaeb | 2014-11-22 03:31:18 -0800 | [diff] [blame^] | 23 | sudo perl -pi -e \"s/ <name>onos</ <name>${ONOS_CELL:-onos}</g\" \ |
| 24 | $ONOS_INSTALL_DIR/$KARAF_DIST/etc/hazelcast.xml |
tom | defed6f | 2014-09-29 11:37:02 -0700 | [diff] [blame] | 25 | |
| 26 | echo \"onos.ip = \$(ifconfig | grep $ONOS_NIC | cut -d: -f2 | cut -d\\ -f1)\" \ |
| 27 | >> $ONOS_INSTALL_DIR/$KARAF_DIST/etc/system.properties |
| 28 | " |
Pavlin Radoslavov | 9141379 | 2014-10-15 11:00:32 -0700 | [diff] [blame] | 29 | scp -q $CDEF_FILE $remote:$ONOS_INSTALL_DIR/config/ |
Yuta HIGUCHI | 60731cb | 2014-11-11 01:34:46 -0800 | [diff] [blame] | 30 | |
| 31 | # Generate a default tablets.json from the ON* environment variables |
| 32 | TDEF_FILE=/tmp/tablets.json |
| 33 | echo "{ \"default\":[" > $TDEF_FILE |
| 34 | for node in $(env | sort | egrep "OC[2-9]+" | cut -d= -f2); do |
| 35 | echo " { \"id\": \"$node\", \"ip\": \"$node\", \"tcpPort\": 9876 }," >> $TDEF_FILE |
| 36 | done |
| 37 | echo " { \"id\": \"$OC1\", \"ip\": \"$OC1\", \"tcpPort\": 9876 }" >> $TDEF_FILE |
| 38 | echo "]}" >> $TDEF_FILE |
| 39 | scp -q $TDEF_FILE $remote:$ONOS_INSTALL_DIR/config/ |
| 40 | |
| 41 | |
| 42 | # copy tools/package/config/ to remote |
| 43 | scp -qr ${ONOS_ROOT}/tools/package/config/ $remote:$ONOS_INSTALL_DIR/ |
| 44 | |