[yang]: Adding yang model for PFC watch dog parameters (#7839)

Added sonic-pfcwd.yang file that defines the yang model for PFC watch dog parameters
sonic-pfcwd.yang is required for configuring action, detection_time, restoration time of PFC watchdog on the interface port.
This commit is contained in:
AmitKaushik7 2021-09-21 03:28:30 +05:30 committed by GitHub
parent d588b3bc8c
commit 4049067534
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 333 additions and 3 deletions

View File

@ -62,6 +62,7 @@ setup(
'./yang-models/sonic-nat.yang',
'./yang-models/sonic-port.yang',
'./yang-models/sonic-portchannel.yang',
'./yang-models/sonic-pfcwd.yang',
'./yang-models/sonic-route-common.yang',
'./yang-models/sonic-route-map.yang',
'./yang-models/sonic-routing-policy-sets.yang',

View File

@ -879,7 +879,18 @@
"polling_interval": "0"
}
},
"PFC_WD": {
"Ethernet9": {
"action": "drop",
"detection_time": "100",
"restoration_time": "400"
}
},
"PFC_WD": {
"GLOBAL": {
"POLL_INTERVAL": "100"
}
},
"SFLOW_COLLECTOR": {
"collector1": {
"collector_ip": "10.100.12.13",
@ -908,7 +919,6 @@
"agent_id": "Ethernet0"
}
},
"AAA": {
"authentication": {
"login": "local"
@ -925,7 +935,6 @@
"timeout": "10"
}
},
"NAT_BINDINGS": {
"bind1": {
"nat_pool": "pool1",

View File

@ -0,0 +1,42 @@
{
"PFC_WDOG_WITH_CORRECT_ACTION_DROP_VALUE": {
"desc": "PFC_WDOG_WITH_CORRECT_ACTION_DROP_VALUE no failure."
},
"PFC_WDOG_WITH_CORRECT_ACTION_FORWARD_VALUE": {
"desc": "PFC_WDOG_WITH_CORRECT_ACTION_FORWARD_VALUE no failure."
},
"PFC_WDOG_WITH_CORRECT_ACTION_ALERT_VALUE": {
"desc": "PFC_WDOG_WITH_CORRECT_ACTION_ALERT_VALUE no failure."
},
"PFC_WDOG_WITH_WRONG_ACTION_VALUE": {
"desc": "PFC_WDOG_WITH_WRONG_ACTION_VALUE must contain a valid action",
"eStr": [ "wrong" ]
},
"PFC_WDOG_WITH_CORRECT_POLL_INTERVAL_VALUE": {
"desc": "PFC_WDOG_WITH_CORRECT_POLL_INTERVAL_VALUE no failure"
},
"PFC_WDOG_WITH_WRONG_POLL_INTERVAL_LOW_VALUE": {
"desc": "PFC_WDOG_WITH_WRONG_POLL_INTERVAL_LOW_VALUE",
"eStr": "range"
},
"PFC_WDOG_WITH_WRONG_POLL_INTERVAL_HIGH_VALUE": {
"desc": "PFC_WDOG_WITH_WRONG_POLL_INTERVAL_HIGH_VALUE",
"eStr": "range"
},
"PFC_WDOG_WITH_WRONG_DETECTION_TIME_LOW_VALUE": {
"desc": "PFC_WDOG_WITH_WRONG_DETECTION_TIME_LOW_VALUE",
"eStr": "range"
},
"PFC_WDOG_WITH_WRONG_DETECTION_TIME_HIGH_VALUE": {
"desc": "PFC_WDOG_WITH_WRONG_DETECTION_TIME_HIGH_VALUE",
"eStr": "range"
},
"PFC_WDOG_WITH_WRONG_RESTORATION_TIME_LOW_VALUE": {
"desc": "PFC_WDOG_WITH_WRONG_RESTORATION_TIME_LOW_VALUE",
"eStr": "range"
},
"PFC_WDOG_WITH_WRONG_RESTORATION_TIME_HIGH_VALUE": {
"desc": "PFC_WDOG_WITH_WRONG_RESTORATION_TIME_HIGH_VALUE",
"eStr": "range"
}
}

View File

@ -0,0 +1,199 @@
{
"PFC_WDOG_WITH_CORRECT_ACTION_DROP_VALUE": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet4",
"lanes": "65",
"mtu": "9000",
"name": "Ethernet4",
"tpid": "0x8100",
"speed": "25000"
}
]
}
},
"sonic-pfcwd:sonic-pfcwd": {
"sonic-pfcwd:PFC_WD": {
"PFC_WD_LIST": [
{
"ifname": "Ethernet4",
"action": "drop",
"detection_time": 300,
"restoration_time": 3000
}
]
}
}
},
"PFC_WDOG_WITH_CORRECT_ACTION_FORWARD_VALUE": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet4",
"lanes": "65",
"mtu": "9000",
"name": "Ethernet4",
"tpid": "0x8100",
"speed": "25000"
}
]
}
},
"sonic-pfcwd:sonic-pfcwd": {
"sonic-pfcwd:PFC_WD": {
"PFC_WD_LIST": [
{
"ifname": "Ethernet4",
"action": "forward",
"detection_time": 300,
"restoration_time": 3000
}
]
}
}
},
"PFC_WDOG_WITH_CORRECT_ACTION_ALERT_VALUE": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet4",
"lanes": "65",
"mtu": "9000",
"name": "Ethernet4",
"tpid": "0x8100",
"speed": "25000"
}
]
}
},
"sonic-pfcwd:sonic-pfcwd": {
"sonic-pfcwd:PFC_WD": {
"PFC_WD_LIST": [
{
"ifname": "Ethernet4",
"action": "alert",
"detection_time": 300,
"restoration_time": 3000
}
]
}
}
},
"PFC_WDOG_WITH_WRONG_ACTION_VALUE": {
"sonic-pfcwd:sonic-pfcwd": {
"sonic-pfcwd:PFC_WD": {
"PFC_WD_LIST": [
{
"ifname": "Ethernet4",
"action": "wrong",
"detection_time": 300,
"restoration_time": 3000
}
]
}
}
},
"PFC_WDOG_WITH_CORRECT_POLL_INTERVAL_VALUE": {
"sonic-pfcwd:sonic-pfcwd": {
"sonic-pfcwd:PFC_WD": {
"PFC_WD_LIST": [
{
"ifname": "GLOBAL",
"POLL_INTERVAL": 101
}
]
}
}
},
"PFC_WDOG_WITH_WRONG_POLL_INTERVAL_LOW_VALUE": {
"sonic-pfcwd:sonic-pfcwd": {
"sonic-pfcwd:PFC_WD": {
"PFC_WD_LIST": [
{
"ifname": "GLOBAL",
"POLL_INTERVAL":99
}
]
}
}
},
"PFC_WDOG_WITH_WRONG_POLL_INTERVAL_HIGH_VALUE": {
"sonic-pfcwd:sonic-pfcwd": {
"sonic-pfcwd:PFC_WD": {
"PFC_WD_LIST": [
{
"ifname": "GLOBAL",
"POLL_INTERVAL": 3001
}
]
}
}
},
"PFC_WDOG_WITH_WRONG_DETECTION_TIME_LOW_VALUE": {
"sonic-pfcwd:sonic-pfcwd": {
"sonic-pfcwd:PFC_WD": {
"PFC_WD_LIST": [
{
"ifname": "Ethernet4",
"action": "drop",
"detection_time": 99,
"restoration_time": 3000
}
]
}
}
},
"PFC_WDOG_WITH_WRONG_DETECTION_TIME_HIGH_VALUE": {
"sonic-pfcwd:sonic-pfcwd": {
"sonic-pfcwd:PFC_WD": {
"PFC_WD_LIST": [
{
"ifname": "Ethernet4",
"action": "wrong",
"detection_time": 5001,
"restoration_time": 3000
}
]
}
}
},
"PFC_WDOG_WITH_WRONG_RESTORATION_TIME_LOW_VALUE": {
"sonic-pfcwd:sonic-pfcwd": {
"sonic-pfcwd:PFC_WD": {
"PFC_WD_LIST": [
{
"ifname": "Ethernet4",
"action": "drop",
"detection_time": 99,
"restoration_time": 3000
}
]
}
}
},
"PFC_WDOG_WITH_WRONG_RESTORATION_TIME_HIGH_VALUE": {
"sonic-pfcwd:sonic-pfcwd": {
"sonic-pfcwd:PFC_WD": {
"PFC_WD_LIST": [
{
"ifname": "Ethernet4",
"action": "wrong",
"detection_time": 60001,
"restoration_time": 3000
}
]
}
}
}
}

