Thomas Vachuska | e112535 | 2016-11-09 14:06:51 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Checks whether the specified ONOS cluster node has the desired state. |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
Jon Hall | a67dc45 | 2017-02-15 16:01:17 -0800 | [diff] [blame] | 6 | aux=/tmp/stc/stc-$$.log |
Thomas Vachuska | e112535 | 2016-11-09 14:06:51 -0800 | [diff] [blame] | 7 | trap "rm -f $aux 2>/dev/null" EXIT |
| 8 | |
| 9 | for attempt in {1..10}; do |
Thomas Vachuska | 5af2e4f | 2016-12-16 12:07:33 -0800 | [diff] [blame] | 10 | onos ${1:-$OCI} "onos:nodes" > $aux |
Thomas Vachuska | e112535 | 2016-11-09 14:06:51 -0800 | [diff] [blame] | 11 | cat $aux |
| 12 | |
| 13 | # Normalize the node status |
| 14 | state=$(grep ${2:-$OC2} $aux | cut -d, -f3 | cut -d= -f2) |
| 15 | |
| 16 | [ "$state" = "${3:-READY}" ] && exit 0 |
| 17 | sleep 1 |
| 18 | done |
| 19 | |
| 20 | exit 1 |