Skip to content

Commit

Permalink
[vxlan]Fixing L2MC vlan member caching issue (sonic-net#2378)
Browse files Browse the repository at this point in the history
* [vxlan]Fixing L2MC vlan member caching issue
  • Loading branch information
dgsudharsan authored Jul 15, 2022
1 parent 24a0797 commit 9d3a5c5
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 12 deletions.
83 changes: 71 additions & 12 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4832,7 +4832,11 @@ bool PortsOrch::addVlanFloodGroups(Port &vlan, Port &port, string end_point_ip)
{
SWSS_LOG_ERROR("Failed to set l2mc flood type combined "
" to vlan %hu for unknown unicast flooding", vlan.m_vlan_info.vlan_id);
return false;
task_process_status handle_status = handleSaiSetStatus(SAI_API_VLAN, status);
if (handle_status != task_success)
{
return parseHandleSaiStatusFailure(handle_status);
}
}
vlan.m_vlan_info.uuc_flood_type = SAI_VLAN_FLOOD_CONTROL_TYPE_COMBINED;
}
Expand All @@ -4847,7 +4851,12 @@ bool PortsOrch::addVlanFloodGroups(Port &vlan, Port &port, string end_point_ip)
{
SWSS_LOG_ERROR("Failed to set l2mc flood type combined "
" to vlan %hu for broadcast flooding", vlan.m_vlan_info.vlan_id);
return false;
task_process_status handle_status = handleSaiSetStatus(SAI_API_VLAN, status);
if (handle_status != task_success)
{
m_portList[vlan.m_alias] = vlan;
return parseHandleSaiStatusFailure(handle_status);
}
}
vlan.m_vlan_info.bc_flood_type = SAI_VLAN_FLOOD_CONTROL_TYPE_COMBINED;
}
Expand All @@ -4858,7 +4867,12 @@ bool PortsOrch::addVlanFloodGroups(Port &vlan, Port &port, string end_point_ip)
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to create l2mc flood group");
return false;
task_process_status handle_status = handleSaiCreateStatus(SAI_API_L2MC_GROUP, status);
if (handle_status != task_success)
{
m_portList[vlan.m_alias] = vlan;
return parseHandleSaiStatusFailure(handle_status);
}
}

if (vlan.m_vlan_info.uuc_flood_type == SAI_VLAN_FLOOD_CONTROL_TYPE_COMBINED)
Expand All @@ -4872,7 +4886,12 @@ bool PortsOrch::addVlanFloodGroups(Port &vlan, Port &port, string end_point_ip)
SWSS_LOG_ERROR("Failed to set l2mc group %" PRIx64
" to vlan %hu for unknown unicast flooding",
l2mc_group_id, vlan.m_vlan_info.vlan_id);
return false;
task_process_status handle_status = handleSaiSetStatus(SAI_API_VLAN, status);
if (handle_status != task_success)
{
m_portList[vlan.m_alias] = vlan;
return parseHandleSaiStatusFailure(handle_status);
}
}
}
if (vlan.m_vlan_info.bc_flood_type == SAI_VLAN_FLOOD_CONTROL_TYPE_COMBINED)
Expand All @@ -4886,7 +4905,12 @@ bool PortsOrch::addVlanFloodGroups(Port &vlan, Port &port, string end_point_ip)
SWSS_LOG_ERROR("Failed to set l2mc group %" PRIx64
" to vlan %hu for broadcast flooding",
l2mc_group_id, vlan.m_vlan_info.vlan_id);
return false;
task_process_status handle_status = handleSaiSetStatus(SAI_API_VLAN, status);
if (handle_status != task_success)
{
m_portList[vlan.m_alias] = vlan;
return parseHandleSaiStatusFailure(handle_status);
}
}
}
vlan.m_vlan_info.l2mc_group_id = l2mc_group_id;
Expand Down Expand Up @@ -4926,7 +4950,12 @@ bool PortsOrch::addVlanFloodGroups(Port &vlan, Port &port, string end_point_ip)
{
SWSS_LOG_ERROR("Failed to create l2mc group member for adding tunnel %s to vlan %hu",
end_point_ip.c_str(), vlan.m_vlan_info.vlan_id);
return false;
task_process_status handle_status = handleSaiCreateStatus(SAI_API_L2MC_GROUP, status);
if (handle_status != task_success)
{
m_portList[vlan.m_alias] = vlan;
return parseHandleSaiStatusFailure(handle_status);
}
}
vlan.m_vlan_info.l2mc_members[end_point_ip] = l2mc_group_member;
m_portList[vlan.m_alias] = vlan;
Expand All @@ -4953,7 +4982,11 @@ bool PortsOrch::removeVlanEndPointIp(Port &vlan, Port &port, string end_point_ip
{
SWSS_LOG_ERROR("Failed to remove end point ip %s from vlan %hu",
end_point_ip.c_str(), vlan.m_vlan_info.vlan_id);
return false;
task_process_status handle_status = handleSaiRemoveStatus(SAI_API_L2MC_GROUP, status);
if (handle_status != task_success)
{
return parseHandleSaiStatusFailure(handle_status);
}
}
decreaseBridgePortRefCount(port);
vlan.m_vlan_info.l2mc_members.erase(end_point_ip);
Expand All @@ -4973,7 +5006,12 @@ bool PortsOrch::removeVlanEndPointIp(Port &vlan, Port &port, string end_point_ip
SWSS_LOG_ERROR("Failed to set null l2mc group "
" to vlan %hu for unknown unicast flooding",
vlan.m_vlan_info.vlan_id);
return false;
task_process_status handle_status = handleSaiSetStatus(SAI_API_VLAN, status);
if (handle_status != task_success)
{
m_portList[vlan.m_alias] = vlan;
return parseHandleSaiStatusFailure(handle_status);
}
}
attr.id = SAI_VLAN_ATTR_UNKNOWN_UNICAST_FLOOD_CONTROL_TYPE;
attr.value.s32 = SAI_VLAN_FLOOD_CONTROL_TYPE_ALL;
Expand All @@ -4983,7 +5021,12 @@ bool PortsOrch::removeVlanEndPointIp(Port &vlan, Port &port, string end_point_ip
SWSS_LOG_ERROR("Failed to set flood control type all"
" to vlan %hu for unknown unicast flooding",
vlan.m_vlan_info.vlan_id);
return false;
task_process_status handle_status = handleSaiSetStatus(SAI_API_VLAN, status);
if (handle_status != task_success)
{
m_portList[vlan.m_alias] = vlan;
return parseHandleSaiStatusFailure(handle_status);
}
}
vlan.m_vlan_info.uuc_flood_type = SAI_VLAN_FLOOD_CONTROL_TYPE_ALL;
}
Expand All @@ -4998,7 +5041,12 @@ bool PortsOrch::removeVlanEndPointIp(Port &vlan, Port &port, string end_point_ip
SWSS_LOG_ERROR("Failed to set null l2mc group "
" to vlan %hu for broadcast flooding",
vlan.m_vlan_info.vlan_id);
return false;
task_process_status handle_status = handleSaiSetStatus(SAI_API_VLAN, status);
if (handle_status != task_success)
{
m_portList[vlan.m_alias] = vlan;
return parseHandleSaiStatusFailure(handle_status);
}
}
attr.id = SAI_VLAN_ATTR_BROADCAST_FLOOD_CONTROL_TYPE;
attr.value.s32 = SAI_VLAN_FLOOD_CONTROL_TYPE_ALL;
Expand All @@ -5008,18 +5056,29 @@ bool PortsOrch::removeVlanEndPointIp(Port &vlan, Port &port, string end_point_ip
SWSS_LOG_ERROR("Failed to set flood control type all"
" to vlan %hu for broadcast flooding",
vlan.m_vlan_info.vlan_id);
return false;
task_process_status handle_status = handleSaiSetStatus(SAI_API_VLAN, status);
if (handle_status != task_success)
{
m_portList[vlan.m_alias] = vlan;
return parseHandleSaiStatusFailure(handle_status);
}
}
vlan.m_vlan_info.bc_flood_type = SAI_VLAN_FLOOD_CONTROL_TYPE_ALL;
}
status = sai_l2mc_group_api->remove_l2mc_group(vlan.m_vlan_info.l2mc_group_id);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to remove l2mc group %" PRIx64, l2mc_group_id);
return false;
task_process_status handle_status = handleSaiRemoveStatus(SAI_API_L2MC_GROUP, status);
if (handle_status != task_success)
{
m_portList[vlan.m_alias] = vlan;
return parseHandleSaiStatusFailure(handle_status);
}
}
vlan.m_vlan_info.l2mc_group_id = SAI_NULL_OBJECT_ID;
}
m_portList[vlan.m_alias] = vlan;
return true;
}

Expand Down
11 changes: 11 additions & 0 deletions tests/test_evpn_tunnel_p2mp.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ def test_vlan_extension(self, dvs, testlog):
vxlan_obj.remove_evpn_remote_vni(dvs, 'Vlan100', '8.8.8.8')
vxlan_obj.check_vlan_extension_delete_p2mp(dvs, '100', '6.6.6.6', '8.8.8.8')

print("Testing remote endpoint again to 8.8.8.8")
vxlan_obj.create_evpn_remote_vni(dvs, 'Vlan100', '8.8.8.8', '1000')
print("Testing remote endpoint creation to 8.8.8.8")

print("Testing VLAN 100 extension to 8.8.8.8")
vxlan_obj.check_vlan_extension_p2mp(dvs, '100', '6.6.6.6', '8.8.8.8')

print("Testing Last Vlan removal and remote endpoint delete for 8.8.8.8")
vxlan_obj.remove_evpn_remote_vni(dvs, 'Vlan100', '8.8.8.8')
vxlan_obj.check_vlan_extension_delete_p2mp(dvs, '100', '6.6.6.6', '8.8.8.8')

vxlan_obj.remove_vxlan_tunnel_map(dvs, tunnel_name, map_name, '1000', 'Vlan100')
vxlan_obj.remove_vxlan_tunnel_map(dvs, tunnel_name, map_name_1, '1001', 'Vlan101')
vxlan_obj.remove_vxlan_tunnel_map(dvs, tunnel_name, map_name_2, '1002', 'Vlan102')
Expand Down

0 comments on commit 9d3a5c5

Please sign in to comment.