diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index 6ce68ffdd5..7c9bce01de 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -18,6 +18,7 @@ Table of Contents * [Buffer port ingress profile list](#buffer-port-ingress-profile-list) * [Buffer port egress profile list](#buffer-port-egress-profile-list) * [Cable length](#cable-length) + * [Chassis module](#chassis-module) * [COPP_TABLE](#copp_table) * [Console](#console) * [CRM](#crm) @@ -648,6 +649,25 @@ This kind of profiles will be handled by buffer manager and won't be applied to ``` +### Chassis Module + +CHASSIS_MODULE table holds the list and configuration of linecard and fabric modules in a SONiC chassis. +It currently allows user to administratively bring down a line-card or fabric-card + +``` +{ + "CHASSIS_MODULE": { + "LINE-CARD0": { + "admin_status": "down" + }, + "FABRIC-CARD1": { + "admin_status": "down" + } + } +} + +``` + ### COPP_TABLE ``` diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 26582723f1..96899c055b 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -97,6 +97,7 @@ setup( './yang-models/sonic-buffer-profile.yang', './yang-models/sonic-buffer-queue.yang', './yang-models/sonic-cable-length.yang', + './yang-models/sonic-chassis-module.yang', './yang-models/sonic-copp.yang', './yang-models/sonic-console.yang', './yang-models/sonic-crm.yang', diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 94b37260f6..d6f3589728 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1631,6 +1631,14 @@ "prefix1|1|10.0.0.0/8|8..16": { } }, + "CHASSIS_MODULE": { + "LINE-CARD0": { + "admin_status": "down" + }, + "FABRIC-CARD1": { + "admin_status": "down" + } + }, "COPP_GROUP": { "queue1_group1": { "queue": "1", diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/chassis_module.json b/src/sonic-yang-models/tests/yang_model_tests/tests/chassis_module.json new file mode 100644 index 0000000000..cfdaa3733e --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/chassis_module.json @@ -0,0 +1,13 @@ +{ + "CHASSIS_MODULE_WITH_DEFAULT_VALUES": { + "desc": "Load chassis module table with fields set to default values" + }, + "CHASSIS_MODULE_WITH_LINECARD_ADMIN_DOWN": { + "desc": "Load chassis module table with admin_status set to down" + }, + "CHASSIS_MODULE_WITH_LINECARD_ADMIN_INVALID_VALUE": { + "desc": "Load chassis module table with admin_status set to invalid value", + "eStrKey": "InvalidValue", + "eStr": ["admin_status"] + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/chassis_module.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/chassis_module.json new file mode 100644 index 0000000000..35c76c7c4d --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/chassis_module.json @@ -0,0 +1,54 @@ +{ + "CHASSIS_MODULE_WITH_DEFAULT_VALUES": { + "sonic-chassis-module:sonic-chassis-module": { + "sonic-chassis-module:CHASSIS_MODULE": { + "CHASSIS_MODULE_LIST": [ + { + "name": "LINE-CARD0", + "admin_status": "up" + }, + { + "name": "LINE-CARD1", + "admin_status": "up" + }, + { + "name": "FABRIC-CARD0", + "admin_status": "up" + }, + { + "name": "FABRIC-CARD1", + "admin_status": "up" + } + ] + } + } + }, + "CHASSIS_MODULE_WITH_LINECARD_ADMIN_DOWN": { + "sonic-chassis-module:sonic-chassis-module": { + "sonic-chassis-module:CHASSIS_MODULE": { + "CHASSIS_MODULE_LIST": [ + { + "name": "LINE-CARD0", + "admin_status": "down" + }, + { + "name": "FABRIC-CARD1", + "admin_status": "down" + } + ] + } + } + }, + "CHASSIS_MODULE_WITH_LINECARD_ADMIN_INVALID_VALUE": { + "sonic-chassis-module:sonic-chassis-module": { + "sonic-chassis-module:CHASSIS_MODULE": { + "CHASSIS_MODULE_LIST": [ + { + "name": "LINE-CARD0", + "admin_status": "false" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-chassis-module.yang b/src/sonic-yang-models/yang-models/sonic-chassis-module.yang new file mode 100644 index 0000000000..e31c252d8a --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-chassis-module.yang @@ -0,0 +1,36 @@ +module sonic-chassis-module { + + yang-version 1.1; + + namespace "http://github.com/sonic-net/sonic-chassis-module"; + prefix chassis_mod; + import sonic-types { + prefix stypes; + } + description "CHASSIS_MODULE YANG to administratively set SONIC modules state"; + + revision 2023-02-24 { + description "Initial version"; + } + + container sonic-chassis-module { + container CHASSIS_MODULE { + description "List of modules in the chassis"; + list CHASSIS_MODULE_LIST { + key "name"; + leaf name { + type string { + pattern "LINE-CARD[0-9]+|FABRIC-CARD[0-9]+"; + } + description "Line-card or fabric-card module name"; + } + + leaf admin_status { + type stypes:admin_status; + default up; + description "Administrative state of chassis module"; + } + } + } + } +}