Skip to content

Conversation

Keshavg-marvell
Copy link

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)

…th None

What is the issue:

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

Expected behaviour:

Cable length config along with other configs should get deleted when the port breakout is done.

Fix:

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, ...}, ...}
}

Signed-off-by: Keshav Gupta <[email protected]>
@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Keshavg-marvell
Copy link
Author

This PR fixes: sonic-net/sonic-buildimage#19133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants