-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
libyang: upgrade to v3 step 2 -- port sonic-yang-models test cases #21719
Open
bradh352
wants to merge
7
commits into
sonic-net:master
Choose a base branch
from
bradh352:bradh352/libyang3-pr1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/azp run Azure.sonic-buildimage |
Azure Pipelines successfully started running 1 pipeline(s). |
3d01af7
to
bc318a9
Compare
/azp run Azure.sonic-buildimage |
Azure Pipelines successfully started running 1 pipeline(s). |
bradh352
added a commit
to bradh352/sonic-buildimage
that referenced
this pull request
Feb 12, 2025
This was referenced Feb 12, 2025
bradh352
added a commit
to bradh352/sonic-buildimage
that referenced
this pull request
Feb 13, 2025
bc318a9
to
d7b6de2
Compare
/azp run Azure.sonic-buildimage |
Azure Pipelines successfully started running 1 pipeline(s). |
bradh352
added a commit
to bradh352/sonic-buildimage
that referenced
this pull request
Feb 13, 2025
bradh352
added a commit
to bradh352/sonic-buildimage
that referenced
this pull request
Feb 13, 2025
bradh352
added a commit
to bradh352/sonic-buildimage
that referenced
this pull request
Feb 13, 2025
bradh352
added a commit
to bradh352/sonic-buildimage
that referenced
this pull request
Feb 13, 2025
d7b6de2
to
652397b
Compare
/azp run Azure.sonic-buildimage |
Azure Pipelines successfully started running 1 pipeline(s). |
652397b
to
7d41fcd
Compare
/azp run Azure.sonic-buildimage |
Azure Pipelines successfully started running 1 pipeline(s). |
bradh352
added a commit
to bradh352/sonic-buildimage
that referenced
this pull request
Feb 16, 2025
bradh352
added a commit
to bradh352/sonic-buildimage
that referenced
this pull request
Feb 16, 2025
bradh352
added a commit
to bradh352/sonic-buildimage
that referenced
this pull request
Feb 16, 2025
7d41fcd
to
395469b
Compare
/azp run Azure.sonic-buildimage |
Azure Pipelines successfully started running 1 pipeline(s). |
bradh352
added a commit
to bradh352/sonic-buildimage
that referenced
this pull request
Feb 17, 2025
bradh352
added a commit
to bradh352/sonic-buildimage
that referenced
this pull request
Feb 17, 2025
This was referenced Feb 19, 2025
bradh352
added a commit
to bradh352/sonic-buildimage
that referenced
this pull request
Feb 19, 2025
395469b
to
97a95e4
Compare
/azp run Azure.sonic-buildimage |
Azure Pipelines successfully started running 1 pipeline(s). |
97a95e4
to
2a00938
Compare
/azp run Azure.sonic-buildimage |
Azure Pipelines successfully started running 1 pipeline(s). |
It looks like there is a behavior difference between libyang1 and libyang3 where a default value of 0 was actually treated the same as not set, so now the `POLICER_PIR_WITHOUT_CIR` test case is failing with: ``` ERROR YANG-TEST:test_yang_model.py:303 POLICER_PIR_WITHOUT_CIR: Mismatch ["pir can't be configured without cir."] and failed to parse data tree: cbs can't be configured without cir.: Data path: /sonic-policer:sonic-policer/POLICER/POLICER_LIST[name='e3policer']/cbs ``` Get rid of this bogus default.
RFC 7950 defines an ordered-by clause when a list needs to maintain its order: https://datatracker.ietf.org/doc/html/rfc7950#section-7.7.7 The default ordering is "system", which means the user specified order doesn't need to be preserved. Prior to this libyang commit there was no difference between system and user ordering: CESNET/libyang@6cf1d16 Since SONiC depends on list ordering being maintained, either explicitly due to the order actually mattering, or implicitly due to the reverse translation performed during config valiation, we need to tag all leaf-list references as `ordered-by user`.
For some reason after upgrading to libyang3, tests started throwing these errors: ``` ------------------- Test 247: DEVICE_METADATA DEFAULT VALUE FOR BGP_STATUS FIELD.--------------------- INFO YANG-TEST:test_yang_model.py:193 Verify xpath: /sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname INFO YANG-TEST:test_yang_model.py:197 Verify dnode: /sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname INFO YANG-TEST:test_yang_model.py:200 Verify path value sonic-device_metadata:default_bgp_status is up in {'sonic-device_metadata:hostname': 'DUT-ASW', 'sonic-device_metadata:platform': 'Stone-DX010', 'sonic-device_metadata:default_pfcwd_status': 'disable', 'sonic-device_metadata:bgp_asn': 65000, 'sonic-device_metadata:frr_mgmt_framework_config': False, 'sonic-device_metadata:synchronous_mode': 'enable', 'sonic-device_metadata:yang_config_validation': 'disable', 'sonic-device_metadata:suppress-fib-pending': 'disabled', 'sonic-device_metadata:timezone': 'UTC', 'sonic-device_metadata:nexthop_group': 'disabled'} ERROR YANG-TEST:test_yang_model.py:29 Exception >assert 'sonic-device_metadata:default_bgp_status' in {'sonic-device_metadata:bgp_asn': 65000, 'sonic-device_metadata:default_pfcwd_status': 'disable', 'sonic-device_metadata:frr_mgmt_framework_config': False, 'sonic-device_metadata:hostname': 'DUT-ASW', ...}< in /sonic/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py:201 ERROR YANG-TEST:test_yang_model.py:29 Exception >DEVICE_METADATA_DEFAULT_BGP_STATUS: Mismatch ['verified'] and < in /sonic/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py:234 INFO YANG-TEST:test_yang_model.py:238 DEVICE_METADATA DEFAULT VALUE FOR BGP_STATUS FIELD. Failed INFO YANG-TEST:test_yang_model.py:159 ------------------- Test 248: DEVICE_METADATA DEFAULT VALUE FOR DOCKER_ROUTING_CONFIG_MODE FIELD.--------------------- INFO YANG-TEST:test_yang_model.py:193 Verify xpath: /sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname INFO YANG-TEST:test_yang_model.py:197 Verify dnode: /sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname INFO YANG-TEST:test_yang_model.py:200 Verify path value sonic-device_metadata:docker_routing_config_mode is unified in {'sonic-device_metadata:hostname': 'DUT-CSW', 'sonic-device_metadata:platform': 'Stone-DX010', 'sonic-device_metadata:default_pfcwd_status': 'disable', 'sonic-device_metadata:bgp_asn': 65001, 'sonic-device_metadata:frr_mgmt_framework_config': False, 'sonic-device_metadata:synchronous_mode': 'enable', 'sonic-device_metadata:yang_config_validation': 'disable', 'sonic-device_metadata:suppress-fib-pending': 'disabled', 'sonic-device_metadata:timezone': 'UTC', 'sonic-device_metadata:nexthop_group': 'disabled'} ERROR YANG-TEST:test_yang_model.py:29 Exception >assert 'sonic-device_metadata:docker_routing_config_mode' in {'sonic-device_metadata:bgp_asn': 65001, 'sonic-device_metadata:default_pfcwd_status': 'disable', 'sonic-device_metadata:frr_mgmt_framework_config': False, 'sonic-device_metadata:hostname': 'DUT-CSW', ...}< in /sonic/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py:201 ERROR YANG-TEST:test_yang_model.py:29 Exception >DEVICE_METADATA_DEFAULT_DOCKER_ROUTING_CONFIG_MODE: Mismatch ['verified'] and < in /sonic/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py:234 INFO YANG-TEST:test_yang_model.py:238 DEVICE_METADATA DEFAULT VALUE FOR DOCKER_ROUTING_CONFIG_MODE FIELD. Failed INFO YANG-TEST:test_yang_model.py:159 ``` The "fix" is to simply mov those 2 leaf nodes lower in the schema and it fixes the issue. This probably needs to be reported to libyang as the schema appears valid.
2a00938
to
f09dbeb
Compare
/azp run Azure.sonic-buildimage |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why I did it
libyang3 porting.
Port of sonic-yang-model test cases
NOTE: this PR actually includes (as a squashed commits) PR #21679. Please review the individual commits (skipping the squashed commit) otherwise this may seem too large/confusing.
Depends PR #21679
Work item tracking
How I did it
Ported code
How to verify it
See test cases succeed in CI/CD
Which release branch to backport (provide reason below if selected)
N/A
Description for the changelog
libyang: upgrade to v3 step 2 - port sonic-yang-models test cases
Link to config_db schema for YANG module changes
N/A
A picture of a cute animal (not mandatory but encouraged)
Signed-off-by: Brad House (@bradh352)