This test tests MC flood to ports that is configured statically to be
mrouter, meaning that it should get all the MC traffic, regardless of join
requests.
The test uses 4 ports: one that sends the data, one that send no join
request and shouldn't get any traffic, one that sends some join requests
and should get some of the traffic and a PUT (port under tests).
The test use 3 MC groups:
- Unregistered one (no port sent join request to it).
- A MC group that was registered to only by a port that is not the PUT.
- A MC group that is registered to by the previous port and the PUT.
The test's algorithm is as follows:
- Send the needed join requests.
- Set the PUT to be mrouter (statically on)
- send traffic from all of the MC groups.
- Check that all of them were sent to the PUT.
- Check that the other ports got the traffic according to the join
requests
- Set the PUT to not be mrouter (statically off)
- Send traffic from all of the MC groups.
- Check that all the ports (including the PUT) got the traffic according
to the join requests
- Check that all the traffic hadn't gone via slowpath
Signed-off-by: Nogah Frankel <nogahf(a)mellanox.com>
Reviewed-by: Yotam Gigi <yotamg(a)mellanox.com>
---
.../l2-023-bridge_mdb_mc_router_port_basic.py | 108 +++++++++++++++++++++
.../l2-023-bridge_mdb_mc_router_port_basic.xml | 70 +++++++++++++
2 files changed, 178 insertions(+)
create mode 100644 recipes/switchdev/l2-023-bridge_mdb_mc_router_port_basic.py
create mode 100644 recipes/switchdev/l2-023-bridge_mdb_mc_router_port_basic.xml
diff --git a/recipes/switchdev/l2-023-bridge_mdb_mc_router_port_basic.py
b/recipes/switchdev/l2-023-bridge_mdb_mc_router_port_basic.py
new file mode 100644
index 0000000..562454e
--- /dev/null
+++ b/recipes/switchdev/l2-023-bridge_mdb_mc_router_port_basic.py
@@ -0,0 +1,108 @@
+"""
+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__ = """
+nogahf(a)mellanox.com (Nogah Frankel)
+"""
+
+from lnst.Controller.Task import ctl
+from TestLib import TestLib
+from time import sleep
+import logging
+from lnst.Common.Consts import MCAST_ROUTER_PORT
+
+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 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_ports = [sw_if1, sw_if2, sw_if3, sw_if4]
+ sw_br = sw.create_bridge(slaves=sw_ports, 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()
+
+ logging.info("%s join %s" % (m3_if.get_devname(), mcgrp(1)))
+ s_procs_1 = [tl.iperf_mc_listen(m3_if, mcgrp(1))]
+ logging.info("%s and %s join %s" % (m2_if.get_devname(),
+ m3_if.get_devname(), mcgrp(2)))
+ s_procs_2 = [tl.iperf_mc_listen(listener, mcgrp(2))
+ for listener in [m2_if, m3_if]]
+ tl._ctl.wait(2)
+
+ logging.info("set mrouter on")
+ mcast_iface = [m2_if, m3_if, m4_if]
+ sw_if2.set_mcast_router(MCAST_ROUTER_PORT.FIXED_ON)
+
+ logging.info("check registered mid flood")
+ tl.check_cpu_traffic(sw_ports, test=False)
+ result = tl.iperf_mc(m1_if, mcast_iface, mcgrp(1))
+ tl.mc_ipref_compare_result(mcast_iface, result, [True, True, False])
+ tl.check_cpu_traffic(sw_ports)
+
+ logging.info("check registered mid with mrouter flood")
+ result = tl.iperf_mc(m1_if, mcast_iface, mcgrp(2))
+ tl.mc_ipref_compare_result(mcast_iface, result, [True, True, False])
+ tl.check_cpu_traffic(sw_ports)
+
+ logging.info("check unregistered mc flood")
+ result = tl.iperf_mc(m1_if, mcast_iface, mcgrp(3))
+ tl.mc_ipref_compare_result(mcast_iface, result, [True, False, False])
+ tl.check_cpu_traffic(sw_ports)
+
+ logging.info("set mrouter off")
+ sw_if2.set_mcast_router(MCAST_ROUTER_PORT.FIXED_OFF)
+ tl._ctl.wait(2)
+
+ logging.info("check registered mid flood")
+ result = tl.iperf_mc(m1_if, mcast_iface, mcgrp(1))
+ tl.mc_ipref_compare_result(mcast_iface, result, [False, True, False])
+ tl.check_cpu_traffic(sw_ports)
+
+ logging.info("check registered mid with mrouter flood")
+ result = tl.iperf_mc(m1_if, mcast_iface, mcgrp(2))
+ tl.mc_ipref_compare_result(mcast_iface, result, [True, True, False])
+ tl.check_cpu_traffic(sw_ports)
+
+ logging.info("check unregistered mc flood")
+ result = tl.iperf_mc(m1_if, mcast_iface, mcgrp(3))
+ tl.mc_ipref_compare_result(mcast_iface, result, [False, False, False])
+ tl.check_cpu_traffic(sw_ports)
+
+ sw_if2.set_mcast_router(MCAST_ROUTER_PORT.LEARNING)
+
+ for proc in s_procs_1 + s_procs_2:
+ proc.intr()
+
+ for iface in mcast_iface:
+ iface.disable_multicast()
+
+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-023-bridge_mdb_mc_router_port_basic.xml
b/recipes/switchdev/l2-023-bridge_mdb_mc_router_port_basic.xml
new file mode 100644
index 0000000..f672eb7
--- /dev/null
+++ b/recipes/switchdev/l2-023-bridge_mdb_mc_router_port_basic.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-023-bridge_mdb_mc_router_port_basic.py" />
+</lnstrecipe>
--
2.4.3