blob: 9af9864886803a2fc0efe73992da6eae1d500b2b [file] [log] [blame]
Carmelo Cascone4c3364b2018-12-13 15:56:34 -08001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Checks whether the given pipeconfs are registered.
4# -----------------------------------------------------------------------------
5
6[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7. $ONOS_ROOT/tools/build/envDefaults
8
9aux=/tmp/stc/stc-$$.log
10trap "rm -f $aux $aux.1 $aux.2 2>/dev/null" EXIT
11
12for attempt in {1..30}; do
13 onos ${1:-$OCI} "onos:pipeconfs -s" > $aux
14 cat $aux
15
16 # Normalize the registered pipeconfs
17 cut -d '=' -f2 $aux | sort > $aux.1
18
19 # Expected pipeconfs
20 pipeconfs=${2-org.onosproject.pipelines.basic}
21 (for pipeconf in ${pipeconfs//,/ }; do echo ${pipeconf}; done) | sort > $aux.2
22
23 # Check for differences
24 case ${3:-equals} in
25 equals) diff $aux.1 $aux.2;;
26 includes) [ $(egrep -c -f $aux.2 $aux.1) -ge $(wc -l $aux.2 | sed "s|$aux.2||g") ];;
27 excludes) ! egrep -f $aux.2 $aux.1;;
28 esac
29
30 [ $? -eq 0 ] && exit 0 || sleep 1
31done
32
33exit 1;