From 0fb6a09823054c62b473582980951a6aa04b1ab7 Mon Sep 17 00:00:00 2001 From: Akhilesh Samineni Date: Wed, 14 Apr 2021 02:00:15 -0700 Subject: [PATCH] Removed hasIp2MeAddr function. --- orchagent/intfsorch.cpp | 66 ++++------------------------------------- orchagent/intfsorch.h | 2 -- 2 files changed, 6 insertions(+), 62 deletions(-) diff --git a/orchagent/intfsorch.cpp b/orchagent/intfsorch.cpp index c1a20dce03..ffae3decac 100644 --- a/orchagent/intfsorch.cpp +++ b/orchagent/intfsorch.cpp @@ -809,32 +809,14 @@ void IntfsOrch::doTask(Consumer &consumer) } else { - if (gPortsOrch->getPort(alias, port)) + if (!setIntf(alias, vrf_id, ip_prefix_in_key ? &ip_prefix : nullptr, adminUp, mtu)) { - if (ip_prefix_in_key) - { - string out_alias; - - if (hasIp2MeAddr(port.m_vr_id, ip_prefix, &out_alias)) - { - string vrfName = m_vrfOrch->getVRFname(port.m_vr_id); - - if (ip_prefix.getIp().getAddrScope() == IpAddress::LINK_SCOPE) - { - SWSS_LOG_INFO("Ignoring SET IP Address: %s in %s, Same IP configured in %s, vrf: %s ", - ip_prefix.to_string().c_str(), alias.c_str(), out_alias.c_str(), vrfName.empty()? "default": vrfName.c_str()); - } - else - { - SWSS_LOG_ERROR("Ignoring SET IP Address: %s in %s, Same IP configured in %s, vrf: %s ", - ip_prefix.to_string().c_str(), alias.c_str(), out_alias.c_str(), vrfName.empty()? "default": vrfName.c_str()); - } - - it = consumer.m_toSync.erase(it); - continue; - } - } + it++; + continue; + } + if (gPortsOrch->getPort(alias, port)) + { /* Set nat zone id */ if ((!nat_zone.empty()) and (port.m_nat_zone_id != nat_zone_id)) { @@ -852,12 +834,6 @@ void IntfsOrch::doTask(Consumer &consumer) gPortsOrch->setPort(alias, port); } } - - if (!setIntf(alias, vrf_id, ip_prefix_in_key ? &ip_prefix : nullptr, adminUp, mtu)) - { - it++; - continue; - } } if (mac) @@ -1171,36 +1147,6 @@ bool IntfsOrch::removeRouterIntfs(Port &port) return true; } -bool IntfsOrch::hasIp2MeAddr(sai_object_id_t in_vrf_id, const IpPrefix &in_ip_prefix, string *out_alias) -{ - sai_object_id_t vrf_id = gVirtualRouterId; - - for (auto it = m_syncdIntfses.begin(); it != m_syncdIntfses.end(); it++) - { - for (auto prefix : it->second.ip_addresses) - { - if (prefix.isAddressInSubnet(in_ip_prefix.getIp())) - { - vrf_id = m_syncdIntfses[it->first].vrf_id; - string vrfName = m_vrfOrch->getVRFname(vrf_id); - - if (vrf_id == in_vrf_id) - { - *out_alias = it->first; - - if (prefix == in_ip_prefix) - { - SWSS_LOG_NOTICE("IP2Me Matched Addr %s, Intf = %s vrf %s ", prefix.to_string().c_str(), it->first.c_str(), vrfName.c_str()); - return true; - } - } - } - } - } - - return false; -} - void IntfsOrch::addIp2MeRoute(sai_object_id_t vrf_id, const IpPrefix &ip_prefix) { sai_route_entry_t unicast_route_entry; diff --git a/orchagent/intfsorch.h b/orchagent/intfsorch.h index a4f5aeaee7..11b947ec29 100644 --- a/orchagent/intfsorch.h +++ b/orchagent/intfsorch.h @@ -55,8 +55,6 @@ class IntfsOrch : public Orch bool setIntf(const string& alias, sai_object_id_t vrf_id = gVirtualRouterId, const IpPrefix *ip_prefix = nullptr, const bool adminUp = true, const uint32_t mtu = 0); bool removeIntf(const string& alias, sai_object_id_t vrf_id = gVirtualRouterId, const IpPrefix *ip_prefix = nullptr); - bool hasIp2MeAddr(sai_object_id_t in_vrf_id, const IpPrefix &in_ip_prefix, string *out_alias); - void addIp2MeRoute(sai_object_id_t vrf_id, const IpPrefix &ip_prefix); void removeIp2MeRoute(sai_object_id_t vrf_id, const IpPrefix &ip_prefix);