Ray Milkey | 955c4b8 | 2016-07-11 09:48:53 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Checks ONOS flows |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
Jon Hall | fb6009d | 2017-02-15 16:01:17 -0800 | [diff] [blame] | 6 | aux=/tmp/stc/stc-$$.log |
Ray Milkey | 955c4b8 | 2016-07-11 09:48:53 -0700 | [diff] [blame] | 7 | trap "rm -f $aux 2>/dev/null" EXIT |
| 8 | |
| 9 | want_present=0 |
| 10 | |
| 11 | if [ "$3" == "present" ]; then |
| 12 | want_present=1 |
| 13 | fi |
| 14 | |
| 15 | for i in {1..5}; do |
| 16 | onos ${1:-$OCI} "onos:flows added $2" > $aux |
| 17 | grep "ETH_TYPE:ipv4" $aux |
| 18 | found=$? |
| 19 | |
| 20 | if [ $want_present == 1 -a $found -eq 0 ] || |
| 21 | [ $want_present == 0 -a $found -ne 0 ]; then |
| 22 | cat $aux |
| 23 | exit 0 |
| 24 | else |
Ray Milkey | fa454bd | 2016-08-31 12:06:45 -0700 | [diff] [blame] | 25 | sleep 2 |
Ray Milkey | 955c4b8 | 2016-07-11 09:48:53 -0700 | [diff] [blame] | 26 | fi |
| 27 | done |
| 28 | cat $aux |
| 29 | exit 1 |