ofproto-dpif: Test flow stats reporting.
authorJoe Stringer <joestringer@nicira.com>
Tue, 11 Feb 2014 21:55:32 +0000 (13:55 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 26 Feb 2014 00:11:21 +0000 (16:11 -0800)
Basic test to check that the datapath reports the correct number of
packets seen, after a delay of 1 second.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
tests/ofproto-dpif.at

index 400fc31..ff9ead1 100644 (file)
@@ -2191,6 +2191,27 @@ AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
 
 AT_CLEANUP
 
+AT_SETUP([ofproto-dpif - flow stats])
+OVS_VSWITCHD_START
+AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
+AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
+
+ovs-appctl time/stop
+
+for i in `seq 1 10`; do
+    ovs-appctl netdev-dummy/receive br0 'in_port(0),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no)'
+done
+
+ovs-appctl time/warp 1000
+
+AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
+AT_CHECK([STRIP_XIDS stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
+ cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
+ cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=600, idle_age=1, ip actions=NORMAL
+])
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
 AT_SETUP([idle_age and hard_age increase over time])
 OVS_VSWITCHD_START