@@ -158,7 +158,7 @@ root = "primary" / "secondary" / "default" ; (DEF: "default")
158158
159159### MSTP_VLAN_TABLE
160160```
161- ;Stores the STP instance operational details
161+ ;Stores MSTP VLAN to instance mapping
162162key = MSTP_VLAN|"Vlan"vlanid ; vlan id with MSTP_VLAN as a prefix
163163instance_id = 1*2DIGIT ; instance id vlan is mapped to (0-63, DEF:0)
164164```
@@ -176,7 +176,7 @@ path_cost = 1*9DIGIT ; port path cost (
176176```
177177;Stores the MSTP regional operational details
178178key = MSTP:REGION ; MSTP REGION key
179- regionname = 1*32CHAR ; region name (DEF: mac-address of switch)
179+ region_name = 1*32CHAR ; region name (DEF: mac-address of switch)
180180revision = 1*5DIGIT ; region revision (0 to 65535, DEF: 0)
181181bridge_id = 16HEX ; bridge id
182182cist_root_bridge_id = 16HEX ; CIST root’s bridge id
@@ -240,7 +240,256 @@ The table holds the VLAN to instance mapping.
240240The table informs when the FDB flushing is required. This is done in case of topology change where the mac entries in FDB become inconsistent and there is a need to flush these entries.
241241
242242# YANG Model
243- Yang will be extended to support MSTP.
243+
244+ YANG Model will be extended as follows for MSTP:
245+ ```
246+ module sonic-stp {
247+
248+ yang-version 1.1;
249+
250+ namespace "http://github.com/sonic-net/sonic-stp";
251+ prefix "stp";
252+
253+ import sonic-port {
254+ prefix port;
255+ revision-date 2019-07-01;
256+ }
257+
258+ import sonic-portchannel {
259+ prefix lag;
260+ revision-date 2021-06-13;
261+ }
262+
263+ import sonic-vlan {
264+ prefix vlan;
265+ revision-date 2021-04-22;
266+ }
267+
268+ import sonic-device_metadata {
269+ prefix device_metadata;
270+ revision-date 2021-02-27;
271+ }
272+
273+ description "STP yang Module for SONiC OS";
274+
275+ revision 2023-04-18 {
276+ description "First Revision";
277+ }
278+
279+ container sonic-stp {
280+
281+ container STP_GLOBAL {
282+ description "Global STP table";
283+
284+ leaf mode {
285+ type enumeration {
286+ enum "pvst";
287+ enum "mstp";
288+ }
289+ description "STP mode";
290+ }
291+
292+ leaf forward_delay {
293+ type uint8 {
294+ range "4..30" {
295+ error-message "forward_delay value out of range";
296+ }
297+ }
298+ default 15;
299+ description "Forward delay in sec";
300+ }
301+
302+ leaf hello_time {
303+ type uint8 {
304+ range "1..10" {
305+ error-message "hello_time value out of range";
306+ }
307+ }
308+ default 2;
309+ description "Hello time in sec";
310+ }
311+
312+ leaf max_age {
313+ type uint8 {
314+ range "6..40" {
315+ error-message "max_age value out of range";
316+ }
317+ }
318+ default 20;
319+ description "Max age";
320+ }
321+
322+ leaf rootguard_timeout {
323+ type uint16 {
324+ range "5..600" {
325+ error-message "rootguard_timeout value out of range";
326+ }
327+ }
328+ default 30;
329+ description "Root guard timeout in sec";
330+ }
331+
332+ leaf priority {
333+ must ". mod 4096 = 0" {
334+ error-message "bridge priority must be a multiple of 4096";
335+ }
336+
337+ type uint16 {
338+ range "0..61440" {
339+ error-message "priority value out of range";
340+ }
341+ }
342+ default 32768;
343+ description "Bridge priority";
344+ }
345+
346+ leaf max_hops {
347+ type uint8 {
348+ range "1..255" {
349+ error-message "max-hops value out of range";
350+ }
351+ }
352+ default 20;
353+ description "Max hops";
354+ }
355+ }
356+
357+ container MSTP_REGION {
358+ description "MSTP Regional operational details";
359+
360+ leaf region_name {
361+ type string {
362+ length "1..32";
363+ }
364+ default "device_metadata:sonic-device_metadata/device_metadata:DEVICE_METADATA/device_metadata:localhost/device_metadata:mac";
365+ description "Region name";
366+ }
367+
368+ leaf revision {
369+ type uint16 {
370+ range "0..65535" {
371+ error-message "revision value out of range";
372+ }
373+ }
374+ default 0;
375+ description "Region revision";
376+ }
377+ }
378+
379+ container MSTP_INSTANCE {
380+ description "MSTP instance operational details";
381+
382+ list MSTP_INSTANCE_LIST {
383+ key "name";
384+
385+ leaf name {
386+ type string {
387+ pattern 'Instance([0-9]|[1-5][0-9]|[6][0-3])';
388+ }
389+ }
390+
391+ leaf priority {
392+ must ". mod 4096 = 0" {
393+ error-message "bridge priority must be a multiple of 4096";
394+ }
395+
396+ type uint16 {
397+ range "0..61440" {
398+ error-message "priority value out of range";
399+ }
400+ }
401+ default 32768;
402+ description "Bridge priority";
403+ }
404+
405+ leaf root {
406+ type enumeration {
407+ enum "primary";
408+ enum "secondary";
409+ enum "default";
410+ }
411+ default "default";
412+ description "Root priority";
413+ }
414+ }
415+ }
416+
417+ container MSTP_VLAN {
418+ description "MSTP VLAN to instance mapping";
419+
420+ list MSTP_VLAN_LIST {
421+ key "vlan";
422+
423+ leaf vlan {
424+ must "(current() = /vlan:sonic-vlan/vlan:VLAN/vlan:VLAN_LIST/vlan:name)" {
425+ error-message "Must condition not satisfied, Try adding Vlan<vlanid>: {}, Example: 'Vlan2': {}";
426+ }
427+
428+ type leafref {
429+ path "/vlan:sonic-vlan/vlan:VLAN/vlan:VLAN_LIST/vlan:name";
430+ }
431+ }
432+
433+ leaf instance_id {
434+ must "(concat('Instance', current()) = ../../../MSTP_INSTANCE/MSTP_INSTANCE_LIST[name=concat('Instance', current())]/name)" {
435+ error-message "Must condition not satisfied, Try adding Instance<instanceid>: {}, Example: 'Instance2': {}";
436+ }
437+
438+ type uint8 {
439+ range "0..63";
440+ }
441+ default 0;
442+ }
443+ }
444+ }
445+
446+ container MSTP_INSTANCE_PORT {
447+ description "STP port details per Instance";
448+
449+ list MSTP_INSTANCE_PORT_LIST {
450+ key "instance port";
451+
452+ leaf instance {
453+ must "(current() = ../../../MSTP_INSTANCE/MSTP_INSTANCE_LIST[name=current()]/name)" {
454+ error-message "Must condition not satisfied, Try adding Instance<instanceid>: {}, Example: 'Instance2': {}";
455+ }
456+
457+ type leafref {
458+ path "/stp:sonic-stp/stp:MSTP_INSTANCE/stp:MSTP_INSTANCE_LIST/stp:name";
459+ }
460+ }
461+
462+ leaf port {
463+ type union {
464+ type leafref {
465+ path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name";
466+ }
467+ type leafref {
468+ path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name";
469+ }
470+ }
471+ }
472+
473+ leaf priority {
474+ type uint8 {
475+ range "0..240" {
476+ error-message "priority value out of range";
477+ }
478+ }
479+ default 128;
480+ description "Port priority";
481+ }
482+
483+ leaf path_cost {
484+ type uint32;
485+ description "Port path cost";
486+ }
487+ }
488+ }
489+ }
490+ }
491+ ```
492+
244493# SAI
245494Following table shows the SAI Attributes that will be used:
246495
0 commit comments