Clean up API YANG models with the help of pyang
[transportpce.git] / ordmodels / network / src / main / yang / org-openroadm-otn-network-topology@2018-11-30.yang
1 module org-openroadm-otn-network-topology {
2   yang-version 1.1;
3   namespace "http://org/openroadm/otn/network/topology";
4   prefix otn-topo;
5
6   import ietf-network {
7     prefix nd;
8     revision-date 2018-02-26;
9   }
10   import ietf-network-topology {
11     prefix nwt;
12     revision-date 2018-02-26;
13   }
14   import org-openroadm-network-types {
15     prefix org-openroadm-network-types;
16     revision-date 2018-11-30;
17   }
18   import org-openroadm-network-topology-types {
19     prefix org-openroadm-network-topology-types;
20     revision-date 2018-11-30;
21   }
22   import org-openroadm-xponder {
23     prefix xpdr;
24     revision-date 2018-11-30;
25   }
26   import org-openroadm-common-state-types {
27     prefix org-openroadm-common-state-types;
28     revision-date 2018-11-30;
29   }
30   import org-openroadm-common-network {
31     prefix cnet;
32     revision-date 2018-11-30;
33   }
34
35   organization
36     "OPEN ROADM MSA";
37   contact
38     "OpenROADM.org.";
39   description
40     "YANG definitions for network view of a ROADM
41
42      Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016,
43      All other rights reserved.
44
45      Redistribution and use in source and binary forms, with or without modification,
46      are permitted provided that the following conditions are met:
47
48      * Redistributions of source code must retain the above copyright notice, this
49        list of conditions and the following disclaimer.
50      * Redistributions in binary form must reproduce the above copyright notice,
51        this list of conditions and the following disclaimer in the documentation and/or
52        other materials provided with the distribution.
53      * Neither the Members of the Open ROADM MSA Agreement nor the names of its
54        contributors may be used to endorse or promote products derived from this software
55        without specific prior written permission.
56
57      THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA  AGREEMENT ''AS IS''
58      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
59      WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
60      IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA  AGREEMENT BE LIABLE FOR ANY DIRECT,
61      INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
62      NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE, DATA,
63      OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
64      WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
65      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
66      POSSIBILITY OF SUCH DAMAGE.";
67
68   revision 2018-11-30 {
69     description
70       "Version 4.1.0";
71   }
72   revision 2018-09-28 {
73     description
74       "Version 4.0.0";
75   }
76   revision 2018-05-30 {
77     description
78       "Version 3.1.0";
79   }
80   revision 2018-03-30 {
81     description
82       "Version 3.0.0";
83   }
84   revision 2017-12-15 {
85     description
86       "Version 2.2";
87   }
88   revision 2017-09-29 {
89     description
90       "Version 2.1";
91   }
92
93   deviation "/nd:networks/nd:network/nd:node/cnet:node-type" {
94     deviate add {
95       must
96         "(not /nd:network/nd:network-types/cnet:openroadm-common-network/otn-topology) or
97          (/nd:network/nd:network-types/cnet:openroadm-common-network/otn-topology and
98          (../cnet:node-type = 'SWITCH' or ../cnet:node-type = 'MUXPDR' or ../cnet:node-type = 'TPDR' or
99           ../cnet:node-type = 'REGEN' or ../cnet:node-type = 'REGEN-UNI'))" {
100         error-message "Invalid node type for otn-topology";
101         description
102           "The type of a node in the OTN topology. Valid node types are 'MUXPDR', 'TPDR' and 'SWITCH'";
103       }
104     }
105   }
106   deviation "/nd:networks/nd:network/nd:node/nwt:termination-point/cnet:tp-type" {
107     description
108       "Defines which TP types can be instantiated on which Node types";
109     deviate add {
110       must
111         "(/nd:network/nd:node/cnet:node-type != 'MUXPDR' and ../../cnet:node-type != 'SWITCH' and ../../cnet:node-type != 'TPDR'
112          and ../cnet:node-type != 'REGEN' and ../cnet:node-type != 'REGEN-UNI') or
113          ((../../cnet:node-type = 'MUXPDR' or ../../cnet:node-type = 'SWITCH' or ../../cnet:node-type = 'TPDR' or
114          ../cnet:node-type = 'REGEN' or ../cnet:node-type = 'REGEN-UNI') and
115          (../cnet:tp-type = 'XPONDER-NETWORK' or ../cnet:tp-type = 'XPONDER-CLIENT' or ../cnet:tp-type = 'XPONDER-PORT'))" {
116         error-message "Invalid TP for node type Xponder";
117       }
118     }
119   }
120   deviation "/nd:networks/nd:network/nwt:link/cnet:link-type" {
121     deviate add {
122       must
123         "(not /nd:network/nd:network-types/cnet:openroadm-common-network/otn-topology) or
124          (/nd:network/nd:network-types/cnet:openroadm-common-network/otn-topology and ../cnet:link-type = 'OTN-LINK')" {
125         error-message "Invalid link type for otn-topology";
126         description
127           "The valid link type in the OTN topology is 'OTN-LINK'";
128       }
129     }
130   }
131   augment "/nd:networks/nd:network/nd:network-types/cnet:openroadm-common-network" {
132     description
133       "Introduce new network type for the Open ROADM OTN network topology";
134     container otn-topology {
135       presence "indicates OTN topology for Transponder, Muxponder, Switchponder and OTN-switch";
136     }
137   }
138   augment "/nd:networks/nd:network/nd:node" {
139     when "../nd:network-types/cnet:openroadm-common-network/otn-topology";
140     description
141       "This augmentations adds the OTN Node type to the generic node
142        definition and defines node-specific attributes for each node type
143        in the OTN Topology.";
144     leaf node-type {
145       type org-openroadm-network-types:openroadm-node-type;
146       must
147         "(../node-type = 'SWITCH' or ../node-type = 'MUXPDR' or ../node-type = 'TPDR' or
148          ../node-type = 'REGEN' or ../node-type = 'REGEN-UNI')" {
149         error-message "Invalid node type for otn-topology";
150       }
151       status deprecated;
152       description
153         "The type of a node in the OTN topology. Valid node types are 'MUXPDR', 'TPDR' and 'SWITCH'";
154     }
155     container tp-bandwidth-sharing {
156       when "../cnet:node-type = 'MUXPDR' or ../cnet:node-type = 'SWITCH' or ../cnet:node-type = 'TPDR'";
157       uses org-openroadm-network-topology-types:xpdr-tp-bandwidth-sharing;
158     }
159     container switching-pools {
160       when "../cnet:node-type = 'MUXPDR' or ../cnet:node-type = 'SWITCH' or ../cnet:node-type = 'TPDR'";
161       description
162         "ODU Switching pool";
163       uses org-openroadm-network-topology-types:xpdr-odu-switching-pools;
164     }
165     container xpdr-attributes {
166       when
167         "../cnet:node-type = 'MUXPDR' or ../cnet:node-type = 'SWITCH' or ../cnet:node-type = 'TPDR' or
168          ../cnet:node-type = 'REGEN' or ../cnet:node-type = 'REGEN-UNI'";
169       description
170         "Topology-related attributes for Xponder nodes";
171       uses xpdr:xpdr-topo-node-attributes;
172     }
173   }
174   augment "/nd:networks/nd:network/nd:node/nwt:termination-point" {
175     when "../../nd:network-types/cnet:openroadm-common-network/otn-topology";
176     description
177       "Defines the type of a termination point in the OTN topology and
178        TP-specific attributes for each termination point type.";
179     leaf tp-type {
180       type org-openroadm-network-types:openroadm-tp-type;
181       must
182         "(../../otn-topo:node-type != 'MUXPDR' and ../../otn-topo:node-type != 'SWITCH' and ../../otn-topo:node-type != 'TPDR'
183          and ../../otn-topo:node-type != 'REGEN' and ../../otn-topo:node-type != 'REGEN-UNI') or
184          ((../../otn-topo:node-type = 'MUXPDR' or ../../otn-topo:node-type = 'SWITCH' or ../../otn-topo:node-type = 'TPDR'
185          or ../../otn-topo:node-type = 'REGEN' or ../../otn-topo:node-type = 'REGEN-UNI') and
186          (../otn-topo:tp-type = 'XPONDER-NETWORK' or ../otn-topo:tp-type = 'XPONDER-CLIENT' or ../otn-topo:tp-type = 'XPONDER-PORT'))" {
187         error-message "Invalid TP for node type Xponder";
188       }
189       status deprecated;
190       description
191         "The TP type; also defines which TP types can be instantiated
192          on which Node types";
193     }
194     leaf eqpt-srg-id {
195       type uint32;
196       status deprecated;
197       description
198         "Shared Risk Group identifier. All ports in a circuit-pack will have same srg-id";
199     }
200     container tp-supported-interfaces {
201       when "../cnet:tp-type = 'XPONDER-NETWORK' or ../cnet:tp-type = 'XPONDER-CLIENT' or ../cnet:tp-type = 'XPONDER-PORT'";
202       description
203         "Supported interface capability on the port.";
204       uses org-openroadm-network-types:xpdr-tp-supported-interfaces;
205     }
206     container xpdr-tp-port-connection-attributes {
207       when "../cnet:tp-type = 'XPONDER-NETWORK' or ../cnet:tp-type = 'XPONDER-CLIENT' or ../cnet:tp-type = 'XPONDER-PORT'";
208       description
209         "Topology-related attributes for Xpdr nodes";
210       uses xpdr:xpdr-otn-tp-attributes;
211       uses xpdr:xpdr-port-connection-attributes;
212       uses org-openroadm-network-topology-types:xpdr-otn-tail-attributes;
213     }
214   }
215   augment "/nd:networks/nd:network/nwt:link" {
216     when "../nd:network-types/cnet:openroadm-common-network/otn-topology";
217     description
218       "This augmentation defines Logical link types in the OTN topology connecting OTN elements";
219     leaf link-type {
220       type org-openroadm-network-types:openroadm-link-type;
221       must "(../link-type = 'OTN-LINK')" {
222         error-message "Invalid link type for otn-topology";
223       }
224       status deprecated;
225     }
226     leaf administrative-group {
227       type uint32;
228       status deprecated;
229       description
230         "according to RFC 3630 definition";
231     }
232     leaf operational-state {
233       type org-openroadm-common-state-types:state;
234       status deprecated;
235     }
236     leaf administrative-state {
237       type org-openroadm-common-state-types:state;
238       status deprecated;
239     }
240     leaf available-bandwidth {
241       type uint32;
242       description
243         "Available bandwidth between OTN elements";
244     }
245     leaf used-bandwidth {
246       type uint32;
247       description
248         "Used bandwidth between OTN elements";
249     }
250     leaf ODU-protected {
251       type boolean;
252       description
253         "ODU protection flag";
254     }
255   }
256 }