[ovs-dev] [PATCH 2/2] ofproto-dpif: Test basic output and flooding.

Ethan Jackson ethan at nicira.com
Mon Nov 21 19:14:21 UTC 2011


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 |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index 397c42e..db2dccd 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -62,6 +62,54 @@ 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.
+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: //' \
+| python -c "import sys; print ','.join(sorted(sys.stdin.read().strip().split(',')))"], [0],
+  [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: //' \
+| python -c "import sys; print ','.join(sorted(sys.stdin.read().strip().split(',')))"], [0],
+  [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
-- 
1.7.7.1




More information about the dev mailing list