Skip to content

Commit

Permalink
Removed hasIp2MeAddr function.
Browse files Browse the repository at this point in the history
  • Loading branch information
AkhileshSamineni committed Jun 7, 2021
1 parent 396fe6e commit 7053e33
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 62 deletions.
66 changes: 6 additions & 60 deletions orchagent/intfsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,32 +810,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))
{
Expand All @@ -853,12 +835,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)
Expand Down Expand Up @@ -1172,36 +1148,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;
Expand Down
2 changes: 0 additions & 2 deletions orchagent/intfsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 7053e33

Please sign in to comment.