kmod-traffic: Expand sanity tests.
authorJoe Stringer <joestringer@nicira.com>
Wed, 29 Jul 2015 19:56:06 +0000 (12:56 -0700)
committerJoe Stringer <joestringer@nicira.com>
Tue, 4 Aug 2015 01:27:33 +0000 (18:27 -0700)
The initial sanity test only checked IPv4 without IP fragments. This patch
adds additional tests using IPv6 and VLANs with IP fragments and expands
the existing test to be more strict.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
tests/kmod-macros.at
tests/kmod-traffic.at

index 5824940..eef1263 100644 (file)
@@ -77,3 +77,14 @@ m4_define([ADD_VETH],
       AT_CHECK([ip netns exec $2 ip link set dev $1 up])
     ]
 )
+
+# ADD_VLAN([port], [namespace], [vlan-id], [ip-addr])
+#
+# Add a VLAN device named 'port' within 'namespace'. It will be configured
+# with the ID 'vlan-id' and the address 'ip-addr'.
+m4_define([ADD_VLAN],
+    [ AT_CHECK([ip netns exec $2 ip link add link $1 name $1.$3 type vlan id $3])
+      AT_CHECK([ip netns exec $2 ip link set dev $1.$3 up])
+      AT_CHECK([ip netns exec $2 ip addr add dev $1.$3 $4])
+    ]
+)
index f7783be..9df8b62 100644 (file)
@@ -11,6 +11,97 @@ ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24")
 
 AT_CAPTURE_FILE([ping.output])
 AT_CHECK([ip netns exec at_ns0 bash -c "ping -q -c 3 -i 0.3 -w 2 10.1.1.2 > ping.output"])
+AT_CHECK([ip netns exec at_ns0 bash -c "ping -s 1600 -q -c 3 -i 0.3 -w 2 10.1.1.2 >> ping.output"])
+AT_CHECK([ip netns exec at_ns0 bash -c "ping -s 3200 -q -c 3 -i 0.3 -w 2 10.1.1.2 >> ping.output"])
 
-OVS_KMOD_VSWITCHD_STOP([], DEL_NAMESPACES(at_ns0, at_ns1))
+AT_CHECK([cat ping.output | grep "transmitted" | sed 's/time.*ms$/time 0ms/'], [0], [dnl
+3 packets transmitted, 3 received, 0% packet loss, time 0ms
+3 packets transmitted, 3 received, 0% packet loss, time 0ms
+3 packets transmitted, 3 received, 0% packet loss, time 0ms
+])
+
+OVS_KMOD_VSWITCHD_STOP
+AT_CLEANUP
+
+AT_SETUP([kmod - ping between two ports on vlan])
+OVS_KMOD_VSWITCHD_START(
+   [set-fail-mode br0 standalone -- ])
+
+ADD_NAMESPACES(at_ns0, at_ns1)
+
+ADD_VETH(p0, at_ns0, br0, "10.1.1.1/24")
+ADD_VETH(p1, at_ns1, br0, "10.1.1.2/24")
+
+ADD_VLAN(p0, at_ns0, 100, "10.2.2.1/24")
+ADD_VLAN(p1, at_ns1, 100, "10.2.2.2/24")
+
+AT_CAPTURE_FILE([ping.output])
+AT_CHECK([ip netns exec at_ns0 bash -c "ping -q -c 3 -i 0.3 -w 2 10.2.2.2 > ping.output"])
+AT_CHECK([ip netns exec at_ns0 bash -c "ping -s 1600 -q -c 3 -i 0.3 -w 2 10.2.2.2 >> ping.output"])
+AT_CHECK([ip netns exec at_ns0 bash -c "ping -s 3200 -q -c 3 -i 0.3 -w 2 10.2.2.2 >> ping.output"])
+
+AT_CHECK([cat ping.output | grep "transmitted" | sed 's/time.*ms$/time 0ms/'], [0], [dnl
+3 packets transmitted, 3 received, 0% packet loss, time 0ms
+3 packets transmitted, 3 received, 0% packet loss, time 0ms
+3 packets transmitted, 3 received, 0% packet loss, time 0ms
+])
+
+OVS_KMOD_VSWITCHD_STOP
+AT_CLEANUP
+
+AT_SETUP([kmod - ping6 between two ports])
+OVS_KMOD_VSWITCHD_START(
+   [set-fail-mode br0 standalone -- ])
+
+ADD_NAMESPACES(at_ns0, at_ns1)
+
+ADD_VETH(p0, at_ns0, br0, "fc00::1/96")
+ADD_VETH(p1, at_ns1, br0, "fc00::2/96")
+
+dnl Without this sleep, we get occasional failures due to the following error:
+dnl "connect: Cannot assign requested address"
+sleep 2;
+
+AT_CAPTURE_FILE([ping.output])
+AT_CHECK([ip netns exec at_ns0 bash -c "ping6 -q -c 3 -i 0.3 -w 2 fc00::2 > ping.output"])
+AT_CHECK([ip netns exec at_ns0 bash -c "ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00::2 >> ping.output"])
+AT_CHECK([ip netns exec at_ns0 bash -c "ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00::2 >> ping.output"])
+
+AT_CHECK([cat ping.output | grep "transmitted" | sed 's/time.*ms$/time 0ms/'], [0], [dnl
+3 packets transmitted, 3 received, 0% packet loss, time 0ms
+3 packets transmitted, 3 received, 0% packet loss, time 0ms
+3 packets transmitted, 3 received, 0% packet loss, time 0ms
+])
+
+OVS_KMOD_VSWITCHD_STOP
+AT_CLEANUP
+
+AT_SETUP([kmod - ping6 between two ports on vlan])
+OVS_KMOD_VSWITCHD_START(
+   [set-fail-mode br0 standalone -- ])
+
+ADD_NAMESPACES(at_ns0, at_ns1)
+
+ADD_VETH(p0, at_ns0, br0, "fc00::1/96")
+ADD_VETH(p1, at_ns1, br0, "fc00::2/96")
+
+ADD_VLAN(p0, at_ns0, 100, "fc00:1::1/96")
+ADD_VLAN(p1, at_ns1, 100, "fc00:1::2/96")
+
+dnl Without this sleep, we get occasional failures due to the following error:
+dnl "connect: Cannot assign requested address"
+sleep 2;
+
+AT_CAPTURE_FILE([ping.output])
+AT_CHECK([ip netns exec at_ns0 bash -c "ping6 -q -c 3 -i 0.3 -w 2 fc00:1::2 > ping.output"])
+AT_CHECK([ip netns exec at_ns0 bash -c "ping6 -s 1600 -q -c 3 -i 0.3 -w 2 fc00:1::2 >> ping.output"])
+AT_CHECK([ip netns exec at_ns0 bash -c "ping6 -s 3200 -q -c 3 -i 0.3 -w 2 fc00:1::2 >> ping.output"])
+
+AT_CHECK([cat ping.output | grep "transmitted" | sed 's/time.*ms$/time 0ms/'], [0], [dnl
+3 packets transmitted, 3 received, 0% packet loss, time 0ms
+3 packets transmitted, 3 received, 0% packet loss, time 0ms
+3 packets transmitted, 3 received, 0% packet loss, time 0ms
+])
+
+OVS_KMOD_VSWITCHD_STOP
 AT_CLEANUP