Skip to content

Commit

Permalink
Add yang model definition for CHASSIS_MODULE table (sonic-net#14007) (s…
Browse files Browse the repository at this point in the history
…onic-net#14262)

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
tjchadaga authored Mar 16, 2023
1 parent 19d6f30 commit df22ead
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 44 deletions.
107 changes: 63 additions & 44 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
* [CRM](#crm)
* [Data Plane L3 Interfaces](#data-plane-l3-interfaces)
Expand Down Expand Up @@ -56,7 +57,7 @@ Table of Contents
* [Virtual router](#virtual-router)
* [WRED_PROFILE](#wred_profile)
* [PASSWORD_HARDENING](#password_hardening)
* [RADIUS](#radius)
* [RADIUS](#radius)
* [For Developers](#for-developers)
* [Generating Application Config by Jinja2 Template](#generating-application-config-by-jinja2-template)
* [Incremental Configuration by Subscribing to ConfigDB](#incremental-configuration-by-subscribing-to-configdb)
Expand Down Expand Up @@ -631,6 +632,24 @@ 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
Expand Down Expand Up @@ -726,41 +745,41 @@ This kind of profiles will be handled by buffer manager and won't be applied to

### Data Plane L3 Interfaces

IP configuration for data plane are defined in **INTERFACE**, **VLAN_SUB_INTERFACE**,
**PORTCHANNEL_INTERFACE** and **VLAN_INTERFACE** table. The objects
in all four tables have the interface (could be physical port, port
channel, vlan or vlan sub interface) that IP address is attached to as first-level key, and
IP prefix as second-level key. IP interface address objects don't have any attributes.
IP interface attributes, resides in those tables as well, key is the interface name
and value is a list of field-values representing the interface attributes, e.g. loopback action.
IP configuration for data plane are defined in **INTERFACE**, **VLAN_SUB_INTERFACE**,
**PORTCHANNEL_INTERFACE** and **VLAN_INTERFACE** table. The objects
in all four tables have the interface (could be physical port, port
channel, vlan or vlan sub interface) that IP address is attached to as first-level key, and
IP prefix as second-level key. IP interface address objects don't have any attributes.
IP interface attributes, resides in those tables as well, key is the interface name
and value is a list of field-values representing the interface attributes, e.g. loopback action.

```
{
"INTERFACE": {
"Ethernet0|10.0.0.0/31": {},
"Ethernet4|10.0.0.2/31": {},
"Ethernet8|10.0.0.4/31": {}
"Ethernet8": {
"loopback_action": "drop"
}
"Ethernet8": {
"loopback_action": "drop"
}
},
"PORTCHANNEL_INTERFACE": {
"PortChannel01|10.0.0.56/31": {},
"PortChannel01|FC00::71/126": {},
"PortChannel02|10.0.0.58/31": {},
"PortChannel02|FC00::75/126": {}
},
"VLAN_INTERFACE": {
"Vlan1000|192.168.0.1/27": {}
},
"VLAN_SUB_INTERFACE": {
"Ethernet4.1|10.0.0.2/31": {},
"Ethernet4.1": {
"loopback_action": "drop"
}
},
"VLAN_SUB_INTERFACE": {
"Ethernet4.1|10.0.0.2/31": {},
"Ethernet4.1": {
"loopback_action": "drop"
}
}
}
```
Expand Down Expand Up @@ -1600,7 +1619,7 @@ VOQ_INBAND_INTERFACE holds the name of the inband system port dedicated for cpu
"Ethernet-IB0|3333::3:5/128": {}
}
```


### Virtual router

The virtual router table allows to insert or update a new virtual router
Expand Down Expand Up @@ -1758,29 +1777,29 @@ The method could be:
}
}
```

### RADIUS

The RADIUS and RADIUS_SERVER tables define RADIUS config paramerters. RADIUS table carries global configuration while RADIUS_SERVER table carries per server configuration.

```
"RADIUS": {
"global": {
"auth_type": "pap",
"timeout": "5"
}
}
"RADIUS_SERVER": {
"192.168.1.2": {
"priority": "4",
"retransmit": "2",
"timeout": "5"
}
}
```


### RADIUS

The RADIUS and RADIUS_SERVER tables define RADIUS config paramerters. RADIUS table carries global configuration while RADIUS_SERVER table carries per server configuration.

```
"RADIUS": {
"global": {
"auth_type": "pap",
"timeout": "5"
}
}
"RADIUS_SERVER": {
"192.168.1.2": {
"priority": "4",
"retransmit": "2",
"timeout": "5"
}
}
```


For Developers
==============
Expand Down
1 change: 1 addition & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def run(self):
'./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-crm.yang',
'./yang-models/sonic-default-lossless-buffer-parameter.yang',
Expand Down
8 changes: 8 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1400,6 +1400,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",
Expand Down
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"]
}
}
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 src/sonic-yang-models/yang-models/sonic-chassis-module.yang
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";
}
}
}
}
}

0 comments on commit df22ead

Please sign in to comment.