Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the platform check for remove/add port action at init phase #1006

Merged
merged 1 commit into from
Jul 31, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 8 additions & 28 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1636,19 +1636,10 @@ void PortsOrch::doPortTask(Consumer &consumer)
{
if (m_lanesAliasSpeedMap.find(it->first) == m_lanesAliasSpeedMap.end())
{
char *platform = getenv("platform");
if (platform && (strstr(platform, BFN_PLATFORM_SUBSTRING) || strstr(platform, MLNX_PLATFORM_SUBSTRING)))
if (!removePort(it->second))
{
if (!removePort(it->second))
{
throw runtime_error("PortsOrch initialization failure.");
}
}
else
{
SWSS_LOG_NOTICE("Failed to remove Port %" PRIx64 " due to missing SAI remove_port API.", it->second);
throw runtime_error("PortsOrch initialization failure.");
}

it = m_portListLaneMap.erase(it);
}
else
Expand All @@ -1663,22 +1654,11 @@ void PortsOrch::doPortTask(Consumer &consumer)

if (m_portListLaneMap.find(it->first) == m_portListLaneMap.end())
{
// work around to avoid syncd termination on SAI error due missing create_port SAI API
// can be removed when SAI redis return NotImplemented error
char *platform = getenv("platform");
if (platform && (strstr(platform, BFN_PLATFORM_SUBSTRING) || strstr(platform, MLNX_PLATFORM_SUBSTRING)))
if (!addPort(it->first, get<1>(it->second), get<2>(it->second), get<3>(it->second)))
{
if (!addPort(it->first, get<1>(it->second), get<2>(it->second), get<3>(it->second)))
{
throw runtime_error("PortsOrch initialization failure.");
}

port_created = true;
}
else
{
SWSS_LOG_NOTICE("Failed to create Port %s due to missing SAI create_port API.", get<0>(it->second).c_str());
throw runtime_error("PortsOrch initialization failure.");
}
port_created = true;
}
else
{
Expand Down Expand Up @@ -2742,7 +2722,7 @@ bool PortsOrch::removeVlan(Port vlan)
SWSS_LOG_ENTER();
if (m_port_ref_count[vlan.m_alias] > 0)
{
SWSS_LOG_ERROR("Failed to remove ref count %d VLAN %s",
SWSS_LOG_ERROR("Failed to remove ref count %d VLAN %s",
m_port_ref_count[vlan.m_alias],
vlan.m_alias.c_str());
return false;
Expand Down Expand Up @@ -2926,8 +2906,8 @@ bool PortsOrch::removeLag(Port lag)

if (m_port_ref_count[lag.m_alias] > 0)
{
SWSS_LOG_ERROR("Failed to remove ref count %d LAG %s",
m_port_ref_count[lag.m_alias],
SWSS_LOG_ERROR("Failed to remove ref count %d LAG %s",
m_port_ref_count[lag.m_alias],
lag.m_alias.c_str());
return false;
}
Expand Down