Skip to content

Commit 738e5f6

Browse files
committed
Add local and remote cpu ports to inband VLAN in the same for loop.
1 parent 2de8cd7 commit 738e5f6

File tree

1 file changed

+19
-30
lines changed

1 file changed

+19
-30
lines changed

orchagent/portsorch.cpp

+19-30
Original file line numberDiff line numberDiff line change
@@ -4950,38 +4950,15 @@ bool PortsOrch::addInbandVlan(const string &alias, const string &type)
49504950

49514951
getCpuPort(cpuPort);
49524952

4953-
if (!addBridgePort(cpuPort))
4954-
{
4955-
SWSS_LOG_ERROR("Failed to add CPU port %s as bridge port", cpuPort.m_alias.c_str());
4956-
return false;
4957-
}
4958-
4959-
if (!addVlanMember(inbandVlan, cpuPort, tagged_mode))
4960-
{
4961-
SWSS_LOG_ERROR("Failed to add CPU port %s in inband VLAN", cpuPort.m_alias.c_str());
4962-
return false;
4963-
}
4964-
4965-
SWSS_LOG_NOTICE("add port %s to inbandVlan %s", cpuPort.m_alias.c_str(), inbandVlan.m_alias.c_str());
4966-
4967-
if (!addHostIntfs(inbandVlan, inbandVlan.m_alias, inbandVlan.m_hif_id))
4968-
{
4969-
SWSS_LOG_ERROR("Failed to add host intf for inband VLAN");
4970-
return false;
4971-
}
4972-
4973-
if (!setHostIntfsOperStatus(inbandVlan, true))
4974-
{
4975-
SWSS_LOG_ERROR("Failed to set host intf oper status for inband VLAN");
4976-
return false;
4977-
}
4978-
49794953
for (auto &it: m_portList)
49804954
{
49814955
Port port = it.second;
4982-
if (port.m_type != Port::SYSTEM ||
4983-
port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_LOCAL ||
4984-
port.m_alias.find("Cpu") == string::npos)
4956+
4957+
// Only add local and remote CPU ports to inband VLAN.
4958+
if (port.m_alias != cpuPort.m_alias &&
4959+
(port.m_type != Port::SYSTEM ||
4960+
port.m_system_port_info.type == SAI_SYSTEM_PORT_TYPE_LOCAL ||
4961+
port.m_alias.find("Cpu") == string::npos))
49854962
{
49864963
continue;
49874964
}
@@ -4998,7 +4975,19 @@ bool PortsOrch::addInbandVlan(const string &alias, const string &type)
49984975
continue;
49994976
}
50004977

5001-
SWSS_LOG_NOTICE("add sysport %s to inbandVlan %s", port.m_alias.c_str(), inbandVlan.m_alias.c_str());
4978+
SWSS_LOG_NOTICE("add port %s to inbandVlan %s", port.m_alias.c_str(), inbandVlan.m_alias.c_str());
4979+
}
4980+
4981+
if (!addHostIntfs(inbandVlan, inbandVlan.m_alias, inbandVlan.m_hif_id))
4982+
{
4983+
SWSS_LOG_ERROR("Failed to add host intf for inband VLAN");
4984+
return false;
4985+
}
4986+
4987+
if (!setHostIntfsOperStatus(inbandVlan, true))
4988+
{
4989+
SWSS_LOG_ERROR("Failed to set host intf oper status for inband VLAN");
4990+
return false;
50024991
}
50034992

50044993
return true;

0 commit comments

Comments
 (0)