SONiC Yang model support for Kdump (#10786)

#### Why I did it
Created SONiC Yang model for Kdump
Tables: KDUMP

#### How I did it
Defined Yang models for NAT based on Guideline doc:
https://github.com/Azure/SONiC/blob/master/doc/mgmt/SONiC_YANG_Model_Guidelines.md
and
https://github.com/Azure/sonic-utilities/blob/master/doc/Command-Reference.md

#### How to verify it
Added test cases to verify it.
This commit is contained in:
rajendra-dendukuri 2022-05-11 02:25:06 -04:00 committed by GitHub
parent 949e76a00f
commit 04175eb34a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 162 additions and 1 deletions

View File

@ -25,6 +25,7 @@ Table of Contents
* [Device neighbor metada](#device-neighbor-metada) * [Device neighbor metada](#device-neighbor-metada)
* [DSCP_TO_TC_MAP](#dscp_to_tc_map) * [DSCP_TO_TC_MAP](#dscp_to_tc_map)
* [FLEX_COUNTER_TABLE](#flex_counter_table) * [FLEX_COUNTER_TABLE](#flex_counter_table)
* [KDUMP](#kdump)
* [L2 Neighbors](#l2-neighbors) * [L2 Neighbors](#l2-neighbors)
* [Loopback Interface](#loopback-interface) * [Loopback Interface](#loopback-interface)
* [LOSSLESS_TRAFFIC_PATTERN](#LOSSLESS_TRAFFIC_PATTERN) * [LOSSLESS_TRAFFIC_PATTERN](#LOSSLESS_TRAFFIC_PATTERN)
@ -861,6 +862,20 @@ instance is supported in SONiC.
``` ```
### KDUMP
```
{
"KDUMP": {
"config": {
"enabled": "true",
"num_dumps": "3",
"memory": "0M-2G:256M,2G-4G:256M,4G-8G:384M,8G-:448M"
}
}
}
```
### L2 Neighbors ### L2 Neighbors

View File

@ -105,6 +105,7 @@ setup(
'./yang-models/sonic-flex_counter.yang', './yang-models/sonic-flex_counter.yang',
'./yang-models/sonic-feature.yang', './yang-models/sonic-feature.yang',
'./yang-models/sonic-interface.yang', './yang-models/sonic-interface.yang',
'./yang-models/sonic-kdump.yang',
'./yang-models/sonic-loopback-interface.yang', './yang-models/sonic-loopback-interface.yang',
'./yang-models/sonic-mgmt_interface.yang', './yang-models/sonic-mgmt_interface.yang',
'./yang-models/sonic-mgmt_port.yang', './yang-models/sonic-mgmt_port.yang',
@ -164,6 +165,7 @@ setup(
'./cvlyang-models/sonic-flex_counter.yang', './cvlyang-models/sonic-flex_counter.yang',
'./cvlyang-models/sonic-feature.yang', './cvlyang-models/sonic-feature.yang',
'./cvlyang-models/sonic-interface.yang', './cvlyang-models/sonic-interface.yang',
'./cvlyang-models/sonic-kdump.yang',
'./cvlyang-models/sonic-loopback-interface.yang', './cvlyang-models/sonic-loopback-interface.yang',
'./cvlyang-models/sonic-mgmt_interface.yang', './cvlyang-models/sonic-mgmt_interface.yang',
'./cvlyang-models/sonic-mgmt_port.yang', './cvlyang-models/sonic-mgmt_port.yang',

View File

@ -1792,7 +1792,15 @@
"rrclient": "0", "rrclient": "0",
"admin_status": "up" "admin_status": "up"
} }
} },
"KDUMP": {
"config": {
"enabled": "true",
"num_dumps": "3",
"memory": "0M-2G:256M,2G-4G:256M,4G-8G:384M,8G-:448M"
}
}
}, },
"SAMPLE_CONFIG_DB_UNKNOWN": { "SAMPLE_CONFIG_DB_UNKNOWN": {
"UNKNOWN_TABLE": { "UNKNOWN_TABLE": {

View File

@ -0,0 +1,19 @@
{
"KDUMP_WITH_VALID_VALUES": {
"desc": "Configuring the kdump with valid values."
},
"KDUMP_WITH_VALID_VALUES_2": {
"desc": "Configuring the kdump with valid values."
},
"KDUMP_WITH_VALID_VALUES_3": {
"desc": "Configuring the kdump with valid values."
},
"KDUMP_WITH_INVALID_NUM_DUMPS": {
"desc": "Configuring kdump config with a invalid number of allowed kdumps.",
"eStr": ["pattern", "does not satisfy"]
},
"KDUMP_WITH_INVALID_MEMORY": {
"desc": "Configuring kdump config with invalid memory config.",
"eStr": ["pattern", "does not satisfy"]
}
}

View File

@ -0,0 +1,57 @@
{
"KDUMP_WITH_VALID_VALUES": {
"sonic-kdump:sonic-kdump": {
"sonic-kdump:KDUMP": {
"config": {
"enabled": "true",
"num_dumps": "3",
"memory": "0M-2G:256M,2G-4G:256M,4G-8G:384M,8G-:448M"
}
}
}
},
"KDUMP_WITH_VALID_VALUES_2": {
"sonic-kdump:sonic-kdump": {
"sonic-kdump:KDUMP": {
"config": {
"enabled": "true",
"num_dumps": "9",
"memory": "512M"
}
}
}
},
"KDUMP_WITH_VALID_VALUES_3": {
"sonic-kdump:sonic-kdump": {
"sonic-kdump:KDUMP": {
"config": {
"enabled": "false",
"num_dumps": "1",
"memory": "512M"
}
}
}
},
"KDUMP_WITH_INVALID_NUM_DUMPS": {
"sonic-kdump:sonic-kdump": {
"sonic-kdump:KDUMP": {
"config": {
"enabled": "true",
"num_dumps": "100",
"memory": "0M-2G:256M,2G-4G:256M,4G-8G:384M,8G-:448M"
}
}
}
},
"KDUMP_WITH_INVALID_MEMORY": {
"sonic-kdump:sonic-kdump": {
"sonic-kdump:KDUMP": {
"config": {
"enabled": "true",
"num_dumps": "3",
"memory": "666"
}
}
}
}
}

View File

@ -0,0 +1,60 @@
module sonic-kdump {
namespace "http://github.com/Azure/sonic-kdump";
prefix kdump;
yang-version 1.1;
organization
"SONiC";
contact
"SONiC";
description
"This module contains a collection of YANG definitions for the
Linux Kernel crash dumping (Kdump) mechanism. The Kdump feature
is used to detect and record Linux kernel crash events.";
revision 2022-05-09 {
description
"Initial revision.";
}
container sonic-kdump {
container KDUMP {
description
"Kdump configuration parameters";
container config {
description "Top level grouping for attributes for Kdump.";
leaf enabled {
type boolean;
description
"Enable or Disable the Kdump mechanism";
}
leaf memory {
type string {
pattern "(((([0-9]+[MG])?(-([0-9]+[MG])?):)?[0-9]+[MG],?)+)";
}
description
"Memory reserved for loading the crash handler kernel. The amount
of reserved memory can be variable, depending on the total amount
of installed memory. The syntax for variable memory reservation is
<range1>:<size1>,<range2>:<size2>. For example, 512M-2G:64M,2G-:128M,
where a memory of 64MB is reserved for the crash kernel for systems
with installed memory between 512MB and 2GB, 128MB is reserved for
systems that have more than 2GB installed memory. An absolute memory
value can also be specified in the format <size>M or <size>G.
For example, 512M.";
}
leaf num_dumps {
type uint8 {
range "1 .. 9";
}
description
"Maximum number of Kernel Core files Stored";
}
}
}
}
}