You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case the path value in a json file that is used in gcu with 'sudo config apply-patch' includes '/', which is replaced with as '~1', the patch fails as the path is not recognized.
As it seems the code reads the code until the '~1' characters and tries to find the path as it is with as a result getting a KeyError.
This behavior seems to be broken only in multi-asics platform where namespace prefix is used in path.
Please see the console output from an apply-patch with a path that falls above category in a successful run (single-asic) vs a failed run (in multi-asic).
# Apply patch of 'add_portchannel_single_asic.json' (SUCCESS)
admin@vlab-01:$ sudo config apply-patch add_portchannel_single_asic.json
Patch Applier: localhost: Patch application starting.
Patch Applier: localhost: Patch: [{"op": "add", "path": "/PORTCHANNEL_INTERFACE/PortChannel101|10.0.0.56131", "value": {}}]
Patch Applier: localhost getting current config db.
Patch Applier: localhost: simulating the target full config after applying the patch.
Patch Applier: localhost: validating all JsonPatch operations are permitted on the specified fields
Patch Applier: localhost: validating target config does not have empty tables,
since they do not show up in ConfigDb.
Patch Applier: localhost: sorting patch updates.
Patch Applier: The localhost patch was converted into 0 changes.
Patch Applier: localhost: applying 0 changes in order.
Patch Applier: localhost: verifying patch updates are reflected on ConfigDB.
Patch Applier: localhost patch application completed.
Patch applied successfully.
# Apply patch of 'add_portchannel_multi_asic.json' (FAILED)
admin@ixre-egl-board30:~$ sudo add_portchannel_multi_asic.json
Patch Applier: asic1: Patch application starting.
Patch Applier: asic1: Patch: [{"op": "add", "path": "/PORTCHANNEL_INTERFACE/PortChannel105|10.0.0.18/31", "value": {}}]
Patch Applier: asic1 getting current config db.
Patch Applier: asic1: simulating the target full config after applying the patch.
Failed to apply patch due to: Failed to apply patch on the following scopes:
asic1: member 'PortChannel105|10.0.0.18' not found in {'PortChannel105': {}, 'PortChannel105|10.0.0.18/31': {}, 'PortChannel105|FC00::25/126': {}}
Usage: config apply-patch [OPTIONS] PATCH_FILE_PATH
Try "config apply-patch -h" for help.
Error: Failed to apply patch on the following scopes:
asic1: member 'PortChannel105|10.0.0.18' not found in {'PortChannel105': {}, 'PortChannel105|10.0.0.18/31': {}, 'PortChannel105|FC00::25/126': {}}
Indeed @xincunli-sonic , the replacement of '/' with '~1' is expected, as referenced in the ticket you mentioned. However, this is not the issue we are encountering. Could you please refer to the issue description?
We are using the JSON path in the expected way, and while it works correctly in single-ASIC, we are experiencing failures in multi-ASIC. It seems there is a change in how the path is being interpreted in multi-ASIC, which is causing the functionality to break. Could you please investigate this further?
Thanks @okaravasi explanation! This is a good finding, here is the fix: sonic-net/sonic-utilities#3573, please help verify the change and help sign off, Thanks!
Description
In case the path value in a json file that is used in gcu with 'sudo config apply-patch' includes '/', which is replaced with as '~1', the patch fails as the path is not recognized.
As it seems the code reads the code until the '~1' characters and tries to find the path as it is with as a result getting a KeyError.
This behavior seems to be broken only in multi-asics platform where namespace prefix is used in path.
Please see the console output from an apply-patch with a path that falls above category in a successful run (single-asic) vs a failed run (in multi-asic).
# Contents of 'add_portchannel_single_asic.json'
# Apply patch of 'add_portchannel_single_asic.json' (SUCCESS)
# Contents of 'add_portchannel_multi_asic.json'
# Apply patch of 'add_portchannel_multi_asic.json' (FAILED)
Steps to reproduce the issue
Failed test cases:
(Automated test cases support for running in t2 topology is added via PR sonic-net/sonic-mgmt#14070 )
Manual steps:
Example:
4.sudo config apply-patch tmp.json
Describe the results you received
apply-patch fails and path is not recognized as expected.
Here, member 'PortChannel105|10.0.0.18' is recognized although it should read 'PortChannel105|10.0.0.18/31'.
Describe the results you expected
apply-patch shoudl succeed.
In above error, member 'PortChannel105|10.0.0.18' is recognized although it should read 'PortChannel105|10.0.0.18/31'.
Additional information you deem important (e.g. issue happens only occasionally)
This behavior is successful in single-asic platforms. Issue is only for multi-asic.
Output of
show version
The text was updated successfully, but these errors were encountered: