Skip to content

Commit

Permalink
Removing Vnet with scope default (#2239)
Browse files Browse the repository at this point in the history
* [Vnetorch] Delete vnet vrf object when scope is not default
  • Loading branch information
sumukhatv authored Apr 26, 2022
1 parent 7f53db7 commit 2ea8581
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 7 additions & 4 deletions orchagent/vnetorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,14 @@ VNetVrfObject::~VNetVrfObject()
set<sai_object_id_t> vr_ent = getVRids();
for (auto it : vr_ent)
{
sai_status_t status = sai_virtual_router_api->remove_virtual_router(it);
if (status != SAI_STATUS_SUCCESS)
if (it != gVirtualRouterId)
{
SWSS_LOG_ERROR("Failed to remove virtual router name: %s, rv:%d",
vnet_name_.c_str(), status);
sai_status_t status = sai_virtual_router_api->remove_virtual_router(it);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to remove virtual router name: %s, rv:%d",
vnet_name_.c_str(), status);
}
}
gFlowCounterRouteOrch->onRemoveVR(it);
}
Expand Down
3 changes: 3 additions & 0 deletions tests/test_vnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,9 @@ def test_vnet_orch_5(self, dvs, testlog):
vnet_obj.check_default_vnet_entry(dvs, 'Vnet_5')
vnet_obj.check_vxlan_tunnel_entry(dvs, tunnel_name, 'Vnet_5', '4789')

delete_vnet_entry(dvs, 'Vnet_5')
vnet_obj.check_default_vnet_entry(dvs, 'Vnet_5')

'''
Test 6 - Test VxLAN tunnel with multiple maps
'''
Expand Down

0 comments on commit 2ea8581

Please sign in to comment.