[Port-breakout] Fixing breakout configuration resulting in cable_length None #4072
+21
−0
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 port breakout is performed, configMgmt creates the list of configs to be deleted and mark the value with None for the value to be deleted like below.
{'BUFFER_PG': {'Ethernet0|0': None, 'Ethernet0|1-2': None,
'Ethernet0|3-4': None, 'Ethernet0|5-7': None}, 'BUFFER_QUEUE':
{'Ethernet0|0-2': None, 'Ethernet0|3-4': None, 'Ethernet0|5-7': None},
'CABLE_LENGTH': {'AZURE': {'Ethernet0': None}},
'INTERFACE': {'Ethernet0': None, 'Ethernet0|10.0.0.0/31': None},
'PORT': {'Ethernet0': None}, 'QUEUE': {}}
and perform writeConfigDB operation hoping to delete all configs. But for the configs which are part of dictionary and not the key like CABLE_LENGTH. the entry get modified to None instead of getting deleted.
and if further break-out/break-in is triggered then it result in to configure failure like below as yang schema does not accept None value.
libyang[0]: Value "None" does not satisfy the constraint "[0-9]+m" (range, length, or pattern). (path: /son ic-cable-length:sonic-cable-length/CABLE_LENGTH/CABLE_LENGTH_LIST[name='AZURE']/CABLE_LENGTH[port='Ethernet 448']/length)
libyang[0]: Invalid cable length. (path: /sonic-cable-length:sonic-cable-length/CABLE_LENGTH/CABLE_LENGTH_L IST[name='AZURE']/CABLE_LENGTH[port='Ethernet448']/length) sonic_yang(3):Data Loading Failed:Invalid cable length. Data Loading Failed
Invalid cable length.
ConfigMgmt Class creation failed
Failed to break out Port. Error: Failed to load the config. Error: ConfigMgmtDPB Class creation failed
This fix takes care of deleting the cable length 'None' entry from the config DB.
How I did it
Handling deletion of column key when it's value is 'None' using set_entry
data: config data in a dictionary form
{
'TABLE_NAME': { 'row_key': {'column_key': None, ...}, ...}
}
How to verify it
By performing port-breakout/break-in CLI, it should not result-in cable length None issue. also config db should not have breakout interface in dictionary value of CABLE_LENGTH|AZURE
Port breakout from 1x800G to 4x200G => sudo config interface breakout Ethernet0 "4x200G[100G,50G]" -y -f
Port break-in back to 1x800G from 4x200G => sudo config interface breakout Ethernet0 "1x800G[400G,200G]" -y -f
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)