blob: ba867030d6915bbce200130138e4f53320aecc81 [file] [log] [blame]
Thomas Vachuskae1125352016-11-09 14:06:51 -08001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Checks whether the specified ONOS cluster node has the desired state.
4# -----------------------------------------------------------------------------
5
6aux=/tmp/stc-$$.log
7trap "rm -f $aux 2>/dev/null" EXIT
8
9for attempt in {1..10}; do
10 onos ${1:-$OCI} "onos:nodes" | grep -v /bin/client > $aux
11 cat $aux
12
13 # Normalize the node status
14 state=$(grep ${2:-$OC2} $aux | cut -d, -f3 | cut -d= -f2)
15
16 [ "$state" = "${3:-READY}" ] && exit 0
17 sleep 1
18done
19
20exit 1