Skip to content

NOS-12728: Added create-only extension to YANG - #234

Open
bradleymoon-nexthop wants to merge 1 commit into
sonic-net:masterfrom
nexthop-ai:nos-12728-move-create-only-to-yang
Open

NOS-12728: Added create-only extension to YANG#234
bradleymoon-nexthop wants to merge 1 commit into
sonic-net:masterfrom
nexthop-ai:nos-12728-move-create-only-to-yang

Conversation

@bradleymoon-nexthop

Copy link
Copy Markdown

PR Description: Add create-only Extension to YANG Models

Why I did it

To support dynamic discovery of immutable (create-only) database fields in the Generic Config Updater (GCU), we need a standardized way to annotate fields directly in the SONiC YANG models. Previously, CreateOnlyFilter in sonic-utilities relied on hardcoded lists of immutable fields (such as port lanes). This hardcoding makes the system difficult to maintain, scale, and extend as new tables or create-only attributes are introduced.

By defining an ext:create-only extension in sonic-extension.yang, we establish a clean, schema-driven approach. The GCU can compile these schemas using libyang and dynamically identify immutable fields during patch operations.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jul 29, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: bradleymoon-nexthop / name: Bradley Konane Moon (eb3d205)

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@bradleymoon-nexthop
bradleymoon-nexthop force-pushed the nos-12728-move-create-only-to-yang branch 2 times, most recently from 133d0fb to eb3d205 Compare July 29, 2026 18:55
@mssonicbld

Copy link
Copy Markdown

/azp run

2 similar comments
@mssonicbld

Copy link
Copy Markdown

/azp run

@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

2 similar comments
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@kwangsuk

Copy link
Copy Markdown
Contributor

The PR description explains why ext:create-only is needed, but I'm unclear on the model-consumption path. How does this new extension become available to GCU at runtime?

SONiC currently has YANG models in both sonic-mgmt-common and sonic-buildimage/src/sonic-yang-models. My understanding is that the former is primarily used by CVL/libyang for OpenConfig-to-SONiC model mapping, while the latter is the schema source consumed by GCU/libyang.

Please check this:
https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-yang-models/yang-templates/sonic-extension.yang.j2

@bradleymoon-nexthop

Copy link
Copy Markdown
Author

The PR description explains why ext:create-only is needed, but I'm unclear on the model-consumption path. How does this new extension become available to GCU at runtime?

SONiC currently has YANG models in both sonic-mgmt-common and sonic-buildimage/src/sonic-yang-models. My understanding is that the former is primarily used by CVL/libyang for OpenConfig-to-SONiC model mapping, while the latter is the schema source consumed by GCU/libyang.

Please check this: https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-yang-models/yang-templates/sonic-extension.yang.j2

Hi @kwangsuk, yes you are completely correct. I had anticipated also having companion PRs in sonic-utilities and sonic-buildimage, but I'm currently resolving some CI errors in Nexthop's private fork before I upstream. I will update the PR description and comment accordingly once these are posted.

@bradleymoon-nexthop

bradleymoon-nexthop commented Jul 30, 2026

Copy link
Copy Markdown
Author

@kwangsuk This PR has the implementation where this annotation will be consumed: sonic-net/sonic-utilities#4733. Could I request a review on this one too?

I put my annotations in the YANG models here: sonic-net/sonic-buildimage#28737

- Move hardcoded create-only properties to formal YANG schema annotations.
- Resolve Generic Config Updater dependency on custom extension definition.

Signed-off-by: Bradley Konane Moon <bradleymoon@nexthop.ai>
@bradleymoon-nexthop
bradleymoon-nexthop force-pushed the nos-12728-move-create-only-to-yang branch from eb3d205 to d02c2a0 Compare August 3, 2026 16:36
@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

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