Skip to content

Commit

Permalink
[EVPN]Fixing race condition when EVPN NVO add comes late (sonic-net#2756
Browse files Browse the repository at this point in the history
)

* Sometime during config reload, EVPN NVO table arrives later than remote VNI table entries. In such scenarios, remote vni entries are ignored and this leads to traffic loss. Added fix to retry instead of ignoring.
  • Loading branch information
dgsudharsan authored May 4, 2023
1 parent 6cbf7a0 commit 750e064
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 3 deletions.
6 changes: 3 additions & 3 deletions orchagent/vxlanorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2353,7 +2353,7 @@ bool EvpnRemoteVnip2pOrch::addOperation(const Request& request)
{
SWSS_LOG_WARN("Remote VNI add: Source VTEP not found. remote=%s vid=%d",
remote_vtep.c_str(), vlan_id);
return true;
return false;
}

VxlanTunnelOrch* tunnel_orch = gDirectory.get<VxlanTunnelOrch*>();
Expand Down Expand Up @@ -2522,7 +2522,7 @@ bool EvpnRemoteVnip2mpOrch::addOperation(const Request& request)
{
SWSS_LOG_WARN("Remote VNI add: Source VTEP not found. remote=%s vid=%d",
end_point_ip.c_str(),vlan_id);
return true;
return false;
}

if (!gPortsOrch->getVlanByVlanId(vlan_id, vlanPort))
Expand Down Expand Up @@ -2602,7 +2602,7 @@ bool EvpnRemoteVnip2mpOrch::delOperation(const Request& request)
auto vtep_ptr = evpn_orch->getEVPNVtep();
if (!vtep_ptr)
{
SWSS_LOG_WARN("Remote VNI add: VTEP not found. remote=%s vid=%d",
SWSS_LOG_WARN("Remote VNI del: VTEP not found. remote=%s vid=%d",
end_point_ip.c_str(), vlan_id);
return true;
}
Expand Down
45 changes: 45 additions & 0 deletions tests/test_evpn_tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,51 @@ def test_delayed_vlan_vni_map(self, dvs, testlog):
vxlan_obj.remove_vlan(dvs, "100")
vxlan_obj.remove_vlan(dvs, "101")

def test_delayed_evpn_nvo(self, dvs, testlog):
vxlan_obj = self.get_vxlan_obj()

tunnel_name = 'tunnel_2'
map_name = 'map_1000_100'
map_name_1 = 'map_1001_101'
vlanlist = ['100']
vnilist = ['1000']

vxlan_obj.fetch_exist_entries(dvs)
vxlan_obj.create_vlan1(dvs,"Vlan100")
vxlan_obj.create_vlan1(dvs,"Vlan101")

vxlan_obj.create_vxlan_tunnel(dvs, tunnel_name, '6.6.6.6')
vxlan_obj.create_vxlan_tunnel_map(dvs, tunnel_name, map_name_1, '1001', 'Vlan101')
vxlan_obj.create_vxlan_tunnel_map(dvs, tunnel_name, map_name, '1000', 'Vlan100')

vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, tunnel_map_entry_count = 2)
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)


vxlan_obj.create_evpn_remote_vni(dvs, 'Vlan101', '7.7.7.7', '1001')
vxlan_obj.check_vxlan_dip_tunnel_not_created(dvs, tunnel_name, '6.6.6.6', '7.7.7.7')
vxlan_obj.create_evpn_nvo(dvs, 'nvo1', tunnel_name)

print("Testing VLAN 101 extension")
vxlan_obj.check_vxlan_dip_tunnel(dvs, tunnel_name, '6.6.6.6', '7.7.7.7')
vxlan_obj.check_vlan_extension(dvs, '101', '7.7.7.7')

print("Testing Vlan Extension removal")
vxlan_obj.remove_evpn_remote_vni(dvs, 'Vlan101', '7.7.7.7')
vxlan_obj.check_vlan_extension_delete(dvs, '101', '7.7.7.7')
vxlan_obj.check_vxlan_dip_tunnel_delete(dvs, '7.7.7.7')

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.check_vxlan_tunnel_map_entry_delete(dvs, tunnel_name, vlanlist, vnilist)

print("Testing SIP Tunnel Deletion")
vxlan_obj.remove_evpn_nvo(dvs, 'nvo1')
vxlan_obj.remove_vxlan_tunnel(dvs, tunnel_name)
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6')
vxlan_obj.remove_vlan(dvs, "100")
vxlan_obj.remove_vlan(dvs, "101")

def test_invalid_vlan_extension(self, dvs, testlog):
vxlan_obj = self.get_vxlan_obj()

Expand Down
43 changes: 43 additions & 0 deletions tests/test_evpn_tunnel_p2mp.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,49 @@ def test_delayed_vlan_vni_map(self, dvs, testlog):
vxlan_obj.remove_vlan(dvs, "100")
vxlan_obj.remove_vlan(dvs, "101")

def test_delayed_evpn_nvo(self, dvs, testlog):
vxlan_obj = self.get_vxlan_obj()

tunnel_name = 'tunnel_2'
map_name = 'map_1000_100'
map_name_1 = 'map_1001_101'
vlanlist = ['100']
vnilist = ['1000']

vxlan_obj.fetch_exist_entries(dvs)
vxlan_obj.create_vlan1(dvs,"Vlan100")
vxlan_obj.create_vlan1(dvs,"Vlan101")

vxlan_obj.create_vxlan_tunnel(dvs, tunnel_name, '6.6.6.6')
vxlan_obj.create_vxlan_tunnel_map(dvs, tunnel_name, map_name, '1000', 'Vlan100')
vxlan_obj.create_vxlan_tunnel_map(dvs, tunnel_name, map_name_1, '1001', 'Vlan101')
vxlan_obj.create_evpn_remote_vni(dvs, 'Vlan101', '7.7.7.7', '1001')

vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, ignore_bp=False, tunnel_map_entry_count = 2)
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)


vxlan_obj.check_vlan_extension_not_created_p2mp(dvs, '101', '6.6.6.6', '7.7.7.7')
vxlan_obj.create_evpn_nvo(dvs, 'nvo1', tunnel_name)

print("Testing VLAN 101 extension")
vxlan_obj.check_vlan_extension_p2mp(dvs, '101', '6.6.6.6', '7.7.7.7')

print("Testing Vlan Extension removal")
vxlan_obj.remove_evpn_remote_vni(dvs, 'Vlan101', '7.7.7.7')
vxlan_obj.check_vlan_extension_delete_p2mp(dvs, '101', '6.6.6.6', '7.7.7.7')

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.check_vxlan_tunnel_map_entry_delete(dvs, tunnel_name, vlanlist, vnilist)

print("Testing SIP Tunnel Deletion")
vxlan_obj.remove_evpn_nvo(dvs, 'nvo1')
vxlan_obj.remove_vxlan_tunnel(dvs, tunnel_name)
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6', ignore_bp=False)
vxlan_obj.remove_vlan(dvs, "100")
vxlan_obj.remove_vlan(dvs, "101")

def test_invalid_vlan_extension(self, dvs, testlog):
vxlan_obj = self.get_vxlan_obj()

Expand Down

0 comments on commit 750e064

Please sign in to comment.