Skip to content

Commit 36673c1

Browse files
[yang] sonic yang changes for BUM storm control (#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
1 parent f3df6e2 commit 36673c1

File tree

5 files changed

+264
-2
lines changed

5 files changed

+264
-2
lines changed

src/sonic-yang-models/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ def run(self):
131131
'./yang-models/sonic-exp-fc-map.yang',
132132
'./yang-models/sonic-dscp-tc-map.yang',
133133
'./yang-models/sonic-dot1p-tc-map.yang',
134+
'./yang-models/sonic-storm-control.yang',
134135
'./yang-models/sonic-tc-priority-group-map.yang',
135136
'./yang-models/sonic-tc-queue-map.yang',
136137
'./yang-models/sonic-pfc-priority-queue-map.yang',

src/sonic-yang-models/tests/files/sample_config_db.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -973,13 +973,22 @@
973973
"polling_interval": "0"
974974
}
975975
},
976-
977976
"WARM_RESTART": {
978977
"bgp": {
979978
"bgp_timer": "500"
980979
}
981980
},
982-
981+
"PORT_STORM_CONTROL": {
982+
"Ethernet0|broadcast": {
983+
"kbps": "10000"
984+
},
985+
"Ethernet0|unknown-multicast": {
986+
"kbps": "30000"
987+
},
988+
"Ethernet0|unknown-unicast": {
989+
"kbps": "20000"
990+
}
991+
},
983992
"PFC_WD": {
984993
"Ethernet9": {
985994
"action": "drop",
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"STORM_BROADCAST_TEST": {
3+
"desc": "Broadcast storm-control"
4+
},
5+
"STORM_UUCAST_TEST": {
6+
"desc": "unknown-unicast storm-control"
7+
},
8+
"STORM_UMCAST_TEST": {
9+
"desc": "unknown-multicast storm-control"
10+
},
11+
"STORM_INVALID_STORM_TYPE_TEST": {
12+
"desc": "storm-control invalid storm-type",
13+
"eStrKey" : "InvalidValue",
14+
"eStr": ["storm_type"]
15+
},
16+
"STORM_BROADCAST_INVALID_KBPS": {
17+
"desc": "Broadcast storm-control invalid kbps",
18+
"eStrKey" : "InvalidValue",
19+
"eStr": ["kbps"]
20+
},
21+
"STORM_BROADCAST_INVALID_INTERFACE": {
22+
"desc": "Broadcast storm-control invalid interface",
23+
"eStrKey" : "LeafRef",
24+
"eStr": ["Eth"]
25+
}
26+
}
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
{
2+
"STORM_BROADCAST_TEST": {
3+
"sonic-port:sonic-port": {
4+
"sonic-port:PORT": {
5+
"PORT_LIST": [
6+
{
7+
"admin_status": "up",
8+
"alias": "eth0",
9+
"description": "Ethernet0",
10+
"lanes": "65",
11+
"mtu": 9000,
12+
"name": "Ethernet0",
13+
"speed": 25000
14+
}
15+
]
16+
}
17+
},
18+
"sonic-storm-control:sonic-storm-control": {
19+
"sonic-storm-control:PORT_STORM_CONTROL": {
20+
"sonic-storm-control:PORT_STORM_CONTROL_LIST": [
21+
{
22+
"ifname": "Ethernet0",
23+
"storm_type": "broadcast",
24+
"kbps": "100000"
25+
}
26+
]
27+
}
28+
}
29+
},
30+
"STORM_UUCAST_TEST": {
31+
"sonic-port:sonic-port": {
32+
"sonic-port:PORT": {
33+
"PORT_LIST": [
34+
{
35+
"admin_status": "up",
36+
"alias": "eth0",
37+
"description": "Ethernet0",
38+
"lanes": "65",
39+
"mtu": 9000,
40+
"name": "Ethernet0",
41+
"speed": 25000
42+
}
43+
]
44+
}
45+
},
46+
"sonic-storm-control:sonic-storm-control": {
47+
"sonic-storm-control:PORT_STORM_CONTROL": {
48+
"sonic-storm-control:PORT_STORM_CONTROL_LIST": [
49+
{
50+
"ifname": "Ethernet0",
51+
"storm_type": "unknown-unicast",
52+
"kbps": "200000"
53+
}
54+
]
55+
}
56+
}
57+
},
58+
"STORM_UMCAST_TEST": {
59+
"sonic-port:sonic-port": {
60+
"sonic-port:PORT": {
61+
"PORT_LIST": [
62+
{
63+
"admin_status": "up",
64+
"alias": "eth0",
65+
"description": "Ethernet0",
66+
"lanes": "65",
67+
"mtu": 9000,
68+
"name": "Ethernet0",
69+
"speed": 25000
70+
}
71+
]
72+
}
73+
},
74+
"sonic-storm-control:sonic-storm-control": {
75+
"sonic-storm-control:PORT_STORM_CONTROL": {
76+
"sonic-storm-control:PORT_STORM_CONTROL_LIST": [
77+
{
78+
"ifname": "Ethernet0",
79+
"storm_type": "unknown-multicast",
80+
"kbps": "300000"
81+
}
82+
]
83+
}
84+
}
85+
},
86+
"STORM_INVALID_STORM_TYPE_TEST": {
87+
"sonic-port:sonic-port": {
88+
"sonic-port:PORT": {
89+
"PORT_LIST": [
90+
{
91+
"admin_status": "up",
92+
"alias": "eth0",
93+
"description": "Ethernet0",
94+
"lanes": "65",
95+
"mtu": 9000,
96+
"name": "Ethernet0",
97+
"speed": 25000
98+
}
99+
]
100+
}
101+
},
102+
"sonic-storm-control:sonic-storm-control": {
103+
"sonic-storm-control:PORT_STORM_CONTROL": {
104+
"sonic-storm-control:PORT_STORM_CONTROL_LIST": [
105+
{
106+
"ifname": "Ethernet0",
107+
"storm_type": "xyz",
108+
"kbps": "400000"
109+
}
110+
]
111+
}
112+
}
113+
},
114+
"STORM_BROADCAST_INVALID_KBPS": {
115+
"sonic-port:sonic-port": {
116+
"sonic-port:PORT": {
117+
"PORT_LIST": [
118+
{
119+
"admin_status": "up",
120+
"alias": "eth0",
121+
"description": "Ethernet0",
122+
"lanes": "65",
123+
"mtu": 9000,
124+
"name": "Ethernet0",
125+
"speed": 25000
126+
}
127+
]
128+
}
129+
},
130+
"sonic-storm-control:sonic-storm-control": {
131+
"sonic-storm-control:PORT_STORM_CONTROL": {
132+
"sonic-storm-control:PORT_STORM_CONTROL_LIST": [
133+
{
134+
"ifname": "Ethernet0",
135+
"storm_type": "broadcast",
136+
"kbps": "xyz-kbps-value"
137+
}
138+
]
139+
}
140+
}
141+
},
142+
"STORM_BROADCAST_INVALID_INTERFACE": {
143+
"sonic-port:sonic-port": {
144+
"sonic-port:PORT": {
145+
"PORT_LIST": [
146+
{
147+
"admin_status": "up",
148+
"alias": "eth0",
149+
"description": "Ethernet0",
150+
"lanes": "65",
151+
"mtu": 9000,
152+
"name": "Ethernet0",
153+
"speed": 25000
154+
}
155+
]
156+
}
157+
},
158+
"sonic-storm-control:sonic-storm-control": {
159+
"sonic-storm-control:PORT_STORM_CONTROL": {
160+
"sonic-storm-control:PORT_STORM_CONTROL_LIST": [
161+
{
162+
"ifname": "Eth",
163+
"storm_type": "broadcast",
164+
"kbps": "500000"
165+
}
166+
]
167+
}
168+
}
169+
}
170+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
module sonic-storm-control {
2+
namespace "http://github.com/Azure/sonic-storm-control";
3+
yang-version "1";
4+
5+
prefix ssc;
6+
7+
import sonic-port {
8+
prefix prt;
9+
}
10+
11+
organization
12+
"SONiC";
13+
14+
contact
15+
"SONiC";
16+
17+
description
18+
"This module defines configuration and operational state
19+
data for broadcast, unknown-unicast and unknown-multicast (BUM) storm-control.
20+
storm-control can be enabled on ethernet interfaces.
21+
Rate is defined in bits-per-second. All three types of storm-control can be
22+
enabled on an interface.";
23+
24+
revision 2021-12-13 {
25+
description
26+
"Initial revision";
27+
}
28+
29+
container sonic-storm-control {
30+
container PORT_STORM_CONTROL {
31+
list PORT_STORM_CONTROL_LIST {
32+
key "ifname storm_type";
33+
/*scommon:key-pattern "PORT_STORM_CONTROL|{ifname}|{storm_type}";*/
34+
leaf ifname {
35+
type leafref {
36+
path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name";
37+
}
38+
}
39+
leaf storm_type {
40+
type enumeration{
41+
enum broadcast;
42+
enum unknown-unicast;
43+
enum unknown-multicast;
44+
}
45+
}
46+
leaf kbps {
47+
type uint64 {
48+
range "0..100000000" {
49+
error-message "kbps value out of range";
50+
}
51+
}
52+
}
53+
}
54+
}
55+
}
56+
}

0 commit comments

Comments
 (0)