[yang]: Add constraint for pfcwd (#9513)
#### Why I did it POLL_INTERVAL cannot be set if any of the detection/restoration times in this table is less than the POLL_INTERVAL. #### How I did it Add "must" constraint to make sure detection/restoration times are greater than POLL_INTERVAL. #### How to verify it Use apply-patch command to update POLL_INTERVAL. Build sonic-yang-model.
This commit is contained in:
parent
72f3cb0aab
commit
92cfbb270a
@ -31,6 +31,10 @@
|
|||||||
"desc": "PFC_WDOG_WITH_WRONG_DETECTION_TIME_HIGH_VALUE",
|
"desc": "PFC_WDOG_WITH_WRONG_DETECTION_TIME_HIGH_VALUE",
|
||||||
"eStr": "range"
|
"eStr": "range"
|
||||||
},
|
},
|
||||||
|
"PFC_WDOG_WITH_INVALID_DETECTION_TIME": {
|
||||||
|
"desc": "PFC_WDOG_WITH_INVALID_DETECTION_TIME",
|
||||||
|
"eStr": ["detection_time must be greater than or equal to POLL_INTERVAL"]
|
||||||
|
},
|
||||||
"PFC_WDOG_WITH_WRONG_RESTORATION_TIME_LOW_VALUE": {
|
"PFC_WDOG_WITH_WRONG_RESTORATION_TIME_LOW_VALUE": {
|
||||||
"desc": "PFC_WDOG_WITH_WRONG_RESTORATION_TIME_LOW_VALUE",
|
"desc": "PFC_WDOG_WITH_WRONG_RESTORATION_TIME_LOW_VALUE",
|
||||||
"eStr": "range"
|
"eStr": "range"
|
||||||
@ -38,5 +42,9 @@
|
|||||||
"PFC_WDOG_WITH_WRONG_RESTORATION_TIME_HIGH_VALUE": {
|
"PFC_WDOG_WITH_WRONG_RESTORATION_TIME_HIGH_VALUE": {
|
||||||
"desc": "PFC_WDOG_WITH_WRONG_RESTORATION_TIME_HIGH_VALUE",
|
"desc": "PFC_WDOG_WITH_WRONG_RESTORATION_TIME_HIGH_VALUE",
|
||||||
"eStr": "range"
|
"eStr": "range"
|
||||||
|
},
|
||||||
|
"PFC_WDOG_WITH_INVALID_RESTORATION_TIME": {
|
||||||
|
"desc": "PFC_WDOG_WITH_INVALID_RESTORATION_TIME",
|
||||||
|
"eStr": ["restoration_time must be greater than or equal to POLL_INTERVAL"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,36 +105,102 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"PFC_WDOG_WITH_CORRECT_POLL_INTERVAL_VALUE": {
|
"PFC_WDOG_WITH_CORRECT_POLL_INTERVAL_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:sonic-pfcwd": {
|
||||||
"sonic-pfcwd:PFC_WD": {
|
"sonic-pfcwd:PFC_WD": {
|
||||||
"PFC_WD_LIST": [
|
"PFC_WD_LIST": [
|
||||||
{
|
{
|
||||||
"ifname": "GLOBAL",
|
"ifname": "GLOBAL",
|
||||||
"POLL_INTERVAL": 101
|
"POLL_INTERVAL": 101
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ifname": "Ethernet4",
|
||||||
|
"action": "drop",
|
||||||
|
"detection_time": 101,
|
||||||
|
"restoration_time": 3000
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"PFC_WDOG_WITH_WRONG_POLL_INTERVAL_LOW_VALUE": {
|
"PFC_WDOG_WITH_WRONG_POLL_INTERVAL_LOW_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:sonic-pfcwd": {
|
||||||
"sonic-pfcwd:PFC_WD": {
|
"sonic-pfcwd:PFC_WD": {
|
||||||
"PFC_WD_LIST": [
|
"PFC_WD_LIST": [
|
||||||
{
|
{
|
||||||
"ifname": "GLOBAL",
|
"ifname": "GLOBAL",
|
||||||
"POLL_INTERVAL":99
|
"POLL_INTERVAL":99
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ifname": "Ethernet4",
|
||||||
|
"action": "drop",
|
||||||
|
"detection_time": 100,
|
||||||
|
"restoration_time": 3000
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"PFC_WDOG_WITH_WRONG_POLL_INTERVAL_HIGH_VALUE": {
|
"PFC_WDOG_WITH_WRONG_POLL_INTERVAL_HIGH_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:sonic-pfcwd": {
|
||||||
"sonic-pfcwd:PFC_WD": {
|
"sonic-pfcwd:PFC_WD": {
|
||||||
"PFC_WD_LIST": [
|
"PFC_WD_LIST": [
|
||||||
{
|
{
|
||||||
"ifname": "GLOBAL",
|
"ifname": "GLOBAL",
|
||||||
"POLL_INTERVAL": 3001
|
"POLL_INTERVAL": 3001
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ifname": "Ethernet4",
|
||||||
|
"action": "drop",
|
||||||
|
"detection_time": 3001,
|
||||||
|
"restoration_time": 3001
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -160,7 +226,7 @@
|
|||||||
"PFC_WD_LIST": [
|
"PFC_WD_LIST": [
|
||||||
{
|
{
|
||||||
"ifname": "Ethernet4",
|
"ifname": "Ethernet4",
|
||||||
"action": "wrong",
|
"action": "drop",
|
||||||
"detection_time": 5001,
|
"detection_time": 5001,
|
||||||
"restoration_time": 3000
|
"restoration_time": 3000
|
||||||
}
|
}
|
||||||
@ -168,6 +234,40 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"PFC_WDOG_WITH_INVALID_DETECTION_TIME": {
|
||||||
|
"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": "GLOBAL",
|
||||||
|
"POLL_INTERVAL": 1000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ifname": "Ethernet4",
|
||||||
|
"action": "drop",
|
||||||
|
"detection_time": 999,
|
||||||
|
"restoration_time": 1000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"PFC_WDOG_WITH_WRONG_RESTORATION_TIME_LOW_VALUE": {
|
"PFC_WDOG_WITH_WRONG_RESTORATION_TIME_LOW_VALUE": {
|
||||||
"sonic-pfcwd:sonic-pfcwd": {
|
"sonic-pfcwd:sonic-pfcwd": {
|
||||||
"sonic-pfcwd:PFC_WD": {
|
"sonic-pfcwd:PFC_WD": {
|
||||||
@ -188,12 +288,46 @@
|
|||||||
"PFC_WD_LIST": [
|
"PFC_WD_LIST": [
|
||||||
{
|
{
|
||||||
"ifname": "Ethernet4",
|
"ifname": "Ethernet4",
|
||||||
"action": "wrong",
|
"action": "drop",
|
||||||
"detection_time": 60001,
|
"detection_time": 60001,
|
||||||
"restoration_time": 3000
|
"restoration_time": 3000
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"PFC_WDOG_WITH_INVALID_RESTORATION_TIME": {
|
||||||
|
"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": "GLOBAL",
|
||||||
|
"POLL_INTERVAL": 1000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ifname": "Ethernet4",
|
||||||
|
"action": "drop",
|
||||||
|
"detection_time": 1000,
|
||||||
|
"restoration_time": 999
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,9 @@ module sonic-pfcwd {
|
|||||||
}
|
}
|
||||||
leaf detection_time {
|
leaf detection_time {
|
||||||
must "../ifname != 'GLOBAL'";
|
must "../ifname != 'GLOBAL'";
|
||||||
|
must "(not(boolean(current()/../../PFC_WD_LIST[ifname='GLOBAL'])) or (current() >= current()/../../PFC_WD_LIST[ifname='GLOBAL']/POLL_INTERVAL))" {
|
||||||
|
error-message "detection_time must be greater than or equal to POLL_INTERVAL";
|
||||||
|
}
|
||||||
type uint32 {
|
type uint32 {
|
||||||
range 100..5000;
|
range 100..5000;
|
||||||
}
|
}
|
||||||
@ -59,6 +62,9 @@ module sonic-pfcwd {
|
|||||||
}
|
}
|
||||||
leaf restoration_time {
|
leaf restoration_time {
|
||||||
must "../ifname != 'GLOBAL'";
|
must "../ifname != 'GLOBAL'";
|
||||||
|
must "(not(boolean(current()/../../PFC_WD_LIST[ifname='GLOBAL'])) or (current() >= current()/../../PFC_WD_LIST[ifname='GLOBAL']/POLL_INTERVAL))" {
|
||||||
|
error-message "restoration_time must be greater than or equal to POLL_INTERVAL";
|
||||||
|
}
|
||||||
type uint32 {
|
type uint32 {
|
||||||
range 100..60000;
|
range 100..60000;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user