Jon Hall | 5812b58 | 2020-09-14 12:22:01 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Checks whether all and only the configured ONOS core storeage instances are active. |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
| 6 | aux=/tmp/stc/stc-$$.log |
| 7 | trap "rm -f $aux $aux.1 $aux.2 2>/dev/null" EXIT |
| 8 | |
| 9 | for attempt in {1..5}; do |
| 10 | onos ${1:-$OCI} "onos:storage-nodes" > $aux |
| 11 | cat $aux |
| 12 | |
| 13 | # Normalize the nodes |
| 14 | cut -d= -f3 $aux | cut -d: -f1 | sort > $aux.1 |
| 15 | |
| 16 | # Normalize the expected nodes |
| 17 | nodes=${2:-$ONOS_CORES} |
| 18 | (for node in $nodes; do echo $node; done) | sort > $aux.2 |
| 19 | |
| 20 | # Check for differences |
| 21 | diff $aux.1 $aux.2 && exit 0 |
| 22 | sleep 1 |
| 23 | done |
| 24 | exit 1 |