svn commit: r233094 - in projects/net80211_testsuite/wtap: . 001

Adrian Chadd adrian at FreeBSD.org
Sat Mar 17 19:35:46 UTC 2012


Author: adrian
Date: Sat Mar 17 19:35:45 2012
New Revision: 233094
URL: http://svn.freebsd.org/changeset/base/233094

Log:
  Begin fleshing out some wtap net80211 tests.
  
  I'll commit a follow-up description with this test.

Added:
  projects/net80211_testsuite/wtap/
  projects/net80211_testsuite/wtap/001/
  projects/net80211_testsuite/wtap/001/test.sh   (contents, props changed)

Added: projects/net80211_testsuite/wtap/001/test.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/net80211_testsuite/wtap/001/test.sh	Sat Mar 17 19:35:45 2012	(r233094)
@@ -0,0 +1,112 @@
+#!/bin/sh
+
+# This program requires:
+# + wtap - to create/destroy the wtap instances
+# + vis_map - to setup the visibility map between wtap instances
+# + vimage - to configure/destroy vtap nodes
+
+# The number of nodes to test
+
+NBR_NODES=4
+
+# The subnet prefix
+IP_SUBNET="192.168.2."
+
+cmd()
+{
+	echo "*** " $*
+	$*
+}
+
+setup()
+{
+	# Create wtap/vimage nodes
+	for i in `seq 1 ${NBR_NODES}`; do
+		wtap_if="`expr $i - 1`"
+		echo "Setup: vimage $i - wtap$wtap_if"
+		cmd vimage -c $i
+		cmd wtap c $wtap_if
+	done
+
+	# Set visibility for each node to see the
+	# next node.
+	n="`expr ${NBR_NODES} - 1`"
+	for i in `seq 0 ${n}`; do
+		j="`expr ${i} + 1`"
+		cmd vis_map a $i $j
+		cmd vis_map a $j $i
+	done
+
+	# What's this do?
+	cmd vis_map o
+
+	# Create each wlan subinterface, place into the correct vnet
+	for i in `seq 0 ${n}`; do
+		vnet="`expr ${i} + 1`"
+		cmd ifconfig wlan${i} create wlandev wtap${i} wlanmode mesh
+		cmd ifconfig wlan${i} meshid mymesh
+		cmd wlandebug -i wlan${i} hwmp
+		cmd ifconfig wlan${i} vnet ${vnet}
+		cmd jexec ${vnet} ifconfig wlan${i} up
+
+		cmd jexec ${vnet} ifconfig wlan${i} inet ${IP_SUBNET}${vnet}
+	done
+}
+
+run()
+{
+	# Test connectivity from each node to each other node
+	for i in `seq 1 ${NBR_NODES}`; do
+		for j in `seq 1 ${NBR_NODES}`; do
+			if [ "$i" != "$j" ]; then
+				# From vimage '$i' to vimage '$j'..
+				echo "* Checking ${i} -> ${j}.."
+				# Return after a single successful packet
+				cmd jexec $i ping -q -t 5 -c 5 \
+				    -o ${IP_SUBNET}${j}
+
+				if [ "$?" = "0" ]; then
+					echo "CHECK: ${i} -> ${j}: SUCCESS"
+				else
+					echo "CHECK: ${i} -> ${j}: FAILURE"
+				fi
+			fi
+		done
+	done
+}
+
+teardown()
+{
+	n="`expr ${NBR_NODES} - 1`"
+	for i in `seq 0 ${n}`; do
+		vnet="`expr ${i} + 1`"
+		cmd jexec ${vnet} ifconfig wlan${i} destroy
+	done
+	for i in `seq 1 ${NBR_NODES}`; do
+		wtap_if="`expr $i - 1`"
+		cmd wtap d ${wtap_if}
+		cmd vimage -d ${i}
+	done
+}
+
+case $1 in
+	'setup')
+		setup
+		exit 0
+	;;
+	'run')
+		run
+		exit 0
+	;;
+	'teardown')
+		teardown
+		exit 0
+	;;
+	*)
+		echo "$0 {setup | run | teardown}"
+		exit 127
+	;;
+esac
+
+exit 0
+


More information about the svn-src-projects mailing list