Ray Milkey | 955c4b8 | 2016-07-11 09:48:53 -0700 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Checks ONOS flows |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
| 6 | aux=/tmp/stc-$$.log |
| 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 |
| 25 | sleep 1 |
| 26 | fi |
| 27 | done |
| 28 | cat $aux |
| 29 | exit 1 |