Skip to content

Commit

Permalink
T2-VOQ-VS: Fix iBGP bringup issue (sonic-net#3053)
Browse files Browse the repository at this point in the history
* Fix iBGP bringup issue T2-vswitch
* On T2-VOQ chassis Emulation with multi-asic linecards, iBGP sessions dont come up. Related Issue: sonic-net/sonic-buildimage#18129
  • Loading branch information
deepak-singhal0408 authored and cscarpitta committed Apr 5, 2024
1 parent c0fcbb9 commit 75b53fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 42 deletions.
37 changes: 4 additions & 33 deletions orchagent/neighorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down Expand Up @@ -1465,42 +1465,13 @@ void NeighOrch::doVoqSystemNeighTask(Consumer &consumer)
//kernel programming.
if(ibif.m_type != Port::VLAN)
{
original_mac_address = mac_address;
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
// <lower 5 bytes of mac same for all asics>:<6th byte = switch_id>

string platform = getenv("ASIC_VENDOR") ? getenv("ASIC_VENDOR") : "";

// For VS platform, use the original MAC address
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);
}
mac_address = original_mac_address;
}
}
vector<FieldValueTuple> fvVector;
Expand Down
14 changes: 5 additions & 9 deletions tests/test_virtual_chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import pytest
import buffer_model

DVS_ENV = ["ASIC_VENDOR=vs"]

class TestVirtualChassis(object):

def set_lag_id_boundaries(self, vct):
Expand Down Expand Up @@ -138,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.
Expand All @@ -159,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.
Expand Down Expand Up @@ -216,7 +216,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.
Expand Down Expand Up @@ -312,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

Expand Down Expand Up @@ -372,7 +371,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"
Expand Down Expand Up @@ -487,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.
Expand Down Expand Up @@ -624,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.
Expand Down Expand Up @@ -702,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.
Expand Down

0 comments on commit 75b53fe

Please sign in to comment.