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