From cf6483345514d71c51c12e6b946afee37ffe33f5 Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Thu, 12 Dec 2024 16:51:29 +0100 Subject: [PATCH] [WIP] expaning model --- src/confd/src/ietf-interfaces.c | 17 ++++++++- src/confd/yang/infix-if-bridge.yang | 57 ++++++++++++++++------------- 2 files changed, 48 insertions(+), 26 deletions(-) diff --git a/src/confd/src/ietf-interfaces.c b/src/confd/src/ietf-interfaces.c index 08e6fb3f7..4a65e3154 100644 --- a/src/confd/src/ietf-interfaces.c +++ b/src/confd/src/ietf-interfaces.c @@ -1451,8 +1451,23 @@ static int bridge_stp_settings(struct dagger *net, FILE *ip, const char *brname, fputs("#!/sbin/mstpctl -b\n", mstpctl); + fprintf(mstpctl, "setforcevers %s %s\n", brname, + lydx_get_cattr(stp, "force-protocol")); + + fprintf(mstpctl, "setfdelay %s %s\n", brname, + lydx_get_cattr(stp, "forward-delay")); + + fprintf(mstpctl, "setmaxage %s %s\n", brname, + lydx_get_cattr(stp, "max-age")); + + fprintf(mstpctl, "settxholdcount %s %s\n", brname, + lydx_get_cattr(stp, "transmit-hold-count")); + + fprintf(mstpctl, "setmaxhops %s %s\n", brname, + lydx_get_cattr(stp, "max-hops")); + fprintf(mstpctl, "settreeprio %s 0 %s\n", brname, - lydx_get_cattr(stp, "priority")); + lydx_get_cattr(lydx_get_child(stp, "cist"), "priority")); fclose(mstpctl); return 0; diff --git a/src/confd/yang/infix-if-bridge.yang b/src/confd/yang/infix-if-bridge.yang index e1819ecaa..51d2e908b 100644 --- a/src/confd/yang/infix-if-bridge.yang +++ b/src/confd/yang/infix-if-bridge.yang @@ -148,7 +148,7 @@ submodule infix-if-bridge { reserved link-local multicast groups, in 01:80:C2:00:00:0X."; } - typedef stp-version { + typedef stp-protocol { description "Spanning Tree Protocol version."; type enumeration { enum stp { @@ -207,7 +207,7 @@ submodule infix-if-bridge { type enumeration { enum auto; } - type bool; + type boolean; } default auto; } @@ -372,6 +372,27 @@ submodule infix-if-bridge { } } + grouping stp-tree { + leaf priority { + description "Priority."; + type stp-priority; + reference "IEEE 802.1Q-2018 13.18"; + } + } + + grouping stp-tree-port { + leaf priority { + description "Priority."; + type stp-priority; + reference "IEEE 802.1Q-2018 13.18"; + } + + leaf state { + description "Operational state."; + type stp-state; + config false; + } + } /* * Data Nodes @@ -457,7 +478,7 @@ submodule infix-if-bridge { } leaf forward-delay { - description "Forward delay." + description "Forward delay."; type uint8 { range "4..30"; } @@ -466,7 +487,7 @@ submodule infix-if-bridge { } leaf max-age { - description "Max age." + description "Max age."; type uint8 { range "6..40"; } @@ -475,7 +496,7 @@ submodule infix-if-bridge { } leaf transmit-hold-count { - description "Transmit hold count." + description "Transmit hold count."; type uint8 { range "1..10"; } @@ -484,7 +505,7 @@ submodule infix-if-bridge { } leaf max-hops { - description "Max hops." + description "Max hops."; type uint8 { range "6..40"; } @@ -494,11 +515,7 @@ submodule infix-if-bridge { container cist { description "Common and Internal Spanning Tree."; - leaf priority { - description "Priority."; - type stp-priority; - reference "IEEE 802.1Q-2018 13.18"; - } + uses stp-tree; } // list mst { @@ -510,16 +527,13 @@ submodule infix-if-bridge { // type dot1q-types:mstid-type; // } + // uses stp-tree; + // leaf-list vlan { // type leafref { // path "/if:interfaces/interface/bridge/vlans/vlan/vid"; // } // } - - // leaf priority { - // description "Priority."; - // type stp-priority; - // } // } } } @@ -661,11 +675,7 @@ submodule infix-if-bridge { container cist { description "Common and Internal Spanning Tree."; - leaf priority { - description "Priority."; - type stp-priority; - reference "IEEE 802.1Q-2018 13.18"; - } + uses stp-tree-port; } // list mst { @@ -677,10 +687,7 @@ submodule infix-if-bridge { // type dot1q-types:mstid-type; // } - // leaf priority { - // description "Priority."; - // type stp-priority; - // } + // uses stp-tree-port; // } }