Skip to content

Add scope to field validator.[redo PR: 3675] (#3805)#288

Merged
cyw233 merged 1 commit into
Azure:202405from
cyw233:cherry/202405/3805
Mar 2, 2026
Merged

Add scope to field validator.[redo PR: 3675] (#3805)#288
cyw233 merged 1 commit into
Azure:202405from
cyw233:cherry/202405/3805

Conversation

@cyw233

@cyw233 cyw233 commented Mar 2, 2026

Copy link
Copy Markdown

What I did
This is for fix issue:sonic-net/sonic-buildimage#20379. It was done by sonic-net/sonic-utilities#3675. and it was reverted by sonic-net/sonic-utilities#3689.

This is redo by removing unnecessary change that caused PR test failure.

How I did it
For field_operation_validators, add scope if need read state_db.

How to verify it
admin@str2-7250-lc1-2:~$ sonic-db-cli STATE_DB -n asic0 hget "PORT_TABLE|Ethernet0" supported_fecs
none,rs

admin@str2-7250-lc1-2:~$ cat fec.json
[
{
"op": "add",
"path": "/asic0/PORT/Ethernet0/fec",
"value": "fc"
}
]

admin@str2-7250-lc1-2:~$ sudo config apply-patch fec.json
Patch Applier: asic0: Patch application starting.
Patch Applier: asic0: Patch: [{"op": "add", "path": "/PORT/Ethernet0/fec", "value": "fc"}]
Patch Applier: asic0 getting current config db.
Patch Applier: asic0: simulating the target full config after applying the patch.
Patch Applier: asic0: validating all JsonPatch operations are permitted on the specified fields
Failed to apply patch due to: Failed to apply patch on the following scopes:

  • asic0: Modification of PORT table is illegal- validating function generic_config_updater.field_operation_validators.port_config_update_validator returned False
    Usage: config apply-patch [OPTIONS] PATCH_FILE_PATH
    Try "config apply-patch -h" for help.

Error: Failed to apply patch on the following scopes:

  • asic0: Modification of PORT table is illegal- validating function generic_config_updater.field_operation_validators.port_config_update_validator returned False
    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)

@cyw233

cyw233 commented Mar 2, 2026

Copy link
Copy Markdown
Author

Original PR: sonic-net/sonic-utilities#3805

@cyw233

cyw233 commented Mar 2, 2026

Copy link
Copy Markdown
Author

@anamehra please review, thanks

@cyw233 cyw233 merged commit a1d145e into Azure:202405 Mar 2, 2026
3 checks passed
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.

3 participants