-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
949e76a
commit 04175eb
Showing
6 changed files
with
162 additions
and
1 deletion.
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
19 changes: 19 additions & 0 deletions
19
src/sonic-yang-models/tests/yang_model_tests/tests/kdump.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,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"] | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
src/sonic-yang-models/tests/yang_model_tests/tests_config/kdump.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,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" | ||
} | ||
} | ||
} | ||
} | ||
} |
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,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"; | ||
} | ||
} | ||
} | ||
} | ||
} |