This recipe tests unregistered MC traffic that should be flooded in the
following way:
* When MC is enabled it should be sent to all the mrouter ports
* When MC is disabled it should be sent to all the ports that marked with
MC flood flag (default on)
The test's algorithm is as follows:
- Set MC on
- Set one port as mrouter (statically on) and as MC flood off.
- Check that unregistered MC traffic is received by this port and no other
port.
- Set MC off
- Check that unregistered MC traffic if not received by this port but is
received by the other ports.
- Change this port to not be mrouter (statically off) and to flood MC
packets. Change another port to be MC flood off and mrouter on.
- Check unregistered MC traffic is not received by the new port but is
received by the other ports.
- Set MC on
- Check that unregistered MC traffic is received only by the new port.
Signed-off-by: Nogah Frankel <nogahf(a)mellanox.com>
Reviewed-by: Yotam Gigi <yotamg(a)mellanox.com>
---
recipes/switchdev/l2-026-bridge_mdb_unreg_flood.py | 92 ++++++++++++++++++++++
.../switchdev/l2-026-bridge_mdb_unreg_flood.xml | 70 ++++++++++++++++
2 files changed, 162 insertions(+)
create mode 100644 recipes/switchdev/l2-026-bridge_mdb_unreg_flood.py
create mode 100644 recipes/switchdev/l2-026-bridge_mdb_unreg_flood.xml
diff --git a/recipes/switchdev/l2-026-bridge_mdb_unreg_flood.py
b/recipes/switchdev/l2-026-bridge_mdb_unreg_flood.py
new file mode 100644
index 0000000..bdb8b1c
--- /dev/null
+++ b/recipes/switchdev/l2-026-bridge_mdb_unreg_flood.py
@@ -0,0 +1,92 @@
+"""
+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()
+
+ tl._ctl.wait(2)
+ tl.check_cpu_traffic(sw_ports, test=False)
+
+ mcast_iface = [m2_if, m3_if, m4_if]
+ sw_if2.set_mcast_router(MCAST_ROUTER_PORT.FIXED_ON)
+ sw_if2.set_mcast_flood(False)
+
+ result = tl.iperf_mc(m1_if, mcast_iface, mcgrp(1))
+ tl.mc_ipref_compare_result(mcast_iface, result, [True, False, False])
+ tl.check_cpu_traffic(sw_ports)
+
+ sw_br.set_br_mcast_snooping(False)
+ tl._ctl.wait(2)
+ result = tl.iperf_mc(m1_if, mcast_iface, mcgrp(1))
+ tl.mc_ipref_compare_result(mcast_iface, result, [False, True, True])
+ tl.check_cpu_traffic(sw_ports)
+
+ sw_if2.set_mcast_flood(True)
+ sw_if2.set_mcast_router(MCAST_ROUTER_PORT.FIXED_OFF)
+ sw_if3.set_mcast_router(MCAST_ROUTER_PORT.FIXED_ON)
+ sw_if3.set_mcast_flood(False)
+
+ result = tl.iperf_mc(m1_if, mcast_iface, mcgrp(1))
+ tl.mc_ipref_compare_result(mcast_iface, result, [True, False, True])
+ tl.check_cpu_traffic(sw_ports)
+
+ sw_br.set_br_mcast_snooping()
+ tl._ctl.wait(2)
+
+ 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)
+
+ sw_if2.set_mcast_router(MCAST_ROUTER_PORT.LEARNING)
+ sw_if2.set_mcast_router(MCAST_ROUTER_PORT.LEARNING)
+ sw_if3.set_mcast_flood(True)
+ for iface in [m1_if, m2_if, m3_if, m4_if]:
+ 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-026-bridge_mdb_unreg_flood.xml
b/recipes/switchdev/l2-026-bridge_mdb_unreg_flood.xml
new file mode 100644
index 0000000..3a29330
--- /dev/null
+++ b/recipes/switchdev/l2-026-bridge_mdb_unreg_flood.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-026-bridge_mdb_unreg_flood.py" />
+</lnstrecipe>
--
2.4.3