Skip to content

[action] [PR:22445] Added slice_type in DEVICE_NEIGHBOR_METADATA yang model#1070

Merged
mssonicbld merged 1 commit intoAzure:202405from
mssonicbld:cherry/msft-202405/22445
May 1, 2025
Merged

[action] [PR:22445] Added slice_type in DEVICE_NEIGHBOR_METADATA yang model#1070
mssonicbld merged 1 commit intoAzure:202405from
mssonicbld:cherry/msft-202405/22445

Conversation

@mssonicbld
Copy link
Collaborator

What I did:

This PR is continuation of sonic-net/sonic-buildimage#19094 where slice_type was added for DEVICE_METADATA. In this PR we are adding this DEVICE_NEIGHBOR_METADATA also.

Why I did:

Without this change Yang Validation fails when doing config apply-patch if this field is present in DEVICE_NEIGHBOR_METADATA

ADO: 32574645

How I verify:

Manual Verification

Before fix:

echo '[]' | sudo config apply-patch /dev/stdin
sonic_yang(3):All Keys are not parsed in DEVICE_NEIGHBOR_METADATA
dict_keys(['xxxxx', 'xxxxx-lc02-ASIC00', 'xxxxx-lc02-ASIC01', 'xxxxx-lc02-ASIC02', 'xxxxx-sup00', 'xxxxx-sup00-ASIC00', 'xxxxx-sup00-ASIC01', 'xxxxx-sup00-ASIC04', 'xxxxx-sup00-ASIC05', 'xxxxx-sup00-ASIC08', 'xxxxx-sup00-ASIC09', 'xxxxx-sup00-ASIC10', 'xxxxx-sup00-ASIC11', 'xxxxx-sup00-ASIC12', 'xxxxx-sup00-ASIC13'])
sonic_yang(3):exceptionList:["'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'"]
sonic_yang(3):Data Loading Failed:All Keys are not parsed in DEVICE_NEIGHBOR_METADATA
dict_keys(['xxxxx', 'xxxxx-lc02-ASIC00', 'xxxxx-lc02-ASIC01', 'xxxxx-lc02-ASIC02', 'xxxxx-sup00', 'xxxxx-sup00-ASIC00', 'xxxxx-sup00-ASIC01', 'xxxxx-sup00-ASIC04', 'xxxxx-sup00-ASIC05', 'xxxxx-sup00-ASIC08', 'xxxxx-sup00-ASIC09', 'xxxxx-sup00-ASIC10', 'xxxxx-sup00-ASIC11', 'xxxxx-sup00-ASIC12', 'xxxxx-sup00-ASIC13'])
exceptionList:["'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'"]
Failed to apply patch due to: Validate json patch: [] failed due to:Data Loading Failed
All Keys are not parsed in DEVICE_NEIGHBOR_METADATA
dict_keys(['xxxxx', 'xxxxx-lc02-ASIC00', 'xxxxx-lc02-ASIC01', 'xxxxx-lc02-ASIC02', 'xxxxx-sup00', 'xxxxx-sup00-ASIC00', 'xxxxx-sup00-ASIC01', 'xxxxx-sup00-ASIC04', 'xxxxx-sup00-ASIC05', 'xxxxx-sup00-ASIC08', 'xxxxx-sup00-ASIC09', 'xxxxx-sup00-ASIC10', 'xxxxx-sup00-ASIC11', 'xxxxx-sup00-ASIC12', 'xxxxx-sup00-ASIC13'])
exceptionList:["'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'"]
Usage: config apply-patch [OPTIONS] PATCH_FILE_PATH
Try "config apply-patch -h" for help.

Error: Validate json patch: [] failed due to:Data Loading Failed
All Keys are not parsed in DEVICE_NEIGHBOR_METADATA
dict_keys(['xxxxx', 'xxxxx-lc02-ASIC00', 'xxxxx-lc02-ASIC01', 'xxxxx-lc02-ASIC02', 'xxxxx-sup00', 'xxxxx-sup00-ASIC00', 'xxxxx-sup00-ASIC01', 'xxxxx-sup00-ASIC04', 'xxxxx-sup00-ASIC05', 'xxxxx-sup00-ASIC08', 'xxxxx-sup00-ASIC09', 'xxxxx-sup00-ASIC10', 'xxxxx-sup00-ASIC11', 'xxxxx-sup00-ASIC12', 'xxxxx-sup00-ASIC13'])
exceptionList:["'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'"]

After fix:

