Skip to content

Commit 750e064

Browse files
authored
[EVPN]Fixing race condition when EVPN NVO add comes late (sonic-net#2756)
* 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.
1 parent 6cbf7a0 commit 750e064

File tree

3 files changed

+91
-3
lines changed

3 files changed

+91
-3
lines changed

orchagent/vxlanorch.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -2353,7 +2353,7 @@ bool EvpnRemoteVnip2pOrch::addOperation(const Request& request)
23532353
{
23542354
SWSS_LOG_WARN("Remote VNI add: Source VTEP not found. remote=%s vid=%d",
23552355
remote_vtep.c_str(), vlan_id);
2356-
return true;
2356+
return false;
23572357
}
23582358

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

25282528
if (!gPortsOrch->getVlanByVlanId(vlan_id, vlanPort))
@@ -2602,7 +2602,7 @@ bool EvpnRemoteVnip2mpOrch::delOperation(const Request& request)
26022602
auto vtep_ptr = evpn_orch->getEVPNVtep();
26032603
if (!vtep_ptr)
26042604
{
2605-
SWSS_LOG_WARN("Remote VNI add: VTEP not found. remote=%s vid=%d",
2605+
SWSS_LOG_WARN("Remote VNI del: VTEP not found. remote=%s vid=%d",
26062606
end_point_ip.c_str(), vlan_id);
26072607
return true;
26082608
}

tests/test_evpn_tunnel.py

+45
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,51 @@ def test_delayed_vlan_vni_map(self, dvs, testlog):
213213
vxlan_obj.remove_vlan(dvs, "100")
214214
vxlan_obj.remove_vlan(dvs, "101")
215215

216+
def test_delayed_evpn_nvo(self, dvs, testlog):
217+
vxlan_obj = self.get_vxlan_obj()
218+
219+
tunnel_name = 'tunnel_2'
220+
map_name = 'map_1000_100'
221+
map_name_1 = 'map_1001_101'
222+
vlanlist = ['100']
223+
vnilist = ['1000']
224+
225+
vxlan_obj.fetch_exist_entries(dvs)
226+
vxlan_obj.create_vlan1(dvs,"Vlan100")
227+
vxlan_obj.create_vlan1(dvs,"Vlan101")
228+
229+
vxlan_obj.create_vxlan_tunnel(dvs, tunnel_name, '6.6.6.6')
230+
vxlan_obj.create_vxlan_tunnel_map(dvs, tunnel_name, map_name_1, '1001', 'Vlan101')
231+
vxlan_obj.create_vxlan_tunnel_map(dvs, tunnel_name, map_name, '1000', 'Vlan100')
232+
233+
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, tunnel_map_entry_count = 2)
234+
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)
235+
236+
237+
vxlan_obj.create_evpn_remote_vni(dvs, 'Vlan101', '7.7.7.7', '1001')
238+
vxlan_obj.check_vxlan_dip_tunnel_not_created(dvs, tunnel_name, '6.6.6.6', '7.7.7.7')
239+
vxlan_obj.create_evpn_nvo(dvs, 'nvo1', tunnel_name)
240+
241+
print("Testing VLAN 101 extension")
242+
vxlan_obj.check_vxlan_dip_tunnel(dvs, tunnel_name, '6.6.6.6', '7.7.7.7')
243+
vxlan_obj.check_vlan_extension(dvs, '101', '7.7.7.7')
244+
245+
print("Testing Vlan Extension removal")
246+
vxlan_obj.remove_evpn_remote_vni(dvs, 'Vlan101', '7.7.7.7')
247+
vxlan_obj.check_vlan_extension_delete(dvs, '101', '7.7.7.7')
248+
vxlan_obj.check_vxlan_dip_tunnel_delete(dvs, '7.7.7.7')
249+
250+
vxlan_obj.remove_vxlan_tunnel_map(dvs, tunnel_name, map_name, '1000', 'Vlan100')
251+
vxlan_obj.remove_vxlan_tunnel_map(dvs, tunnel_name, map_name_1, '1001', 'Vlan101')
252+
vxlan_obj.check_vxlan_tunnel_map_entry_delete(dvs, tunnel_name, vlanlist, vnilist)
253+
254+
print("Testing SIP Tunnel Deletion")
255+
vxlan_obj.remove_evpn_nvo(dvs, 'nvo1')
256+
vxlan_obj.remove_vxlan_tunnel(dvs, tunnel_name)
257+
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6')
258+
vxlan_obj.remove_vlan(dvs, "100")
259+
vxlan_obj.remove_vlan(dvs, "101")
260+
216261
def test_invalid_vlan_extension(self, dvs, testlog):
217262
vxlan_obj = self.get_vxlan_obj()
218263

