Ray Milkey | ba82c0d | 2016-08-30 12:45:27 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Checks whether the given ONOS component has a given state. |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
Jon Hall | a67dc45 | 2017-02-15 16:01:17 -0800 | [diff] [blame] | 6 | aux=/tmp/stc/stc-$$.log |
Ray Milkey | ba82c0d | 2016-08-30 12:45:27 -0700 | [diff] [blame] | 7 | trap "rm -f $aux 2>/dev/null" EXIT |
| 8 | |
| 9 | node=$1 |
| 10 | component=$2 |
| 11 | state=$3 |
| 12 | |
| 13 | for attempt in {1..30}; do |
| 14 | onos ${node:-$OCI} scr:list | grep $component > $aux |
| 15 | |
Thomas Vachuska | 534f476 | 2016-08-30 16:25:13 -0700 | [diff] [blame] | 16 | if grep $state $aux; then |
Ray Milkey | ba82c0d | 2016-08-30 12:45:27 -0700 | [diff] [blame] | 17 | exit 0 |
| 18 | else |
| 19 | sleep 1 |
| 20 | fi |
| 21 | done |
| 22 | |
| 23 | cat $aux && exit 1 |