fix funcional test issue when list in dict
[transportpce.git] / api / src / main / yang / gnpy-network-topology@2022-06-15.yang
1 module gnpy-network-topology {
2   yang-version 1.1;
3   namespace "gnpy:gnpy-network-topology";
4   prefix gnpynt;
5
6   organization
7     "Telecom Infra Project OOPT PSE Working Group";
8   contact
9     "WG Web:   <https://github.com/Telecominfraproject/oopt-gnpy>
10      contact:  <mailto:ahmed.triki@orange.com>
11      contact:  <mailto:esther.lerouzic@orange.com>
12     ";
13   description
14     "YANG model for gnpy network input -
15     The license used for all the yang files of GNPy is BSD 3-Clause License
16
17     BSD 3-Clause License
18
19     Copyright (c) 2018, Telecom Infra Project
20     All rights reserved.
21
22     Redistribution and use in source and binary forms, with or without
23     modification, are permitted provided that the following conditions are met:
24
25     * Redistributions of source code must retain the above copyright notice, this
26       list of conditions and the following disclaimer.
27
28     * Redistributions in binary form must reproduce the above copyright notice,
29       this list of conditions and the following disclaimer in the documentation
30       and/or other materials provided with the distribution.
31
32     * Neither the name of the copyright holder nor the names of its
33       contributors may be used to endorse or promote products derived from
34       this software without specific prior written permission.
35
36     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
37     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
40     FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
41     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
42     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
43     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44     OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.";
46
47   revision 2022-06-15 {
48     description
49       "change fraction digits from 2 to 5 for loss_coef leaf";
50     reference
51       "YANG model for api input for path computation with gnpy";
52   }
53
54   revision 2022-02-21 {
55     description
56       "draft for GNPy4TPCE preversion - non official version relevant for v2.4 GNPy file format";
57     reference
58       "YANG model for api input for path computation with gnpy";
59   }
60
61   revision 2020-10-22 {
62     description
63       "draft for experimental/2020-candi";
64     reference
65       "YANG model for network input for path computation with gnpy";
66   }
67
68   revision 2019-01-03 {
69     description
70       "first draft for GNPy4TPCE preversion - non official version relevant for v1.2 GNPy file format";
71     reference
72       "YANG model for api input for path computation with gnpy";
73   }
74
75   identity type-element {
76     description
77       "Base identity for element type";
78   }
79
80   identity Transceiver {
81     base type-element;
82     description
83       " Transceiver element";
84   }
85
86   identity Fiber {
87     base type-element;
88     description
89       "Fiber element (unidirectional)";
90   }
91
92   identity Roadm {
93     base type-element;
94     description
95       "Roadm element";
96   }
97
98   identity Edfa {
99     base type-element;
100     description
101       "Edfa element";
102   }
103
104   identity Fused {
105     base type-element;
106     description
107       "Fused element ; non amplified connection between two fiber spans ;
108        can be used to model optical distribution frame, or losses due to
109        connectors or fused in a span";
110   }
111
112   identity length-unit {
113     description
114       "length unit";
115   }
116
117   identity km {
118     base length-unit;
119     description
120       "kilometers";
121   }
122
123   identity m {
124     base length-unit;
125     description
126       "meter";
127   }
128
129   typedef Coordinate {
130     type decimal64 {
131       fraction-digits 6;
132     }
133   }
134
135   typedef Coef {
136     type decimal64 {
137       fraction-digits 2;
138     }
139   }
140
141   grouping location-attributes {
142     container location {
143       leaf city {
144         type string;
145         mandatory true;
146       }
147       leaf region {
148         type string;
149         mandatory true;
150       }
151       leaf latitude {
152         type Coordinate;
153         mandatory true;
154       }
155       leaf longitude {
156         type Coordinate;
157         mandatory true;
158       }
159     }
160   }
161
162   grouping fiber-params {
163     description
164       ".....";
165     leaf length {
166       type decimal64 {
167         fraction-digits 2;
168       }
169       mandatory true;
170     }
171     leaf loss_coef {
172       type decimal64 {
173         fraction-digits 5;
174       }
175       mandatory true;
176       units db/km;
177       description "Loss coefficient of the fiber span (dB/km)";
178     }
179     leaf length_units {
180       type identityref {
181         base length-unit;
182       }
183       mandatory true;
184     }
185     leaf att_in {
186       type decimal64 {
187         fraction-digits 2;
188       }
189       units "dB";
190       mandatory true;
191     }
192     leaf con_in {
193       type decimal64 {
194         fraction-digits 2;
195       }
196       units "dB";
197       mandatory true;
198     }
199     leaf con_out {
200       type decimal64 {
201         fraction-digits 2;
202       }
203       units "dB";
204       mandatory true;
205     }
206   }
207
208   grouping edfa-params {
209     container operational {
210       description
211         "Operational values for the Edfa ";
212       leaf gain_target {
213         type decimal64 {
214           fraction-digits 2;
215         }
216         units "dB";
217         mandatory true;
218         description
219           "gain target of the amplifier (before VOA and after att_in)";
220       }
221       leaf tilt_target {
222         type decimal64 {
223           fraction-digits 2;
224         }
225         mandatory true;
226         description
227           "..";
228       }
229       leaf out_voa {
230         type decimal64 {
231           fraction-digits 2;
232         }
233         units "dB";
234         mandatory true;
235         description
236           "..";
237       }
238       leaf delta_p {
239         type decimal64 {
240           fraction-digits 2;
241         }
242         units "dB";
243         mandatory true;
244         description
245           "per channel target output power delta with respect to power setting in SI";
246       }
247     }
248   }
249
250   grouping roadm-params {
251     leaf target_pch_out_db {
252       type decimal64 {
253         fraction-digits 2;
254       }
255       units "dB";
256       description
257         "..";
258     }
259     container restrictions {
260       leaf-list preamp_variety_list {
261         type string;
262         description
263           "List of authorized preamp type-variety";
264       }
265       leaf-list booster_variety_list {
266         type string;
267         description
268           "List of authorized booster type-variety";
269       }
270     }
271   }
272
273   grouping transceiver-params;
274
275   grouping fused-params{
276     leaf loss {
277       type decimal64 {
278         fraction-digits 2;
279       }
280       units "dB";
281       description
282         "Concentrated loss of the fused element";
283     }
284   }
285
286   grouping element-type-choice {
287     choice element-type {
288       case Edfa {
289         when "type = 'Edfa'";
290         uses edfa-params;
291       }
292       case FiberRoadm {
293         container params {
294           choice fiberroadmfused {
295             case Fiber {
296               when "type = 'Fiber'";
297               uses fiber-params;
298             }
299             case Roadm {
300               when "type = 'Roadm'";
301               uses roadm-params;
302             }
303             case Fused {
304               when "type = 'Fused'";
305               uses fused-params;
306             }
307           }
308         }
309       }
310       case Transceiver {
311         when "type = 'Transceiver'";
312       }
313     }
314   }
315
316
317   grouping topo {
318     list elements {
319       key "uid";
320       leaf uid {
321         type string;
322       }
323       leaf type {
324         type identityref {
325           base type-element;
326         }
327         mandatory true;
328       }
329       leaf type_variety {
330         type string;
331         mandatory false;
332       }
333       container metadata {
334         uses location-attributes;
335       }
336       uses element-type-choice;
337     }
338     list connections {
339       config false;
340       leaf from_node {
341         type leafref {
342           path "../../elements/uid";
343         }
344       }
345       leaf to_node {
346         type leafref {
347           path "../../elements/uid";
348         }
349       }
350     }
351   }
352 }