sonic-yang-models: add POLICER_ACTION leafref to ACL_RULE#27859
Open
AnantKishorSharma wants to merge 1 commit into
Open
sonic-yang-models: add POLICER_ACTION leafref to ACL_RULE#27859AnantKishorSharma wants to merge 1 commit into
AnantKishorSharma wants to merge 1 commit into
Conversation
Add a POLICER_ACTION leaf to ACL_RULE in the sonic-acl YANG model as a leafref to /sonic-policer/POLICER/POLICER_LIST/name, so that an ACL rule with a policer action passes config validation (config reload, GCU, load_minigraph). Without it, a CONFIG_DB rule carrying POLICER_ACTION is rejected at YANG validation before reaching orchagent. Add positive (valid policer reference) and negative (non-existent policer -> LeafRef error) test cases. Signed-off-by: AnantKishorSharma <AnantKishorSharma@users.noreply.github.com>
532a167 to
ab53324
Compare
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
This PR has backport request for branch(es): 202511,202605. ---Powered by SONiC BuildBot
|
This file contains hidden or 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
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
A
CONFIG_DBACL rule cannot carry a policer action.ACL_RULEin thesonic-aclYANG model has no policer leaf, so a rule referencing a policer is rejected at YANG validation (config reload, GCU,load_minigraph) before it ever reaches orchagent. This adds the model support that the SET_POLICER ACL action (sonic-swss companion PR) needs to be configurable fromconfig_db.json.Work item tracking
How I did it
src/sonic-yang-models/yang-templates/sonic-acl.yang.j2: importsonic-policerand addleaf POLICER_ACTIONtoACL_RULEas a leafref to/policer:sonic policer/policer:POLICER/policer:POLICER_LIST/policer:name(modeled on the existingMIRROR_INGRESS_ACTIONleafref to mirror sessions).ACL_RULE_WITH_VALID_POLICER_ACTION(rule + matchingPOLICERentry) and negativeACL_RULE_WITH_INVALID_POLICER_ACTION(non-existent policer ->LeafReferror) intests/yang_model_tests/tests/acl.jsonand.../tests_config/acl.json.How to verify it
cd src/sonic-yang-models && pytest tests/(yang_model_tests).pyangagainst the renderedsonic-policer.yang(exit 0).Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
sonic-yang-models: add POLICER_ACTION leafref to ACL_RULE (policer action support).
Link to config_db schema for YANG module changes
https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md#acl_rule
A picture of a cute animal (not mandatory but encouraged)