Ray Milkey | c345663 | 2015-08-24 17:06:29 -0700 | [diff] [blame] | 1 | #!/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 | |
| 9 | aux=/tmp/stc-$$.log |
| 10 | trap "rm -f $aux 2>/dev/null" EXIT |
| 11 | target=${1:-$OCI} |
| 12 | |
Ray Milkey | bba7138 | 2015-08-26 13:09:23 -0700 | [diff] [blame] | 13 | echo onos-check-intent: $* |
| 14 | |
Ray Milkey | c345663 | 2015-08-24 17:06:29 -0700 | [diff] [blame] | 15 | set -x |
Thomas Vachuska | 1c15287 | 2015-08-26 18:41:10 -0700 | [diff] [blame] | 16 | for i in {1..10}; do |
| 17 | onos $target "onos:intents" | tee $aux |
| 18 | ( cat $aux | grep "key=$2" | grep "state=$3" ) && cat $aux && exit 0 |
Ray Milkey | c345663 | 2015-08-24 17:06:29 -0700 | [diff] [blame] | 19 | sleep 1 |
| 20 | done |
| 21 | |
| 22 | cat $aux |
| 23 | exit 1 |
| 24 | |