Skip to content

Commit 2ea8581

Browse files
authored
Removing Vnet with scope default (sonic-net#2239)
* [Vnetorch] Delete vnet vrf object when scope is not default
1 parent 7f53db7 commit 2ea8581

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

orchagent/vnetorch.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,14 @@ VNetVrfObject::~VNetVrfObject()
312312
set<sai_object_id_t> vr_ent = getVRids();
313313
for (auto it : vr_ent)
314314
{
315-
sai_status_t status = sai_virtual_router_api->remove_virtual_router(it);
316-
if (status != SAI_STATUS_SUCCESS)
315+
if (it != gVirtualRouterId)
317316
{
318-
SWSS_LOG_ERROR("Failed to remove virtual router name: %s, rv:%d",
319-
vnet_name_.c_str(), status);
317+
sai_status_t status = sai_virtual_router_api->remove_virtual_router(it);
318+
if (status != SAI_STATUS_SUCCESS)
319+
{
320+
SWSS_LOG_ERROR("Failed to remove virtual router name: %s, rv:%d",
321+
vnet_name_.c_str(), status);
322+
}
320323
}
321324
gFlowCounterRouteOrch->onRemoveVR(it);
322325
}

tests/test_vnet.py

+3
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,9 @@ def test_vnet_orch_5(self, dvs, testlog):
14391439
vnet_obj.check_default_vnet_entry(dvs, 'Vnet_5')
14401440
vnet_obj.check_vxlan_tunnel_entry(dvs, tunnel_name, 'Vnet_5', '4789')
14411441

1442+
delete_vnet_entry(dvs, 'Vnet_5')
1443+
vnet_obj.check_default_vnet_entry(dvs, 'Vnet_5')
1444+
14421445
'''
14431446
Test 6 - Test VxLAN tunnel with multiple maps
14441447
'''

0 commit comments

Comments
 (0)