Ray Milkey | 1f0fb3b | 2019-02-26 08:45:48 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Checks if the given number of expected components are present. |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 7 | . $ONOS_ROOT/tools/build/envDefaults |
| 8 | |
| 9 | aux=/tmp/stc/stc-$$.log |
| 10 | trap "rm -f $aux $aux.1 $aux.2 2>/dev/null" EXIT |
| 11 | |
| 12 | expected=$2 |
| 13 | |
| 14 | for attempt in {1..30}; do |
| 15 | onos ${1} "onos:scr-list" | wc -l | xargs > $aux |
| 16 | cat $aux |
| 17 | |
| 18 | current=`cat $aux` |
| 19 | |
| 20 | # Check for differences |
| 21 | if [ "$expected" == "$current" ]; then |
| 22 | exit 0 |
| 23 | fi |
| 24 | sleep 1 |
| 25 | done |
| 26 | |
| 27 | exit 1; |