From 762f972f89ef0beafc292f93590203c60df4cce6 Mon Sep 17 00:00:00 2001 From: deepak-singhal0408 Date: Sun, 18 Feb 2024 07:12:45 +0000 Subject: [PATCH 1/5] Fix iBGP bringup issue T2-vswitch --- orchagent/neighorch.cpp | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/orchagent/neighorch.cpp b/orchagent/neighorch.cpp index efbe7ff481..e270d6362a 100644 --- a/orchagent/neighorch.cpp +++ b/orchagent/neighorch.cpp @@ -1444,42 +1444,10 @@ void NeighOrch::doVoqSystemNeighTask(Consumer &consumer) //kernel programming. if(ibif.m_type != Port::VLAN) { - mac_address = gMacAddress; - - // For VS platforms, the mac of the static neigh should not be same as asic's own mac. - // This is because host originated packets will have same mac for both src and dst which - // will result in host NOT sending packet out. To address this problem which is specific - // to port type inband interfaces, set the mac to the neighbor's owner asic's mac. Since - // the owner asic's mac is not readily avaiable here, the owner asic mac is derived from - // the switch id and lower 5 bytes of asic mac which is assumed to be same for all asics - // in the VS system. - // Therefore to make VOQ chassis systems work in VS platform based setups like the setups - // using KVMs, it is required that all asics have same base mac in the format given below - // :<6th byte = switch_id> - string platform = getenv("ASIC_VENDOR") ? getenv("ASIC_VENDOR") : ""; - - if (platform == VS_PLATFORM_SUBSTRING) - { - int8_t sw_id = -1; - uint8_t egress_asic_mac[ETHER_ADDR_LEN]; - - gMacAddress.getMac(egress_asic_mac); - - if (p.m_type == Port::LAG) - { - sw_id = (int8_t) p.m_system_lag_info.switch_id; - } - else if (p.m_type == Port::PHY || p.m_type == Port::SYSTEM) - { - sw_id = (int8_t) p.m_system_port_info.switch_id; - } - - if(sw_id != -1) - { - egress_asic_mac[5] = sw_id; - mac_address = MacAddress(egress_asic_mac); - } + // For VS platform, dont overwrite the MAC address + if (platform != VS_PLATFORM_SUBSTRING) { + mac_address = gMacAddress; } } vector fvVector; From fca5499612d0a0ad291d2b4d74a54fbfb21780ae Mon Sep 17 00:00:00 2001 From: deepak-singhal0408 Date: Wed, 20 Mar 2024 07:07:02 +0000 Subject: [PATCH 2/5] Moved the opening brance to next line --- orchagent/neighorch.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/orchagent/neighorch.cpp b/orchagent/neighorch.cpp index 7fb03c4157..57f70bbc0a 100644 --- a/orchagent/neighorch.cpp +++ b/orchagent/neighorch.cpp @@ -1467,7 +1467,8 @@ void NeighOrch::doVoqSystemNeighTask(Consumer &consumer) { string platform = getenv("ASIC_VENDOR") ? getenv("ASIC_VENDOR") : ""; // For VS platform, dont overwrite the MAC address - if (platform != VS_PLATFORM_SUBSTRING) { + if (platform != VS_PLATFORM_SUBSTRING) + { mac_address = gMacAddress; } } From f9a4d5864995564d189e1505ef0a78098132be22 Mon Sep 17 00:00:00 2001 From: deepak-singhal0408 Date: Wed, 20 Mar 2024 16:47:29 +0000 Subject: [PATCH 3/5] Modified the logic slightly to have code coverage --- orchagent/neighorch.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/orchagent/neighorch.cpp b/orchagent/neighorch.cpp index 57f70bbc0a..a2bdebbc62 100644 --- a/orchagent/neighorch.cpp +++ b/orchagent/neighorch.cpp @@ -1385,7 +1385,7 @@ void NeighOrch::doVoqSystemNeighTask(Consumer &consumer) continue; } - MacAddress mac_address; + MacAddress mac_address, original_mac_address; uint32_t encap_index = 0; for (auto i = kfvFieldsValues(t).begin(); i != kfvFieldsValues(t).end(); i++) @@ -1465,11 +1465,13 @@ void NeighOrch::doVoqSystemNeighTask(Consumer &consumer) //kernel programming. if(ibif.m_type != Port::VLAN) { + original_mac_address = mac_address; + mac_address = gMacAddress; string platform = getenv("ASIC_VENDOR") ? getenv("ASIC_VENDOR") : ""; - // For VS platform, dont overwrite the MAC address - if (platform != VS_PLATFORM_SUBSTRING) + // For VS platform, use the original MAC address + if (platform == VS_PLATFORM_SUBSTRING) { - mac_address = gMacAddress; + mac_address = original_mac_address; } } vector fvVector; From 6558e69ac2f6fa31db52cf10e252003f49dcd47b Mon Sep 17 00:00:00 2001 From: deepak-singhal0408 Date: Wed, 20 Mar 2024 23:33:37 +0000 Subject: [PATCH 4/5] Enabled and Modified the test_chassis_system_neigh testcase --- tests/test_virtual_chassis.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_virtual_chassis.py b/tests/test_virtual_chassis.py index c92ed88c40..3111e8c475 100644 --- a/tests/test_virtual_chassis.py +++ b/tests/test_virtual_chassis.py @@ -5,6 +5,8 @@ import pytest import buffer_model +DVS_ENV = ["ASIC_VENDOR=vs"] + class TestVirtualChassis(object): def set_lag_id_boundaries(self, vct): @@ -216,7 +218,6 @@ def test_chassis_system_interface(self, vct): # Remote system ports's switch id should not match local switch id assert spcfginfo["attached_switch_id"] != lc_switch_id, "RIF system port with wrong switch_id" - @pytest.mark.skip(reason="Failing. Under investigation") def test_chassis_system_neigh(self, vct): """Test neigh record create/delete and syncing to chassis app db. @@ -372,7 +373,7 @@ def chassis_system_neigh_create(): # Check for kernel entries _, output = dvs.runcmd("ip neigh show") - assert f"{test_neigh_ip} dev {inband_port}" in output, "Kernel neigh not found for remote neighbor" + assert f"{test_neigh_ip} dev {inband_port} lladdr {mac_address}" in output, "Kernel neigh not found for remote neighbor" _, output = dvs.runcmd("ip route show") assert f"{test_neigh_ip} dev {inband_port} scope link" in output, "Kernel route not found for remote neighbor" From be9436dfa323dc59978e070d7e3c88cb97c360fd Mon Sep 17 00:00:00 2001 From: deepak-singhal0408 Date: Thu, 21 Mar 2024 18:48:23 +0000 Subject: [PATCH 5/5] Enabled VS-Chassis test cases. Also Fixed the sysNeigh key expectation in chassisdb based on newPortName change --- tests/test_virtual_chassis.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/test_virtual_chassis.py b/tests/test_virtual_chassis.py index 3111e8c475..5401f6870f 100644 --- a/tests/test_virtual_chassis.py +++ b/tests/test_virtual_chassis.py @@ -140,7 +140,6 @@ def test_voq_switch(self, vct): spcfg = ast.literal_eval(value) assert spcfg['count'] == sp_count, "Number of systems ports configured is invalid" - @pytest.mark.skip(reason="Failing. Under investigation") def test_chassis_app_db_sync(self, vct): """Test chassis app db syncing. @@ -161,7 +160,6 @@ def test_chassis_app_db_sync(self, vct): keys = chassis_app_db.get_keys("SYSTEM_INTERFACE") assert len(keys), "No chassis app db syncing is done" - @pytest.mark.skip(reason="Failing. Under investigation") def test_chassis_system_interface(self, vct): """Test RIF record creation in ASIC_DB for remote interfaces. @@ -313,8 +311,8 @@ def chassis_system_neigh_create(): test_sysneigh = "" for sysnk in sysneighkeys: sysnk_tok = sysnk.split("|") - assert len(sysnk_tok) == 3, "Invalid system neigh key in chassis app db" - if sysnk_tok[2] == test_neigh_ip: + assert len(sysnk_tok) == 4, "Invalid system neigh key in chassis app db" + if sysnk_tok[3] == test_neigh_ip: test_sysneigh = sysnk break @@ -488,7 +486,6 @@ def chassis_system_neigh_create(): # Cleanup inband if configuration self.del_inbandif_port(vct, inband_port) - @pytest.mark.skip(reason="Failing. Under investigation") def test_chassis_system_lag(self, vct): """Test PortChannel in VOQ based chassis systems. @@ -625,7 +622,6 @@ def test_chassis_system_lag(self, vct): break - @pytest.mark.skip(reason="Failing. Under investigation") def test_chassis_system_lag_id_allocator_table_full(self, vct): """Test lag id allocator table full. @@ -703,7 +699,6 @@ def test_chassis_system_lag_id_allocator_table_full(self, vct): break - @pytest.mark.skip(reason="Failing. Under investigation") def test_chassis_system_lag_id_allocator_del_id(self, vct): """Test lag id allocator's release id and re-use id processing.