[yang] Add sonic-monitor-link-group model#27004
Open
srodd-nexthop wants to merge 6 commits into
Open
Conversation
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This was referenced Apr 27, 2026
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
a3e5514 to
d5a8e79
Compare
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Open
6 tasks
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Adds a YANG model for the Monitor Link Group feature, defining the CONFIG_DB schema for the MONITOR_LINK_GROUP table. The model defines a single list (MONITOR_LINK_GROUP_LIST) keyed by group name, with leaf-list uplinks/downlinks of interface names and the startup-delay / min-uplinks threshold parameters. Tests: - tests/yang_model_tests/tests/monitor_link_group.json and tests_config/monitor_link_group.json validate the model against a representative config. - A sample config is added to tests/files/sample_config_db.json. Companion PRs and motivation: see the Monitor Link Group HLD in sonic-net/SONiC. Signed-off-by: Satishkumar Rodd <srodd@nexthop.ai>
…nk-up-delay Remove TAM/TAM_COLLECTOR/TAM_FLOW_GROUP/TAM_SESSION entries from sample_config_db.json that leaked in from an unrelated feature. Rename startup-delay to link-up-delay throughout all monitor-link-group test fixtures to match the YANG leaf name. Signed-off-by: Satishkumar Rodd <srodd@nexthop.ai>
An interface cannot be configured as both uplink and downlink in the same monitor link group. Enforce this at config load time with a YANG must constraint on MONITOR_LINK_GROUP_LIST. Signed-off-by: Satishkumar Rodd <srodd@nexthop.ai>
R-4 (terminology rename), R-7 (drop empty-string defaults), R-10 (extend must constraint). YANG model now uses monitored-links / managed-links / min-monitored-links with adjusted must constraints: must "not(monitored-links[. = current()/managed-links])" (disjointness) must "min-monitored-links <= count(monitored-links[. != ''])" (R-10 bound) The empty-string `default ""` on the two leaf-lists is dropped (R-7, D-D). Revision bumped to 2026-05-12. Test files updated to exercise the renamed leaf-lists. Signed-off-by: Satishkumar Rodd <srodd@nexthop.ai>
Signed-off-by: Satishkumar Rodd <srodd@nexthop.ai>
2efc778 to
6132db1
Compare
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
The leaf-list union for monitored-links/managed-links had three branches: two leafrefs plus a fallback string with pattern "" (empty regex). The empty pattern matches only the empty string, so every Ethernet/PortChannel name fell through all three branches under strict-mode unit tests where PORT/PORTCHANNEL tables are not in scope. Drop the empty-pattern branch so leafref-only unions enforce that interface names exist in PORT or PORTCHANNEL, and add the matching PORT_LIST/PORTCHANNEL_LIST entries to each test fixture in tests_config/monitor_link_group.json. link-up-delay and min-monitored-links were declared with no pattern, so the *_PATTERN/*_NEGATIVE invalid tests for them could never trigger a pattern failure. Add a numeric [0-9]+ pattern to both. group_name had a custom error-message that replaced the libyang default "Unsatisfied pattern" text. The YANG test framework hard-codes that substring in its Pattern matcher, so the GROUP_NAME_PATTERN test failed with the wrong text. Drop the custom message. Flip eStrKey from Pattern to LeafRef on the six interface-list invalid tests so the new leafref-only union produces matching expected errors. Signed-off-by: Satishkumar Rodd <srodd@nexthop.ai>
Collaborator
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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.
What I did
Add a YANG model for the Monitor Link Group feature, defining the CONFIG_DB schema for the
MONITOR_LINK_GROUPtable.Files changed:
yang-models/sonic-monitor-link-group.yangsetup.pytests/yang_model_tests/tests/monitor_link_group.jsontests/yang_model_tests/tests_config/monitor_link_group.jsontests/files/sample_config_db.jsonWhy I did it
The Monitor Link Group feature requires a YANG model for CONFIG_DB schema validation on
config load/config reloadand for GCU (generic config updater) compatibility.Design
The model defines a single list
MONITOR_LINK_GROUP_LISTkeyed bygroup_name, with:uplinks/downlinks: leaf-list with union of leafrefs tosonic-port:PORT_LISTandsonic-portchannel:PORTCHANNEL_LIST, plus an empty-string option. Validates that configured interfaces exist.min-uplinks:type string, default"1"— minimum operational uplinks for the group to be UPlink-up-delay:type string, default"0"— seconds to wait after threshold is met before bringing downlinks updescription: optional stringmin-uplinksandlink-up-delayusetype string(notuint32) to match how SONiC CONFIG_DB stores all numeric values as strings, which avoids a GCU post-apply verification mismatch between integer patch values and string DB values.How I verified it
Companion PRs
show monitor-linkCLIHLD: sonic-net/SONiC#2308
swss: sonic-net/sonic-swss#4523
Show: sonic-net/sonic-utilities#4497
swss-common: sonic-net/sonic-swss-common#1181