fix funcional test issue when list in dict
[transportpce.git] / api / src / main / yang / gnpy-network-topology@2022-02-21.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-02-21 {
48     description
49       "draft for GNPy4TPCE preversion - non official version relevant for v2.4 GNPy file format";
50     reference
51       "YANG model for api input for path computation with gnpy";
52   }
53
54   revision 2020-10-22 {
55     description
56       "draft for experimental/2020-candi";
57     reference
58       "YANG model for network input for path computation with gnpy";
59   }
60
61   revision 2019-01-03 {
62     description
63       "first draft for GNPy4TPCE preversion - non official version relevant for v1.2 GNPy file format";
64     reference
65       "YANG model for api input for path computation with gnpy";
66   }
67
68   identity type-element {
69     description
70       "Base identity for element type";
71   }
72
73   identity Transceiver {
74     base type-element;
75     description
76       " Transceiver element";
77   }
78
79   identity Fiber {
80     base type-element;
81     description
82       "Fiber element (unidirectional)";
83   }
84
85   identity Roadm {
86     base type-element;
87     description
88       "Roadm element";
89   }
90
91   identity Edfa {
92     base type-element;
93     description
94       "Edfa element";
95   }
96
97   identity Fused {
98     base type-element;
99     description
100       "Fused element ; non amplified connection between two fiber spans ;
101        can be used to model optical distribution frame, or losses due to
102        connectors or fused in a span";
103   }
104
105   identity length-unit {
106     description
107       "length unit";
108   }
109
110   identity km {
111     base length-unit;
112     description
113       "kilometers";
114   }
115
116   identity m {
117     base length-unit;
118     description
119       "meter";
120   }
121
122   typedef Coordinate {
123     type decimal64 {
124       fraction-digits 6;
125     }
126   }
127
128   typedef Coef {
129     type decimal64 {
130       fraction-digits 2;
131     }
132   }
133
134   grouping location-attributes {
135     container location {
136       leaf city {
137         type string;
138         mandatory true;
139       }
140       leaf region {
141         type string;
142         mandatory true;
143       }
144       leaf latitude {
145         type Coordinate;
146         mandatory true;
147       }
148       leaf longitude {
149         type Coordinate;
150         mandatory true;
151       }
152     }
153   }
154
155   grouping fiber-params {
156     description
157       ".....";
158     leaf length {
159       type decimal64 {
160         fraction-digits 2;
161       }
162       mandatory true;
163     }
164     leaf loss_coef {
165       type decimal64 {
166         fraction-digits 2;
167       }
168       mandatory true;
169       units db/km;
170       description "Loss coefficient of the fiber span (dB/km)";
171     }
172     leaf length_units {
173       type identityref {
174         base length-unit;
175       }
176       mandatory true;
177     }
178     leaf att_in {
179       type decimal64 {
180         fraction-digits 2;
181       }
182       units "dB";
183       mandatory true;
184     }
185     leaf con_in {
186       type decimal64 {
187         fraction-digits 2;
188       }
189       units "dB";
190       mandatory true;
191     }
192     leaf con_out {
193       type decimal64 {
194         fraction-digits 2;
195       }
196       units "dB";
197       mandatory true;
198     }
199   }
200
201   grouping edfa-params {
202     container operational {
203       description
204         "Operational values for the Edfa ";
205       leaf gain_target {
206         type decimal64 {
207           fraction-digits 2;
208         }
209         units "dB";
210         mandatory true;
211         description
212           "gain target of the amplifier (before VOA and after att_in)";
213       }
214       leaf tilt_target {
215         type decimal64 {
216           fraction-digits 2;
217         }
218         mandatory true;
219         description
220           "..";
221       }
222       leaf out_voa {
223         type decimal64 {
224           fraction-digits 2;
225         }
226         units "dB";
227         mandatory true;
228         description
229           "..";
230       }
231       leaf delta_p {
232         type decimal64 {
233           fraction-digits 2;
234         }
235         units "dB";
236         mandatory true;
237         description
238           "per channel target output power delta with respect to power setting in SI";
239       }
240     }
241   }
242
243   grouping roadm-params {
244     leaf target_pch_out_db {
245       type decimal64 {
246         fraction-digits 2;
247       }
248       units "dB";
249       description
250         "..";
251     }
252     container restrictions {
253       leaf-list preamp_variety_list {
254         type string;
255         description
256           "List of authorized preamp type-variety";
257       }
258       leaf-list booster_variety_list {
259         type string;
260         description
261           "List of authorized booster type-variety";
262       }
263     }
264   }
265
266   grouping transceiver-params;
267
268   grouping fused-params{
269     leaf loss {
270       type decimal64 {
271         fraction-digits 2;
272       }
273       units "dB";
274       description
275         "Concentrated loss of the fused element";
276     }
277   }
278
279   grouping element-type-choice {
280     choice element-type {
281       case Edfa {
282         when "type = 'Edfa'";
283         uses edfa-params;
284       }
285       case FiberRoadm {
286         container params {
287           choice fiberroadmfused {
288             case Fiber {
289               when "type = 'Fiber'";
290               uses fiber-params;
291             }
292             case Roadm {
293               when "type = 'Roadm'";
294               uses roadm-params;
295             }
296             case Fused {
297               when "type = 'Fused'";
298               uses fused-params;
299             }
300           }
301         }
302       }
303       case Transceiver {
304         when "type = 'Transceiver'";
305       }
306     }
307   }
308
309
310   grouping topo {
311     list elements {
312       key "uid";
313       leaf uid {
314         type string;
315       }
316       leaf type {
317         type identityref {
318           base type-element;
319         }
320         mandatory true;
321       }
322       leaf type_variety {
323         type string;
324         mandatory false;
325       }
326       container metadata {
327         uses location-attributes;
328       }
329       uses element-type-choice;
330     }
331     list connections {
332       config false;
333       leaf from_node {
334         type leafref {
335           path "../../elements/uid";
336         }
337       }
338       leaf to_node {
339         type leafref {
340           path "../../elements/uid";
341         }
342       }
343     }
344   }
345 }