Enabling execution of STC on a remote proxy

Change-Id: Id7fb8a9b23c27a59f39f01ba1a512344572e1fa0
TBD: tmux/mosh integration
diff --git a/tools/build/onos-package-test b/tools/build/onos-package-test
index 59d5b42..3f4fd41 100755
--- a/tools/build/onos-package-test
+++ b/tools/build/onos-package-test
@@ -4,5 +4,8 @@
 # -----------------------------------------------------------------------------
 
 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
-cd $ONOS_ROOT && onos-buck build //:onos-test --show-output
-exit $?
+. $ONOS_ROOT/tools/build/envDefaults
+
+cd $ONOS_ROOT && onos-buck build //:onos-test --show-output && \
+    rm -f $ONOS_TEST_TAR && \
+    ln -s $ONOS_ROOT/buck-out/gen/onos-test/onos-test-*.tar.gz $ONOS_TEST_TAR
diff --git a/tools/test/bin/onos-push-test-bits b/tools/test/bin/onos-push-test-bits
index 927d157..1965643 100755
--- a/tools/test/bin/onos-push-test-bits
+++ b/tools/test/bin/onos-push-test-bits
@@ -6,7 +6,7 @@
 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
 . $ONOS_ROOT/tools/build/envDefaults
 
-node=${1:-$OCI}
+node=${1:-$OCN}
 remote=$ONOS_USER@$node
 
 scp -q $ONOS_TEST_TAR $remote:/tmp
diff --git a/tools/test/bin/proxy-stc b/tools/test/bin/proxy-stc
new file mode 100755
index 0000000..4bf01c8
--- /dev/null
+++ b/tools/test/bin/proxy-stc
@@ -0,0 +1,33 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Executes validation build using onos-test.tar.gz and onos.tar.gz on a remote
+# proxy. It assumes that the tar.gz files are already available.
+# -----------------------------------------------------------------------------
+
+. $ONOS_ROOT/tools/build/envDefaults
+
+onos-push-test-bits $OCT
+onos-push-bits $OCT
+
+ssh -t $ONOS_USER@$OCT "
+    # Unpack the test tools
+    cd /tmp; rm -fr \$(ls -Fd onos-test-*/)
+    tar xf $ONOS_TEST_TAR
+
+    # Source in the cell environment
+    $(onos-cell | sed 's/^/export /')
+    unset OCT
+
+    # Set ONOS root to the top of the unrolled test directory and
+    # prime the environment.
+    cd \$(ls -Fd onos-test-*/)
+    export ONOS_ROOT=\$PWD
+    source tools/dev/bash_profile
+    setPrimaryInstance 1
+    onos-verify-cell   # TODO: remove once warden does this for us
+
+    # Finally, execute required STC scenario(s) using the default topology
+    topo default
+    export stcDumpLogs=true
+    stc fast
+"
diff --git a/tools/test/bin/stc b/tools/test/bin/stc
index cb5f32a..5361c24 100755
--- a/tools/test/bin/stc
+++ b/tools/test/bin/stc
@@ -6,16 +6,15 @@
 . $ONOS_ROOT/tools/build/envDefaults
 
 VER=${STC_VERSION:-2.3}
-JAR=~/.m2/repository/org/onosproject/onos-stc/$VER/onos-stc-$VER.jar
+MVN_JAR=org/onosproject/onos-stc/$VER/onos-stc-$VER.jar
+JAR=${MAVEN_REPO:-$HOME/.m2/repository}/$MVN_JAR
 SCENARIOS=$ONOS_ROOT/tools/test/scenarios
 
 # Download the STC binary if needed
 if [ ! -f $JAR ]; then
     printf "Downloading STC binary..."
-    mkdir -p /tmp/stc
-    aux=/tmp/stc/stc-$$.log
-    mvn dependency:get -Dartifact=org.onosproject:onos-stc:$VER -Dtransitive=false -B >$aux || fgrep '[ERROR]' $aux
-    rm -f $aux
+    mkdir -p /tmp/stc $(dirname $JAR)
+    curl http://repo1.maven.org/maven2/$MVN_JAR > $JAR
     [ -f $JAR ] && printf "Done.\n"
 fi
 
diff --git a/tools/test/scenarios/fast.xml b/tools/test/scenarios/fast.xml
index d829069..b488e60 100644
--- a/tools/test/scenarios/fast.xml
+++ b/tools/test/scenarios/fast.xml
@@ -23,9 +23,6 @@
     <import file="${ONOS_SCENARIOS}/net-fast.xml"/>
     <dependency name="Net-Fast" requires="Setup"/>
 
-    <import file="${ONOS_SCENARIOS}/archetypes.xml"/>
-    <dependency name="Archetypes" requires="Setup"/>
-
     <import file="${ONOS_SCENARIOS}/wrapup.xml"/>
-    <dependency name="Wrapup" requires="Prerequisites,~Archetypes,~Setup,~Net-Fast"/>
+    <dependency name="Wrapup" requires="Prerequisites,~Setup,~Net-Fast"/>
 </scenario>