Adopt the FDB test to the following changes: 1. Removal of the support for SELF. 2. Adding of the extern_learned FDB attribute.
Signed-off-by: Arkadi Sharshevsky arkadis@mellanox.com --- Arkadi Sharshevsky (2): BridgeTool: Update FDB parsing for new externally learned attribute recipes: switchdev: Change FDB check routine and bridge tests
lnst/Slave/BridgeTool.py | 4 +- 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 +++++++--------------- 7 files changed, 139 insertions(+), 302 deletions(-)
Add FDB parsing to include externally learned attribute.
Signed-off-by: Arkadi Sharshevsky arkadis@mellanox.com --- lnst/Slave/BridgeTool.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lnst/Slave/BridgeTool.py b/lnst/Slave/BridgeTool.py index 5e8f497..d483b75 100644 --- a/lnst/Slave/BridgeTool.py +++ b/lnst/Slave/BridgeTool.py @@ -83,8 +83,10 @@ class BridgeTool: self = True if re.match(r'.*\s+self', line) else False master = True if re.match(r'.*\s+master', line) else False offload = True if re.match(r'.*\s+offload', line) else False + extern_learn = True if re.match(r'.*\s+extern_learn', line) else False br_fdb_info = {"hwaddr": hwaddr, "vlan_id": vlan_id, - "self": self, "master": master, "offload": offload} + "self": self, "master": master, "offload": offload, + "extern_learn": extern_learn} br_fdb_info_list.append(br_fdb_info) return br_fdb_info_list
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@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"),
On 06/01/2017 02:54 PM, Arkadi Sharshevsky wrote:
Adopt the FDB test to the following changes:
- Removal of the support for SELF.
- Adding of the extern_learned FDB attribute.
Signed-off-by: Arkadi Sharshevsky arkadis@mellanox.com
Arkadi Sharshevsky (2): BridgeTool: Update FDB parsing for new externally learned attribute recipes: switchdev: Change FDB check routine and bridge tests
lnst/Slave/BridgeTool.py | 4 +- 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 +++++++--------------- 7 files changed, 139 insertions(+), 302 deletions(-)
Please don't take it yet. The kernel side changes are not yet upstream. Thanks.
On Thu, Jun 01, 2017 at 04:06:54PM +0300, Arkadi Sharshevsky wrote:
On 06/01/2017 02:54 PM, Arkadi Sharshevsky wrote:
Adopt the FDB test to the following changes:
- Removal of the support for SELF.
- Adding of the extern_learned FDB attribute.
Signed-off-by: Arkadi Sharshevsky arkadis@mellanox.com
Arkadi Sharshevsky (2): BridgeTool: Update FDB parsing for new externally learned attribute recipes: switchdev: Change FDB check routine and bridge tests
lnst/Slave/BridgeTool.py | 4 +- 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 +++++++--------------- 7 files changed, 139 insertions(+), 302 deletions(-)
Please don't take it yet. The kernel side changes are not yet upstream. Thanks. _______________________________________________ LNST-developers mailing list -- lnst-developers@lists.fedorahosted.org To unsubscribe send an email to lnst-developers-leave@lists.fedorahosted.org
ok, unmarking it from my queue for now, send an email when it's ready
FYI, for the other patches that were not pushed yet, I should to get around to them today or tomorrow.
-Ondrej
lnst-developers@lists.fedorahosted.org