Skip to content

Commit

Permalink
[portsorch]: Set Port VLAN ID only for untagged VLAN (sonic-net#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-shirshov authored and Shuotian Cheng committed Jun 9, 2017
1 parent 7c34bdf commit 0e9b855
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1007,18 +1007,21 @@ bool PortsOrch::addVlanMember(Port vlan, Port port, string& tagging_mode)
SWSS_LOG_NOTICE("Add member %s to VLAN %s vid:%hu pid%lx",
port.m_alias.c_str(), vlan.m_alias.c_str(), vlan.m_vlan_id, port.m_port_id);

attr.id = SAI_PORT_ATTR_PORT_VLAN_ID;
attr.value.u16 = vlan.m_vlan_id;

status = sai_port_api->set_port_attribute(port.m_port_id, &attr);
if (status != SAI_STATUS_SUCCESS)
if (tagging_mode == "untagged") // set pvlan id for untagged port only
{
SWSS_LOG_ERROR("Failed to set port VLAN ID vid:%hu pid:%lx",
vlan.m_vlan_id, port.m_port_id);
return false;
}
attr.id = SAI_PORT_ATTR_PORT_VLAN_ID;
attr.value.u16 = vlan.m_vlan_id;

status = sai_port_api->set_port_attribute(port.m_port_id, &attr);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to set port VLAN ID vid:%hu pid:%lx",
vlan.m_vlan_id, port.m_port_id);
return false;
}

SWSS_LOG_INFO("Set port %s VLAN ID to %hu", port.m_alias.c_str(), vlan.m_vlan_id);
SWSS_LOG_INFO("Set port %s VLAN ID to %hu", port.m_alias.c_str(), vlan.m_vlan_id);
}

port.m_vlan_id = vlan.m_vlan_id;
port.m_port_vlan_id = vlan.m_vlan_id;
Expand Down

0 comments on commit 0e9b855

Please sign in to comment.