Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SONiC Yang model support for Kdump #10786

Merged
merged 2 commits into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Table of Contents
* [Device neighbor metada](#device-neighbor-metada)
* [DSCP_TO_TC_MAP](#dscp_to_tc_map)
* [FLEX_COUNTER_TABLE](#flex_counter_table)
* [KDUMP](#kdump)
* [L2 Neighbors](#l2-neighbors)
* [Loopback Interface](#loopback-interface)
* [LOSSLESS_TRAFFIC_PATTERN](#LOSSLESS_TRAFFIC_PATTERN)
Expand Down Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def run(self):
'./yang-models/sonic-flex_counter.yang',
'./yang-models/sonic-feature.yang',
'./yang-models/sonic-interface.yang',
'./yang-models/sonic-kdump.yang',
'./yang-models/sonic-loopback-interface.yang',
'./yang-models/sonic-mgmt_interface.yang',
'./yang-models/sonic-mgmt_port.yang',
Expand Down Expand Up @@ -164,6 +165,7 @@ def run(self):
'./cvlyang-models/sonic-flex_counter.yang',
'./cvlyang-models/sonic-feature.yang',
'./cvlyang-models/sonic-interface.yang',
'./cvlyang-models/sonic-kdump.yang',
'./cvlyang-models/sonic-loopback-interface.yang',
'./cvlyang-models/sonic-mgmt_interface.yang',
'./cvlyang-models/sonic-mgmt_port.yang',
Expand Down
10 changes: 9 additions & 1 deletion src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1792,7 +1792,15 @@
"rrclient": "0",
"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": {
"UNKNOWN_TABLE": {
Expand Down
19 changes: 19 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/kdump.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}
}
60 changes: 60 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-kdump.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
module sonic-kdump {
namespace "https://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";
}
}
}
}
}