Fixing onos-package not to be sensitive to cell settings and instead allowing onos-config (used from onos-install) to be fully sensitive to cell settings.
Added onos-package-test and onos-push-test-bits scripts.

Change-Id: Ie3f829f8a6e6d8a419388428feca56b69635ed44
diff --git a/tools/build/envDefaults b/tools/build/envDefaults
index a7eb8bf..f66d47e 100644
--- a/tools/build/envDefaults
+++ b/tools/build/envDefaults
@@ -20,12 +20,20 @@
 # ONOS Version and onos.tar.gz staging environment
 export ONOS_POM_VERSION="1.1.0-SNAPSHOT"
 export ONOS_VERSION=${ONOS_VERSION:-1.1.0.$BUILD_NUMBER}
+
+# ONOS production bits (onos.tar.gz & onos.zip) staging environment
 export ONOS_BITS=onos-${ONOS_VERSION%~*}
 export ONOS_STAGE_ROOT=${ONOS_STAGE_ROOT:-/tmp}
 export ONOS_STAGE=$ONOS_STAGE_ROOT/$ONOS_BITS
 export ONOS_TAR=$ONOS_STAGE.tar.gz
 export ONOS_ZIP=$ONOS_STAGE.zip
 
+# ONOS test bits (onos-test.tar.gz) staging environment
+export ONOS_TEST_BITS=onos-test-${ONOS_VERSION%~*}
+export ONOS_TEST_STAGE_ROOT=${ONOS_TEST_STAGE_ROOT:-/tmp}
+export ONOS_TEST_STAGE=$ONOS_STAGE_ROOT/$ONOS_TEST_BITS
+export ONOS_TEST_TAR=$ONOS_TEST_STAGE.tar.gz
+
 # Defaults for ONOS testing using remote machines.
 # if [ -n "${ONOS_CELL}" -a -f $ONOS_ROOT/tools/test/cells/${ONOS_CELL} ]; then
 #   . $ONOS_ROOT/tools/test/cells/${ONOS_CELL}
diff --git a/tools/build/onos-package b/tools/build/onos-package
index 31551ea..05b51e6 100755
--- a/tools/build/onos-package
+++ b/tools/build/onos-package
@@ -1,6 +1,6 @@
 #!/bin/bash
 # -----------------------------------------------------------------------------
-# Packages ONOS distributable into onos.tar.gz
+# Packages ONOS distributable into onos.tar.gz and onos.zip
 # -----------------------------------------------------------------------------
 
 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
@@ -57,8 +57,6 @@
         $KARAF_DIST/system/org/onosproject/$artifact/$ONOS_POM_VERSION
 done
 
-export ONOS_FEATURES="${ONOS_FEATURES:-webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow,onos-app-fwd,onos-app-foo}"
-
 # ONOS Patching ----------------------------------------------------------------
 
 # Patch the Apache Karaf distribution file to add ONOS features repository
@@ -66,6 +64,7 @@
     $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg 
 
 # Patch the Apache Karaf distribution file to load ONOS features
+export ONOS_FEATURES="webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow"
 perl -pi.old -e "s|^(featuresBoot=.*)|\1,$ONOS_FEATURES|" \
     $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
 
