blob: 03c3215338593aa0f42294ed40dac4e278adfe58 [file] [log] [blame]
Ray Milkeyc3456632015-08-24 17:06:29 -07001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Checks that all intents in the system have a given state.
4# -----------------------------------------------------------------------------
5
6[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7. $ONOS_ROOT/tools/build/envDefaults
8
9aux=/tmp/stc-$$.log
10trap "rm -f $aux 2>/dev/null" EXIT
11target=${1:-$OCI}
12
13set -x
14for i in 1 2 3; do
Ray Milkeyb2765cc2015-08-25 14:00:03 -070015 onos $target "onos:intents" >> $aux
16 grep "state=$2" $aux && cat $aux && exit 0
Ray Milkeyc3456632015-08-24 17:06:29 -070017 sleep 1
18done
19
20cat $aux
21exit 1
22