ofproto-dpif: Test basic output and flooding.
authorEthan Jackson <ethan@nicira.com>
Fri, 18 Nov 2011 21:47:25 +0000 (13:47 -0800)
committerEthan Jackson <ethan@nicira.com>
Mon, 21 Nov 2011 20:52:10 +0000 (12:52 -0800)
This patch adds basic tests to ofproto-dpif which verify that
output and flood actions respect the relevant OFPPC flags, and do
not loop back to the in_port.

tests/ofproto-dpif.at

index 397c42e..13c6fd7 100644 (file)
@@ -62,6 +62,64 @@ AT_CHECK([tail -1 stdout], [0],
 OVS_VSWITCHD_STOP
 AT_CLEANUP
 
+AT_SETUP([ofproto-dpif - output/flood flags])
+dnl This test assumes that OpenFlow port numbers are allocated in order
+dnl starting from one.  It does not necessarily require that they are allocated
+dnl in the same order that they are named in the database.  Just that the
+dnl following command guarantees OpenFlow port 65534, and ports 1-7 exist in
+dnl the bridge.
+OVS_VSWITCHD_START([dnl
+        add-port br0 p1 -- set Interface p1 type=dummy --\
+        add-port br0 p2 -- set Interface p2 type=dummy --\
+        add-port br0 p3 -- set Interface p3 type=dummy --\
+        add-port br0 p4 -- set Interface p4 type=dummy --\
+        add-port br0 p5 -- set Interface p5 type=dummy --\
+        add-port br0 p6 -- set Interface p6 type=dummy --\
+        add-port br0 p7 -- set Interface p7 type=dummy ])
+
+AT_DATA([flows.txt], [dnl
+in_port=1 actions=flood
+in_port=2 actions=all
+in_port=3 actions=output:65534,output:1,output:2,output:3,output:4,output:5,output:6,output:7
+in_port=4 actions=enqueue:65534:1,enqueue:1:1,enqueue:2:1,enqueue:3:1,enqueue:4:1,enqueue:5:1,enqueue:6:1,enqueue:7:1
+])
+AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
+AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
+AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
+
+AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(1),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
+AT_CHECK([tail -1 stdout \
+| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
+0
+2
+3
+4
+7
+])
+
+AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(2),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
+AT_CHECK([tail -1 stdout \
+| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
+0
+1
+3
+4
+6
+7
+])
+
+AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(3),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
+AT_CHECK([tail -1 stdout], [0],
+  [Datapath actions: 0,1,2,4,6,7
+])
+
+AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(4),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
+AT_CHECK([tail -1 stdout], [0],
+  [Datapath actions: 0,1,2,3,6,7
+])
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
 AT_SETUP([ofproto-dpif - set_tunnel])
 OVS_VSWITCHD_START
 AT_DATA([flows.txt], [dnl