blob: 686d93643cca45631776d3290ba39d4579a584d8 [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
16 if grep -q $state $aux; then
17 exit 0
18 else
19 sleep 1
20 fi
21done
22
23cat $aux && exit 1