VLAN trunk support: orchagent update.#296
VLAN trunk support: orchagent update.#296jipanyang wants to merge 4 commits intosonic-net:v1.0.3from
Conversation
|
@JipanYanga, |
stcheng
left a comment
There was a problem hiding this comment.
thanks! please review the comments.
| gPortsOrch->setPort(port.m_alias, port); | ||
|
|
||
| /* Clean this port from default VLAN */ | ||
| gPortsOrch->removeDefaultVlanMembers(); |
There was a problem hiding this comment.
why do you need to call this function here?
There was a problem hiding this comment.
After removeRouterIntfs(), the port goes back to default VLAN. Since there is no vlan member id available, this is the only way to get the port out of default VLAN.
Not very clear about the expected behavior at sai level. If port is not supposed to be put back to default VLAN, then it could be libsai implementation issue. This line may be removed.
There was a problem hiding this comment.
the port is not supposed to be put back to default VLAN according to the SAI spec. you could remove this line.
There was a problem hiding this comment.
the port is not supposed to be put back to default VLAN according to the SAI spec. you could remove this line.
There was a problem hiding this comment.
Ok, will remove the line of code. Libsai from ASIC vendor should not automatically move the port to default VLAN.
orchagent/port.h
Outdated
| sai_object_id_t vlan_oid; | ||
| sai_vlan_id_t vlan_id; | ||
| std::string autostate; | ||
| uint32_t mtu; |
There was a problem hiding this comment.
move this mtu to Port structure's variable
orchagent/port.h
Outdated
| sai_vlan_id_t m_vlan_id = 0; | ||
| sai_vlan_id_t m_port_vlan_id = DEFAULT_PORT_VLAN_ID; // Port VLAN ID | ||
| sai_object_id_t m_vlan_member_id = 0; | ||
| port_vlan_members_t m_vlan_members; |
orchagent/portsorch.cpp
Outdated
| { | ||
| SWSS_LOG_ENTER(); | ||
|
|
||
| vector<sai_object_id_t> idv; |
orchagent/portsorch.cpp
Outdated
| { | ||
| Port member; | ||
| auto it = port.m_members.begin(); | ||
| while (it != port.m_members.end()) |
| it = consumer.m_toSync.erase(it); | ||
| else | ||
| it++; | ||
| string autostate; |
There was a problem hiding this comment.
just wondering if autostate is a boolean or a string?
There was a problem hiding this comment.
It is a value from redis, in type of string. VLAN autostate feature is to be implemented.
orchagent/portsorch.cpp
Outdated
| * Port has been removed from 1q bridge at PortsOrch constructor, | ||
| * also start stipping off VLAN tag. | ||
| */ | ||
| bool rv = setHostIntfsStripTag(p, SAI_HOSTIF_VLAN_TAG_STRIP); |
There was a problem hiding this comment.
move this piece of code inside the addHostIntfs function?
There was a problem hiding this comment.
After checking it again, bool PortsOrch::setHostIntfsStripTag(Port &port, sai_hostif_vlan_tag_t strip) is taking Port class as first parameter, while bool PortsOrch::addHostIntfs(sai_object_id_t id, string alias, sai_object_id_t &host_intfs_id) is using port id of type sai_object_id_t .
Probably it is better to keep setHostIntfsStripTag() out side of addHostIntfs(), and leave setHostIntfsStripTag() at initializePort().
There was a problem hiding this comment.
what shall we do if this function fails here? what about moving this function above under the addHostIntfs function without checking the return value to match the rest of the initialization functions. it seems that if this function fails, there's nothing we could do here. since there's already error message inside this function, we could anyway catch it.
There was a problem hiding this comment.
ok, will move the function to addHostIntfs() without checking return value.
orchagent/portsorch.cpp
Outdated
| } | ||
|
|
||
| bool PortsOrch::addVlanMember(Port vlan, Port port, string& tagging_mode) | ||
| bool PortsOrch::addVlanMember(Port &vlan, Port &port, string& tagging_mode) |
There was a problem hiding this comment.
align the space, e.g. string &tagging_mode
orchagent/portsorch.cpp
Outdated
| assert (vlan_member != port.m_vlan_members.end()); | ||
| sai_tagging_mode = vlan_member->second.vlan_mode; | ||
| vlan_member_id = vlan_member->second.vlan_member_id; | ||
| sai_status_t status = sai_vlan_api->remove_vlan_member(vlan_member_id); |
There was a problem hiding this comment.
switch with the lower empty line 1586.
orchagent/saihelper.cpp
Outdated
| } | ||
| } | ||
|
|
||
| /* Disable/enable SwSS recording */ |
There was a problem hiding this comment.
It duplicates with https://github.com/Azure/sonic-swss/blob/v1.0.3/orchagent/main.cpp#L164, and causes file write issue.
There was a problem hiding this comment.
ah! I see. thanks! Let me fix this in a separate pull request!
…class, code format and so on.
stcheng
left a comment
There was a problem hiding this comment.
minor changes. as for the PVID discussion, we could sync on the phone.
| gPortsOrch->setPort(port.m_alias, port); | ||
|
|
||
| /* Clean this port from default VLAN */ | ||
| gPortsOrch->removeDefaultVlanMembers(); |
There was a problem hiding this comment.
the port is not supposed to be put back to default VLAN according to the SAI spec. you could remove this line.
orchagent/portsorch.cpp
Outdated
| bool PortsOrch::setPortPvid (Port &port, sai_uint32_t pvid) | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
| vector<Port> portv; |
There was a problem hiding this comment.
Ok, will remove it.
|
|
||
| bool PortsOrch::getPortPvid(Port &port, sai_uint32_t &pvid) | ||
| { | ||
|
|
There was a problem hiding this comment.
Ok, will remove it.
|
|
||
| for (auto &vme: port.m_vlan_members) | ||
| { | ||
| if(vme.second.vlan_mode == SAI_VLAN_TAGGING_MODE_UNTAGGED) { |
There was a problem hiding this comment.
here the port VLAN ID is valid only when we are querying the physical port, is that right? a physical port will not have VLAN members. I'm not sure about why the for loop is here. Do we need to add checks at the entrance of this function to ensure the type of the port? If a sync is needed, let's discuss this on the phone.
orchagent/portsorch.cpp
Outdated
| bool PortsOrch::setHostIntfsStripTag(Port &port, sai_hostif_vlan_tag_t strip) | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
| vector<Port> portv; |
There was a problem hiding this comment.
Ok, will remove it.
orchagent/portsorch.cpp
Outdated
| return false; | ||
| } | ||
| SWSS_LOG_NOTICE("Set %s to host interface: %s", | ||
| hostif_vlan_tag[strip], p.m_alias.c_str()); |
There was a problem hiding this comment.
align the code or use 8 spaces
orchagent/portsorch.cpp
Outdated
| * Port has been removed from 1q bridge at PortsOrch constructor, | ||
| * also start stipping off VLAN tag. | ||
| */ | ||
| bool rv = setHostIntfsStripTag(p, SAI_HOSTIF_VLAN_TAG_STRIP); |
There was a problem hiding this comment.
what shall we do if this function fails here? what about moving this function above under the addHostIntfs function without checking the return value to match the rest of the initialization functions. it seems that if this function fails, there's nothing we could do here. since there's already error message inside this function, we could anyway catch it.
orchagent/portsorch.cpp
Outdated
|
|
||
| sai_status_t status = sai_vlan_api->remove_vlan_member(port.m_vlan_member_id); | ||
| sai_object_id_t vlan_member_id; | ||
| sai_vlan_tagging_mode_t sai_tagging_mode; |
There was a problem hiding this comment.
no need to align spaces here
orchagent/portsorch.cpp
Outdated
| SWSS_LOG_ERROR("Failed to reset port VLAN ID to DEFAULT_PORT_VLAN_ID pid:%lx", | ||
| port.m_port_id); | ||
| return false; | ||
| if(!setPortPvid(port, DEFAULT_PORT_VLAN_ID)) |
orchagent/portsorch.cpp
Outdated
| { | ||
| Port member; | ||
|
|
||
| for(auto &name: lag.m_members) |
|
target branch not active. |
* Enhanced "show arp/ndp" output to have vlan member info * Fixes and restructure * Addressed review comments, pep8online comments
…c-net#296) Signed-off-by: Shu0T1an ChenG <shuche@microsoft.com>
VLAN trunk support. Changes in orchagent: