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