fix funcional test issue when list in dict
[transportpce.git] / api / src / main / yang / gnpy-path-computation-simplified@2022-06-15.yang
1 module gnpy-path-computation-simplified {
2   yang-version 1.1;
3   namespace "gnpy:path";
4
5   prefix "gnpypc";
6
7     organization
8     "Telecom Infra Project OOPT PSE Working Group";
9
10   contact
11     "WG Web:   <https://github.com/Telecominfraproject/oopt-gnpy>
12      contact:  <mailto:ahmed.triki@orange.com>
13      contact:  <mailto:esther.lerouzic@orange.com>
14    ";
15
16   description
17     "YANG model for gnpy path computation simplified -
18     The license used for all the yang files of GNPy is BSD 3-Clause License
19
20     BSD 3-Clause License
21
22     Copyright (c) 2018, Telecom Infra Project
23     All rights reserved.
24
25     Redistribution and use in source and binary forms, with or without
26     modification, 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
31     * Redistributions in binary form must reproduce the above copyright notice,
32       this list of conditions and the following disclaimer in the documentation
33       and/or other materials provided with the distribution.
34
35     * Neither the name of the copyright holder nor the names of its
36       contributors may be used to endorse or promote products derived from
37       this software without specific prior written permission.
38
39     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
40     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
42     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
43     FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
44     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
45     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
46     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
47     OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
48     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.";
49
50   revision 2022-06-15 {
51     description
52       "change fraction digits from 2 to 6 for accumulative-value leaf, from 5 to 6 for output-power leaf";
53     reference
54       "YANG model for api input for path computation with gnpy";
55   }
56
57   revision 2022-02-21 {
58     description
59       "draft for GNPy4TPCE preversion - non official version relevant for v2.4 GNPy file format";
60     reference
61       "YANG model for api input for path computation with gnpy";
62   }
63
64   revision 2020-10-22 {
65     description
66       "draft for experimental/2020-candi";
67     reference
68       "YANG model for path computation with gnpy inputs";
69   }
70
71   revision 2019-01-03 {
72     description
73       "first draft for GNPy4TPCE preversion - non official version relevant for v1.2 GNPy file format";
74     reference
75       "YANG model for api input for path computation with gnpy";
76   }
77
78   grouping effective-freq-slot{
79          /* content copied from ietf-flexi-grid-media-channel, because only M and N are needed
80             from the initial grouping.
81          */
82          description "The effective frequency slot is an attribute
83             of a media channel and, being a frequency slot, it is
84             described by its nominal central frequency and slot
85             width";
86          reference "rfc7698";
87             leaf N {
88               type int32;
89               description
90                   "Is used to determine the Nominal Central
91                   Frequency. The set of nominal central frequencies
92                   can be built using the following expression:
93                      f = 193.1 THz + n x 0.00625 THz,
94                   where 193.1 THz is ITU-T ''anchor frequency'' for
95                   transmission over the C band, n is a positive or
96                   negative integer including 0.";
97                reference "rfc7698";
98             }
99             leaf M {
100               type uint32;
101               description
102                   "Is used to determine the slot width. A slot width
103                   is constrained to be M x SWG (that is, M x 12.5 GHz),
104                   where M is an integer greater than or equal to 1.";
105                reference "rfc7698";
106     }
107   }
108
109   grouping gnpy-specific-parameters{
110     description
111       "This grouping defines the gnpy specific parameters for requests.";
112         leaf technology {
113             type string;
114             default "flexi-grid";
115             description
116           "Data plane technology type.";
117           }
118       leaf trx_type {
119         type string ;
120         mandatory true;
121         description "name of the transponder type (to be read from equipment library";
122
123       }
124       leaf trx_mode {
125         type string;
126         description "name of the transponder mode (to be read from equipment library";
127
128       }
129       list effective-freq-slot {
130         key "N";
131         uses effective-freq-slot ;
132       }
133       leaf spacing {
134         mandatory true;
135         type decimal64 {
136           fraction-digits 1;
137         }
138         units Hz;
139         description
140           "It is the spacing between channels assuming full load with
141           same channels as the requested one. multiple of 12.5 GHz";
142
143       }
144       leaf max-nb-of-channel{
145         type int32;
146         description "Nb of channel to take into account for the full load case.
147         ";
148
149       }
150       leaf output-power{
151         type decimal64 {
152           fraction-digits 6;
153         }
154         units W;
155         description "optical power setting to be used for the propagation";
156
157       }
158       leaf path_bandwidth{
159         type decimal64 {
160           fraction-digits 5;
161         }
162         mandatory true;
163         units bit/s;
164         description "Capacity required";
165       }
166   }
167
168   identity SNR-bandwidth {
169     base path-metric-type;
170     description
171       "A metric that records SNR in signal bandwidth";
172   }
173
174   identity OSNR-bandwidth {
175     base path-metric-type;
176     description
177       "A metric that records OSNR in signal bandwidth";
178   }
179
180   identity SNR-0.1nm {
181     base path-metric-type;
182     description
183       "A metric that records SNR in 0.1nm";
184   }
185
186   identity OSNR-0.1nm {
187     base path-metric-type;
188     description
189       "A metric that records OSNR in 0.1nm";
190   }
191
192   identity reference_power {
193     base path-metric-type;
194     description
195       "to be revised";
196   }
197
198   identity path_bandwidth {
199      base path-metric-type;
200      description
201        "to be revised";
202   }
203
204   grouping transponder{
205         leaf transponder-type {
206         type string ;
207         description
208           "transponder type.";
209           }
210       leaf transponder-mode {
211         type string ;
212         description
213           "transponder mode.";
214           }
215   }
216
217   grouping hop-attribute{
218     description
219       "This grouping defines the hop attribute parameters for request or response";
220     choice hop-type{
221       case tsp {
222         container transponder{
223           uses transponder ;
224         }
225       }
226       case regen {
227         container regenerator{
228           leaf regenerator-id{
229             type string ;
230           }
231           uses transponder ;
232         }
233       }
234       case pow {
235         container optical-power{
236           leaf optical-power{
237             type decimal64 {
238               fraction-digits 5;
239             }
240             units W;
241             description "not used yet. hop output (input??) power";
242           }
243         }
244       }
245     }
246
247   }
248
249   identity path-metric-type {
250     description
251       "Base identity for path metric type";
252   }
253
254   identity route-usage-type {
255     description
256       "Base identity for route usage";
257   }
258
259   identity route-include-ero {
260     base route-usage-type;
261     description
262       "Include ERO from route";
263   }
264
265   identity route-exclude-ero {
266     base route-usage-type;
267     description
268       "Exclude ERO from route";
269   }
270
271   identity route-exclude-srlg {
272     base route-usage-type;
273     description
274       "Exclude SRLG from route";
275   }
276
277   typedef te-hop-type {
278     type enumeration {
279       enum LOOSE {
280         description
281           "loose hop in an explicit path";
282       }
283       enum STRICT {
284         description
285           "strict hop in an explicit path";
286       }
287     }
288     description
289      "enumerated type for specifying loose or strict
290       paths";
291     reference "RFC3209: section-4.3.2";
292   }
293
294   typedef te-path-disjointness {
295     type bits {
296       bit node {
297         position 0;
298         description "Node disjoint.";
299       }
300       bit link {
301         position 1;
302         description "Link disjoint.";
303       }
304       bit srlg {
305         position 2;
306         description "SRLG (Shared Risk Link Group) disjoint.";
307       }
308     }
309     description
310       "Type of the resource disjointness for a TE tunnel path.";
311     reference
312       "RFC4872: RSVP-TE Extensions in Support of End-to-End
313        Generalized Multi-Protocol Label Switching (GMPLS)
314        Recovery";
315   } // te-path-disjointness
316
317     typedef accumulated-metric-type {
318       type union {
319         type uint64;
320         type decimal64 {
321           fraction-digits 2;
322         }
323       }
324       description
325           "type useable for accumulative-value";
326   }
327
328   grouping path-route-objects {
329     description
330       "List of EROs to be included or excluded when performing
331        the path computation.";
332     container explicit-route-objects {
333       description
334         "Container for the route object list";
335       list route-object-include-exclude {
336         description
337           "List of explicit route objects to include or
338            exclude in path computation";
339         leaf explicit-route-usage {
340           type identityref {
341             base route-usage-type;
342           }
343           description "Explicit-route usage.";
344         }
345         key "index";
346         uses explicit-route-hop ;
347       }
348     }
349   }
350
351   grouping generic-path-disjointness {
352     description "Path disjointness grouping";
353     leaf disjointness {
354       type te-path-disjointness;
355       description
356         "The type of resource disjointness.
357          Under primary path, disjointness level applies to
358          all secondary LSPs. Under secondary, disjointness
359          level overrides the one under primary";
360     }
361   }
362
363   grouping common-path-constraints-attributes {
364     description
365       "Common path constraints configuration grouping";
366     uses common-constraints_config;
367   }
368
369   grouping generic-path-constraints {
370     description
371       "Global named path constraints configuration
372       grouping";
373     container path-constraints {
374       description "TE named path constraints container";
375       uses common-path-constraints-attributes;
376     }
377   }
378
379
380   grouping explicit-route-hop {
381     description
382       "The explicit route subobject grouping";
383     leaf index {
384       type uint32;
385       description "ERO subobject index";
386     }
387     choice type {
388       description
389         "The explicit route subobject type";
390       case num-unnum-hop {
391         container num-unnum-hop {
392           leaf node-id {
393             //type te-node-id;
394             type string;
395             description
396               "The identifier of a node in the TE topology.";
397           }
398           leaf link-tp-id {
399             //type te-tp-id;
400             type string;
401             description
402               "TE link termination point identifier. The combination
403               of TE link ID and the TE node ID is used to identify an
404               unnumbered TE link.";
405           }
406           leaf hop-type {
407             type te-hop-type;
408             description "strict or loose hop";
409           }
410           description
411             "Numbered and Unnumbered link/node explicit route
412             subobject";
413         }
414       }
415       case label {
416         container label-hop {
417           description "Label hop type";
418           uses effective-freq-slot;
419         }
420         description
421           "The Label ERO subobject";
422       }
423       case hop-attribute{
424         uses gnpypc:hop-attribute ;
425       }
426     }
427   }
428
429   grouping common-constraints_config {
430     description
431       "Common constraints grouping that can be set on
432        a constraint set or directly on the tunnel";
433
434     container te-bandwidth {
435       uses gnpy-specific-parameters ;
436       description
437         "A requested bandwidth to use for path computation";
438     }
439   }
440
441   grouping end-points {
442     description
443       "Common grouping to define the TE tunnel end-points";
444
445     leaf source {
446       type string;
447       description "TE tunnel source address.";
448     }
449     leaf destination {
450       type string;
451       description "P2P tunnel destination address";
452     }
453     leaf src-tp-id {
454       type string;
455       description "TE tunnel source termination point identifier.";
456     }
457     leaf dst-tp-id {
458       type string;
459       description "TE tunnel destination termination point
460     identifier.";
461     }
462   }
463
464   grouping synchronization-info {
465     description "Information for sync";
466     list synchronization {
467       key "synchronization-id";
468       description "sync list";
469       leaf synchronization-id {
470         type string;
471         description "index";
472       }
473       container svec {
474         description
475          "Synchronization VECtor";
476         leaf relaxable {
477           type boolean;
478           default true;
479           description
480             "If this leaf is true, path computation process is free
481             to ignore svec content.
482             otherwise it must take into account this svec.";
483         }
484         uses generic-path-disjointness;
485         leaf-list request-id-number {
486           type string;
487           description "This list reports the set of M path computation requests that must be synchronized.";
488         }
489       }
490     }
491   }
492
493   grouping path-metric {
494     description "TE path metric type";
495     leaf metric-type {
496       type identityref {
497         base path-metric-type;
498       }
499       description "TE path metric type";
500     }
501     leaf accumulative-value {
502       type decimal64 {
503           fraction-digits 6;
504       }
505       description "TE path metric accumulative value";
506     }
507   }
508   grouping generic-path-properties {
509     description "TE generic path properties grouping";
510     container path-properties {
511       config false;
512       description "The TE path properties";
513       list path-metric {
514         key metric-type;
515         uses path-metric;
516       }
517       list z-a-path-metric {
518         key metric-type;
519         uses path-metric;
520       }
521       list path-route-objects {
522           description
523             "Container for the list of route objects either returned by
524              the computation engine or actually used by an LSP";
525           container path-route-object {
526             description
527               "List of route objects either returned by the computation
528                engine or actually used by an LSP";
529             uses explicit-route-hop;
530           }
531         }
532     }
533   }
534
535   grouping path-info {
536     uses generic-path-properties;
537     description "Path computation output information";
538   }
539
540 // adding some blocking reasons and info on path in case of blocking
541
542   grouping no-path-info {
543     description "no-path-info";
544     container no-path {
545       presence "Response without path information, due to failure
546         performing the path computation";
547       leaf no-path {
548         type string;
549         mandatory true ;
550         description
551           "returned blocking reasons:
552             NO_PATH
553             NO_COMPUTED_SNR
554             NO_FEASIBLE_BAUDRATE_WITH_SPACING
555             NO_PATH_WITH_CONSTRAINT
556             NO_FEASIBLE_MODE
557             MODE_NOT_FEASIBLE
558             NO_SPECTRUM
559           ";
560         }
561       uses generic-path-properties ;
562       description "if path computation cannot identify a path,
563         rpc returns no path.";
564     }
565   }
566
567    grouping service {
568      list path-request {
569        key "request-id";
570        description "request-list";
571        leaf request-id {
572          type string;
573          mandatory true;
574          description "Each path computation request is uniquely identified by the request-id-number.";
575        }
576        leaf bidirectional {
577          type boolean;
578          mandatory true;
579          description "Specify the bidirectionality of the path";
580        }
581
582        uses end-points;
583        uses path-route-objects;
584        uses generic-path-constraints;
585      }
586      uses synchronization-info;
587    }
588
589    grouping result {
590      list response {
591        key response-id;
592        config false;
593        description "response";
594        leaf response-id {
595          type string;
596          description
597          "The list key that has to reuse request-id-number.";
598        }
599        choice response-type {
600          config false;
601          description "response-type";
602          case no-path-case {
603            uses no-path-info;
604          }
605          case path-case {
606            uses path-info;
607            description "Path computation service.";
608          }
609        }
610      }
611    }
612
613
614   container result {
615     uses gnpypc:result;
616     description
617       "Describe the response object to gnpy";
618   }
619 }