Fix dependencies in Trellis P4 STC scenario
Add steps to verify driver and pipeconf apps, as well as registered
pipeconfs. Also, start Mininet first, then push Trellis netcfg.
Change-Id: Idf52e268e6f50c7f6b8f17a5ea0390f01a607fea
(cherry picked from commit 4c3364b22ed68511b00e1494a574f29eaf8841d3)
diff --git a/tools/test/bin/onos-check-pipeconfs b/tools/test/bin/onos-check-pipeconfs
new file mode 100755
index 0000000..9af9864
--- /dev/null
+++ b/tools/test/bin/onos-check-pipeconfs
@@ -0,0 +1,33 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Checks whether the given pipeconfs are registered.
+# -----------------------------------------------------------------------------
+
+[ ! -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 $aux.1 $aux.2 2>/dev/null" EXIT
+
+for attempt in {1..30}; do
+ onos ${1:-$OCI} "onos:pipeconfs -s" > $aux
+ cat $aux
+
+ # Normalize the registered pipeconfs
+ cut -d '=' -f2 $aux | sort > $aux.1
+
+ # Expected pipeconfs
+ pipeconfs=${2-org.onosproject.pipelines.basic}
+ (for pipeconf in ${pipeconfs//,/ }; do echo ${pipeconf}; done) | sort > $aux.2
+
+ # Check for differences
+ case ${3:-equals} in
+ equals) diff $aux.1 $aux.2;;
+ includes) [ $(egrep -c -f $aux.2 $aux.1) -ge $(wc -l $aux.2 | sed "s|$aux.2||g") ];;
+ excludes) ! egrep -f $aux.2 $aux.1;;
+ esac
+
+ [ $? -eq 0 ] && exit 0 || sleep 1
+done
+
+exit 1;