diff --git a/tools/test/bin/onos b/tools/test/bin/onos index 780a90dcc0..222ab99a96 100755 --- a/tools/test/bin/onos +++ b/tools/test/bin/onos @@ -6,10 +6,11 @@ function _usage () { cat << _EOF_ usage: - $(basename $0) [-w] [node] + $(basename $0) [-w] [-f] [node] flags: - -w : Waits for ONOS instance to reach run-level 100, i.e. to be fully started. +- -f : (Affects non-secure client only) - use bash's IFS expansion of positional parameters options: - [node] : the node to attach to @@ -29,13 +30,18 @@ _EOF_ . $ONOS_ROOT/tools/test/bin/find-node.sh [ "$1" = "-w" ] && shift && onos-wait-for-start $1 +[ "$1" = "-f" ] && shift && flat=1 [ -n "$1" ] && OCI=$(find_node $1) && shift if which client 1>/dev/null 2>&1 && [ -z "$ONOS_USE_SSH" ]; then # Use Karaf client only if we can and are allowed to unset KARAF_HOME - client -h $OCI -u karaf "$@" 2>/dev/null + if [ -z "$flat" ]; then + client -h $OCI -u karaf "$@" 2>/dev/null + else + client -h $OCI -u karaf "$*" 2>/dev/null + fi else # Otherwise use raw ssh; strict checking is off for dev environments only ssh -p 8101 -o StrictHostKeyChecking=no $OCI "$@" diff --git a/tools/test/bin/onos-check-intent b/tools/test/bin/onos-check-intent index 760afafe2b..37558ccb60 100755 --- a/tools/test/bin/onos-check-intent +++ b/tools/test/bin/onos-check-intent @@ -13,9 +13,29 @@ target=${1:-$OCI} echo onos-check-intent: $* set -x + +# $1: target host +# $2: intent key +# $3: intent state +# $4: number of expected intents +re='^[0-9]+$' +[[ $4 =~ $re ]] && numIntentsExpected=$4 # silently ignore if not positive + for i in {1..15}; do + echo "Attempt #$i" onos $target "onos:intents" | tee $aux - ( cat $aux | grep "key=$2" | grep "state=$3" ) && cat $aux && exit 0 + if [ -z "$numIntentsExpected" ]; then + ( cat $aux | grep "key=$2" | grep "state=$3" ) && cat $aux && exit 0 + else + # exit 0 only if expected number of intents (with required key) + # are present and all intents match state (if expected no. of intents > 0) + numIntents=`grep "key=$2" $aux | wc -l` + numIntentsOfState=0 + [ $numIntentsExpected -gt 0 ] && numIntentsOfState=`grep "key=$2" $aux | grep "state=$3" | wc -l` + [ $numIntents -eq $numIntentsOfState ] \ + && [ $numIntents -eq $numIntentsExpected ] \ + && cat $aux && exit 0 + fi sleep 1 done diff --git a/tools/test/scenarios/net-setup-vnets.xml b/tools/test/scenarios/net-setup-vnets.xml index 66e5697f3e..55207cc5f8 100644 --- a/tools/test/scenarios/net-setup-vnets.xml +++ b/tools/test/scenarios/net-setup-vnets.xml @@ -46,19 +46,14 @@ - + - + - - - - - diff --git a/tools/test/scenarios/net-teardown-vnets.xml b/tools/test/scenarios/net-teardown-vnets.xml index c030e739c7..69b7c5c6a8 100644 --- a/tools/test/scenarios/net-teardown-vnets.xml +++ b/tools/test/scenarios/net-teardown-vnets.xml @@ -22,11 +22,11 @@ - + - +