tests/test_evpn_tunnel_p2mp.py

+43
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,49 @@ def test_delayed_vlan_vni_map(self, dvs, testlog):
172172
vxlan_obj.remove_vlan(dvs, "100")
173173
vxlan_obj.remove_vlan(dvs, "101")
174174

175+
def test_delayed_evpn_nvo(self, dvs, testlog):
176+
vxlan_obj = self.get_vxlan_obj()
177+
178+
tunnel_name = 'tunnel_2'
179+
map_name = 'map_1000_100'
180+
map_name_1 = 'map_1001_101'
181+
vlanlist = ['100']
182+
vnilist = ['1000']
183+
184+
vxlan_obj.fetch_exist_entries(dvs)
185+
vxlan_obj.create_vlan1(dvs,"Vlan100")
186+
vxlan_obj.create_vlan1(dvs,"Vlan101")
187+
188+
vxlan_obj.create_vxlan_tunnel(dvs, tunnel_name, '6.6.6.6')
189+
vxlan_obj.create_vxlan_tunnel_map(dvs, tunnel_name, map_name, '1000', 'Vlan100')
190+
vxlan_obj.create_vxlan_tunnel_map(dvs, tunnel_name, map_name_1, '1001', 'Vlan101')
191+
vxlan_obj.create_evpn_remote_vni(dvs, 'Vlan101', '7.7.7.7', '1001')
192+
193+
vxlan_obj.check_vxlan_sip_tunnel(dvs, tunnel_name, '6.6.6.6', vlanlist, vnilist, ignore_bp=False, tunnel_map_entry_count = 2)
194+
vxlan_obj.check_vxlan_tunnel_map_entry(dvs, tunnel_name, vlanlist, vnilist)
195+
196+
197+
vxlan_obj.check_vlan_extension_not_created_p2mp(dvs, '101', '6.6.6.6', '7.7.7.7')
198+
vxlan_obj.create_evpn_nvo(dvs, 'nvo1', tunnel_name)
199+
200+
print("Testing VLAN 101 extension")
201+
vxlan_obj.check_vlan_extension_p2mp(dvs, '101', '6.6.6.6', '7.7.7.7')
202+
203+
print("Testing Vlan Extension removal")
204+
vxlan_obj.remove_evpn_remote_vni(dvs, 'Vlan101', '7.7.7.7')
205+
vxlan_obj.check_vlan_extension_delete_p2mp(dvs, '101', '6.6.6.6', '7.7.7.7')
206+
207+
vxlan_obj.remove_vxlan_tunnel_map(dvs, tunnel_name, map_name, '1000', 'Vlan100')
208+
vxlan_obj.remove_vxlan_tunnel_map(dvs, tunnel_name, map_name_1, '1001', 'Vlan101')
209+
vxlan_obj.check_vxlan_tunnel_map_entry_delete(dvs, tunnel_name, vlanlist, vnilist)
210+
211+
print("Testing SIP Tunnel Deletion")
212+
vxlan_obj.remove_evpn_nvo(dvs, 'nvo1')
213+
vxlan_obj.remove_vxlan_tunnel(dvs, tunnel_name)
214+
vxlan_obj.check_vxlan_sip_tunnel_delete(dvs, tunnel_name, '6.6.6.6', ignore_bp=False)
215+
vxlan_obj.remove_vlan(dvs, "100")
216+
vxlan_obj.remove_vlan(dvs, "101")
217+
175218
def test_invalid_vlan_extension(self, dvs, testlog):
176219
vxlan_obj = self.get_vxlan_obj()
177220

0 commit comments

Comments
 (0)