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