Thomas Vachuska | 8189a74 | 2015-05-29 10:02:52 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Checks whether all ONOS components are either ACTIVE or DISABLED. |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
| 6 | aux=/tmp/stc-$$.log |
| 7 | trap "rm -f $aux 2>/dev/null" EXIT |
| 8 | |
Ray Milkey | 2023347 | 2016-02-18 15:52:26 -0800 | [diff] [blame] | 9 | for attempt in {1..30}; do |
Thomas Vachuska | 9c630b2 | 2016-02-10 17:53:52 -0800 | [diff] [blame] | 10 | onos ${1:-$OCI} scr:list > $aux |
Thomas Vachuska | 4bfccd54 | 2015-05-30 00:35:25 -0700 | [diff] [blame] | 11 | |
Thomas Vachuska | 9c630b2 | 2016-02-10 17:53:52 -0800 | [diff] [blame] | 12 | if grep -q UNSATISFIED $aux; then |
| 13 | sleep 1 |
| 14 | else |
| 15 | if [ -n "$2" ]; then |
| 16 | echo "Searching for ACTIVE $2" |
| 17 | egrep "ACTIVE.*$2" $aux && exit 0 || sleep 1 |
| 18 | else |
| 19 | cat $aux && exit 0 |
| 20 | fi |
| 21 | fi |
| 22 | done |
| 23 | |
Ray Milkey | 2023347 | 2016-02-18 15:52:26 -0800 | [diff] [blame] | 24 | exit 1 |