onos-cluster-execute-expect fix

Change-Id: Ifddce4bb1bc42b53e1c35e33a71047c002ba7435
diff --git a/tools/test/bin/onos-cluster-execute-expect b/tools/test/bin/onos-cluster-execute-expect
index 0754045..6e95a98 100755
--- a/tools/test/bin/onos-cluster-execute-expect
+++ b/tools/test/bin/onos-cluster-execute-expect
@@ -19,14 +19,13 @@
 expect="${@: -1}"
 echo $cmd
 echo "expect ${expect}"
-node_count=`onos $OC1 nodes | wc -l`
-# FIMXE: This only works if nodes are sequential
-# For dynamic clustering we could grab the IPs from 'nodes'
-for i in `seq 1 $node_count`; do
-    node_var="OC$i"
-    onos ${!node_var} $cmd > $aux
+nodes=`onos $OCI nodes | awk -F 'address=' '{print $2}' | cut -d':' -f1`
+while read -r line; do
+    node_var=$line
+    onos ${node_var} $cmd > $aux
     cat $aux
     grep -q $expect $aux || exit 1
-done
+done <<< "$nodes"
+
 echo "expected value found"
 exit 0