Skip to content

Commit

Permalink
Add local and remote cpu ports to inband VLAN in the same for loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmanman committed Apr 11, 2021
1 parent 2de8cd7 commit 738e5f6
Showing 1 changed file with 19 additions and 30 deletions.
49 changes: 19 additions & 30 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4950,38 +4950,15 @@ bool PortsOrch::addInbandVlan(const string &alias, const string &type)

getCpuPort(cpuPort);

if (!addBridgePort(cpuPort))
{
SWSS_LOG_ERROR("Failed to add CPU port %s as bridge port", cpuPort.m_alias.c_str());
return false;
}

if (!addVlanMember(inbandVlan, cpuPort, tagged_mode))
{
SWSS_LOG_ERROR("Failed to add CPU port %s in inband VLAN", cpuPort.m_alias.c_str());
return false;
}

SWSS_LOG_NOTICE("add port %s to inbandVlan %s", cpuPort.m_alias.c_str(), inbandVlan.m_alias.c_str());

if (!addHostIntfs(inbandVlan, inbandVlan.m_alias, inbandVlan.m_hif_id))
{
SWSS_LOG_ERROR("Failed to add host intf for inband VLAN");
return false;
}

if (!setHostIntfsOperStatus(inbandVlan, true))
{
SWSS_LOG_ERROR("Failed to set host intf oper status for inband VLAN");
return false;
}

for (auto &it: m_portList)
{
Port port = it.second;
if (port.m_type != Port::SYSTEM ||
port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_LOCAL ||
port.m_alias.find("Cpu") == string::npos)

// Only add local and remote CPU ports to inband VLAN.
if (port.m_alias != cpuPort.m_alias &&
(port.m_type != Port::SYSTEM ||
port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_LOCAL ||
port.m_alias.find("Cpu") == string::npos))
{
continue;
}
Expand All @@ -4998,7 +4975,19 @@ bool PortsOrch::addInbandVlan(const string &alias, const string &type)
continue;
}

SWSS_LOG_NOTICE("add sysport %s to inbandVlan %s", port.m_alias.c_str(), inbandVlan.m_alias.c_str());
SWSS_LOG_NOTICE("add port %s to inbandVlan %s", port.m_alias.c_str(), inbandVlan.m_alias.c_str());
}

if (!addHostIntfs(inbandVlan, inbandVlan.m_alias, inbandVlan.m_hif_id))
{
SWSS_LOG_ERROR("Failed to add host intf for inband VLAN");
return false;
}

if (!setHostIntfsOperStatus(inbandVlan, true))
{
SWSS_LOG_ERROR("Failed to set host intf oper status for inband VLAN");
return false;
}

return true;
Expand Down

0 comments on commit 738e5f6

Please sign in to comment.