Port is not adding to portchannel when the port is removed from participating VLAN and not member of any VLAN. #886
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
- What I did
When is port added to any VLAN, Bridge port association is created and port is enslaved(/sys/class/net//master -> ../Bridge).
When port is removed from VLAN and the port is no more member of any VLAN, the VLAN---Bridge---Port association has to be cleaned up.
In SONiC, the VLAN manger code will check the VLAN membership association and detach the port from Dot1Q bridge, by invoking the Linux shell command (/sbin/ip link set nomaster).
Due to parsing issue, the Linux shell command is not taking place and not setting 'nomaster'.
In this state, when the port is configured to add to PortChannel, the operation is failed assuming that port is enslaved by others.
So, corrected the parsing logic to check the port is not member of any VLAN.
- How I did it
By using sed, grep utilities the parsing logic modified to check the port is part of any VLAN.
The bridge vlan show output is as follows.
root@sonic:~# /sbin/bridge vlan show dev Ethernet0
port vlan ids
Ethernet0 1 PVID Egress Untagged
1000
In the above example, the port is still member of VLAN 1000.
When port VLAN membership 1000 is removed and then port is not part of any VLAN;
Clear the bridge port association.
- How to verify it
Without fix:
The port is not added to PortChannel and configuration is the entry only present in config DB.
After the save and reload the configuration (or) reboot only, the physical port becomes the part of PortChannel.