Thomas Vachuska | a48e3d1 | 2015-06-02 09:43:29 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Checks whether all and only the ONOS instances configured active. |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
Jon Hall | fb6009d | 2017-02-15 16:01:17 -0800 | [diff] [blame] | 6 | aux=/tmp/stc/stc-$$.log |
Thomas Vachuska | a48e3d1 | 2015-06-02 09:43:29 -0700 | [diff] [blame] | 7 | trap "rm -f $aux $aux.1 $aux.2 2>/dev/null" EXIT |
| 8 | |
Jordan Halterman | 28b21d1 | 2018-11-12 11:03:35 -0800 | [diff] [blame] | 9 | for attempt in {1..5}; do |
| 10 | onos ${1:-$OCI} "onos:nodes" > $aux |
| 11 | cat $aux |
Thomas Vachuska | a48e3d1 | 2015-06-02 09:43:29 -0700 | [diff] [blame] | 12 | |
Jordan Halterman | 28b21d1 | 2018-11-12 11:03:35 -0800 | [diff] [blame] | 13 | # Normalize the nodes |
| 14 | cut -d= -f3 $aux | cut -d: -f1 | sort > $aux.1 |
Thomas Vachuska | a48e3d1 | 2015-06-02 09:43:29 -0700 | [diff] [blame] | 15 | |
Jordan Halterman | 28b21d1 | 2018-11-12 11:03:35 -0800 | [diff] [blame] | 16 | # Normalize the expected nodes |
| 17 | nodes=${2:-$ONOS_INSTANCES} |
| 18 | (for node in $nodes; do echo $node; done) | sort > $aux.2 |
Thomas Vachuska | a48e3d1 | 2015-06-02 09:43:29 -0700 | [diff] [blame] | 19 | |
Jordan Halterman | 28b21d1 | 2018-11-12 11:03:35 -0800 | [diff] [blame] | 20 | # Check for differences |
| 21 | diff $aux.1 $aux.2 && exit 0 |
| 22 | sleep 1 |
Jon Hall | 5812b58 | 2020-09-14 12:22:01 -0700 | [diff] [blame^] | 23 | done |
| 24 | exit 1 |