From 5516ec4d0c9689edc9ad2d4f9ae9e812442064c6 Mon Sep 17 00:00:00 2001 From: Prince Sunny Date: Tue, 29 Oct 2019 15:59:09 -0700 Subject: [PATCH] Check RIF/Port exists only for add entries (#1110) --- orchagent/neighorch.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/orchagent/neighorch.cpp b/orchagent/neighorch.cpp index 5f81e4ba7339..ae0db0751c22 100644 --- a/orchagent/neighorch.cpp +++ b/orchagent/neighorch.cpp @@ -317,27 +317,27 @@ void NeighOrch::doTask(Consumer &consumer) continue; } - Port p; - if (!gPortsOrch->getPort(alias, p)) - { - SWSS_LOG_INFO("Port %s doesn't exist", alias.c_str()); - it++; - continue; - } - - if (!p.m_rif_id) - { - SWSS_LOG_INFO("Router interface doesn't exist on %s", alias.c_str()); - it++; - continue; - } - IpAddress ip_address(key.substr(found+1)); NeighborEntry neighbor_entry = { ip_address, alias }; if (op == SET_COMMAND) { + Port p; + if (!gPortsOrch->getPort(alias, p)) + { + SWSS_LOG_INFO("Port %s doesn't exist", alias.c_str()); + it++; + continue; + } + + if (!p.m_rif_id) + { + SWSS_LOG_INFO("Router interface doesn't exist on %s", alias.c_str()); + it++; + continue; + } + MacAddress mac_address; for (auto i = kfvFieldsValues(t).begin(); i != kfvFieldsValues(t).end(); i++)