View File

@ -0,0 +1,79 @@
module sonic-pfcwd {
namespace "http://github.com/Azure/sonic-pfcwd";
prefix sonic-pfcwd;
yang-version 1.1;
import sonic-port {
prefix port;
}
organization
"SONiC";
contact
"SONiC";
description
"SONIC PFC Watchdog parameters";
revision 2021-07-01 {
description
"Initial revision.";
}
container sonic-pfcwd {
container PFC_WD {
list PFC_WD_LIST {
key "ifname";
leaf ifname {
type union {
type leafref {
path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name";
}
type string {
pattern "GLOBAL" {
error-message "Invalid interface name";
error-app-tag interface-name-invalid;
}
}
}
}
leaf action {
must "../ifname != 'GLOBAL'";
type enumeration {
enum drop;
enum forward;
enum alert;
}
description
"PFC watchdog action when entering storm state.";
}
leaf detection_time {
must "../ifname != 'GLOBAL'";
type uint32 {
range 100..5000;
}
description
"Detection interval for pause storm in msec.";
}
leaf restoration_time {
must "../ifname != 'GLOBAL'";
type uint32 {
range 100..60000;
}
description
"Time delay before resuming normal PFC operation in msec.";
}
leaf POLL_INTERVAL {
must "../ifname = 'GLOBAL'";
type uint32 {
range 100..3000;
}
description
"PFC watchdog global polling interval in msec.";
}
}
}
}
}