blob: 39628b84c9b5a9e4eeb9f7ca5bb808e4d3b69c8d [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
Thomas Vachuska5af2e4f2016-12-16 12:07:33 -080010 onos ${1:-$OCI} "onos:nodes" > $aux
Thomas Vachuskae1125352016-11-09 14:06:51 -080011 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