diff --git a/orchagent/intfsorch.cpp b/orchagent/intfsorch.cpp index 87c2206e90..2de378a448 100644 --- a/orchagent/intfsorch.cpp +++ b/orchagent/intfsorch.cpp @@ -1316,8 +1316,21 @@ bool IntfsOrch::removeRouterIntfs(Port &port) return false; } - const auto id = sai_serialize_object_id(port.m_rif_id); - removeRifFromFlexCounter(id, port.m_alias); + bool port_found = false; + for (auto it = m_rifsToAdd.begin(); it != m_rifsToAdd.end(); ++it) + { + if (it->m_rif_id == port.m_rif_id) + { + m_rifsToAdd.erase(it); + port_found = true; + break; + } + } + if (!port_found) + { + const auto id = sai_serialize_object_id(port.m_rif_id); + removeRifFromFlexCounter(id, port.m_alias); + } sai_status_t status = sai_router_intfs_api->remove_router_interface(port.m_rif_id); if (status != SAI_STATUS_SUCCESS) @@ -1746,4 +1759,5 @@ void IntfsOrch::voqSyncIntfState(string &alias, bool isUp) m_tableVoqSystemInterfaceTable->hset(port_alias, "oper_status", isUp ? "up" : "down"); } -} \ No newline at end of file +} +