forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add yang model definition for CHASSIS_MODULE table (sonic-net#14007)
Why I did it Add yang model definition for CHASSIS_MODULE define and implemented for sonic chassis. HLD for this configuration is included in https://github.com/sonic-net/SONiC/blob/master/doc/pmon/pmon-chassis-design.md#configuration Fixes sonic-net#12640 How I did it Added yang model definition, unit tests, sample config and documentation for the table How to verify it Validated config tree generation using "pyang -Vf tree -p /usr/local/share/yang/modules/ietf ./yang-models/sonic-voq-inband-interface.yang" Built the below python-wheels to validate unit tests and other changes target/python-wheels/bullseye/sonic_yang_mgmt-1.0-py3-none-any.whl target/python-wheels/bullseye/sonic_yang_models-1.0-py3-none-any.whl target/python-wheels/bullseye/sonic_config_engine-1.0-py3-none-any.whl
- Loading branch information
Showing
6 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
13 changes: 13 additions & 0 deletions
13
src/sonic-yang-models/tests/yang_model_tests/tests/chassis_module.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
src/sonic-yang-models/tests/yang_model_tests/tests_config/chassis_module.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/sonic-yang-models/yang-models/sonic-chassis-module.yang
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"; | ||
} | ||
} | ||
} | ||
} | ||
} |