Jordan Halterman | 3c65d1b | 2018-01-09 13:01:03 -0800 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Checks whether the specified ONOS cluster node has the desired state. |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
| 6 | aux=/tmp/stc/stc-$$.log |
| 7 | trap "rm -f $aux 2>/dev/null" EXIT |
| 8 | |
| 9 | function onos_nodes() { |
| 10 | echo $(env | sort | egrep "^OC[0-9]+" | cut -d= -f2) |
| 11 | } |
| 12 | |
| 13 | nodes=$(onos_nodes) |
| 14 | |
| 15 | for attempt in {1..5}; do |
| 16 | for node in $nodes; do |
| 17 | onos $node issu status > $aux |
| 18 | cat $aux |
| 19 | |
| 20 | status=$(cat $aux) |
| 21 | |
| 22 | [ "$status" = "${1}" ] && exit 0 |
| 23 | sleep 1 |
| 24 | done |
| 25 | done |
| 26 | |
| 27 | exit 1 |