From 7ae60cab2c0d63f951376e8d08ba882b4a29f81c Mon Sep 17 00:00:00 2001 From: pettershao-ragilenetworks <81281940+pettershao-ragilenetworks@users.noreply.github.com> Date: Sat, 8 May 2021 16:29:58 +0800 Subject: [PATCH 1/8] change some code for trigger build --- fdbsyncd/fdbsync.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/fdbsyncd/fdbsync.cpp b/fdbsyncd/fdbsync.cpp index 30c9e2d54c..4e0da4feb1 100644 --- a/fdbsyncd/fdbsync.cpp +++ b/fdbsyncd/fdbsync.cpp @@ -33,6 +33,7 @@ FdbSync::FdbSync(RedisPipeline *pipelineAppDB, DBConnector *stateDb, DBConnector m_AppRestartAssist->registerAppTable(APP_VXLAN_FDB_TABLE_NAME, &m_fdbTable); m_AppRestartAssist->registerAppTable(APP_VXLAN_REMOTE_VNI_TABLE_NAME, &m_imetTable); } + SWSS_LOG_INFO("trigger gcov need code changing"); } FdbSync::~FdbSync() From e9d6e2b614c40c49bd1255249e7f67af8b8a6331 Mon Sep 17 00:00:00 2001 From: pettershao-ragilenetworks Date: Sun, 26 Sep 2021 10:13:19 +0800 Subject: [PATCH 2/8] [mlag] fix fdb not save to state db when type is dynamic_local Signed-off-by: pettershao-ragilenetworks --- orchagent/fdborch.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/orchagent/fdborch.cpp b/orchagent/fdborch.cpp index cad14ebc9d..934b193826 100644 --- a/orchagent/fdborch.cpp +++ b/orchagent/fdborch.cpp @@ -1392,8 +1392,7 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name, string key = "Vlan" + to_string(vlan.m_vlan_info.vlan_id) + ":" + entry.mac.to_string(); - if ((fdbData.origin != FDB_ORIGIN_MCLAG_ADVERTIZED) && - (fdbData.origin != FDB_ORIGIN_VXLAN_ADVERTIZED)) + if (dbData.origin != FDB_ORIGIN_VXLAN_ADVERTIZED) { /* State-DB is updated only for Local Mac addresses */ // Write to StateDb @@ -1403,7 +1402,11 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name, fvs.push_back(FieldValueTuple("type", "dynamic")); else fvs.push_back(FieldValueTuple("type", fdbData.type)); - m_fdbStateTable.set(key, fvs); + if(fdbData.origin != FDB_ORIGIN_MCLAG_ADVERTIZED || + fdbData.type == "dynamic_local") + { + m_fdbStateTable.set(key, fvs); + } } else if (macUpdate && (oldOrigin != FDB_ORIGIN_MCLAG_ADVERTIZED) && From 2a08640c76150366e368ac9b7c9adbbca725b9bc Mon Sep 17 00:00:00 2001 From: pettershao-ragilenetworks <81281940+pettershao-ragilenetworks@users.noreply.github.com> Date: Fri, 8 Oct 2021 09:12:28 +0800 Subject: [PATCH 3/8] Update fdborch.cpp --- orchagent/fdborch.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/orchagent/fdborch.cpp b/orchagent/fdborch.cpp index 934b193826..72172210fb 100644 --- a/orchagent/fdborch.cpp +++ b/orchagent/fdborch.cpp @@ -1402,8 +1402,7 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name, fvs.push_back(FieldValueTuple("type", "dynamic")); else fvs.push_back(FieldValueTuple("type", fdbData.type)); - if(fdbData.origin != FDB_ORIGIN_MCLAG_ADVERTIZED || - fdbData.type == "dynamic_local") + if (fdbData.origin != FDB_ORIGIN_MCLAG_ADVERTIZED || fdbData.type == "dynamic_local") { m_fdbStateTable.set(key, fvs); } From 61c152e1fc20e9f1a43f97a4ec5696e590890fa9 Mon Sep 17 00:00:00 2001 From: pettershao-ragilenetworks Date: Thu, 14 Oct 2021 10:59:50 +0800 Subject: [PATCH 4/8] add vstest Signed-off-by: pettershao-ragilenetworks --- tests/test_mclag_fdb.py | 65 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/tests/test_mclag_fdb.py b/tests/test_mclag_fdb.py index 5049859437..bcadb15d7a 100644 --- a/tests/test_mclag_fdb.py +++ b/tests/test_mclag_fdb.py @@ -483,7 +483,70 @@ def test_mclagFdb_static_mac_dynamic_move_reject(dvs, testlog): "MCLAG_FDB_TABLE", "Vlan200:3C:85:99:5E:00:01", ) -# Test-12 Verify cleanup of the basic config. +# Test-12 Verify remote peer interface shut down, local sync mac change from static to dynamic and save to state db. + +@pytest.mark.dev_sanity +def test_mclagFdb_remote_to_local(dvs, testlog): + dvs.setup_db() + # create FDB entry in APP_DB MCLAG_FDB_TABLE + create_entry_pst( + dvs.pdb, + "MCLAG_FDB_TABLE", "Vlan200:3C:85:99:5E:00:01", + [ + ("port", "PortChannel0005"), + ("type", "dynamic"), + ] + ) + + # check that the FDB entry was inserted into ASIC DB + assert how_many_entries_exist(dvs.adb, "ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY") == 1, "The MCLAG fdb entry not inserted to ASIC" + + ok, extra = dvs.is_fdb_entry_exists(dvs.adb, "ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY", + [("mac", "3C:85:99:5E:00:01"), ("bvid", str(dvs.getVlanOid("200")))], + [("SAI_FDB_ENTRY_ATTR_TYPE", "SAI_FDB_ENTRY_TYPE_STATIC"), + ("SAI_FDB_ENTRY_ATTR_ALLOW_MAC_MOVE", "true")] + ) + + assert ok, str(extra) + + # simulate remote peer link interface down, fdb convert to local dynamic + create_entry_pst( + dvs.pdb, + "MCLAG_FDB_TABLE", "Vlan200:3C:85:99:5E:00:01", + [ + ("port", "PortChannel0005"), + ("type", "local_dynamic"), + ] + ) + + time.sleep(2) + + # check that the FDB entry was inserted into ASIC DB + assert how_many_entries_exist(dvs.adb, "ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY") == 1, "The MCLAG fdb entry not inserted to ASIC" + + # local fdb has no ALLOW MOVE attribute + ok, extra = dvs.is_fdb_entry_exists(dvs.adb, "ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY", + [("mac", "3C:85:99:5E:00:01"), ("bvid", str(dvs.getVlanOid("200")))], + [("SAI_FDB_ENTRY_ATTR_TYPE", "SAI_FDB_ENTRY_TYPE_DYNAMIC")] + ) + + assert ok, str(extra) + + # check that the FDB entry was inserted into state DB, this will guarantee kernel fdb entry work fine + assert how_many_entries_exist(dvs.adb, "FDB_TABLE") == 1, "The local dynamic fdb not inserted in state db" + + # remove app db fdb entry, but this will not remove asic db + delete_entry_pst( + dvs.pdb, + "MCLAG_FDB_TABLE", "Vlan200:3C:85:99:5E:00:01", + ) + + #remove local dynamic asic fdb entry by remove vlan member indirectly + dvs.remove_vlan_member("200", "PortChannel0005") + dvs.create_vlan_member("200", "PortChannel0005") + + +# Test-13 Verify cleanup of the basic config. @pytest.mark.dev_sanity def test_mclagFdb_basic_config_del(dvs, testlog): From 614df1a1ae7fc783969cdc85454de8e5fef1671b Mon Sep 17 00:00:00 2001 From: pettershao-ragilenetworks Date: Thu, 14 Oct 2021 11:21:26 +0800 Subject: [PATCH 5/8] fix error Signed-off-by: pettershao-ragilenetworks --- orchagent/fdborch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orchagent/fdborch.cpp b/orchagent/fdborch.cpp index 72172210fb..2c462da0b2 100644 --- a/orchagent/fdborch.cpp +++ b/orchagent/fdborch.cpp @@ -1392,7 +1392,7 @@ bool FdbOrch::addFdbEntry(const FdbEntry& entry, const string& port_name, string key = "Vlan" + to_string(vlan.m_vlan_info.vlan_id) + ":" + entry.mac.to_string(); - if (dbData.origin != FDB_ORIGIN_VXLAN_ADVERTIZED) + if (fdbData.origin != FDB_ORIGIN_VXLAN_ADVERTIZED) { /* State-DB is updated only for Local Mac addresses */ // Write to StateDb From ea5bd1b52f5fa9746fcc8cf955eaeadd6690cc23 Mon Sep 17 00:00:00 2001 From: pettershao-ragilenetworks Date: Thu, 14 Oct 2021 15:01:09 +0800 Subject: [PATCH 6/8] fix spell error Signed-off-by: pettershao-ragilenetworks --- tests/test_mclag_fdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_mclag_fdb.py b/tests/test_mclag_fdb.py index bcadb15d7a..e168caa4e5 100644 --- a/tests/test_mclag_fdb.py +++ b/tests/test_mclag_fdb.py @@ -515,7 +515,7 @@ def test_mclagFdb_remote_to_local(dvs, testlog): "MCLAG_FDB_TABLE", "Vlan200:3C:85:99:5E:00:01", [ ("port", "PortChannel0005"), - ("type", "local_dynamic"), + ("type", "dynamic_local"), ] ) From e488c1cd3aa9d5d892e842df09320134365cdeac Mon Sep 17 00:00:00 2001 From: pettershao-ragilenetworks Date: Fri, 15 Oct 2021 09:27:20 +0800 Subject: [PATCH 7/8] fix vstest Signed-off-by: pettershao-ragilenetworks --- tests/test_mclag_fdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_mclag_fdb.py b/tests/test_mclag_fdb.py index e168caa4e5..a8f333bb6b 100644 --- a/tests/test_mclag_fdb.py +++ b/tests/test_mclag_fdb.py @@ -533,7 +533,7 @@ def test_mclagFdb_remote_to_local(dvs, testlog): assert ok, str(extra) # check that the FDB entry was inserted into state DB, this will guarantee kernel fdb entry work fine - assert how_many_entries_exist(dvs.adb, "FDB_TABLE") == 1, "The local dynamic fdb not inserted in state db" + assert how_many_entries_exist(dvs.sdb, "FDB_TABLE") == 1, "The local dynamic fdb not inserted in state db" # remove app db fdb entry, but this will not remove asic db delete_entry_pst( From b158eb4881b9c52c49b9d2e7f1adf9069d2147a9 Mon Sep 17 00:00:00 2001 From: pettershao-ragilenetworks <81281940+pettershao-ragilenetworks@users.noreply.github.com> Date: Wed, 9 Feb 2022 16:08:39 +0800 Subject: [PATCH 8/8] triggle rebuild --- tests/test_mclag_fdb.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_mclag_fdb.py b/tests/test_mclag_fdb.py index a8f333bb6b..043a74742b 100644 --- a/tests/test_mclag_fdb.py +++ b/tests/test_mclag_fdb.py @@ -545,7 +545,6 @@ def test_mclagFdb_remote_to_local(dvs, testlog): dvs.remove_vlan_member("200", "PortChannel0005") dvs.create_vlan_member("200", "PortChannel0005") - # Test-13 Verify cleanup of the basic config. @pytest.mark.dev_sanity