8000 YANG: remove uses clause handling, now part of sonic-yang-mgmt by bradh352 · Pull Request #3814 · sonic-net/sonic-utilities · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

YANG: remove uses clause handling, now part of sonic-yang-mgmt #3814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 27, 2025

Conversation

bradh352
Copy link
Contributor
@bradh352 bradh352 commented Mar 21, 2025

What I did

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't exist. No need to have this complex handling in sonic-utilities.

Depends on sonic-net/sonic-buildimage#21907
Fixes sonic-net/sonic-buildimage#22382

How I did it

Besides removal of the code, the only test case changes are the removal of the 'grouping' clause as it is specific to 'uses' which is not relevant and some minor reordering of expected responses.

How to verify it

Run tests/cli_autogen_yang_parser_test.py after applying both this PR and sonic-net/sonic-buildimage#21907

Previous command output (if the output of a command-line utility has changed)

N/A

New command output (if the output of a command-line utility has changed)

N/A

Signed-off-by: Brad House (@bradh352)

@mssonicbld
Copy link
Collaborator

/azp run

Copy link
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link
Azure Pipelines successfully started running 1 pipeline(s).

bradh352 added a commit to bradh352/sonic-utilities that referenced this pull request Mar 21, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
Copy link
Contributor
@kalash-nexthop kalash-nexthop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just leaving a comment here that I accidentally hit approve button. Hopefully this will be enough for "unapproving" this. Although it doesn't matter since I am not an official reviewer anyway.

github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Mar 22, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Mar 23, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Mar 25, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Mar 26, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
@gechiang
Copy link
Contributor

@adyeung , please help tag the YANG and UMF group.
Thanks!

@lguohan lguohan added the yang label Mar 26, 2025
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Mar 31, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Apr 1, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Apr 4, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Apr 11, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Apr 15, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Apr 16, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Apr 18, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Apr 22, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Apr 23, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Apr 24, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Apr 29, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Apr 30, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request May 3, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
bradh352 added a commit to bradh352/sonic-utilities that referenced this pull request May 3, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)

fix formatting for lines touched (but not caused by me)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Jun 17, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
@qiluo-msft qiluo-msft requested a review from Copilot June 19, 2025 06:28
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the legacy handling of the YANG 'uses' clause from sonic-utilities in favor of integration with sonic-yang-mgmt. Key changes include:

  • Eliminating the "group" attribute and related grouping logic from test dictionaries.
  • Removing the on_uses function and associated parameters from the YANG parser.
  • Adjusting function signatures and docstrings to reflect the removal of grouping support.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/cli_autogen_input/yang_parser_test/assert_dictionaries.py Removed "group" key from expected test output and updated key names
sonic_cli_gen/yang_parser.py Removed usage of grouping in YANG parsing logic and updated function signatures/docstrings accordingly
Comments suppressed due to low confidence (3)

sonic_cli_gen/yang_parser.py:334

  • The docstring and inline comments for on_leaf should be updated to remove references to 'grouping_name' since it is no longer used.
            'is-mandatory': get_mandatory(leaf)}

tests/cli_autogen_input/yang_parser_test/assert_dictionaries.py:390

  • [nitpick] Verify that the renaming of keys (such as 'GR_1_LEAF_2' and related changes) in the expected dictionaries aligns with the output produced by sonic-yang-mgmt.
                        "name": "GR_1_LEAF_2",

sonic_cli_gen/yang_parser.py:39

  • Ensure that the removal of the 'group' field from the object entity construction in on_object_entity does not break downstream consumers that might expect this field.
                            'is-mandatory': False

github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Jun 20, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Jun 21, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
qiluo-msft pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Jun 24, 2025
When a uses clause imports a grouping, it was only processing leaf entries and ignoring leaf-list and choice clauses. That means that for instance in bgp route maps, route_map_in and route_map_out validations would fail.

Honoring the uses refine clause is now also honored which is depended upon in sonic-utilities.

This now precompiles the uses clause and integrates it as if the uses clause was not part of the schema as multiple end users were having to do this additional processing.

This fixes that behavior and adds test cases to ensure it doesn't regress in the future.

This is the proper fix, replacing #21078 that just worked around it.

Removal of uses logic in sonic-utilities here: sonic-net/sonic-utilities#3814

Fixes #22382

Work item tracking
Microsoft ADO (number only):
How I did it
Added leaf-list lookup.

How to verify it
See test cases pass

Description for the changelog
sonic-yang-mgmt: uses clause with leaf-list, choice not honored
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Jun 24, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
@bradh352 bradh352 force-pushed the bradh352/uses-removed branch from 4d3fc5a to bcea496 Compare June 24, 2025 11:09
@mssonicbld
Copy link
Collaborator

/azp run

Copy link
Azure Pipelines successfully started running 1 pipeline(s).

@bradh352
Copy link
Contributor Author

@qiluo-msft Now that sonic-net/sonic-buildimage#21907 is merged this ticket needs to be merged. I just rebased against current master to force a rebuild.

@bradh352 bradh352 requested a review from kalash-nexthop June 24, 2025 11:10
@bradh352
Copy link
Contributor Author

@qiluo-msft Now that sonic-net/sonic-buildimage#21907 is merged this ticket needs to be merged. I just rebased against current master to force a rebuild.

I forced the rebuild too early, the new sonic-buildimage assets aren't available yet so tests fail. Will retry in a few hours.

github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Jun 25, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Jun 26, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Jun 26, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)

fix formatting for lines touched (but not caused by me)
bradh352 added 2 commits June 25, 2025 22:14
sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
@bradh352 bradh352 force-pushed the bradh352/uses-removed branch from bcea496 to b1ef321 Compare June 26, 2025 02:15
@mssonicbld
Copy link
Collaborator

/azp run

Copy link
Azure Pipelines successfully started running 1 pipeline(s).

@bradh352
Copy link
Contributor Author

@qiluo-msft all test pass now since the artifacts from the merged PR sonic-net/sonic-buildimage#21907 are available.

Can this be merged?

@bradh352
Copy link
Contributor Author

FYI, all PRs are failing tests in sonic-utilities due to this not being merged!

github-actions bot pushed a commit to bradh352/sonic-utilities that referenced this pull request Jun 27, 2025
…nic-net#3814)

sonic-yang-mgmt now integrates uses clauses as if a uses clause didn't
exist. No need to have this complex handling in sonic-utilities.

Besides removal of the code, the only test case changes are the removal
of the 'grouping' clause as it is specific to 'uses' which is not relevant
and some minor reordering of expected responses.

Signed-off-by: Brad House (@bradh352)
@qiluo-msft qiluo-msft dismissed kalash-nexthop’s stale review June 27, 2025 21:32

By words "Just leaving a comment here that I accidentally hit approve button. Hopefully this will be enough for "unapproving" this. Although it doesn't matter since I am not an official reviewer anyway."
Just dismissing "request changes" status.

@qiluo-msft qiluo-msft merged commit be72304 into sonic-net:master Jun 27, 2025
7 checks passed
@yejianquan
Copy link
Contributor
yejianquan commented Jun 28, 2025

The depenent PR sonic-net/sonic-buildimage#21907 is marked as 202505 not needed, removing 202505 request label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: sonic-yang-mgmt uses clause evaluation ignores leaf-list and refine
10 participants
0