Merge "Fix bug when creating SRG termination points"
[transportpce.git] / ordmodels / device / src / main / yang / org-openroadm-routing@2020-05-29.yang
1 module org-openroadm-routing {
2   namespace "http://org/openroadm/routing";
3   prefix org-openroadm-routing;
4
5   import ietf-yang-types {
6     prefix yang;
7     revision-date 2013-07-15;
8   }
9   import org-openroadm-device {
10     prefix org-openroadm-device;
11     revision-date 2020-05-29;
12   }
13
14   organization
15     "Open ROADM MSA";
16   contact
17     "OpenROADM.org";
18   description
19     "This model defines Yang model for routing.
20
21      This model reuses data items defined in the IETF YANG model for
22      interfaces described by RFC 8022.
23
24      Some attributes which are not required in Open ROADM MSA are removed.
25      Yang file included are changed to fit into Open ROADM MSA yang structure.
26
27      IETF code is subject to the following copyright and license:
28      Copyright (c) IETF Trust and the persons identified as authors of
29      the code.
30      All rights reserved.
31
32      Redistribution and use in source and binary forms, with or without
33      modification, is permitted pursuant to, and subject to the license
34      terms contained in, the Simplified BSD License set forth in
35      Section 4.c of the IETF Trust's Legal Provisions Relating
36      to IETF Documents (http://trustee.ietf.org/license-info).";
37
38   revision 2020-05-29 {
39     description
40       "Version 7.1.0";
41   }
42   revision 2020-03-27 {
43     description
44       "Version 7.0.0";
45   }
46   revision 2019-11-29 {
47     description
48       "Version 6.1.0";
49   }
50   revision 2019-09-27 {
51     description
52       "Version 6.0.0";
53   }
54   revision 2019-05-31 {
55     description
56       "Version 5.1.0";
57   }
58   revision 2019-03-29 {
59     description
60       "Version 5.0.0";
61   }
62   revision 2015-05-25 {
63     description
64       "Initial revision.";
65     reference
66       "RFC XXXX: A YANG Data Model for Routing Management";
67   }
68
69   feature multiple-ribs {
70     description
71       "This feature indicates that the server supports user-defined
72        RIBs.
73
74        Servers that do not advertise this feature SHOULD provide
75        exactly one system-controlled RIB per routing-instance and
76        supported address family and make them also the default RIBs.
77        These RIBs then appear as entries of the list
78        /routing-state/routing-instance/ribs/rib.";
79   }
80
81   feature router-id {
82     description
83       "This feature indicates that the server supports configuration
84        of an explicit 32-bit router ID that is used by some routing
85        protocols.
86
87        Servers that do not advertise this feature set a router ID
88        algorithmically, usually to one of configured IPv4 addresses.
89        However, this algorithm is implementation-specific.";
90   }
91
92   identity address-family {
93     description
94       "Base identity from which identities describing address
95        families are derived.";
96   }
97
98   identity ipv4 {
99     base address-family;
100     description
101       "This identity represents IPv4 address family.";
102   }
103
104   identity ipv6 {
105     base address-family;
106     description
107       "This identity represents IPv6 address family.";
108   }
109
110   identity routing-instance {
111     description
112       "Base identity from which identities describing routing
113        instance types are derived.";
114   }
115
116   identity default-routing-instance {
117     base routing-instance;
118     description
119       "This identity represents either a default routing instance, or
120        the only routing instance on systems that do not support
121        multiple instances.";
122   }
123
124   identity vrf-routing-instance {
125     base routing-instance;
126     description
127       "This identity represents a VRF routing instance. The type is
128        distinct from the default-routing-instance. There may be
129        multiple vrf-routing-interfaces.";
130   }
131
132   identity routing-protocol {
133     description
134       "Base identity from which routing protocol identities are
135        derived.";
136   }
137
138   identity direct {
139     base routing-protocol;
140     description
141       "Routing pseudo-protocol that provides routes to directly
142        connected networks.";
143   }
144
145   identity static {
146     base routing-protocol;
147     description
148       "Static routing pseudo-protocol.";
149   }
150
151   typedef routing-instance-ref {
152     type leafref {
153       path "/org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing/org-openroadm-routing:routing-instance/org-openroadm-routing:name";
154     }
155     description
156       "This type is used for leafs that reference a routing instance
157        configuration.";
158   }
159
160   typedef routing-instance-state-ref {
161     type leafref {
162       path "/org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing-state/org-openroadm-routing:routing-instance/org-openroadm-routing:name";
163     }
164     description
165       "This type is used for leafs that reference state data of a
166        routing instance.";
167   }
168
169   typedef route-preference {
170     type uint32;
171     description
172       "This type is used for route preferences.";
173   }
174
175   grouping address-family-group {
176     description
177       "This grouping provides a leaf identifying an address
178        family.";
179     leaf address-family {
180       type identityref {
181         base address-family;
182       }
183       mandatory true;
184       description
185         "Address family.";
186     }
187   }
188
189   grouping router-id {
190     description
191       "This grouping provides router ID.";
192     leaf router-id {
193       type yang:dotted-quad;
194       description
195         "A 32-bit number in the form of a dotted quad that is used by
196          some routing protocols identifying a router.";
197       reference
198         "RFC 2328: OSPF Version 2.";
199     }
200   }
201
202   grouping special-next-hop-group {
203     description
204       "This grouping provides a leaf with an enumeration of special
205        next-hops.";
206     leaf special-next-hop {
207       type enumeration {
208         enum blackhole {
209           description
210             "Silently discard the packet.";
211         }
212         enum unreachable {
213           description
214             "Discard the packet and notify the sender with an error
215              message indicating that the destination host is
216              unreachable.";
217         }
218         enum prohibit {
219           description
220             "Discard the packet and notify the sender with an error
221              message indicating that the communication is
222              administratively prohibited.";
223         }
224         enum receive {
225           description
226             "The packet will be received by the local system.";
227         }
228       }
229       description
230         "Special next-hop options.";
231     }
232   }
233
234   grouping next-hop-content {
235     description
236       "Generic parameters of next-hops in static routes.";
237     choice next-hop-options {
238       mandatory true;
239       description
240         "Options for next-hops in static routes.
241
242          It is expected that other cases will be added through
243          augments from other modules, e.g., for Equal-Cost Multipath
244          routing (ECMP).";
245       case simple-next-hop {
246         description
247           "Simple next-hop is specified as an outgoing interface,
248            next-hop address or both.
249
250            Address-family-specific modules are expected to provide
251            'next-hop-address' leaf via augmentation.";
252         leaf outgoing-interface {
253           type leafref {
254             path "/org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing/org-openroadm-routing:routing-instance/org-openroadm-routing:interfaces/org-openroadm-routing:interface";
255           }
256           description
257             "Name of the outgoing interface.";
258         }
259       }
260       case special-next-hop {
261         uses special-next-hop-group;
262       }
263     }
264   }
265
266   grouping route-metadata {
267     description
268       "Common route metadata.";
269     leaf source-protocol {
270       type identityref {
271         base routing-protocol;
272       }
273       mandatory true;
274       description
275         "Type of the routing protocol from which the route
276          originated.";
277     }
278     leaf active {
279       type empty;
280       description
281         "Presence of this leaf indicates that the route is preferred
282          among all routes in the same RIB that have the same
283          destination prefix.";
284     }
285     leaf last-updated {
286       type yang:date-and-time;
287       description
288         "Time stamp of the last modification of the route. If the
289          route was never modified, it is the time when the route was
290          inserted into the RIB.";
291     }
292   }
293
294   grouping routing-grp {
295     container routing {
296       description
297         "Configuration parameters for the routing subsystem.";
298       list routing-instance {
299         key "name";
300         description
301           "Configuration of a routing instance.";
302         leaf name {
303           type string;
304           description
305             "The name of the routing instance.
306
307              For system-controlled entries, the value of this leaf must
308              be the same as the name of the corresponding entry in
309              state data.
310
311              For user-controlled entries, an arbitrary name can be
312              used.";
313         }
314         leaf type {
315           type identityref {
316             base routing-instance;
317           }
318           default "org-openroadm-routing:default-routing-instance";
319           description
320             "The type of the routing instance.";
321         }
322         leaf enabled {
323           type boolean;
324           default "true";
325           description
326             "Enable/disable the routing instance.
327
328              If this parameter is false, the parent routing instance is
329              disabled and does not appear in state data, despite any
330              other configuration that might be present.";
331         }
332         uses router-id {
333           if-feature "router-id";
334           description
335             "Configuration of the global router ID. Routing protocols
336              that use router ID can use this parameter or override it
337              with another value.";
338         }
339         leaf description {
340           type string;
341           description
342             "Textual description of the routing instance.";
343         }
344         container interfaces {
345           description
346             "Assignment of the routing instance's interfaces.";
347           leaf-list interface {
348             type org-openroadm-device:interface-ref;
349             description
350               "The name of a configured network layer interface to be
351                assigned to the routing-instance.";
352           }
353         }
354         container routing-protocols {
355           description
356             "Configuration of routing protocol instances.";
357           list routing-protocol {
358             key "type name";
359             description
360               "Each entry contains configuration of a routing protocol
361                instance.";
362             leaf type {
363               type identityref {
364                 base routing-protocol;
365               }
366               description
367                 "Type of the routing protocol - an identity derived
368                  from the 'routing-protocol' base identity.";
369             }
370             leaf name {
371               type string;
372               description
373                 "An arbitrary name of the routing protocol instance.";
374             }
375             leaf description {
376               type string;
377               description
378                 "Textual description of the routing protocol
379                  instance.";
380             }
381             container static-routes {
382               when "../type='org-openroadm-routing:static'" {
383                 description
384                   "This container is only valid for the 'static'
385                    routing protocol.";
386               }
387               description
388                 "Configuration of the 'static' pseudo-protocol.
389
390                  Address-family-specific modules augment this node with
391                  their lists of routes.";
392             }
393           }
394         }
395         container ribs {
396           description
397             "Configuration of RIBs.";
398           list rib {
399             key "name";
400             description
401               "Each entry contains configuration for a RIB identified
402                by the 'name' key.
403
404                Entries having the same key as a system-controlled entry
405                of the list /routing-state/routing-instance/ribs/rib are
406                used for configuring parameters of that entry. Other
407                entries define additional user-controlled RIBs.";
408             leaf name {
409               type string;
410               description
411                 "The name of the RIB.
412
413                  For system-controlled entries, the value of this leaf
414                  must be the same as the name of the corresponding
415                  entry in state data.
416
417                  For user-controlled entries, an arbitrary name can be
418                  used.";
419             }
420             uses address-family-group {
421               description
422                 "Address family of the RIB.
423
424                  It is mandatory for user-controlled RIBs. For
425                  system-controlled RIBs it can be omitted, otherwise it
426                  must match the address family of the corresponding
427                  state entry.";
428               refine "address-family" {
429                 mandatory false;
430               }
431             }
432             leaf description {
433               type string;
434               description
435                 "Textual description of the RIB.";
436             }
437           }
438         }
439       }
440     }
441   }
442
443   augment "/org-openroadm-device:org-openroadm-device" {
444     uses routing-grp;
445   }
446
447   grouping routing-state-grp {
448     container routing-state {
449       config false;
450       description
451         "State data of the routing subsystem.";
452       list routing-instance {
453         key "name";
454         description
455           "Each list entry is a container for state data of a routing
456            instance.
457
458            An implementation MUST support routing instance(s) of the
459            type 'rt:default-routing-instance', and MAY support other
460            types. An implementation MAY restrict the number of routing
461            instances of each supported type.
462
463            An implementation SHOULD create at least one
464            system-controlled instance, and MAY allow the clients to
465            create user-controlled routing instances in
466            configuration.";
467         leaf name {
468           type string;
469           description
470             "The name of the routing instance.
471
472              For system-controlled instances the name is persistent,
473              i.e., it SHOULD NOT change across reboots.";
474         }
475         leaf type {
476           type identityref {
477             base routing-instance;
478           }
479           description
480             "The routing instance type.";
481         }
482         uses router-id {
483           description
484             "Global router ID.
485
486              It may be either configured or assigned algorithmically by
487              the implementation.";
488         }
489         container routing-protocols {
490           description
491             "Container for the list of routing protocol instances.";
492           list routing-protocol {
493             key "type name";
494             description
495               "State data of a routing protocol instance.
496
497                An implementation MUST provide exactly one
498                system-controlled instance of the type 'direct'. Other
499                instances MAY be created by configuration.";
500             leaf type {
501               type identityref {
502                 base routing-protocol;
503               }
504               description
505                 "Type of the routing protocol.";
506             }
507             leaf name {
508               type string;
509               description
510                 "The name of the routing protocol instance.
511
512                  For system-controlled instances this name is
513                  persistent, i.e., it SHOULD NOT change across
514                  reboots.";
515             }
516           }
517         }
518         container ribs {
519           description
520             "Container for RIBs.";
521           list rib {
522             key "name";
523             min-elements 1;
524             description
525               "Each entry represents a RIB identified by the 'name'
526                key. All routes in a RIB MUST belong to the same address
527                family.
528
529                For each routing instance, an implementation SHOULD
530                provide one system-controlled default RIB for each
531                supported address family.";
532             leaf name {
533               type string;
534               description
535                 "The name of the RIB.";
536             }
537             uses address-family-group;
538             leaf default-rib {
539               if-feature "multiple-ribs";
540               type boolean;
541               default "true";
542               description
543                 "This flag has the value of 'true' if and only if the
544                  RIB is the default RIB for the given address family.
545
546                  A default RIB always receives direct routes. By
547                  default it also receives routes from all routing
548                  protocols.";
549             }
550             container routes {
551               description
552                 "Current content of the RIB.";
553             }
554           }
555         }
556       }
557     }
558   }
559
560   augment "/org-openroadm-device:org-openroadm-device" {
561     uses routing-state-grp;
562   }
563 }