mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-29 07:11:49 +01:00
28 lines
1.1 KiB
Bash
Executable File
28 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# -----------------------------------------------------------------------------
|
|
# Remotely configures & starts ONOS for the first time.
|
|
# -----------------------------------------------------------------------------
|
|
|
|
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
|
|
. $ONOS_ROOT/tools/build/envDefaults
|
|
|
|
remote=$ONOS_USER@${1:-$OCI}
|
|
|
|
# Generate a cluster.json from the ON* environment variables
|
|
CDEF_FILE=/tmp/cluster.json
|
|
echo "{ \"nodes\":[" > $CDEF_FILE
|
|
for node in $(env | sort | egrep "OC[2-9]+" | cut -d= -f2); do
|
|
echo " { \"id\": \"$node\", \"ip\": \"$node\", \"tcpPort\": 9876 }," >> $CDEF_FILE
|
|
done
|
|
echo " { \"id\": \"$OC1\", \"ip\": \"$OC1\", \"tcpPort\": 9876 }" >> $CDEF_FILE
|
|
echo "]}" >> $CDEF_FILE
|
|
|
|
ssh $remote "
|
|
sudo perl -pi.bak -e \"s/ <interface>.*</ <interface>${ONOS_NIC:-192.168.56.*}</g\" \
|
|
$ONOS_INSTALL_DIR/$KARAF_DIST/etc/hazelcast.xml
|
|
|
|
echo \"onos.ip = \$(ifconfig | grep $ONOS_NIC | cut -d: -f2 | cut -d\\ -f1)\" \
|
|
>> $ONOS_INSTALL_DIR/$KARAF_DIST/etc/system.properties
|
|
"
|
|
scp -q $CDEF_FILE $remote:$ONOS_INSTALL_DIR/config/
|