forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[yang] sonic yang changes for BUM storm control (sonic-net#7355)
#### Why I did it Sonic yang model for BUM storm control #### How I did it Added yang model and the corresponding test cases. #### How to verify it yang model test case for storm control
- Loading branch information
1 parent
f3df6e2
commit 36673c1
Showing
5 changed files
with
264 additions
and
2 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
26 changes: 26 additions & 0 deletions
26
src/sonic-yang-models/tests/yang_model_tests/tests/storm_control.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,26 @@ | ||
{ | ||
"STORM_BROADCAST_TEST": { | ||
"desc": "Broadcast storm-control" | ||
}, | ||
"STORM_UUCAST_TEST": { | ||
"desc": "unknown-unicast storm-control" | ||
}, | ||
"STORM_UMCAST_TEST": { | ||
"desc": "unknown-multicast storm-control" | ||
}, | ||
"STORM_INVALID_STORM_TYPE_TEST": { | ||
"desc": "storm-control invalid storm-type", | ||
"eStrKey" : "InvalidValue", | ||
"eStr": ["storm_type"] | ||
}, | ||
"STORM_BROADCAST_INVALID_KBPS": { | ||
"desc": "Broadcast storm-control invalid kbps", | ||
"eStrKey" : "InvalidValue", | ||
"eStr": ["kbps"] | ||
}, | ||
"STORM_BROADCAST_INVALID_INTERFACE": { | ||
"desc": "Broadcast storm-control invalid interface", | ||
"eStrKey" : "LeafRef", | ||
"eStr": ["Eth"] | ||
} | ||
} |
170 changes: 170 additions & 0 deletions
170
src/sonic-yang-models/tests/yang_model_tests/tests_config/storm_control.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,170 @@ | ||
{ | ||
"STORM_BROADCAST_TEST": { | ||
"sonic-port:sonic-port": { | ||
"sonic-port:PORT": { | ||
"PORT_LIST": [ | ||
{ | ||
"admin_status": "up", | ||
"alias": "eth0", | ||
"description": "Ethernet0", | ||
"lanes": "65", | ||
"mtu": 9000, | ||
"name": "Ethernet0", | ||
"speed": 25000 | ||
} | ||
] | ||
} | ||
}, | ||
"sonic-storm-control:sonic-storm-control": { | ||
"sonic-storm-control:PORT_STORM_CONTROL": { | ||
"sonic-storm-control:PORT_STORM_CONTROL_LIST": [ | ||
{ | ||
"ifname": "Ethernet0", | ||
"storm_type": "broadcast", | ||
"kbps": "100000" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"STORM_UUCAST_TEST": { | ||
"sonic-port:sonic-port": { | ||
"sonic-port:PORT": { | ||
"PORT_LIST": [ | ||
{ | ||
"admin_status": "up", | ||
"alias": "eth0", | ||
"description": "Ethernet0", | ||
"lanes": "65", | ||
"mtu": 9000, | ||
"name": "Ethernet0", | ||
"speed": 25000 | ||
} | ||
] | ||
} | ||
}, | ||
"sonic-storm-control:sonic-storm-control": { | ||
"sonic-storm-control:PORT_STORM_CONTROL": { | ||
"sonic-storm-control:PORT_STORM_CONTROL_LIST": [ | ||
{ | ||
"ifname": "Ethernet0", | ||
"storm_type": "unknown-unicast", | ||
"kbps": "200000" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"STORM_UMCAST_TEST": { | ||
"sonic-port:sonic-port": { | ||
"sonic-port:PORT": { | ||
"PORT_LIST": [ | ||
{ | ||
"admin_status": "up", | ||
"alias": "eth0", | ||
"description": "Ethernet0", | ||
"lanes": "65", | ||
"mtu": 9000, | ||
"name": "Ethernet0", | ||
"speed": 25000 | ||
} | ||
] | ||
} | ||
}, | ||
"sonic-storm-control:sonic-storm-control": { | ||
"sonic-storm-control:PORT_STORM_CONTROL": { | ||
"sonic-storm-control:PORT_STORM_CONTROL_LIST": [ | ||
{ | ||
"ifname": "Ethernet0", | ||
"storm_type": "unknown-multicast", | ||
"kbps": "300000" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"STORM_INVALID_STORM_TYPE_TEST": { | ||
"sonic-port:sonic-port": { | ||
"sonic-port:PORT": { | ||
"PORT_LIST": [ | ||
{ | ||
"admin_status": "up", | ||
"alias": "eth0", | ||
"description": "Ethernet0", | ||
"lanes": "65", | ||
"mtu": 9000, | ||
"name": "Ethernet0", | ||
"speed": 25000 | ||
} | ||
] | ||
} | ||
}, | ||
"sonic-storm-control:sonic-storm-control": { | ||
"sonic-storm-control:PORT_STORM_CONTROL": { | ||
"sonic-storm-control:PORT_STORM_CONTROL_LIST": [ | ||
{ | ||
"ifname": "Ethernet0", | ||
"storm_type": "xyz", | ||
"kbps": "400000" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"STORM_BROADCAST_INVALID_KBPS": { | ||
"sonic-port:sonic-port": { | ||
"sonic-port:PORT": { | ||
"PORT_LIST": [ | ||
{ | ||
"admin_status": "up", | ||
"alias": "eth0", | ||
"description": "Ethernet0", | ||
"lanes": "65", | ||
"mtu": 9000, | ||
"name": "Ethernet0", | ||
"speed": 25000 | ||
} | ||
] | ||
} | ||
}, | ||
"sonic-storm-control:sonic-storm-control": { | ||
"sonic-storm-control:PORT_STORM_CONTROL": { | ||
"sonic-storm-control:PORT_STORM_CONTROL_LIST": [ | ||
{ | ||
"ifname": "Ethernet0", | ||
"storm_type": "broadcast", | ||
"kbps": "xyz-kbps-value" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"STORM_BROADCAST_INVALID_INTERFACE": { | ||
"sonic-port:sonic-port": { | ||
"sonic-port:PORT": { | ||
"PORT_LIST": [ | ||
{ | ||
"admin_status": "up", | ||
"alias": "eth0", | ||
"description": "Ethernet0", | ||
"lanes": "65", | ||
"mtu": 9000, | ||
"name": "Ethernet0", | ||
"speed": 25000 | ||
} | ||
] | ||
} | ||
}, | ||
"sonic-storm-control:sonic-storm-control": { | ||
"sonic-storm-control:PORT_STORM_CONTROL": { | ||
"sonic-storm-control:PORT_STORM_CONTROL_LIST": [ | ||
{ | ||
"ifname": "Eth", | ||
"storm_type": "broadcast", | ||
"kbps": "500000" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
src/sonic-yang-models/yang-models/sonic-storm-control.yang
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,56 @@ | ||
module sonic-storm-control { | ||
namespace "http://github.com/Azure/sonic-storm-control"; | ||
yang-version "1"; | ||
|
||
prefix ssc; | ||
|
||
import sonic-port { | ||
prefix prt; | ||
} | ||
|
||
organization | ||
"SONiC"; | ||
|
||
contact | ||
"SONiC"; | ||
|
||
description | ||
"This module defines configuration and operational state | ||
data for broadcast, unknown-unicast and unknown-multicast (BUM) storm-control. | ||
storm-control can be enabled on ethernet interfaces. | ||
Rate is defined in bits-per-second. All three types of storm-control can be | ||
enabled on an interface."; | ||
|
||
revision 2021-12-13 { | ||
description | ||
"Initial revision"; | ||
} | ||
|
||
container sonic-storm-control { | ||
container PORT_STORM_CONTROL { | ||
list PORT_STORM_CONTROL_LIST { | ||
key "ifname storm_type"; | ||
/*scommon:key-pattern "PORT_STORM_CONTROL|{ifname}|{storm_type}";*/ | ||
leaf ifname { | ||
type leafref { | ||
path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; | ||
} | ||
} | ||
leaf storm_type { | ||
type enumeration{ | ||
enum broadcast; | ||
enum unknown-unicast; | ||
enum unknown-multicast; | ||
} | ||
} | ||
leaf kbps { | ||
type uint64 { | ||
range "0..100000000" { | ||
error-message "kbps value out of range"; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |