Skip to content

[YANG] Support controlled_device attribute in CONSOLE_SWITCH#25131

Merged
yejianquan merged 1 commit into
sonic-net:masterfrom
wiperi:cliffchen/submit/console_controlled_device
May 11, 2026
Merged

[YANG] Support controlled_device attribute in CONSOLE_SWITCH#25131
yejianquan merged 1 commit into
sonic-net:masterfrom
wiperi:cliffchen/submit/console_controlled_device

Conversation

@wiperi
Copy link
Copy Markdown
Contributor

@wiperi wiperi commented Jan 20, 2026

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:

"CONSOLE_SWITCH": {
    "console_mgmt": {
        "enabled": "yes"
    },
    "controlled_device": {
        "enabled": "yes"
    }
}
Work item tracking
  • Microsoft ADO (number only):

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.

Which release branch to backport (provide reason below if selected)

  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511

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)

Cat

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>
@wiperi wiperi requested a review from qiluo-msft as a code owner January 20, 2026 04:41
Copilot AI review requested due to automatic review settings January 20, 2026 04:41
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

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 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_device container to CONSOLE_SWITCH in the YANG model with an enabled field
  • 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";
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@lizhijianrd lizhijianrd left a comment

Choose a reason for hiding this comment

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

LGTM

@yejianquan yejianquan merged commit 99b0a39 into sonic-net:master May 11, 2026
29 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants