blob: 27ce619ba66cd7d4c2da1cb7d0c38ba96c57e629 [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
6aux=/tmp/stc-$$.log
7trap "rm -f $aux 2>/dev/null" EXIT
8
9node=$1
10component=$2
11state=$3
12
13for attempt in {1..30}; do
14 onos ${node:-$OCI} scr:list | grep $component > $aux
15
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