Yuta HIGUCHI

Support running onos-config in parallel against each hosts in cell

Change-Id: Ifc2145068b92d320d42178afb05cd1bb825f86d2
......@@ -9,13 +9,14 @@
remote=$ONOS_USER@${1:-$OCI}
# Generate a cluster.json from the ON* environment variables
CDEF_FILE=/tmp/cluster.json
CDEF_FILE=/tmp/${remote}.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
scp -q $CDEF_FILE $remote:$ONOS_INSTALL_DIR/config/cluster.json
ssh $remote "
sudo perl -pi.bak -e \"s/ <interface>.*</ <interface>${ONOS_NIC:-192.168.56.*}</g\" \
......@@ -26,17 +27,22 @@ ssh $remote "
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/
# Generate a default tablets.json from the ON* environment variables
TDEF_FILE=/tmp/tablets.json
TDEF_FILE=/tmp/${remote}.tablets.json
nodes=( $(env | sort | egrep "OC[0-9]+" | cut -d= -f2) )
echo "{ \"default\":[" > $TDEF_FILE
for node in $(env | sort | egrep "OC[2-9]+" | cut -d= -f2); do
echo " { \"id\": \"$node\", \"ip\": \"$node\", \"tcpPort\": 9876 }," >> $TDEF_FILE
while [ ${#nodes[@]} -gt 0 ]; do
node=${nodes[0]}
nodes=( ${nodes[@]:1} )
if [ "${#nodes[@]}" -ne "0" ]; then
echo " { \"id\": \"$node\", \"ip\": \"$node\", \"tcpPort\": 9876 }," >> $TDEF_FILE
else
echo " { \"id\": \"$node\", \"ip\": \"$node\", \"tcpPort\": 9876 }" >> $TDEF_FILE
fi
done
echo " { \"id\": \"$OC1\", \"ip\": \"$OC1\", \"tcpPort\": 9876 }" >> $TDEF_FILE
echo "]}" >> $TDEF_FILE
scp -q $TDEF_FILE $remote:$ONOS_INSTALL_DIR/config/
scp -q $TDEF_FILE $remote:$ONOS_INSTALL_DIR/config/tablets.json
# copy tools/package/config/ to remote
......