blob: e62786e88b9f911987e61706de93b5a75834e798 [file] [log] [blame]
Ray Milkeyba82c0d2016-08-30 12:45:27 -07001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Checks whether the given ONOS component has a given state.
4# -----------------------------------------------------------------------------
5
Jon Hallfb6009d2017-02-15 16:01:17 -08006aux=/tmp/stc/stc-$$.log
Ray Milkeyba82c0d2016-08-30 12:45:27 -07007trap "rm -f $aux 2>/dev/null" EXIT
8
9node=$1
10component=$2
11state=$3
12
13for attempt in {1..30}; do
Ray Milkey696191d2018-10-23 09:20:46 -070014 onos ${node:-$OCI} onos:scr-list | grep $component > $aux
Ray Milkeyba82c0d2016-08-30 12:45:27 -070015
Thomas Vachuska534f4762016-08-30 16:25:13 -070016 if grep $state $aux; then
Ray Milkeyba82c0d2016-08-30 12:45:27 -070017 exit 0
18 else
19 sleep 1
20 fi
21done
22
23cat $aux && exit 1