The mdb mcast disabled test case tests that the bridge mcast_disabled flag
gets offloaded right
The test's algorithm is as follows:
- Add ports to mcast group
- Send traffic to that group
- Validate that traffic received only by joined ports
- Turn mcast_disabled flag on
- Send traffic to that same group
- Validate that traffic received by all ports
- Check that all the traffic hadn't gone via slowpath
Signed-off-by: Yotam Gigi <yotamg(a)mellanox.com>
Signed-off-by: Nogah Frankel <nogahf(a)mellanox.com>
---
.../switchdev/l2-022-bridge_mdb_mcast_disabled.py | 85 ++++++++++++++++++++++
.../switchdev/l2-022-bridge_mdb_mcast_disabled.xml | 70 ++++++++++++++++++
2 files changed, 155 insertions(+)
create mode 100644 recipes/switchdev/l2-022-bridge_mdb_mcast_disabled.py
create mode 100644 recipes/switchdev/l2-022-bridge_mdb_mcast_disabled.xml
diff --git a/recipes/switchdev/l2-022-bridge_mdb_mcast_disabled.py
b/recipes/switchdev/l2-022-bridge_mdb_mcast_disabled.py
new file mode 100644
index 0000000..0351582
--- /dev/null
+++ b/recipes/switchdev/l2-022-bridge_mdb_mcast_disabled.py
@@ -0,0 +1,85 @@
+"""
+Copyright 2016 Mellanox Technologies. All rights reserved.
+Licensed under the GNU General Public License, version 2 as
+published by the Free Software Foundation; see COPYING for details.
+"""
+
+__author__ = """
+yotamg(a)mellanox.com (Yotam Gigi)
+"""
+
+from lnst.Controller.Task import ctl
+from TestLib import TestLib
+from time import sleep
+
+def test_ip(major, minor):
+ return ["192.168.10%d.%d/24" % (major, minor),
+ "2002:%d::%d/64" % (major, minor)]
+
+def mcgrp(i):
+ return "239.255.1.%d" % i
+
+def test_mcast_onoff(tl, sw_br, sender, listeners, bridged, group):
+ mcast_ifaces = listeners + bridged
+ sw = sw_br.get_host()
+
+ expected_mcast_on = [True for l in listeners] + [False for l in bridged]
+ expected_mcast_off = [True for l in listeners] + [True for l in bridged]
+
+ s_procs = [tl.iperf_mc_listen(listener, group) for listener in listeners]
+ tl._ctl.wait(2)
+
+ result = tl.iperf_mc(sender, mcast_ifaces, group)
+ tl.mc_ipref_compare_result(mcast_ifaces, result, expected_mcast_on)
+
+ sw_br.set_br_mcast_snooping(False)
+ result = tl.iperf_mc(sender, mcast_ifaces, group)
+ tl.mc_ipref_compare_result(mcast_ifaces, result, expected_mcast_off)
+
+ sw_br.set_br_mcast_snooping(True)
+ result = tl.iperf_mc(sender, mcast_ifaces, group)
+ tl.mc_ipref_compare_result(mcast_ifaces, result, expected_mcast_on)
+
+ for proc in s_procs:
+ proc.intr()
+
+def do_task(ctl, hosts, ifaces, aliases):
+ m1, m2, sw = hosts
+ m1_if, m2_if, m3_if, m4_if, sw_if1, sw_if2, sw_if3, sw_if4 = ifaces
+
+ # Create a bridge
+ sw_ifaces = [sw_if1, sw_if2, sw_if3, sw_if4]
+ sw_br = sw.create_bridge(slaves=sw_ifaces, options={"vlan_filtering": 1})
+
+ m1_if.set_addresses(test_ip(1, 1))
+ m2_if.set_addresses(test_ip(1, 2))
+ m3_if.set_addresses(test_ip(1, 3))
+ m4_if.set_addresses(test_ip(1, 4))
+ sleep(15)
+
+ tl = TestLib(ctl, aliases)
+ for iface in [m1_if, m2_if, m3_if, m4_if]:
+ iface.enable_multicast()
+ tl.check_cpu_traffic(sw_ifaces, test=False)
+
+ test_mcast_onoff(tl, sw_br, m1_if, [], [m3_if, m2_if, m4_if], mcgrp(1))
+ test_mcast_onoff(tl, sw_br, m1_if, [m2_if], [m3_if, m4_if], mcgrp(2))
+ test_mcast_onoff(tl, sw_br, m1_if, [m2_if, m4_if], [m3_if], mcgrp(3))
+ test_mcast_onoff(tl, sw_br, m3_if, [m1_if, m4_if], [m2_if], mcgrp(4))
+
+ for iface in [m1_if, m2_if, m3_if, m4_if]:
+ iface.disable_multicast()
+ tl.check_cpu_traffic(sw_ifaces)
+
+do_task(ctl, [ctl.get_host("machine1"),
+ ctl.get_host("machine2"),
+ ctl.get_host("switch")],
+ [ctl.get_host("machine1").get_interface("veth1"),
+ ctl.get_host("machine1").get_interface("veth3"),
+ ctl.get_host("machine2").get_interface("veth1"),
+ ctl.get_host("machine2").get_interface("veth3"),
+ ctl.get_host("switch").get_interface("if1"),
+ ctl.get_host("switch").get_interface("if2"),
+ ctl.get_host("switch").get_interface("if3"),
+ ctl.get_host("switch").get_interface("if4")],
+ ctl.get_aliases())
diff --git a/recipes/switchdev/l2-022-bridge_mdb_mcast_disabled.xml
b/recipes/switchdev/l2-022-bridge_mdb_mcast_disabled.xml
new file mode 100644
index 0000000..8e17b59
--- /dev/null
+++ b/recipes/switchdev/l2-022-bridge_mdb_mcast_disabled.xml
@@ -0,0 +1,70 @@
+<lnstrecipe
xmlns:xi="http://www.w3.org/2003/XInclude">
+ <xi:include href="default_aliases.xml" />
+ <network>
+ <host id="machine1">
+ <interfaces>
+ <eth id="if1" label="A" />
+ <veth_pair>
+ <veth id="veth0"/>
+ <veth id="veth1" netns="nsif1">
+ </veth>
+ </veth_pair>
+ <bridge id="brif1">
+ <slaves>
+ <slave id="if1"/>
+ <slave id="veth0"/>
+ </slaves>
+ </bridge>
+ <eth id="if2" label="B" />
+ <veth_pair>
+ <veth id="veth2"/>
+ <veth id="veth3" netns="nsif2">
+ </veth>
+ </veth_pair>
+ <bridge id="brif2">
+ <slaves>
+ <slave id="if2"/>
+ <slave id="veth2"/>
+ </slaves>
+ </bridge>
+ </interfaces>
+ </host>
+ <host id="machine2">
+ <interfaces>
+ <eth id="if1" label="C" />
+ <veth_pair>
+ <veth id="veth0"/>
+ <veth id="veth1" netns="nsif1">
+ </veth>
+ </veth_pair>
+ <bridge id="brif1">
+ <slaves>
+ <slave id="if1"/>
+ <slave id="veth0"/>
+ </slaves>
+ </bridge>
+ <eth id="if2" label="D" />
+ <veth_pair>
+ <veth id="veth2"/>
+ <veth id="veth3" netns="nsif2">
+ </veth>
+ </veth_pair>
+ <bridge id="brif2">
+ <slaves>
+ <slave id="if2"/>
+ <slave id="veth2"/>
+ </slaves>
+ </bridge>
+ </interfaces>
+ </host>
+ <host id="switch">
+ <interfaces>
+ <eth id="if1" label="A" />
+ <eth id="if2" label="B" />
+ <eth id="if3" label="C" />
+ <eth id="if4" label="D" />
+ </interfaces>
+ </host>
+ </network>
+ <task python="l2-022-bridge_mdb_mcast_disabled.py" />
+</lnstrecipe>
--
2.4.3