recover onos-config
Change-Id: I6778503bd801ea1660cc116036a193e080deb57d
Showing
1 changed file
with
27 additions
and
0 deletions
tools/test/bin/onos-config
0 → 100755
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 | +# 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 | + | ||
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 | ||
23 | + | ||
24 | + echo \"onos.ip = \$(ifconfig | grep $ONOS_NIC | cut -d: -f2 | cut -d\\ -f1)\" \ | ||
25 | + >> $ONOS_INSTALL_DIR/$KARAF_DIST/etc/system.properties | ||
26 | +" | ||
27 | +scp -q $CDEF_FILE $remote:$ONOS_INSTALL_DIR/config/ |
-
Please register or login to post a comment