[DPB] Fix a potential command failure when break out a port that is a member of portchannel. #3104
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
Fix issue: sonic-net/sonic-buildimage#10005 where DPB may not be able to break out ports when these ports are port-channel member. Upon analyzing the output obtained via “redis-cli monitor” command, we found the Consumer cannot process DEL port request in time before executing HSET admin_status and mtu operation from teammgr removeLagMember function.
This sequence mismatch led to the failure in port deletion, causing Orchagent to miss the DELETE message.
How I did it
The _deletePorts function was split into two parts:
Part1: Deletion of dependencies
Part2: Deletion of port itself
Additionally an 1 second delay was added between Part1 and Part2 to ensure the serialization of ConfigDB update.
Example:
Original deleted config:
ConfigMgmt: Write in DB: {'PORT': {'Ethernet0': None}, 'PORTCHANNEL_MEMBER': None}
Separate the deleted config into two parts (solution):
part1). 'delete dependencies'(delConfigDepToLoad):
ConfigMgmt: Write in DB: {'PORTCHANNEL_MEMBER': None}
sleep 1 sec...
part2). 'delete port'(delConfigToLoad):
ConfigMgmt: Write in DB: {'PORT': {'Ethernet0': None}}
How to verify it
Step1. Create portchannel with Ethernet0
Step2. Dynamic port breakout:
admin@sonic:~$ sudo config interface breakout Ethernet0 4x10G[10G,1G] -fy
Step3. Check console:
admin@sonic:~$ sudo config interface breakout Ethernet0 4x10G[10G,1G] -fy
Running Breakout Mode : 1x40G[40G,10G,1G]
Target Breakout Mode : 4x10G[10G,1G]
Ports to be deleted :
{
"Ethernet0": "40000"
}
Ports to be added :
{
"Ethernet0": "10000",
"Ethernet1": "10000",
"Ethernet2": "10000",
"Ethernet3": "10000"
}
Breakout process got successfully completed.
Please note loaded setting will be lost after system reboot. To preserve setting, run
config save
.Step4. Check interface:
Step5. Check syslog:
"Deleting Port Ethernet0" can be found. Orchagent received the DELETE message.
Step6. Check redis-cli monitor:
HSET admin_status/mtu and DEL port by Consumer are Separated and DEL Ethernet0 success.
Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)