blob: 0a76f086936f572e8d310b226a9b3be291b40c44 [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
Jon Hallfb6009d2017-02-15 16:01:17 -08006aux=/tmp/stc/stc-$$.log
Thomas Vachuskae1125352016-11-09 14:06:51 -08007trap "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