Committed by
Brian O'Connor
Ensure cluster metadata is setup as part of onos-run-karaf
Change-Id: I88e61459cec6af8a2762a439ece6fc4d33d87ee4
Showing
1 changed file
with
15 additions
and
1 deletions
... | @@ -25,6 +25,19 @@ export ONOS_HOME=$PWD | ... | @@ -25,6 +25,19 @@ export ONOS_HOME=$PWD |
25 | # FIXME: for now we're running using the karaf client; later use raw SSH | 25 | # FIXME: for now we're running using the karaf client; later use raw SSH |
26 | unset ONOS_USE_SSH | 26 | unset ONOS_USE_SSH |
27 | 27 | ||
28 | +# Create config/cluster.json (cluster metadata) | ||
29 | +ONOS_IP=${ONOS_IP:-127.0.0.1} | ||
30 | +IP="${1:-$ONOS_IP}" | ||
31 | +echo "Creating local cluster configs for IP $IP..." | ||
32 | +[ -d $ONOS_HOME/config ] || mkdir -p $ONOS_HOME/config | ||
33 | +cat > $ONOS_HOME/config/cluster.json <<EOF | ||
34 | +{ | ||
35 | + "name": "default", | ||
36 | + "nodes": [ {"id": "$IP", "ip": "$IP", "port": 9876 } ], | ||
37 | + "partitions": [ { "id": 1, "members": [ "$IP" ] } ] | ||
38 | +} | ||
39 | +EOF | ||
40 | + | ||
28 | # Start ONOS as a server, but include any specified options | 41 | # Start ONOS as a server, but include any specified options |
29 | ./bin/onos-service server "$@" &>onos.log & | 42 | ./bin/onos-service server "$@" &>onos.log & |
30 | echo "$!" > /tmp/onos.pid | 43 | echo "$!" > /tmp/onos.pid |
... | @@ -41,4 +54,5 @@ until [ $RETRY_COUNT -le 0 ]; do | ... | @@ -41,4 +54,5 @@ until [ $RETRY_COUNT -le 0 ]; do |
41 | RETRY_COUNT=$[$RETRY_COUNT-1] | 54 | RETRY_COUNT=$[$RETRY_COUNT-1] |
42 | sleep 1 | 55 | sleep 1 |
43 | done | 56 | done |
44 | -echo "Fail to open karaf.log" | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
57 | +echo "Fail to open karaf.log" | ||
58 | + | ... | ... |
-
Please register or login to post a comment