[YANG] Support controlled_device attribute in CONSOLE_SWITCH#25131
Conversation
Why I did it This PR supports [HLD](sonic-net/SONiC#2178) To support controlled_device attribute in CONSOLE_SWITCH table to enable/disable the controlled device feature on SONiC console switch. Sample config: "CONSOLE_SWITCH": { "console_mgmt": { "enabled": "yes" }, "controlled_device": { "enabled": "yes" } } How I did it Update Yang model for sonic-console and add corresponding unit tests: - Added controlled_device container in CONSOLE_SWITCH - Added test cases for default value verification - Added test cases for valid configuration - Added test cases for invalid pattern detection How to verify it Verified by unit test. Signed-off-by: cliffchen <t-cliffchen+github@microsoft.com>
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR adds support for the controlled_device attribute in the CONSOLE_SWITCH table to enable/disable the controlled device feature (heartbeat sending) on SONiC console switches.
Changes:
- Added
controlled_devicecontainer to CONSOLE_SWITCH in the YANG model with anenabledfield - Added comprehensive test coverage including default value verification, valid configuration, and invalid pattern detection tests
- Updated sample configuration to demonstrate the new attribute
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/sonic-yang-models/yang-models/sonic-console.yang | Adds controlled_device container with enabled leaf, following the same pattern as console_mgmt |
| src/sonic-yang-models/tests/yang_model_tests/tests_config/console.json | Adds test configurations for default value, valid input, and invalid pattern scenarios |
| src/sonic-yang-models/tests/yang_model_tests/tests/console.json | Adds test definitions with proper assertions and XPath validations |
| src/sonic-yang-models/tests/files/sample_config_db.json | Updates sample configuration to include the new controlled_device attribute |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| container controlled_device { | ||
| leaf enabled { | ||
| description "This configuration indicate if enable controlled device feature on SONiC"; |
There was a problem hiding this comment.
The description has a grammatical error. It should say "This configuration indicates whether to enable controlled device feature on SONiC" or "This configuration indicates if controlled device feature is enabled on SONiC". The verb "indicate" should be conjugated as "indicates" for the third-person singular subject.
Why I did it
To support controlled_device attribute in CONSOLE_SWITCH table to enable/disable the controlled device feature (heartbeat sending) on SONiC console switch.
Relate to HLD
Sample config:
Work item tracking
How I did it
Update Yang model for sonic-console and add corresponding unit tests:
How to verify it
Verified by unit test.
Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)