STC scenario for Trellis HAG topology

Change-Id: Ie0b40a15748a1d925167a247ac31f78b9ed206ac
diff --git a/tools/test/bin/onos-check-summary b/tools/test/bin/onos-check-summary
index 948e5d5..6e7bfcf 100755
--- a/tools/test/bin/onos-check-summary
+++ b/tools/test/bin/onos-check-summary
@@ -6,7 +6,7 @@
 aux=/tmp/stc/stc-$$.log
 trap "rm -f $aux 2>/dev/null" EXIT
 
-for i in {1..15}; do
+for i in {1..30}; do
     onos ${1:-$OCI} "onos:summary" > $aux
     cat $aux
 
diff --git a/tools/test/bin/onos-clean-routing b/tools/test/bin/onos-clean-routing
new file mode 100755
index 0000000..ec6dcfd
--- /dev/null
+++ b/tools/test/bin/onos-clean-routing
@@ -0,0 +1,13 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Cleans up /tmp if a local copy of the routing repo was created
+# -----------------------------------------------------------------------------
+
+
+routing="$1"
+
+[ ! -d "$routing" ] && echo "routing source tree not found" >&2 && exit 1
+
+if [[ $routing = *"/tmp/routing."* ]]; then
+  rm -rf $routing
+fi
diff --git a/tools/test/bin/onos-find-host b/tools/test/bin/onos-find-host
new file mode 100755
index 0000000..4989357
--- /dev/null
+++ b/tools/test/bin/onos-find-host
@@ -0,0 +1,29 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Finds a host in the system.
+# -----------------------------------------------------------------------------
+
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+. $ONOS_ROOT/tools/build/envDefaults
+
+aux=/tmp/stc/stc-$$.log
+trap "rm -f $aux 2>/dev/null" EXIT
+
+echo onos-find-host: $*
+
+target=${1:-$OCI}
+mac=$2
+locations=$3
+ips=$4
+set -x
+
+onos $target "onos:hosts" | tee $aux
+cat $aux | fgrep "mac=$mac" | fgrep "locations=[$locations]" | grep "ip.*[.*$ips.*]"
+
+if [ $? -ne 0 ]
+then
+    exit 1;
+fi
+
+exit 0
+
diff --git a/tools/test/bin/onos-mininet b/tools/test/bin/onos-mininet
index 2683a29..4c60e42 100755
--- a/tools/test/bin/onos-mininet
+++ b/tools/test/bin/onos-mininet
@@ -34,7 +34,7 @@
     ssh $remote "
         let count=0
         sleep 1 && while test ! -f $log; do if test \$count -ge $MAX_WAIT; then exit 1; fi; sleep 1; let count=count+1; done
-        while ! (tail -n1 $log | egrep -q '^mininet>'); do if [ \$count -ge $MAX_WAIT ]; then exit 1; fi; sleep 1; done
+        while ! (tail -n1 $log | egrep -q '^[ ]*[0]*mininet>'); do if [ \$count -ge $MAX_WAIT ]; then exit 1; fi; sleep 1; done
         sleep ${1-:1}
     "
     ;;
@@ -45,8 +45,8 @@
         sleep 1
         if [ ! -f $log ]; then exit 1; fi;
         let count=0
-        while ! (tail -n1 $log | egrep -q '^mininet>'); do if test \$count -ge $MAX_WAIT; then exit 1; fi; sleep 1; let count=count+1; done
-        tac $log | awk '{ print \$0; } /^mininet>/ { if (on) { exit 0; } on=1; }' | tac > $aux
+        while ! (tail -n1 $log | egrep -q '^[ ]*[0]*mininet>'); do if test \$count -ge $MAX_WAIT; then exit 1; fi; sleep 1; let count=count+1; done
+        tac $log | awk '{ print \$0; } /^[ ]*[0]*mininet>/ { if (on) { exit 0; } on=1; }' | tac > $aux
         cat $aux
         set -x
         egrep \"$@\" $aux
diff --git a/tools/test/bin/onos-push-routing b/tools/test/bin/onos-push-routing
new file mode 100755
index 0000000..0926772
--- /dev/null
+++ b/tools/test/bin/onos-push-routing
@@ -0,0 +1,26 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Remotely pushes routing scripts a remote mininet test machine.
+# -----------------------------------------------------------------------------
+
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+. $ONOS_ROOT/tools/build/envDefaults
+
+routing="${ONOS_ROUTING:-}"
+routing_root="${ONOS_ROUTING:-}"
+
+if [ -z "$routing_root" ]; then
+    routing_root=$(mktemp -d /tmp/routing.XXXXX)
+    ( cd $routing_root && git init && git clone https://gerrit.onosproject.org/routing )
+    routing=$routing_root/routing
+fi
+
+[ ! -d "$routing" ] && echo "routing source tree not found" >&2 && exit 1
+
+node=${1:-$OCN}
+
+ssh $ONOS_USER@$node sudo rm -rf routing
+scp -qr $routing $ONOS_USER@$node:
+
+echo "@stc routing_root=$routing_root"
+echo "@stc routing=$routing"