-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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.
- Loading branch information
1 parent
d588b3b
commit 4049067
Showing
5 changed files
with
333 additions
and
3 deletions.
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
42 changes: 42 additions & 0 deletions
42
src/sonic-yang-models/tests/yang_model_tests/tests/pfc.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,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" | ||
} | ||
} |
199 changes: 199 additions & 0 deletions
199
src/sonic-yang-models/tests/yang_model_tests/tests_config/pfc.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,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 | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
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,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."; | ||
} | ||
} | ||
} | ||
} | ||
} |