blob: 205fa0aa4a6d2df71c3286636e48ebab3d4a86f7 [file] [log] [blame]
Thomas Vachuska8189a742015-05-29 10:02:52 -07001#!/bin/bash
2# -----------------------------------------------------------------------------
Jon Hall922cd042020-09-04 18:51:16 -07003# Checks whether all ONOS components are either ACTIVE or SATISFIED.
Thomas Vachuska8189a742015-05-29 10:02:52 -07004# -----------------------------------------------------------------------------
Jon Hallfb6009d2017-02-15 16:01:17 -08005aux=/tmp/stc/stc-$$.log
Thomas Vachuska8189a742015-05-29 10:02:52 -07006trap "rm -f $aux 2>/dev/null" EXIT
7
Ray Milkey20233472016-02-18 15:52:26 -08008for attempt in {1..30}; do
Jon Hall922cd042020-09-04 18:51:16 -07009 onos ${1:-$OCI} onos:scr-list &> $aux
Thomas Vachuska4bfccd542015-05-30 00:35:25 -070010
Jon Hall922cd042020-09-04 18:51:16 -070011 if grep -q -E "UNKNOWN|not found" $aux; then
Thomas Vachuska9c630b22016-02-10 17:53:52 -080012 sleep 1
13 else
14 if [ -n "$2" ]; then
15 echo "Searching for ACTIVE $2"
16 egrep "ACTIVE.*$2" $aux && exit 0 || sleep 1
17 else
Jon Hall922cd042020-09-04 18:51:16 -070018 cat $aux && exit 0
Thomas Vachuska9c630b22016-02-10 17:53:52 -080019 fi
20 fi
21done
22
Jon Hall922cd042020-09-04 18:51:16 -070023cat $aux && exit 1