Adding onos-form-cluster & onos-config to the packaged runtime tools to allow installation and cluster configuration w/o any of the test or dev tools.
Change-Id: I84a9b0b82c623e17d43e053ca98c90937f532a63
diff --git a/tools/build/onos-package b/tools/build/onos-package
index 5ecb3ab..74d3379 100755
--- a/tools/build/onos-package
+++ b/tools/build/onos-package
@@ -40,6 +40,9 @@
# Stage all builtin ONOS apps for factory install
onos-stage-apps $ONOS_STAGE/apps $ONOS_STAGE/$KARAF_DIST/system
+# Mark the org.onosproject.drivers app active by default
+touch $ONOS_STAGE/apps/org.onosproject.drivers/active
+
# Patch-in proper Karaf version into the startup script
sed "s/\$KARAF_VERSION/$KARAF_VERSION/g" \
$ONOS_ROOT/tools/package/bin/onos-service > bin/onos-service
diff --git a/tools/package/bin/onos-config b/tools/package/bin/onos-config
new file mode 100755
index 0000000..307a628
--- /dev/null
+++ b/tools/package/bin/onos-config
@@ -0,0 +1,14 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Configures ONOS to multicast on the specified IP prefix/subnet.
+# -----------------------------------------------------------------------------
+
+[ $# -lt 2 ] && echo "usage: $(basename $0) name ipPrefix" && exit 1
+
+name=$1
+ipPrefix=$2
+
+hzXml=$(dirname $0)/../apache-karaf-*/etc/hazelcast.xml
+
+perl -pi.bak -e "s/^ <interface>[^<]*/ <interface>$ipPrefix/g" $hzXml
+perl -pi -e "s/ <name>[^<]*/ <name>$name/g" $hzXml
diff --git a/tools/package/bin/onos-form-cluster b/tools/package/bin/onos-form-cluster
new file mode 100755
index 0000000..925c6ff
--- /dev/null
+++ b/tools/package/bin/onos-form-cluster
@@ -0,0 +1,26 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Forms ONOS cluster using REST API of each separate instance.
+# -----------------------------------------------------------------------------
+
+[ $# -lt 2 ] && echo "usage: $(basename $0) ip1 ip2..." && exit 1
+
+ip=$1
+shift
+nodes=$*
+
+ipPrefix=${ip%.*}
+
+aux=/tmp/${ipPrefix}.cluster.json
+trap "rm -f $aux" EXIT
+
+echo "{ \"nodes\": [ { \"ip\": \"$ip\" }" > $aux
+for node in $nodes; do
+ echo ", { \"ip\": \"$node\" }" >> $aux
+done
+echo "], \"ipPrefix\": \"$ipPrefix.*\" }" >> $aux
+
+for node in $ip $nodes; do
+ echo "Forming cluster on $node..."
+ curl -X POST http://$node:8181/onos/v1/cluster/configuration -d @$aux
+done
\ No newline at end of file