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