blob: 0eadf3c1f8fa5c37d6b17edc200a6206ec1ec741 [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
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