Skip to content

Commit

Permalink
[yang] sonic yang changes for BUM storm control (#7355)
Browse files Browse the repository at this point in the history
#### 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
mohan-selvaraj authored Dec 16, 2021
1 parent f3df6e2 commit 36673c1
Show file tree
Hide file tree
Showing 5 changed files with 264 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def run(self):
'./yang-models/sonic-exp-fc-map.yang',
'./yang-models/sonic-dscp-tc-map.yang',
'./yang-models/sonic-dot1p-tc-map.yang',
'./yang-models/sonic-storm-control.yang',
'./yang-models/sonic-tc-priority-group-map.yang',
'./yang-models/sonic-tc-queue-map.yang',
'./yang-models/sonic-pfc-priority-queue-map.yang',
Expand Down
13 changes: 11 additions & 2 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -973,13 +973,22 @@
"polling_interval": "0"
}
},

"WARM_RESTART": {
"bgp": {
"bgp_timer": "500"
}
},

"PORT_STORM_CONTROL": {
"Ethernet0|broadcast": {
"kbps": "10000"
},
"Ethernet0|unknown-multicast": {
"kbps": "30000"
},
"Ethernet0|unknown-unicast": {
"kbps": "20000"
}
},
"PFC_WD": {
"Ethernet9": {
"action": "drop",
Expand Down
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"]
}
}
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 src/sonic-yang-models/yang-models/sonic-storm-control.yang
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";
}
}
}
}
}
}
}

0 comments on commit 36673c1

Please sign in to comment.