Check that the DHCP Manager is active before testing its configuration
Change-Id: Id760d58df005060c0f1d0c2ebdde90fe356d2c9f
diff --git a/tools/test/bin/onos-check-component b/tools/test/bin/onos-check-component
new file mode 100755
index 0000000..686d936
--- /dev/null
+++ b/tools/test/bin/onos-check-component
@@ -0,0 +1,23 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Checks whether the given ONOS component has a given state.
+# -----------------------------------------------------------------------------
+
+aux=/tmp/stc-$$.log
+trap "rm -f $aux 2>/dev/null" EXIT
+
+node=$1
+component=$2
+state=$3
+
+for attempt in {1..30}; do
+ onos ${node:-$OCI} scr:list | grep $component > $aux
+
+ if grep -q $state $aux; then
+ exit 0
+ else
+ sleep 1
+ fi
+done
+
+cat $aux && exit 1