echo '[]' | sudo config apply-patch /dev/stdin
Patch Applier: localhost: Patch application starting.
Patch Applier: localhost: Patch: []
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 Applier: asic0: Patch application starting.
Patch Applier: asic0: Patch: []
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
Patch Applier: asic0: validating target config does not have empty tables,
                            since they do not show up in ConfigDb.
Patch Applier: asic0: sorting patch updates.
Patch Applier: The asic0 patch was converted into 0 changes.
Patch Applier: asic0: applying 0 changes in order.
Patch Applier: asic0: verifying patch updates are reflected on ConfigDB.
Patch Applier: asic0 patch application completed.
Patch Applier: asic1: Patch application starting.
Patch Applier: asic1: Patch: []
Patch Applier: asic1 getting current config db.
Patch Applier: asic1: simulating the target full config after applying the patch.
Patch Applier: asic1: validating all JsonPatch operations are permitted on the specified fields
Patch Applier: asic1: validating target config does not have empty tables,
                            since they do not show up in ConfigDb.
Patch Applier: asic1: sorting patch updates.
Patch Applier: The asic1 patch was converted into 0 changes.
Patch Applier: asic1: applying 0 changes in order.
Patch Applier: asic1: verifying patch updates are reflected on ConfigDB.
Patch Applier: asic1 patch application completed.
Patch Applier: asic2: Patch application starting.
Patch Applier: asic2: Patch: []
Patch Applier: asic2 getting current config db.
Patch Applier: asic2: simulating the target full config after applying the patch.
Patch Applier: asic2: validating all JsonPatch operations are permitted on the specified fields
Patch Applier: asic2: validating target config does not have empty tables,
                            since they do not show up in ConfigDb.
Patch Applier: asic2: sorting patch updates.
Patch Applier: The asic2 patch was converted into 0 changes.
Patch Applier: asic2: applying 0 changes in order.
Patch Applier: asic2: verifying patch updates are reflected on ConfigDB.
Patch Applier: asic2 patch application completed.
Patch applied successfully.

UT updated.

What I did:

This PR is continuation of  sonic-net/sonic-buildimage#19094 where `slice_type` was added for DEVICE_METADATA. In this PR we are adding this DEVICE_NEIGHBOR_METADATA also.

Why I did:

Without this change Yang Validation fails when doing `config apply-patch` if this field is present in DEVICE_NEIGHBOR_METADATA

ADO: 32574645

How I verify:

Manual Verification

Before fix:

```
echo '[]' | sudo config apply-patch /dev/stdin
sonic_yang(3):All Keys are not parsed in DEVICE_NEIGHBOR_METADATA
dict_keys(['xxxxx', 'xxxxx-lc02-ASIC00', 'xxxxx-lc02-ASIC01', 'xxxxx-lc02-ASIC02', 'xxxxx-sup00', 'xxxxx-sup00-ASIC00', 'xxxxx-sup00-ASIC01', 'xxxxx-sup00-ASIC04', 'xxxxx-sup00-ASIC05', 'xxxxx-sup00-ASIC08', 'xxxxx-sup00-ASIC09', 'xxxxx-sup00-ASIC10', 'xxxxx-sup00-ASIC11', 'xxxxx-sup00-ASIC12', 'xxxxx-sup00-ASIC13'])
sonic_yang(3):exceptionList:["'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'"]
sonic_yang(3):Data Loading Failed:All Keys are not parsed in DEVICE_NEIGHBOR_METADATA
dict_keys(['xxxxx', 'xxxxx-lc02-ASIC00', 'xxxxx-lc02-ASIC01', 'xxxxx-lc02-ASIC02', 'xxxxx-sup00', 'xxxxx-sup00-ASIC00', 'xxxxx-sup00-ASIC01', 'xxxxx-sup00-ASIC04', 'xxxxx-sup00-ASIC05', 'xxxxx-sup00-ASIC08', 'xxxxx-sup00-ASIC09', 'xxxxx-sup00-ASIC10', 'xxxxx-sup00-ASIC11', 'xxxxx-sup00-ASIC12', 'xxxxx-sup00-ASIC13'])
exceptionList:["'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'"]
Failed to apply patch due to: Validate json patch: [] failed due to:Data Loading Failed
All Keys are not parsed in DEVICE_NEIGHBOR_METADATA
dict_keys(['xxxxx', 'xxxxx-lc02-ASIC00', 'xxxxx-lc02-ASIC01', 'xxxxx-lc02-ASIC02', 'xxxxx-sup00', 'xxxxx-sup00-ASIC00', 'xxxxx-sup00-ASIC01', 'xxxxx-sup00-ASIC04', 'xxxxx-sup00-ASIC05', 'xxxxx-sup00-ASIC08', 'xxxxx-sup00-ASIC09', 'xxxxx-sup00-ASIC10', 'xxxxx-sup00-ASIC11', 'xxxxx-sup00-ASIC12', 'xxxxx-sup00-ASIC13'])
exceptionList:["'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'"]
Usage: config apply-patch [OPTIONS] PATCH_FILE_PATH
Try "config apply-patch -h" for help.

Error: Validate json patch: [] failed due to:Data Loading Failed
All Keys are not parsed in DEVICE_NEIGHBOR_METADATA
dict_keys(['xxxxx', 'xxxxx-lc02-ASIC00', 'xxxxx-lc02-ASIC01', 'xxxxx-lc02-ASIC02', 'xxxxx-sup00', 'xxxxx-sup00-ASIC00', 'xxxxx-sup00-ASIC01', 'xxxxx-sup00-ASIC04', 'xxxxx-sup00-ASIC05', 'xxxxx-sup00-ASIC08', 'xxxxx-sup00-ASIC09', 'xxxxx-sup00-ASIC10', 'xxxxx-sup00-ASIC11', 'xxxxx-sup00-ASIC12', 'xxxxx-sup00-ASIC13'])
exceptionList:["'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'", "'slice_type'"]
```

