0bec3d913e88df1b7e3d726a124d285e24eb625e
[transportpce.git] / ordmodels / device / src / main / yang / org-openroadm-rstp@2016-10-14.yang
1 module org-openroadm-rstp {
2   namespace "http://org/openroadm/rstp";
3   prefix org-openroadm-rstp;
4
5   import org-openroadm-device {
6     prefix org-openroadm-device;
7   }
8
9   organization "Open ROADM MSA";
10   contact
11     "OpenROADM.org";
12   description
13     "YANG definitions for rstp protocol.
14
15
16      Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016,
17      AT&T Intellectual Property.  All other rights reserved.
18
19      Redistribution and use in source and binary forms, with or without modification,
20      are permitted provided that the following conditions are met:
21
22      * Redistributions of source code must retain the above copyright notice, this
23        list of conditions and the following disclaimer.
24      * Redistributions in binary form must reproduce the above copyright notice,
25        this list of conditions and the following disclaimer in the documentation and/or
26        other materials provided with the distribution.
27      * Neither the Members of the Open ROADM MSA Agreement nor the names of its
28        contributors may be used to endorse or promote products derived from this software
29        without specific prior written permission.
30
31      THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA  AGREEMENT ''AS IS''
32      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33      WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
34      IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA  AGREEMENT BE LIABLE FOR ANY DIRECT,
35      INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
36      NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE, DATA,
37      OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
38      WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
39      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40      POSSIBILITY OF SUCH DAMAGE.";
41
42   revision 2016-10-14 {
43     description
44       "Version 1.2";
45   }
46
47   typedef bridge-id-type {
48     type string;
49     description
50       "Unique Bridge Identifier";
51   }
52
53   grouping rstp-common-bridge-config {
54     leaf bridge-priority {
55       description
56         "Bridge Priority Value";
57       type uint32 {
58         range "0..61440";
59       }
60       default "32768";
61     }
62     leaf shutdown {
63       description
64         "Bridge admin state";
65       type empty;
66     }
67     leaf hold-time {
68       description
69         "The time interval during which no more than two
70             BPDUs transmitted by this node in seconds - not used in rstp mode (in seconds)";
71       type uint32 {
72         range "1..10";
73       }
74       default "2";
75     }
76     leaf hello-time {
77       description
78         "The time between the transmission of BPDU's by this node on any
79             port, when role is rooti (in seconds)";
80       type uint32 {
81         range "1..10";
82       }
83       default "2";
84     }
85     leaf max-age {
86       description
87         "The value that all bridges use for MaxAge when this bridge
88             is acting as the root";
89       type uint32 {
90         range "6..40";
91       }
92       default "20";
93     }
94     leaf forward-delay {
95       description
96         "The port on the Switch spends this time in the listening
97             state while moving from the blocking state to the forwarding state (in seconds)";
98       type uint32 {
99         range "4..30";
100       }
101       default "15";
102     }
103     leaf transmit-hold-count {
104       description
105         "Maximum BPDU transmission rate";
106       type uint32 {
107         range "1..10";
108       }
109       default "2";
110     }
111   }
112
113   grouping rstp-root-bridge-attr {
114     leaf root-bridge-port {
115       description
116         "Port id of the root port";
117       type uint32;
118     }
119     leaf root-path-cost {
120       description
121         "The cost of the path to the root as
122                seen from this bridge";
123       type uint32;
124     }
125     leaf root-bridge-priority {
126       description
127         "Root Bridge Priority Value";
128       type uint32;
129     }
130     leaf root-bridge-id {
131       description
132         "Root Bridge identifier";
133       type bridge-id-type;
134     }
135     leaf root-hold-time {
136       description
137         "The time interval during which no more than two
138                BPDUs transmitted by this node in seconds at root node (in seconds)";
139       type uint32;
140     }
141     leaf root-hello-time {
142       description
143         "The time between the transmission of BPDU's used at root node (in seconds)";
144       type uint32;
145     }
146     leaf root-max-age {
147       description
148         "The value that all bridges use for MaxAge used at root node";
149       type uint32;
150     }
151     leaf root-forward-delay {
152       description
153         "The time in seconds spent on the listening state used at root node (in seconds)";
154       type uint32;
155     }
156   }
157
158   grouping rstp-bridge-port-state-attr {
159     list rstp-bridge-port-table {
160       max-elements "15";
161       description
162         "This table contains port-specific information for rstp state attributes";
163       key "ifname";
164       leaf ifname {
165         description
166           "Interface name of the port";
167         type string {
168           length "1..255";
169         }
170       }
171       leaf bridge-port-state {
172         description
173           "The port's current state";
174         type enumeration {
175           enum "discarding";
176           enum "blocked";
177           enum "learning";
178           enum "forwarding";
179           enum "unknown";
180         }
181       }
182       leaf bridge-port-role {
183         description
184           "The role payed by this port in the bridge";
185         type enumeration {
186           enum "designated";
187           enum "root";
188           enum "alternate";
189           enum "disabled";
190           enum "backup";
191           enum "unknown";
192         }
193       }
194       leaf bridge-port-id {
195         description
196           "Unique port id of this port";
197         type uint32;
198       }
199       leaf oper-edge-bridge-port {
200         description
201           "The operational value of the Edge Port parameter";
202         type empty;
203       }
204       leaf designated-bridge-port {
205         description
206           "Port id of the designated port";
207         type uint32;
208       }
209       leaf designated-bridgeid {
210         description
211           "The Bridge Identifier of the bridge that this port considers
212            to be the Designated Bridge for this port's segment";
213         type bridge-id-type;
214       }
215     }
216   }
217
218   grouping rstp-bridge-port-attr {
219     list rstp-bridge-port-table {
220       max-elements "15";
221       description
222         "Table contains port-specific information for rstp config";
223       key "ifname";
224       leaf ifname {
225         description
226           "Interface name of the port";
227         type leafref {
228           path "/org-openroadm-device:org-openroadm-device/org-openroadm-device:interface/org-openroadm-device:name";
229         }
230       }
231       leaf cost {
232         description
233           "The contribution of this port to the path cost of
234                  paths towards the spanning tree root which include this port also";
235         type uint32 {
236           range "2000..200000";
237         }
238         default "20000";
239       }
240       leaf priority {
241         description
242           "The value of the priority field";
243         type uint32 {
244           range "0..240";
245         }
246       }
247     }
248   }
249
250   grouping rstp-container {
251     container rstp {
252       description
253         "Open ROADM RSTP top level";
254       list rstp-bridge-instance {
255         max-elements "1";
256         description
257           "rstp bridge instance, max instance = 1";
258         key "bridge-name";
259         leaf bridge-name {
260           description
261             "unique name of the bridge";
262           type string {
263             length "1..255";
264           }
265         }
266         container rstp-config {
267           description
268             "Collection of rstp configuration attributes";
269           uses rstp-common-bridge-config;
270           uses rstp-bridge-port-attr;
271         }
272         container rstp-state {
273           description
274             "Collection of rstp operational attributes";
275           config false;
276           container rstp-bridge-attr {
277             description
278               "Collection of operational rstp bridge attributes";
279             uses rstp-root-bridge-attr;
280             leaf bridge-id {
281               description
282                 "Bridge identifier of the bridge";
283               type bridge-id-type;
284             }
285             leaf topo-change-count {
286               description
287                 "The total number of topology changes";
288               type uint32;
289             }
290             leaf time-since-topo-change {
291               description
292                 "Time since last topology changes occured (in seconds)";
293               type uint32;
294             }
295           }
296           container rstp-bridge-port-attr {
297             description
298               "Collection of operational rstp port related attributes";
299             uses rstp-bridge-port-state-attr;
300           }
301         }
302       }
303     }
304   }
305
306   augment "/org-openroadm-device:org-openroadm-device/org-openroadm-device:protocols" {
307     when "/org-openroadm-device:org-openroadm-device/org-openroadm-device:info/org-openroadm-device:node-type='rdm'";
308     uses rstp-container;
309   }
310 }