Skip to content

Commit

Permalink
[sub intf] Use m_lag_id to be the parent port object id when parent p…
Browse files Browse the repository at this point in the history
…ort is LAG (sonic-net#1235)

Fix to sonic-net#4142

Add vs test on lag sub interface based on unconventional lag naming "PortChannel1.20" to fit the interface name within 15 characters

Signed-off-by: Wenda Ni wonda.ni@gmail.com
  • Loading branch information
wendani authored Apr 3, 2020
1 parent b27d06b commit d6236b5
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 63 deletions.
16 changes: 14 additions & 2 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ bool PortsOrch::addSubPort(Port &port, const string &alias, const bool &adminUp,
}
if (vlan_id > MAX_VALID_VLAN_ID)
{
SWSS_LOG_ERROR("sub interface %s Port object creation: invalid VLAN id %u", alias.c_str(), vlan_id);
SWSS_LOG_ERROR("sub interface %s Port object creation failed: invalid VLAN id %u", alias.c_str(), vlan_id);
return false;
}

Expand All @@ -614,7 +614,19 @@ bool PortsOrch::addSubPort(Port &port, const string &alias, const bool &adminUp,
p.m_mtu = parentPort.m_mtu;
}

p.m_parent_port_id = parentPort.m_port_id;
switch (parentPort.m_type)
{
case Port::PHY:
p.m_parent_port_id = parentPort.m_port_id;
break;
case Port::LAG:
p.m_parent_port_id = parentPort.m_lag_id;
break;
default:
SWSS_LOG_ERROR("Sub interface %s Port object creation failed: \
parent port %s of invalid type (must be physical port or LAG)", alias.c_str(), parentAlias.c_str());
return false;
}
p.m_vlan_info.vlan_id = vlan_id;

parentPort.m_child_ports.insert(p.m_alias);
Expand Down
Loading

0 comments on commit d6236b5

Please sign in to comment.