Skip to content

Added Yang Support for attribute slice_type to DEVICE_METADATA#19094

Merged
rlhui merged 16 commits intosonic-net:masterfrom
abdosi:master-2
May 31, 2024
Merged

Added Yang Support for attribute slice_type to DEVICE_METADATA#19094
rlhui merged 16 commits intosonic-net:masterfrom
abdosi:master-2

Conversation

@abdosi
Copy link
Contributor

@abdosi abdosi commented May 28, 2024

What I did:
Added Yang model support for new attribute in DEVICE_METADATA of slice_type

Why I did:

For Spine Router we use this metadata to run-time decide the BGP template to use.

How I verify:

  • Manual Verification
  • UT added

@abdosi abdosi requested a review from qiluo-msft as a code owner May 28, 2024 01:24
@abdosi abdosi requested a review from arlakshm May 28, 2024 01:24
@gechiang gechiang added the Chassis for 202205 branch PRs needed for 202205 branch in msft repo label May 28, 2024
@abdosi abdosi changed the title Added Support to Parse Associated Slice in minigraph and add as config to DEVICE_METADATA Added Yang Support for attribute slice_type to DEVICE_METADATA May 31, 2024
@arlakshm arlakshm added the YANG YANG model related changes label May 31, 2024
@rlhui rlhui merged commit d912366 into sonic-net:master May 31, 2024
lguohan pushed a commit that referenced this pull request Jun 6, 2024
…minigraph (#19160)

What I did:
Added support to parse "AssociatedSliceStr" attribute of minigraph and save as slice_type as part of DEVICE_METADATA for Chassis Device Type.
Yang model are done as part of : #19094

Also as part of this change fixed issue of current device not selected correctly as asic_hostname not being correct.

Why I did:
In BGP Templates we need to take different action based on this attribute.

Signed-off-by: Abhishek Dosi <[email protected]>
@abdosi abdosi removed the Chassis for 202205 branch PRs needed for 202205 branch in msft repo label Jun 6, 2024
mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this pull request Jun 12, 2024
…minigraph (sonic-net#19160)

What I did:
Added support to parse "AssociatedSliceStr" attribute of minigraph and save as slice_type as part of DEVICE_METADATA for Chassis Device Type.
Yang model are done as part of : sonic-net#19094

Also as part of this change fixed issue of current device not selected correctly as asic_hostname not being correct.

Why I did:
In BGP Templates we need to take different action based on this attribute.

Signed-off-by: Abhishek Dosi <[email protected]>
mssonicbld pushed a commit that referenced this pull request Jun 15, 2024
…minigraph (#19160)

What I did:
Added support to parse "AssociatedSliceStr" attribute of minigraph and save as slice_type as part of DEVICE_METADATA for Chassis Device Type.
Yang model are done as part of : #19094

Also as part of this change fixed issue of current device not selected correctly as asic_hostname not being correct.

Why I did:
In BGP Templates we need to take different action based on this attribute.

Signed-off-by: Abhishek Dosi <[email protected]>
rlhui pushed a commit that referenced this pull request Apr 28, 2025
This PR is continuation of #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
---------

Signed-off-by: Abhishek Dosi <[email protected]>
mssonicbld added a commit to mssonicbld/sonic-buildimage-msft that referenced this pull request Apr 30, 2025
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 added a commit to Azure/sonic-buildimage-msft that referenced this pull request May 1, 2025
… model (#1070)

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 added a commit to mssonicbld/sonic-buildimage-msft that referenced this pull request Jul 9, 2025
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 added a commit to Azure/sonic-buildimage-msft that referenced this pull request Jul 9, 2025
… model (#1331)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

YANG YANG model related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants