onos-check-summary 781 Bytes
#!/bin/bash
# -----------------------------------------------------------------------------
# Checks ONOS summary data
# -----------------------------------------------------------------------------

aux=/tmp/stc-$$.log
trap "rm -f $aux 2>/dev/null" EXIT

for i in {1..10}; do
    onos ${1:-$OCI} "onos:summary" > $aux
    cat $aux

    let status=0
    grep -q "nodes=${2:-.*}" $aux || let status=status+1
    grep -q "devices=${3:-.*}" $aux || let status=status+1
    grep -q "links=${4:-.*}" $aux || let status=status+1
    grep -q "hosts=${5:-.*}" $aux || let status=status+1
    grep -q "flows=${6:-.*}" $aux || let status=status+1
    grep -q "intents=${7:-.*}" $aux || let status=status+1

    if [ $status -eq 0 ]; then
        exit 0;
    fi
    sleep 1
done

exit $status