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