blob: 0c48a6a8063d73c7e4fe299554a00ac79d844543 [file] [log] [blame]
Thomas Vachuskaa48e3d12015-06-02 09:43:29 -07001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Checks whether all and only the ONOS instances configured active.
4# -----------------------------------------------------------------------------
5
Jon Hallfb6009d2017-02-15 16:01:17 -08006aux=/tmp/stc/stc-$$.log
Thomas Vachuskaa48e3d12015-06-02 09:43:29 -07007trap "rm -f $aux $aux.1 $aux.2 2>/dev/null" EXIT
8
Jordan Halterman28b21d12018-11-12 11:03:35 -08009for attempt in {1..5}; do
10 onos ${1:-$OCI} "onos:nodes" > $aux
11 cat $aux
Thomas Vachuskaa48e3d12015-06-02 09:43:29 -070012
Jordan Halterman28b21d12018-11-12 11:03:35 -080013 # Normalize the nodes
14 cut -d= -f3 $aux | cut -d: -f1 | sort > $aux.1
Thomas Vachuskaa48e3d12015-06-02 09:43:29 -070015
Jordan Halterman28b21d12018-11-12 11:03:35 -080016 # Normalize the expected nodes
17 nodes=${2:-$ONOS_INSTANCES}
18 (for node in $nodes; do echo $node; done) | sort > $aux.2
Thomas Vachuskaa48e3d12015-06-02 09:43:29 -070019
Jordan Halterman28b21d12018-11-12 11:03:35 -080020 # Check for differences
21 diff $aux.1 $aux.2 && exit 0
22 sleep 1
23done