Adopt the FDB check routine and bridge tests to the following changes
1. Removal of the support for SELF.
2. Adding of the extern_learned FDB attribute.
3. Remove tests realted to learining_sync.
Signed-off-by: Arkadi Sharshevsky <arkadis(a)mellanox.com>
---
recipes/switchdev/TestLib.py | 23 +++--
recipes/switchdev/l2-002-bridge_fdb.py | 98 +++++++---------------
recipes/switchdev/l2-003-bridge_stp.py | 22 ++---
recipes/switchdev/l2-017-bridge_fdb_vlan1d.py | 98 +++++++---------------
recipes/switchdev/l2-018-bridge_fdb_team.py | 98 +++++++---------------
recipes/switchdev/l2-019-bridge_fdb_team_vlan1d.py | 98 +++++++---------------
6 files changed, 136 insertions(+), 301 deletions(-)
diff --git a/recipes/switchdev/TestLib.py b/recipes/switchdev/TestLib.py
index cabce0b..ec9d521 100644
--- a/recipes/switchdev/TestLib.py
+++ b/recipes/switchdev/TestLib.py
@@ -316,20 +316,29 @@ class TestLib:
custom_mod = self._ctl.get_module("Custom", options=options)
m1.run(custom_mod, desc=desc)
- def check_fdb(self, iface, hwaddr, vlan_id, rec_type, find=True):
+ def check_fdb(self, iface, hwaddr, vlan_id, offload, extern_learn, find=True):
fdb_table = iface.get_br_fdbs()
- rec = "offload" if rec_type == "software" else
"self"
found = False
+ err_arg = None
for fdb in fdb_table:
- if (fdb["hwaddr"] == str(hwaddr) and fdb["vlan_id"] ==
vlan_id and
- fdb[rec]):
- found = True
+ if not (fdb["hwaddr"] == str(hwaddr) and fdb["vlan_id"]
== vlan_id):
+ continue
+ if (offload and not fdb["offload"]):
+ err_arg = "offload"
+ continue
+ if (extern_learn and not fdb["extern_learn"]):
+ err_arg = "extern_learn"
+ continue
+ found = True
if found and not find:
- err_msg = "found %s record when shouldn't" % rec_type
+ if err_arg is None:
+ err_msg = "didn't find record when should've"
+ else:
+ err_msg = "found %s record when shouldn't" % err_arg
elif find and not found:
- err_msg = "didn't find %s record when should've" %
rec_type
+ err_msg = "didn't find %s record when should've" % err_arg
else:
err_msg = ""
diff --git a/recipes/switchdev/l2-002-bridge_fdb.py
b/recipes/switchdev/l2-002-bridge_fdb.py
index ba34749..63f9852 100644
--- a/recipes/switchdev/l2-002-bridge_fdb.py
+++ b/recipes/switchdev/l2-002-bridge_fdb.py
@@ -32,103 +32,61 @@ def do_task(ctl, hosts, ifaces, aliases):
tl = TestLib(ctl, aliases)
tl.ping_simple(m1_if1, m2_if1)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software")
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware")
- sw_if1.set_br_learning(on=False, self=True)
+ tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True)
+ sw_if1.set_br_learning(on=False, master=True)
sleep(30)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware", False)
+ tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True, False)
# Make sure FDB is not populated when learning is disabled.
- sw_if1.set_br_learning(on=False, self=True)
+ sw_if1.set_br_learning(on=False, master=True)
tl.ping_simple(m1_if1, m2_if1)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware", False)
+ tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True, False)
# Disable flooding and make sure ping fails.
- sw_if1.set_br_flooding(on=False, self=True)
+ sw_if1.set_br_flooding(on=False, master=True)
tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
- # Set a static FDB entry and make sure ping works again.
- sw_if1.add_br_fdb(str(m1_if1.get_hwaddr()), self=True, vlan_tci=1)
+ # Set a static FDB entry and make sure ping works again. Also check
+ # its offloaded
+ sw_if1.add_br_fdb(str(m1_if1.get_hwaddr()), master=True, vlan_tci=1)
tl.ping_simple(m1_if1, m2_if1)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware")
+ tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, False)
# Remove static FDB entry. Ping should fail.
- sw_if1.del_br_fdb(str(m1_if1.get_hwaddr()), self=True, vlan_tci=1)
+ sw_if1.del_br_fdb(str(m1_if1.get_hwaddr()), master=True, vlan_tci=1)
tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware", False)
+ tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, False, False)
- # Enable learning_sync and make sure both FDBs are populated.
- sw_if1.set_br_learning(on=True, self=True)
- sw_if1.set_br_flooding(on=True, self=True)
- sw_if1.set_br_learning_sync(on=True, self=True)
+ # Enable learning and flooding and make sure ping works again.
+ sw_if1.set_br_learning(on=True, master=True)
+ sw_if1.set_br_flooding(on=True, master=True)
tl.ping_simple(m1_if1, m2_if1)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software")
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware")
- sw_if1.set_br_learning(on=False, self=True)
+ tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True)
+ sw_if1.set_br_learning(on=False, master=True)
sleep(20)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware", False)
+ tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True, False)
- # Disable learning_sync and make sure only hardware FDB is populated.
- sw_if1.set_br_learning(on=True, self=True)
- sw_if1.set_br_learning_sync(on=False, self=True)
+ # Insert a static FDB entry. Ping should work.
+ sw_if1.add_br_fdb(str(m1_if1.get_hwaddr()), master=True, vlan_tci=1)
tl.ping_simple(m1_if1, m2_if1)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware")
-
- # Remove port from bridge and add it back. Disable flooding and learning
- # and make sure ping doesn't work. Note that port must be removed from
- # bridge when the FDB entry exists only in the hardware table. Otherwise,
- # bridge code will flush it himself, instead of driver.
- sw_br.slave_del(sw_if1.get_id())
- sw_br.slave_add(sw_if1.get_id()) # Enables learning sync by default.
- sw_if1.set_br_learning(on=False, self=True)
- sw_if1.set_br_flooding(on=False, self=True)
- tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
-
- # Enable learning and make sure ping works again.
- sw_if1.set_br_learning(on=True, self=True)
- tl.ping_simple(m1_if1, m2_if1)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software")
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware")
- sw_if1.set_br_learning(on=False, self=True)
-
- sleep(20)
-
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware", False)
-
- # Insert a static FDB entry and disable learning sync. Ping should work.
- sw_if1.add_br_fdb(str(m1_if1.get_hwaddr()), self=True, vlan_tci=1)
- sw_if1.set_br_learning_sync(on=False, self=True)
- tl.ping_simple(m1_if1, m2_if1)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware")
+ tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, False)
sleep(20)
# Make sure static entry is not aged out.
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware")
-
- # Remove port from bridge and add it back. Disable flooding and learning
- # and make sure ping doesn't work. Note that port must be removed from
- # bridge when the FDB entry exists only in the hardware table. Otherwise,
- # bridge code will flush it himself, instead of driver. Unlike the
- # previous case, here we check if the driver correctly removes the static
- # entry.
+ tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, False)
+
+ # Remove port from bridge and add it back. The static entry added
+ # before should be flushed. Disable flooding and learning and make
+ # sure ping doesn't work.
sw_br.slave_del(sw_if1.get_id())
sw_br.slave_add(sw_if1.get_id())
- sw_if1.set_br_learning(on=False, self=True)
- sw_if1.set_br_flooding(on=False, self=True)
+ sw_if1.set_br_learning(on=False, master=True)
+ sw_if1.set_br_flooding(on=False, master=True)
tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
do_task(ctl, [ctl.get_host("machine1"),
diff --git a/recipes/switchdev/l2-003-bridge_stp.py
b/recipes/switchdev/l2-003-bridge_stp.py
index 44e87e7..347b2d7 100644
--- a/recipes/switchdev/l2-003-bridge_stp.py
+++ b/recipes/switchdev/l2-003-bridge_stp.py
@@ -36,43 +36,37 @@ def do_task(ctl, hosts, ifaces, aliases):
# populated.
sw_if1.set_br_state(0)
tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware", False)
+ tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True, False)
# Set STP state to LISTENING and make sure ping fails and FDB is not
# populated.
sw_if1.set_br_state(1)
tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware", False)
+ tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True, False)
# Set STP state to LEARNING and make sure ping fails, but FDB *is*
# populated.
sw_if1.set_br_state(2)
tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software")
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware")
+ tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True)
sleep(30)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware", False)
+ tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True, False)
# Set STP state to FORWARDING and make sure ping works and FDB is
# populated.
sw_if1.set_br_state(3)
tl.ping_simple(m1_if1, m2_if1)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software")
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware")
+ tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True)
sleep(30)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware", False)
+ tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True, False)
# Make sure that even with a static FDB record we don't get traffic
# when state is DISABLED, LEARNING or LISTENING.
- sw_if2.add_br_fdb(str(m2_if1.get_hwaddr()), self=True, vlan_tci=1)
+ sw_if2.add_br_fdb(str(m2_if1.get_hwaddr()), master=True, vlan_tci=1)
sw_if1.set_br_state(0)
tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
sw_if1.set_br_state(1)
@@ -81,7 +75,7 @@ def do_task(ctl, hosts, ifaces, aliases):
tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
# Cleanup
- sw_if2.del_br_fdb(str(m2_if1.get_hwaddr()), self=True, vlan_tci=1)
+ sw_if2.del_br_fdb(str(m2_if1.get_hwaddr()), master=True, vlan_tci=1)
do_task(ctl, [ctl.get_host("machine1"),
ctl.get_host("machine2"),
diff --git a/recipes/switchdev/l2-017-bridge_fdb_vlan1d.py
b/recipes/switchdev/l2-017-bridge_fdb_vlan1d.py
index 1de39ec..493dddd 100644
--- a/recipes/switchdev/l2-017-bridge_fdb_vlan1d.py
+++ b/recipes/switchdev/l2-017-bridge_fdb_vlan1d.py
@@ -34,103 +34,61 @@ def do_task(ctl, hosts, ifaces, aliases):
tl = TestLib(ctl, aliases)
tl.ping_simple(m1_if1_10, m2_if1_20)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software")
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")
- sw_if1_10.set_br_learning(on=False, self=True)
+ tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, True)
+ sw_if1_10.set_br_learning(on=False, master=True)
sleep(30)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)
+ tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, True, False)
# Make sure FDB is not populated when learning is disabled.
- sw_if1_10.set_br_learning(on=False, self=True)
+ sw_if1_10.set_br_learning(on=False, master=True)
tl.ping_simple(m1_if1_10, m2_if1_20)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)
+ tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, True, False)
# Disable flooding and make sure ping fails.
- sw_if1_10.set_br_flooding(on=False, self=True)
+ sw_if1_10.set_br_flooding(on=False, master=True)
tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)
- # Set a static FDB entry and make sure ping works again.
- sw_if1_10.add_br_fdb(str(m1_if1_10.get_hwaddr()), self=True)
+ # Set a static FDB entry and make sure ping works again. Also check
+ # its offloaded
+ sw_if1_10.add_br_fdb(str(m1_if1_10.get_hwaddr()), master=True)
tl.ping_simple(m1_if1_10, m2_if1_20)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")
+ tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, False)
# Remove static FDB entry. Ping should fail.
- sw_if1_10.del_br_fdb(str(m1_if1_10.get_hwaddr()), self=True)
+ sw_if1_10.del_br_fdb(str(m1_if1_10.get_hwaddr()), master=True)
tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)
+ tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, False, False)
- # Enable learning_sync and make sure both FDBs are populated.
- sw_if1_10.set_br_learning(on=True, self=True)
- sw_if1_10.set_br_flooding(on=True, self=True)
- sw_if1_10.set_br_learning_sync(on=True, self=True)
+ # Enable learning and flooding and make sure ping works again.
+ sw_if1_10.set_br_learning(on=True, master=True)
+ sw_if1_10.set_br_flooding(on=True, master=True)
tl.ping_simple(m1_if1_10, m2_if1_20)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software")
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")
- sw_if1_10.set_br_learning(on=False, self=True)
+ tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, True)
+ sw_if1_10.set_br_learning(on=False, master=True)
sleep(20)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)
+ tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, True, False)
- # Disable learning_sync and make sure only hardware FDB is populated.
- sw_if1_10.set_br_learning(on=True, self=True)
- sw_if1_10.set_br_learning_sync(on=False, self=True)
+ # Insert a static FDB entry. Ping should work.
+ sw_if1_10.add_br_fdb(str(m1_if1_10.get_hwaddr()), master=True)
tl.ping_simple(m1_if1_10, m2_if1_20)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")
-
- # Remove port from bridge and add it back. Disable flooding and learning
- # and make sure ping doesn't work. Note that port must be removed from
- # bridge when the FDB entry exists only in the hardware table. Otherwise,
- # bridge code will flush it himself, instead of driver.
- sw_br.slave_del(sw_if1_10.get_id())
- sw_br.slave_add(sw_if1_10.get_id()) # Enables learning sync by default.
- sw_if1_10.set_br_learning(on=False, self=True)
- sw_if1_10.set_br_flooding(on=False, self=True)
- tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)
-
- # Enable learning and make sure ping works again.
- sw_if1_10.set_br_learning(on=True, self=True)
- tl.ping_simple(m1_if1_10, m2_if1_20)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software")
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")
- sw_if1_10.set_br_learning(on=False, self=True)
-
- sleep(20)
-
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)
-
- # Insert a static FDB entry and disable learning sync. Ping should work.
- sw_if1_10.add_br_fdb(str(m1_if1_10.get_hwaddr()), self=True)
- sw_if1_10.set_br_learning_sync(on=False, self=True)
- tl.ping_simple(m1_if1_10, m2_if1_20)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")
+ tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, False)
sleep(20)
# Make sure static entry is not aged out.
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")
-
- # Remove port from bridge and add it back. Disable flooding and learning
- # and make sure ping doesn't work. Note that port must be removed from
- # bridge when the FDB entry exists only in the hardware table. Otherwise,
- # bridge code will flush it himself, instead of driver. Unlike the
- # previous case, here we check if the driver correctly removes the static
- # entry.
+ tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, False)
+
+ # Remove port from bridge and add it back. The static entry added
+ # before should be flushed. Disable flooding and learning and make
+ # sure ping doesn't work.
sw_br.slave_del(sw_if1_10.get_id())
sw_br.slave_add(sw_if1_10.get_id())
- sw_if1_10.set_br_learning(on=False, self=True)
- sw_if1_10.set_br_flooding(on=False, self=True)
+ sw_if1_10.set_br_learning(on=False, master=True)
+ sw_if1_10.set_br_flooding(on=False, master=True)
tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)
do_task(ctl, [ctl.get_host("machine1"),
diff --git a/recipes/switchdev/l2-018-bridge_fdb_team.py
b/recipes/switchdev/l2-018-bridge_fdb_team.py
index 38f910a..5fae8ff 100644
--- a/recipes/switchdev/l2-018-bridge_fdb_team.py
+++ b/recipes/switchdev/l2-018-bridge_fdb_team.py
@@ -36,103 +36,61 @@ def do_task(ctl, hosts, ifaces, aliases):
tl = TestLib(ctl, aliases)
tl.ping_simple(m1_lag1, m2_lag1)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software")
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")
- sw_lag1.set_br_learning(on=False, self=True)
+ tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True)
+ sw_lag1.set_br_learning(on=False, master=True)
sleep(30)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)
+ tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True, False)
# Make sure FDB is not populated when learning is disabled.
- sw_lag1.set_br_learning(on=False, self=True)
+ sw_lag1.set_br_learning(on=False, master=True)
tl.ping_simple(m1_lag1, m2_lag1)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)
+ tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True, False)
# Disable flooding and make sure ping fails.
- sw_lag1.set_br_flooding(on=False, self=True)
+ sw_lag1.set_br_flooding(on=False, master=True)
tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)
- # Set a static FDB entry and make sure ping works again.
- sw_lag1.add_br_fdb(str(m1_lag1.get_hwaddr()), self=True, vlan_tci=1)
+ # Set a static FDB entry and make sure ping works again. Also check
+ # its offloaded
+ sw_lag1.add_br_fdb(str(m1_lag1.get_hwaddr()), master=True, vlan_tci=1)
tl.ping_simple(m1_lag1, m2_lag1)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")
+ tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, False)
# Remove static FDB entry. Ping should fail.
- sw_lag1.del_br_fdb(str(m1_lag1.get_hwaddr()), self=True, vlan_tci=1)
+ sw_lag1.del_br_fdb(str(m1_lag1.get_hwaddr()), master=True, vlan_tci=1)
tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)
+ tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, False, False)
- # Enable learning_sync and make sure both FDBs are populated.
- sw_lag1.set_br_learning(on=True, self=True)
- sw_lag1.set_br_flooding(on=True, self=True)
- sw_lag1.set_br_learning_sync(on=True, self=True)
+ # Enable learning and flooading and make sure ping works again.
+ sw_lag1.set_br_learning(on=True, master=True)
+ sw_lag1.set_br_flooding(on=True, master=True)
tl.ping_simple(m1_lag1, m2_lag1)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software")
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")
- sw_lag1.set_br_learning(on=False, self=True)
+ tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True)
+ sw_lag1.set_br_learning(on=False, master=True)
sleep(30)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)
+ tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True, False)
- # Disable learning_sync and make sure only hardware FDB is populated.
- sw_lag1.set_br_learning(on=True, self=True)
- sw_lag1.set_br_learning_sync(on=False, self=True)
+ # Insert a static FDB entry. Ping should work.
+ sw_lag1.add_br_fdb(str(m1_lag1.get_hwaddr()), master=True, vlan_tci=1)
tl.ping_simple(m1_lag1, m2_lag1)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")
-
- # Remove port from bridge and add it back. Disable flooding and learning
- # and make sure ping doesn't work. Note that port must be removed from
- # bridge when the FDB entry exists only in the hardware table. Otherwise,
- # bridge code will flush it himself, instead of driver.
- sw_br.slave_del(sw_lag1.get_id())
- sw_br.slave_add(sw_lag1.get_id()) # Enables learning sync by default.
- sw_lag1.set_br_learning(on=False, self=True)
- sw_lag1.set_br_flooding(on=False, self=True)
- tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)
-
- # Enable learning and make sure ping works again.
- sw_lag1.set_br_learning(on=True, self=True)
- tl.ping_simple(m1_lag1, m2_lag1)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software")
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")
- sw_lag1.set_br_learning(on=False, self=True)
-
- sleep(30)
-
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)
-
- # Insert a static FDB entry and disable learning sync. Ping should work.
- sw_lag1.add_br_fdb(str(m1_lag1.get_hwaddr()), self=True, vlan_tci=1)
- sw_lag1.set_br_learning_sync(on=False, self=True)
- tl.ping_simple(m1_lag1, m2_lag1)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")
+ tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, False)
sleep(30)
# Make sure static entry is not aged out.
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
- tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")
-
- # Remove port from bridge and add it back. Disable flooding and learning
- # and make sure ping doesn't work. Note that port must be removed from
- # bridge when the FDB entry exists only in the hardware table. Otherwise,
- # bridge code will flush it himself, instead of driver. Unlike the
- # previous case, here we check if the driver correctly removes the static
- # entry.
+ tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, False)
+
+ # Remove port from bridge and add it back. The static entry added
+ # before should be flushed. Disable flooding and learning and make
+ # sure ping doesn't work.
sw_br.slave_del(sw_lag1.get_id())
sw_br.slave_add(sw_lag1.get_id())
- sw_lag1.set_br_learning(on=False, self=True)
- sw_lag1.set_br_flooding(on=False, self=True)
+ sw_lag1.set_br_learning(on=False, master=True)
+ sw_lag1.set_br_flooding(on=False, master=True)
tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)
do_task(ctl, [ctl.get_host("machine1"),
diff --git a/recipes/switchdev/l2-019-bridge_fdb_team_vlan1d.py
b/recipes/switchdev/l2-019-bridge_fdb_team_vlan1d.py
index 03b5bfe..ec786b2 100644
--- a/recipes/switchdev/l2-019-bridge_fdb_team_vlan1d.py
+++ b/recipes/switchdev/l2-019-bridge_fdb_team_vlan1d.py
@@ -43,103 +43,61 @@ def do_task(ctl, hosts, ifaces, aliases):
tl = TestLib(ctl, aliases)
tl.ping_simple(m1_lag1_10, m2_lag1_20)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "software")
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "hardware")
- sw_lag1_10.set_br_learning(on=False, self=True)
+ tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, True, True)
+ sw_lag1_10.set_br_learning(on=False, master=True)
sleep(30)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "hardware", False)
+ tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, True, True, False)
# Make sure FDB is not populated when learning is disabled.
- sw_lag1_10.set_br_learning(on=False, self=True)
+ sw_lag1_10.set_br_learning(on=False, master=True)
tl.ping_simple(m1_lag1_10, m2_lag1_20)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "hardware", False)
+ tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, True, True, False)
# Disable flooding and make sure ping fails.
- sw_lag1_10.set_br_flooding(on=False, self=True)
+ sw_lag1_10.set_br_flooding(on=False, master=True)
tl.ping_simple(m1_lag1_10, m2_lag1_20, fail_expected=True)
- # Set a static FDB entry and make sure ping works again.
- sw_lag1_10.add_br_fdb(str(m1_lag1_10.get_hwaddr()), self=True)
+ # Set a static FDB entry and make sure ping works again. Also check
+ # its offloaded
+ sw_lag1_10.add_br_fdb(str(m1_lag1_10.get_hwaddr()), master=True)
tl.ping_simple(m1_lag1_10, m2_lag1_20)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "hardware")
+ tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, True, False)
# Remove static FDB entry. Ping should fail.
- sw_lag1_10.del_br_fdb(str(m1_lag1_10.get_hwaddr()), self=True)
+ sw_lag1_10.del_br_fdb(str(m1_lag1_10.get_hwaddr()), master=True)
tl.ping_simple(m1_lag1_10, m2_lag1_20, fail_expected=True)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "hardware", False)
+ tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, True, False, False)
- # Enable learning_sync and make sure both FDBs are populated.
- sw_lag1_10.set_br_learning(on=True, self=True)
- sw_lag1_10.set_br_flooding(on=True, self=True)
- sw_lag1_10.set_br_learning_sync(on=True, self=True)
+ # Enable learning and flooding and make sure ping works again.
+ sw_lag1_10.set_br_learning(on=True, master=True)
+ sw_lag1_10.set_br_flooding(on=True, master=True)
tl.ping_simple(m1_lag1_10, m2_lag1_20)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "software")
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "hardware")
- sw_lag1_10.set_br_learning(on=False, self=True)
+ tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, True, True)
+ sw_lag1_10.set_br_learning(on=False, master=True)
sleep(30)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "hardware", False)
+ tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, True, True, False)
- # Disable learning_sync and make sure only hardware FDB is populated.
- sw_lag1_10.set_br_learning(on=True, self=True)
- sw_lag1_10.set_br_learning_sync(on=False, self=True)
+ # Insert a static FDB entry. Ping should work.
+ sw_lag1_10.add_br_fdb(str(m1_lag1_10.get_hwaddr()), master=True)
tl.ping_simple(m1_lag1_10, m2_lag1_20)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "hardware")
-
- # Remove port from bridge and add it back. Disable flooding and learning
- # and make sure ping doesn't work. Note that port must be removed from
- # bridge when the FDB entry exists only in the hardware table. Otherwise,
- # bridge code will flush it himself, instead of driver.
- sw_br.slave_del(sw_lag1_10.get_id())
- sw_br.slave_add(sw_lag1_10.get_id()) # Enables learning sync by default.
- sw_lag1_10.set_br_learning(on=False, self=True)
- sw_lag1_10.set_br_flooding(on=False, self=True)
- tl.ping_simple(m1_lag1_10, m2_lag1_20, fail_expected=True)
-
- # Enable learning and make sure ping works again.
- sw_lag1_10.set_br_learning(on=True, self=True)
- tl.ping_simple(m1_lag1_10, m2_lag1_20)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "software")
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "hardware")
- sw_lag1_10.set_br_learning(on=False, self=True)
-
- sleep(30)
-
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "hardware", False)
-
- # Insert a static FDB entry and disable learning sync. Ping should work.
- sw_lag1_10.add_br_fdb(str(m1_lag1_10.get_hwaddr()), self=True)
- sw_lag1_10.set_br_learning_sync(on=False, self=True)
- tl.ping_simple(m1_lag1_10, m2_lag1_20)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "hardware")
+ tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, True, False)
sleep(30)
# Make sure static entry is not aged out.
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "software", False)
- tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, "hardware")
-
- # Remove port from bridge and add it back. Disable flooding and learning
- # and make sure ping doesn't work. Note that port must be removed from
- # bridge when the FDB entry exists only in the hardware table. Otherwise,
- # bridge code will flush it himself, instead of driver. Unlike the
- # previous case, here we check if the driver correctly removes the static
- # entry.
+ tl.check_fdb(sw_lag1_10, m1_lag1_10.get_hwaddr(), 0, True, False)
+
+ # Remove port from bridge and add it back. The static entry added
+ # before should be flushed. Disable flooding and learning and make
+ # sure ping doesn't work.
sw_br.slave_del(sw_lag1_10.get_id())
sw_br.slave_add(sw_lag1_10.get_id())
- sw_lag1_10.set_br_learning(on=False, self=True)
- sw_lag1_10.set_br_flooding(on=False, self=True)
+ sw_lag1_10.set_br_learning(on=False, master=True)
+ sw_lag1_10.set_br_flooding(on=False, master=True)
tl.ping_simple(m1_lag1_10, m2_lag1_20, fail_expected=True)
do_task(ctl, [ctl.get_host("machine1"),
--
2.4.11