diff --git a/tools/build/onos-package-test b/tools/build/onos-package-test
new file mode 100755
index 0000000..38a4877
--- /dev/null
+++ b/tools/build/onos-package-test
@@ -0,0 +1,29 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Packages ONOS test facilities into onos-test.tar.gz
+# -----------------------------------------------------------------------------
+
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+. $ONOS_ROOT/tools/build/envDefaults
+
+# Bail on any errors
+set -e
+
+rm -fr $ONOS_TEST_STAGE # Remove this when package script is completed
+
+# Create the stage directory and warp into it
+mkdir -p $ONOS_TEST_STAGE/tools/test \
+    $ONOS_TEST_STAGE/tools/dev \
+    $ONOS_TEST_STAGE/tools/build \
+    $ONOS_TEST_STAGE/tools/package/config
+
+cp -r $ONOS_ROOT/tools/test $ONOS_TEST_STAGE/tools
+cp $ONOS_ROOT/tools/dev/bash_profile $ONOS_TEST_STAGE/tools/dev
+cp $ONOS_ROOT/tools/build/envDefaults $ONOS_TEST_STAGE/tools/build
+
+cd $ONOS_TEST_STAGE_ROOT
+
+# Now package up the ONOS test tools tar file
+COPYFILE_DISABLE=1 tar zcf $ONOS_TEST_TAR $ONOS_TEST_BITS
+cd $ONOS_TEST_STAGE_ROOT
+# rm -r $ONOS_TEST_STAGE
diff --git a/tools/test/bin/onos-config b/tools/test/bin/onos-config
index d1a2ff0..082f506 100755
--- a/tools/test/bin/onos-config
+++ b/tools/test/bin/onos-config
@@ -8,6 +8,10 @@
 
 remote=$ONOS_USER@${1:-$OCI}
 
+# Customize features
+export ONOS_FEATURES="${ONOS_FEATURES:-webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow}"
+
+
 # Generate a cluster.json from the ON* environment variables
 CDEF_FILE=/tmp/${remote}.cluster.json
 echo "{ \"ipPrefix\": \"$ONOS_NIC\"," > $CDEF_FILE
@@ -35,6 +39,10 @@
     # Suppress Hazelcast multicast joiner warning
     echo "log4j.logger.com.hazelcast.cluster.impl.MulticastService= ERROR" \
         >> $ONOS_INSTALL_DIR/$KARAF_DIST/etc/org.ops4j.pax.logging.cfg
+
+    # Patch the Apache Karaf distribution file to load ONOS features
+    perl -pi.old -e \"s|^(featuresBoot=.*,management)(,webconsole,.*)|\1,$ONOS_FEATURES|\" \
+        $ONOS_INSTALL_DIR/$KARAF_DIST/etc/org.apache.karaf.features.cfg
 "
 
 # Generate a default tablets.json from the ON* environment variables
@@ -42,7 +50,6 @@
 onos-gen-partitions $TDEF_FILE
 scp -q $TDEF_FILE $remote:$ONOS_INSTALL_DIR/config/tablets.json
 
-
 # copy tools/package/config/ to remote
 scp -qr ${ONOS_ROOT}/tools/package/config/ $remote:$ONOS_INSTALL_DIR/
 
diff --git a/tools/test/bin/onos-push-test-bits b/tools/test/bin/onos-push-test-bits
new file mode 100755
index 0000000..927d157
--- /dev/null
+++ b/tools/test/bin/onos-push-test-bits
@@ -0,0 +1,16 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Remotely pushes test bits to a remote test machine and unrolls them in /tmp
+# -----------------------------------------------------------------------------
+
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+. $ONOS_ROOT/tools/build/envDefaults
+
+node=${1:-$OCI}
+remote=$ONOS_USER@$node
+
+scp -q $ONOS_TEST_TAR $remote:/tmp
+ssh $remote "
+    rm -f /tmp/onos $ONOS_TEST_BITS
+    cd /tmp && tar zxf $ONOS_TEST_BITS.tar.gz && ln -s $ONOS_TEST_BITS onos
+"
diff --git a/tools/test/cells/ec2 b/tools/test/cells/ec2
new file mode 100644
index 0000000..204988e
--- /dev/null
+++ b/tools/test/cells/ec2
@@ -0,0 +1,20 @@
+# Bare metal cluster
+
+# Use the 10G NIC for cluster communications
+export ONOS_NIC="192.168.200.*"
+
+# ONOS Test proxy
+export OCT=192.168.200.101
+
+# Use the 1G NICs for external access
+export OC1=192.168.200.101
+export OC2=192.168.200.102
+export OC3=192.168.200.103
+export OC4=192.168.200.104
+export OC5=192.168.200.105
+export OC6=192.168.200.106
+export OC7=192.168.200.107
+
+export OCI=${OC1}
+
+export ONOS_FEATURES=webconsole,onos-api,onos-core,onos-cli,onos-rest,onos-null