From 97b32c6dc520634ba0a30ed1674fccd0e1a6b3ac Mon Sep 17 00:00:00 2001 From: vishnushetty <63081285+vishnushetty@users.noreply.github.com> Date: Fri, 18 Dec 2020 14:04:58 -0800 Subject: [PATCH] [dpb]: make sure port is in admin down state before remove port. (#1513) Bring down the port before remove. During DPB SET request to bring down the port may get replaced DEL. Make sure to bring down the port before remove. --- orchagent/portsorch.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/orchagent/portsorch.cpp b/orchagent/portsorch.cpp index 966d61cbbc53..f806cad95fe2 100755 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -1819,6 +1819,18 @@ sai_status_t PortsOrch::removePort(sai_object_id_t port_id) { SWSS_LOG_ENTER(); + Port port; + + /* + * Make sure to bring down admin state. + * SET would have replaced with DEL + */ + if (getPort(port_id, port)) + { + setPortAdminStatus(port, false); + } + /* else : port is in default state or not yet created */ + sai_status_t status = sai_port_api->remove_port(port_id); if (status != SAI_STATUS_SUCCESS) {