After fix:

```
echo '[]' | sudo config apply-patch /dev/stdin
Patch Applier: localhost: Patch application starting.
Patch Applier: localhost: Patch: []
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 Applier: asic0: Patch application starting.
Patch Applier: asic0: Patch: []
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
Patch Applier: asic0: validating target config does not have empty tables,
                            since they do not show up in ConfigDb.
Patch Applier: asic0: sorting patch updates.
Patch Applier: The asic0 patch was converted into 0 changes.
Patch Applier: asic0: applying 0 changes in order.
Patch Applier: asic0: verifying patch updates are reflected on ConfigDB.
Patch Applier: asic0 patch application completed.
Patch Applier: asic1: Patch application starting.
Patch Applier: asic1: Patch: []
Patch Applier: asic1 getting current config db.
Patch Applier: asic1: simulating the target full config after applying the patch.
Patch Applier: asic1: validating all JsonPatch operations are permitted on the specified fields
Patch Applier: asic1: validating target config does not have empty tables,
                            since they do not show up in ConfigDb.
Patch Applier: asic1: sorting patch updates.
Patch Applier: The asic1 patch was converted into 0 changes.
Patch Applier: asic1: applying 0 changes in order.
Patch Applier: asic1: verifying patch updates are reflected on ConfigDB.
Patch Applier: asic1 patch application completed.
Patch Applier: asic2: Patch application starting.
Patch Applier: asic2: Patch: []
Patch Applier: asic2 getting current config db.
Patch Applier: asic2: simulating the target full config after applying the patch.
Patch Applier: asic2: validating all JsonPatch operations are permitted on the specified fields
Patch Applier: asic2: validating target config does not have empty tables,
                            since they do not show up in ConfigDb.
Patch Applier: asic2: sorting patch updates.
Patch Applier: The asic2 patch was converted into 0 changes.
Patch Applier: asic2: applying 0 changes in order.
Patch Applier: asic2: verifying patch updates are reflected on ConfigDB.
Patch Applier: asic2 patch application completed.
Patch applied successfully.

```

UT updated.
@mssonicbld
Copy link
Collaborator Author

Original PR: sonic-net/sonic-buildimage#22445

@mssonicbld
Copy link
Collaborator Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld mssonicbld merged commit e64ec58 into Azure:202405 May 1, 2025
8 of 16 checks passed
bingwang-ms pushed a commit that referenced this pull request Jan 16, 2026
…omatically (#24233)

#### Why I did it
src/sonic-swss-common
```
* 130d8b6 - (HEAD -> master, origin/master, origin/HEAD) Add chassis db. (#1085) (67 minutes ago) [dypet]
* 66e437a - Fix mocktests for buster builds (#1087) (3 days ago) [prabhataravind]
* 32b14a4 - Update static database_config.json in swsscommon (#1086) (4 days ago) [prabhataravind]
* c253917 - Add pop batch size support for ZMQ Consumer (#1084) (5 days ago) [Vivek]
* 4fea06e - [sonic-db-cli] Add flag to make cli calls to container databases (#1070) (6 days ago) [Connor Roos]
```
#### How I did it
#### How to verify it
#### Description for the changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant