Improving net test tools and scenarios.
Change-Id: I2b53fa7b28e1135d2356ae58d4ee8ac35184d9b8
diff --git a/tools/test/bin/onos-check-summary b/tools/test/bin/onos-check-summary
index daa5253..008506e 100755
--- a/tools/test/bin/onos-check-summary
+++ b/tools/test/bin/onos-check-summary
@@ -10,9 +10,11 @@
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 "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
exit $status
\ No newline at end of file
diff --git a/tools/test/bin/onos-mininet b/tools/test/bin/onos-mininet
index 5c03c06..5bcd2f5 100755
--- a/tools/test/bin/onos-mininet
+++ b/tools/test/bin/onos-mininet
@@ -17,8 +17,9 @@
;;
sendAndExpect)
- $mininet -X "stuff \"$1\\n\"" 2>/dev/null
- shift
+ cmd=""
+ for a in $*; do shift; if [ "$a" = "--expect" ]; then break; fi; cmd="$cmd $a"; done
+ $mininet -X "stuff \"$cmd\\n\"" 2>/dev/null
onos-mininet expect "$@"
;;
@@ -33,7 +34,9 @@
expect)
aux=/tmp/mininet.$$.log
ssh $remote "
- sleep 1 && while ! (tail -n1 $log | egrep -q '^mininet>'); do sleep 1; done
+ sleep 1
+ if [ ! -f $log ]; then exit 1; fi;
+ while ! (tail -n1 $log | egrep -q '^mininet>'); do sleep 1; done
tac $log | awk '{ print \$0; } /^mininet>/ { if (on) { exit 0; } on=1; }' | tac > $aux
cat $aux
set -x
@@ -42,10 +45,12 @@
;;
start)
- ssh $remote rm -f $log
+ ssh $remote "rm -f $log; echo logfile flush 1 > ~/.screenrc"
+ (
$mininet "$@"
scp $remote:$log /tmp/mininet.log
ssh $remote rm -f $log
+ ) &
;;
stop)
diff --git a/tools/test/bin/onos-wipe-out b/tools/test/bin/onos-wipe-out
new file mode 100755
index 0000000..4384fc2
--- /dev/null
+++ b/tools/test/bin/onos-wipe-out
@@ -0,0 +1,11 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Wipes out all data from the ONOS cluster. Temporary until wipe-out is fixed.
+# -----------------------------------------------------------------------------
+
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+. $ONOS_ROOT/tools/build/envDefaults
+
+while ! onos-check-summary $OCI '.*' 0 0 0 0 0; do
+ onos $OCI wipe-out please
+done