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