[ovs-dev] [PATCH v3 07/16] ofproto-dpif: Bonding with in_port that isn't present in the datapath

Simon Horman horms at verge.net.au
Mon Apr 28 01:24:09 UTC 2014


On Fri, Apr 25, 2014 at 12:46:16AM -0700, Andy Zhou wrote:
> Simon,  I thought this test exposed a bug that is fixed with this
> patch series.  However, when I apply this patch alone against current
> master, it passed fine. (I tried many times).   So I must
> misunderstand the intention of the test, or why current master failed
> to address
> packet out.  Would you please shed some light on this?

Hi Andy,

thanks for pointing that out. My intention was, as you suggest,
to provide a test that fails without previous patches in the series.
Unfortunately I managed to create a test that passes regardless
of the presence of other patches in the series :(

Could you please take a look at the updated test below?
It should fail without earlier patches in the series.

From: Simon Horman <horms at verge.net.au>

[PATCH] ofproto-dpif: Bonding with in_port that isn't present in the datapath

This tests exercises execution of actions in ovs-vswitchd
in the case where a packet is processed due to a packet out message
with an in_port that doesn't exist in the datapath and translation
results in recirc actions due to bonding.

Signed-off-by: Simon Horman <horms at verge.net.au>

---
v2
* First Post

v2.1
* Use a patch-port instead of NONE as the in_port for packet_out.
  This has the intended effect of causing a packet with an in_port
  that does not exist in the datapath to be output to a bonding interface.
---
 tests/ofproto-dpif.at | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 90 insertions(+)

diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index 89c8ad7..2113464 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -197,6 +197,96 @@ AT_CHECK([test `grep in_port.6 br1_flows.txt |wc -l` -gt 7])
 OVS_VSWITCHD_STOP()
 AT_CLEANUP
 
+AT_SETUP([ofproto-dpif, balance-tcp bonding, packet-out])
+# Create br0 with interfaces bond0(p1, p2, p3), bond1(p4,p5,p6) and p7, and
+#        br1 with interfaces bond10(p11, p12, p13) and bond11(p14,p15,p16), and
+#        br2 with interfaces bond20(p21, p22, p23) and bond21(p24,p25,p26)
+#        br3 with interface p37
+#    bond0 <-> bond10 (unix socket backed interfaces)
+#    bond1 <-> bond20 (unix socket backed interfaces)
+#    p7 <-> p37 (patch interface)
+# Send some traffic, make sure the traffic are spread based on L4 headers.
+OVS_VSWITCHD_START(
+  [add-bond br0 bond0 p1 p2 p3 bond_mode=balance-tcp lacp=active \
+        other-config:lacp-time=fast other-config:bond-rebalance-interval=0 --\
+   set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
+   set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
+   set interface p3 type=dummy options:pstream=punix:$OVS_RUNDIR/p3.sock ofport_request=3 -- \
+   add-bond br0 bond1 p4 p5 p6 bond_mode=balance-tcp lacp=active \
+        other-config:lacp-time=fast other-config:bond-rebalance-interval=0 --\
+   set interface p4 type=dummy options:pstream=punix:$OVS_RUNDIR/p4.sock ofport_request=4 -- \
+   set interface p5 type=dummy options:pstream=punix:$OVS_RUNDIR/p5.sock ofport_request=5 -- \
+   set interface p6 type=dummy options:pstream=punix:$OVS_RUNDIR/p6.sock ofport_request=6 -- \
+   add-port br0 p7 -- \
+   set interface p7 type=patch options:peer=p37 ofport_request=7 -- \
+   add-br br1 -- \
+   set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
+   set bridge br1 datapath-type=dummy other-config:datapath-id=1234 fail-mode=secure -- \
+   add-bond br1 bond10 p11 p12 p13 bond_mode=balance-tcp lacp=active \
+        other-config:lacp-time=fast other-config:bond-rebalance-interval=0 --\
+   set interface p11 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
+   set interface p12 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=3 -- \
+   set interface p13 type=dummy options:stream=unix:$OVS_RUNDIR/p3.sock ofport_request=2 -- \
+   add-bond br1 bond11 p14 p15 p16 bond_mode=balance-tcp lacp=active \
+        other-config:lacp-time=fast other-config:bond-rebalance-interval=0 --\
+   set interface p14 type=dummy options:stream=unix:$OVS_RUNDIR/p7.sock ofport_request=4 -- \
+   set interface p15 type=dummy options:stream=unix:$OVS_RUNDIR/p8.sock ofport_request=5 -- \
+   set interface p16 type=dummy options:stream=unix:$OVS_RUNDIR/p9.sock ofport_request=6 -- \
+   add-br br2 -- \
+   set bridge br2 other-config:hwaddr=aa:66:aa:66:00:02 -- \
+   set bridge br2 datapath-type=dummy other-config:datapath-id=1235 fail-mode=secure -- \
+   add-bond br2 bond20 p21 p22 p23 bond_mode=balance-tcp lacp=active \
+        other-config:lacp-time=fast other-config:bond-rebalance-interval=0 --\
+   set interface p21 type=dummy options:stream=unix:$OVS_RUNDIR/p4.sock ofport_request=1 -- \
+   set interface p22 type=dummy options:stream=unix:$OVS_RUNDIR/p5.sock ofport_request=2 -- \
+   set interface p23 type=dummy options:stream=unix:$OVS_RUNDIR/p6.sock ofport_request=3 -- \
+   add-br br3 -- \
+   set bridge br3 other-config:hwaddr=aa:66:aa:66:00:03 -- \
+   set bridge br3 datapath-type=dummy other-config:datapath-id=1236 fail-mode=secure -- \
+   add-port br3 p37 -- \
+   set interface p37 type=patch options:peer=p7 ofport_request=37 -- ])
+AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
+])
+AT_CHECK([ovs-ofctl add-flow br1 action=normal])
+AT_CHECK([ovs-ofctl add-flow br2 action=normal])
+AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
+], [])
+sleep 1;
+ovs-appctl time/stop
+ovs-appctl time/warp 100
+ovs-appctl lacp/show > lacp.txt
+ovs-appctl bond/show > bond.txt
+
+ovs-appctl vlog/set dpif,file,dbg
+#ovs-appctl vlog/set ofproto,file,dbg
+
+dnl The input is a TCP/IP frame which tcpdump -vve shows as:
+dnl 60:66:66:66:00:01 > 50:54:00:00:00:07, ethertype IPv4 (0x0800), length 58: (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
+dnl     192.168.0.1.80 > 192.168.0.2.$port: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
+(
+for i in `seq 0 255` ;
+    do
+    port=$(printf "%02x" $i)
+    ovs-ofctl -O OpenFlow13 packet-out br0 7 normal "50 54 00 00 00 07 60 66 66 66 00 01 08 00 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 $port 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45"
+done
+)
+
+ovs-appctl time/warp 100
+ovs-appctl time/warp 100
+ovs-appctl time/warp 100
+AT_CHECK([ovs-appctl dpif/dump-flows br1 |grep tcp > br1_flows.txt])
+AT_CHECK([ovs-appctl dpif/dump-flows br2 |grep tcp > br2_flows.txt])
+# Make sure there is resonable distribution to all three ports.
+# We don't want to make this check precise, in case hash function changes.
+AT_CHECK([test `grep in_port.11 br1_flows.txt |wc -l` -gt 7])
+AT_CHECK([test `grep in_port.12 br1_flows.txt |wc -l` -gt 7])
+AT_CHECK([test `grep in_port.13 br1_flows.txt |wc -l` -gt 7])
+AT_CHECK([test `grep in_port.21 br2_flows.txt |wc -l` -gt 7])
+AT_CHECK([test `grep in_port.22 br2_flows.txt |wc -l` -gt 7])
+AT_CHECK([test `grep in_port.23 br2_flows.txt |wc -l` -gt 7])
+OVS_VSWITCHD_STOP()
+AT_CLEANUP
+
 AT_SETUP([ofproto-dpif - resubmit])
 OVS_VSWITCHD_START
 ADD_OF_PORTS([br0], [1], [10], [11], [12], [13], [14], [15],
-- 
1.8.5.2




More information about the dev mailing list