Skip to content

Commit 2929b0b

Browse files
committed
Updated the YANG model
1 parent baa95e3 commit 2929b0b

File tree

2 files changed

+127
-67
lines changed

2 files changed

+127
-67
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/path/to/sonic-extension.yang

src/sonic-yang-models/yang-models/sonic-stp.yang

+126-67
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
module sonic-stp {
2+
23
yang-version 1.1;
4+
35
namespace "https://github.com/sonic-net/sonic-stp";
6+
47
prefix stp;
58

69
import sonic-extension {
710
prefix sonic-ext;
811
}
9-
10-
description
11-
"SONiC STP YANG model for PVST and MST configurations";
1212

13-
revision 2024-12-30 {
14-
description
15-
"Version01 for combined PVST configurations.";
16-
}
13+
description
14+
"This module contains the collection of YANG definitions for the PVST & MSTP";
1715

18-
extension dependent-on {
19-
argument "dependency";
16+
revision 2024-12-30 {
2017
description
21-
"Indicates module dependencies";
18+
"Version01 for combined PVST & MSTP configurations.";
2219
}
2320

2421
grouping vlanModeAttr {
22+
description
23+
"Configuration parameters";
24+
2525
leaf forward_delay {
2626
type uint8 {
2727
range "4..30" {
@@ -74,6 +74,9 @@ module sonic-stp {
7474
}
7575

7676
grouping interfaceAttr {
77+
description
78+
"Configuration parameters of interfaces.";
79+
7780
leaf path_cost {
7881
type uint64 {
7982
range "1..200000000" {
@@ -99,42 +102,59 @@ module sonic-stp {
99102
}
100103
}
101104

102-
container sonic-spanning-tree {
105+
container spanning-tree {
106+
description
107+
"Top level container for SONiC Spanning Tree configurations";
108+
109+
container stp-config {
110+
description
111+
"Global configurations";
103112

104-
container STP {
105-
list STP_LIST {
113+
list stp-list {
114+
description
115+
"STP list containing global attributes";
106116
max-elements 1;
107117
key "keyleaf";
118+
108119
leaf keyleaf {
109120
type enumeration {
110-
enum GLOBAL;
121+
enum GLOBAL {
122+
description
123+
"Global configuration identifier";
124+
}
111125
}
112126
description
113127
"Key node identifier. It's value is always GLOBAL";
114128
}
115129

116130
leaf mode {
117131
type enumeration {
118-
enum pvst;
119-
enum mst;
132+
enum pvst {
133+
description
134+
"Per VLAN Spanning Tree Mode";
135+
}
136+
enum mst {
137+
description
138+
"Multiple Spanning Tree Mode";
139+
}
120140
}
121141
mandatory true;
122142
description
123143
"Spanning tree mode";
124144
}
125145

126146
leaf rootguard_timeout {
127-
must "../../../STP/STP_LIST[keyleaf='GLOBAL']/mode!='mst'" {
128-
error-message "Configuration not allowed in MST mode";
129-
error-app-tag stp-invalid;
130-
}
131-
132147
type uint16 {
133148
range "5..600" {
134149
error-message "Invalid Root-guard Timeout value.";
135150
}
136151
}
137152
units seconds;
153+
must "../../../stp-config/stp-list[keyleaf='GLOBAL']/mode!='mst'" {
154+
error-message "Root guard timeout not allowed in MST mode";
155+
error-app-tag stp-invalid;
156+
}
157+
138158
description
139159
"Once superior BPDUs stop coming on the port, device
140160
will wait for a period until root guard timeout before
@@ -145,9 +165,15 @@ module sonic-stp {
145165
}
146166
}
147167

148-
container STP_VLAN {
149-
list STP_VLAN_LIST {
168+
container stp-vlan {
169+
description
170+
"VLAN Specific STP Configurations";
171+
172+
list stp-vlan-list {
173+
description
174+
"List of VLAN STP configurations";
150175
key "name";
176+
151177
leaf name {
152178
type string;
153179
description
@@ -176,21 +202,26 @@ module sonic-stp {
176202
}
177203
}
178204

179-
container STP_VLAN_PORT {
180-
list STP_VLAN_PORT_LIST {
205+
container stp-vlan-port {
206+
description
207+
"Vlan port configurations";
208+
209+
list stp-vlan-port-list {
210+
description
211+
"List of VLAN port configurations";
181212
key "vlan-name ifname";
182213

183214
leaf vlan-name {
184215
type leafref {
185-
path "../../../STP_VLAN/STP_VLAN_LIST/name";
216+
path "../../../stp-vlan/stp-vlan-list/name";
186217
}
187218
description
188219
"Reference to Vlan";
189220
}
190221

191222
leaf ifname {
192223
type leafref {
193-
path "../../../STP_PORT/STP_PORT_LIST/ifname";
224+
path "../../../stp-port/stp-port-list/ifname";
194225
}
195226
description
196227
"Reference to Ethernet interface or PortChannel";
@@ -200,13 +231,17 @@ module sonic-stp {
200231
}
201232
}
202233

203-
container STP_PORT {
204-
list STP_PORT_LIST {
234+
container stp-port {
235+
description
236+
"Port Configurations.";
237+
238+
list stp-port-list {
239+
description
240+
"List of STP port List attributes.";
205241
key "ifname";
206-
//sonic-ext:dependent-on "STP_LIST";
207-
must "/sonic-spanning-tree/STP/STP_LIST" {
208-
error-message "STP global configuration must exist";
209-
}
242+
243+
sonic-ext:dependent-on "stp-list";
244+
210245
leaf ifname {
211246
type string;
212247
description
@@ -245,13 +280,13 @@ module sonic-stp {
245280
}
246281

247282
leaf portfast {
248-
must "current()!='true' or ../../../STP/STP_LIST[keyleaf='GLOBAL']/mode='pvst'" {
283+
type boolean;
284+
must "current()!='true' or ../../../stp-config/stp-list[keyleaf='GLOBAL']/mode='pvst'" {
249285
error-message "Configuration not allowed in MST mode";
250286
error-app-tag stp-invalid;
251287
}
252-
type boolean;
253288
description
254-
"Enable/Disable portfast on port";
289+
"Enable/Disable portfast on port in PVST only";
255290
}
256291

257292
uses interfaceAttr;
@@ -265,9 +300,18 @@ module sonic-stp {
265300

266301
leaf link_type {
267302
type enumeration {
268-
enum auto;
269-
enum shared;
270-
enum point-to-point;
303+
enum auto {
304+
description
305+
"Specifies the interface's link type. Permissible values 'auto'";
306+
}
307+
enum shared {
308+
description
309+
"Specifies the interface's link type. Permissible values 'shared'";
310+
}
311+
enum point-to-point {
312+
description
313+
"Specifies the interface's link type. Permissible values 'point-to-point'";
314+
}
271315
}
272316
description
273317
"Specifies the interface's link type. Permissible values
@@ -276,97 +320,108 @@ module sonic-stp {
276320
}
277321
}
278322

279-
container STP_MST {
280-
list STP_MST_LIST {
323+
container stp-mst {
324+
description
325+
"MST specific configuration container";
326+
327+
list stp-mst-list {
328+
description
329+
"List of MST global configurations";
281330
max-elements 1;
282331
key "keyleaf";
283-
//sonic-ext:dependent-on "STP_LIST";
284-
must "/sonic-spanning-tree/STP/STP_LIST" {
285-
error-message "STP global configuration must exist";
286-
}
332+
333+
sonic-ext:dependent-on "stp-list";
287334

288335
leaf keyleaf {
289336
type enumeration {
290-
enum GLOBAL;
337+
enum GLOBAL {
338+
description
339+
"Global MST";
340+
}
291341
}
292342
description
293343
"Key node identifier. It's value is always GLOBAL";
294344
}
295345

296346
leaf name {
297-
must "../../../STP/STP_LIST[keyleaf='GLOBAL']/mode='mst'" {
347+
type string;
348+
must "../../../stp-config/stp-list[keyleaf='GLOBAL']/mode='mst'" {
298349
error-message "Configuration allowed in MST mode";
299350
error-app-tag stp-invalid;
300351
}
301-
type string;
302352
description
303353
"MST Region name";
304354
}
305355

306356
leaf revision {
307-
must "../../../STP/STP_LIST[keyleaf='GLOBAL']/mode='mst'" {
357+
type uint32;
358+
must "../../../stp-config/stp-list[keyleaf='GLOBAL']/mode='mst'" {
308359
error-message "Configuration allowed in MST mode";
309360
error-app-tag stp-invalid;
310361
}
311-
type uint32;
312362
description
313363
"MST Revision number";
314364
}
315365

316366
leaf max_hops {
317-
must "../../../STP/STP_LIST[keyleaf='GLOBAL']/mode='mst'" {
367+
type uint8;
368+
must "../../../stp-config/stp-list[keyleaf='GLOBAL']/mode='mst'" {
318369
error-message "Configuration allowed in MST mode";
319370
error-app-tag stp-invalid;
320371
}
321-
type uint8;
322372
description
323373
"MST Max hops";
324374
}
325375

326376
leaf hello_time {
327-
must "../../../STP/STP_LIST[keyleaf='GLOBAL']/mode='mst'" {
377+
type uint8;
378+
must "../../../stp-config/stp-list[keyleaf='GLOBAL']/mode='mst'" {
328379
error-message "Configuration allowed in MST mode";
329380
error-app-tag stp-invalid;
330381
}
331-
type uint8;
332382
description
333383
"MST hello time";
334384
}
335385

336386
leaf max_age {
337-
must "../../../STP/STP_LIST[keyleaf='GLOBAL']/mode='mst'" {
387+
type uint8;
388+
must "../../../stp-config/stp-list[keyleaf='GLOBAL']/mode='mst'" {
338389
error-message "Configuration allowed in MST mode";
339390
error-app-tag stp-invalid;
340391
}
341-
type uint8;
342392
description
343393
"MST max age";
344394
}
345395

346396
leaf forward_delay {
347-
must "../../../STP/STP_LIST[keyleaf='GLOBAL']/mode='mst'" {
397+
type uint8;
398+
must "../../../stp-config/stp-list[keyleaf='GLOBAL']/mode='mst'" {
348399
error-message "Configuration allowed in MST mode";
349400
error-app-tag stp-invalid;
350401
}
351-
type uint8;
352402
description
353403
"MST forward delay";
354404
}
355405

356406
leaf hold_count {
357-
must "../../../STP/STP_LIST[keyleaf='GLOBAL']/mode='mst'" {
407+
type uint8;
408+
must "../../../stp-config/stp-list[keyleaf='GLOBAL']/mode='mst'" {
358409
error-message "Configuration allowed in MST mode";
359410
error-app-tag stp-invalid;
360411
}
361-
type uint8;
362412
description
363413
"MST hold count";
364414
}
365415
}
366416
}
367417

368-
container STP_MST_INST {
369-
list STP_MST_INST_LIST {
418+
container stp-mst-inst {
419+
description
420+
"STP MST Instance Configuration.";
421+
422+
list stp-mst-inst-list {
423+
description
424+
"List of STP MST Instance attributes.";
370425
key "instance";
371426

372427
leaf instance {
@@ -393,23 +448,27 @@ module sonic-stp {
393448
}
394449
}
395450

396-
container STP_MST_PORT {
397-
list STP_MST_PORT_LIST {
451+
container stp-mst-port {
452+
description
453+
"STP MST Port configurations.";
454+
455+
list stp-mst-port-list {
456+
description
457+
"STP MST Port List attributes";
398458
key "inst_id ifname";
399459

400460
leaf inst_id {
401461
type leafref {
402-
path "../../../STP_MST_INST/STP_MST_INST_LIST/instance";
462+
path "../../../stp-mst-inst/stp-mst-inst-list/instance";
403463
}
404464
description
405465
"Reference to MST Instance";
406466
}
407467

408468
leaf ifname {
409469
type leafref {
410-
path "../../../STP_PORT/STP_PORT_LIST/ifname";
470+
path "../../../stp-port/stp-port-list/ifname";
411471
}
412-
413472
description
414473
"Reference to Ethernet interface or PortChannel";
415474
}

0 commit comments

Comments
 (0)