HONEYCOMB-58 - Routing Api
[honeycomb.git] / routing / routing-api / src / main / yang / ietf-ipv6-unicast-routing.yang
1 module ietf-ipv6-unicast-routing {
2
3   namespace "urn:ietf:params:xml:ns:yang:ietf-ipv6-unicast-routing";
4
5   prefix "v6ur";
6
7   import ietf-routing {
8     prefix "rt";
9   }
10
11   import ietf-inet-types {
12     prefix "inet";
13   }
14
15   import ietf-interfaces {
16     prefix "if";
17   }
18
19   import ietf-ip {
20     prefix "ip";
21   }
22
23   //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
24   import vpp-routing {
25     prefix vpp-r;
26   }
27
28   organization
29     "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
30
31   contact
32     "WG Web:   <http://tools.ietf.org/wg/netmod/>
33      WG List:  <mailto:netmod@ietf.org>
34
35      WG Chair: Thomas Nadeau
36                <mailto:tnadeau@lucidvision.com>
37
38      WG Chair: Juergen Schoenwaelder
39                <mailto:j.schoenwaelder@jacobs-university.de>
40
41      Editor:   Ladislav Lhotka
42                <mailto:lhotka@nic.cz>";
43
44   description
45     "This YANG module augments the 'ietf-routing' module with basic
46      configuration and operational state data for IPv6 unicast
47      routing.
48
49      Copyright (c) 2014 IETF Trust and the persons identified as
50      authors of the code. All rights reserved.
51
52      Redistribution and use in source and binary forms, with or
53      without modification, is permitted pursuant to, and subject to
54      the license terms contained in, the Simplified BSD License set
55      forth in Section 4.c of the IETF Trust's Legal Provisions
56      Relating to IETF Documents
57      (http://trustee.ietf.org/license-info).
58
59      This version of this YANG module is part of RFC XXXX; see the
60      RFC itself for full legal notices.";
61
62   revision 2014-05-25 {
63     description
64       "Initial revision.";
65     reference
66       "RFC XXXX: A YANG Data Model for Routing Management";
67   }
68
69   /* Identities */
70
71   identity ipv6-unicast {
72     base rt:ipv6;
73     description
74       "This identity represents the IPv6 unicast address family.";
75   }
76
77   /* Operational state data */
78
79   augment "/rt:routing-state/rt:routing-instance/rt:interfaces/"
80         + "rt:interface" {
81     description
82       "IPv6-specific parameters of router interfaces.";
83     container ipv6-router-advertisements {
84       description
85         "Parameters of IPv6 Router Advertisements.";
86       leaf send-advertisements {
87         type boolean;
88         description
89           "A flag indicating whether or not the router sends periodic
90            Router Advertisements and responds to Router
91            Solicitations.";
92       }
93       leaf max-rtr-adv-interval {
94         type uint16 {
95           range "4..1800";
96         }
97         units "seconds";
98         description
99           "The maximum time allowed between sending unsolicited
100            multicast Router Advertisements from the interface.";
101       }
102       leaf min-rtr-adv-interval {
103         type uint16 {
104           range "3..1350";
105         }
106         units "seconds";
107         description
108           "The minimum time allowed between sending unsolicited
109            multicast Router Advertisements from the interface.";
110       }
111       leaf managed-flag {
112         type boolean;
113         description
114           "The value that is placed in the 'Managed address
115            configuration' flag field in the Router Advertisement.";
116       }
117       leaf other-config-flag {
118         type boolean;
119         description
120           "The value that is placed in the 'Other configuration' flag
121            field in the Router Advertisement.";
122       }
123       leaf link-mtu {
124         type uint32;
125         description
126           "The value that is placed in MTU options sent by the
127            router. A value of zero indicates that no MTU options are
128            sent.";
129       }
130       leaf reachable-time {
131         type uint32 {
132           range "0..3600000";
133         }
134         units "milliseconds";
135         description
136           "The value that is placed in the Reachable Time field in
137            the Router Advertisement messages sent by the router. A
138            value of zero means unspecified (by this router).";
139       }
140       leaf retrans-timer {
141         type uint32;
142         units "milliseconds";
143         description
144           "The value that is placed in the Retrans Timer field in the
145            Router Advertisement messages sent by the router. A value
146            of zero means unspecified (by this router).";
147       }
148       leaf cur-hop-limit {
149         type uint8;
150         description
151           "The value that is placed in the Cur Hop Limit field in the
152            Router Advertisement messages sent by the router. A value
153            of zero means unspecified (by this router).";
154       }
155       leaf default-lifetime {
156         type uint16 {
157           range "0..9000";
158         }
159         units "seconds";
160         description
161           "The value that is placed in the Router Lifetime field of
162            Router Advertisements sent from the interface, in seconds.
163            A value of zero indicates that the router is not to be
164            used as a default router.";
165       }
166       container prefix-list {
167         description
168           "A list of prefixes that are placed in Prefix Information
169            options in Router Advertisement messages sent from the
170            interface.
171
172            By default, these are all prefixes that the router
173            advertises via routing protocols as being on-link for the
174            interface from which the advertisement is sent.";
175         list prefix {
176           key "prefix-spec";
177           description
178             "Advertised prefix entry and its parameters.";
179           leaf prefix-spec {
180             type inet:ipv6-prefix;
181             description
182               "IPv6 address prefix.";
183           }
184           leaf valid-lifetime {
185             type uint32;
186             units "seconds";
187             description
188               "The value that is placed in the Valid Lifetime in the
189                Prefix Information option. The designated value of all
190                1's (0xffffffff) represents infinity.";
191           }
192           leaf on-link-flag {
193             type boolean;
194             description
195               "The value that is placed in the on-link flag ('L-bit')
196                field in the Prefix Information option.";
197           }
198           leaf preferred-lifetime {
199             type uint32;
200             units "seconds";
201             description
202               "The value that is placed in the Preferred Lifetime in
203                the Prefix Information option, in seconds. The
204                designated value of all 1's (0xffffffff) represents
205                infinity.";
206           }
207           leaf autonomous-flag {
208             type boolean;
209             description
210               "The value that is placed in the Autonomous Flag field
211                in the Prefix Information option.";
212           }
213         }
214       }
215     }
216   }
217
218   augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route" {
219     when "../../rt:address-family = 'v6ur:ipv6-unicast'" {
220       description
221         "This augment is valid only for IPv6 unicast.";
222     }
223     description
224       "This leaf augments an IPv6 unicast route.";
225     leaf destination-prefix {
226       type inet:ipv6-prefix;
227       description
228         "IPv6 destination prefix.";
229     }
230   }
231
232   augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route/"
233         + "rt:next-hop-options/rt:simple-next-hop" {
234     when "../../rt:address-family = 'v6ur:ipv6-unicast'" {
235       description
236         "This augment is valid only for IPv6 unicast.";
237     }
238     description
239       "This leaf augments the 'simple-next-hop' case of IPv6 unicast
240        routes.";
241     leaf next-hop {
242       type inet:ipv6-address;
243       description
244         "IPv6 address of the next-hop.";
245     }
246   }
247
248   augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route/"
249         + "rt:next-hop-options/rt:next-hop-list/rt:next-hop-list/"
250         + "rt:next-hop" {
251     when "../../../../rt:address-family = 'v6ur:ipv6-unicast'" {
252       description
253         "This augment is valid only for IPv6 unicast.";
254     }
255     if-feature rt:multipath-routes;
256     description
257       "This leaf augments the 'next-hop-list' case of IPv6 unicast
258        routes.";
259     leaf address {
260       type inet:ipv6-address;
261       description
262         "IPv6 address of the next-hop.";
263     }
264   }
265
266   /* Configuration data */
267
268   augment
269     "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface" {
270     when "/if:interfaces/if:interface[if:name=current()/rt:name]/"
271        + "ip:ipv6/ip:enabled='true'" {
272       description
273         "This augment is only valid for router interfaces with
274          enabled IPv6.";
275     }
276     description
277       "Configuration of IPv6-specific parameters of router
278        interfaces.";
279     container ipv6-router-advertisements {
280       description
281         "Configuration of IPv6 Router Advertisements.";
282       leaf send-advertisements {
283         type boolean;
284         default "false";
285         description
286           "A flag indicating whether or not the router sends periodic
287            Router Advertisements and responds to Router
288            Solicitations.";
289         reference
290           "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
291            AdvSendAdvertisements.";
292       }
293       leaf max-rtr-adv-interval {
294         type uint16 {
295           range "4..1800";
296         }
297         units "seconds";
298         default "600";
299         description
300           "The maximum time allowed between sending unsolicited
301            multicast Router Advertisements from the interface.";
302         reference
303           "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
304            MaxRtrAdvInterval.";
305       }
306       leaf min-rtr-adv-interval {
307         type uint16 {
308           range "3..1350";
309         }
310         units "seconds";
311         must ". <= 0.75 * ../max-rtr-adv-interval" {
312           description
313             "The value MUST NOT be greater than 75 % of
314              'max-rtr-adv-interval'.";
315         }
316         description
317           "The minimum time allowed between sending unsolicited
318            multicast Router Advertisements from the interface.
319
320            The default value to be used operationally if this leaf is
321            not configured is determined as follows:
322
323            - if max-rtr-adv-interval >= 9 seconds, the default value
324              is 0.33 * max-rtr-adv-interval;
325
326            - otherwise it is 0.75 * max-rtr-adv-interval.";
327         reference
328           "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
329            MinRtrAdvInterval.";
330       }
331       leaf managed-flag {
332         type boolean;
333         default "false";
334         description
335           "The value to be placed in the 'Managed address
336            configuration' flag field in the Router Advertisement.";
337         reference
338           "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
339            AdvManagedFlag.";
340       }
341       leaf other-config-flag {
342         type boolean;
343         default "false";
344         description
345           "The value to be placed in the 'Other configuration' flag
346            field in the Router Advertisement.";
347         reference
348           "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
349            AdvOtherConfigFlag.";
350       }
351       leaf link-mtu {
352         type uint32;
353         default "0";
354         description
355           "The value to be placed in MTU options sent by the router.
356            A value of zero indicates that no MTU options are sent.";
357         reference
358           "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
359            AdvLinkMTU.";
360       }
361       leaf reachable-time {
362         type uint32 {
363           range "0..3600000";
364         }
365         units "milliseconds";
366         default "0";
367         description
368           "The value to be placed in the Reachable Time field in the
369            Router Advertisement messages sent by the router. A value
370            of zero means unspecified (by this router).";
371         reference
372           "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
373            AdvReachableTime.";
374       }
375       leaf retrans-timer {
376         type uint32;
377         units "milliseconds";
378         default "0";
379         description
380           "The value to be placed in the Retrans Timer field in the
381            Router Advertisement messages sent by the router. A value
382            of zero means unspecified (by this router).";
383         reference
384           "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
385            AdvRetransTimer.";
386       }
387       leaf cur-hop-limit {
388         type uint8;
389         description
390           "The value to be placed in the Cur Hop Limit field in the
391            Router Advertisement messages sent by the router. A value
392            of zero means unspecified (by this router).
393
394            If this parameter is not configured, the device SHOULD use
395            the value specified in IANA Assigned Numbers that was in
396            effect at the time of implementation.";
397         reference
398           "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
399            AdvCurHopLimit.
400
401            IANA: IP Parameters,
402            http://www.iana.org/assignments/ip-parameters";
403       }
404       leaf default-lifetime {
405         type uint16 {
406           range "0..9000";
407         }
408         units "seconds";
409         description
410           "The value to be placed in the Router Lifetime field of
411            Router Advertisements sent from the interface, in seconds.
412            It MUST be either zero or between max-rtr-adv-interval and
413            9000 seconds. A value of zero indicates that the router is
414            not to be used as a default router. These limits may be
415            overridden by specific documents that describe how IPv6
416            operates over different link layers.
417
418            If this parameter is not configured, the device SHOULD use
419            a value of 3 * max-rtr-adv-interval.";
420         reference
421           "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
422            AdvDefaultLifeTime.";
423       }
424       container prefix-list {
425         description
426           "Configuration of prefixes to be placed in Prefix
427            Information options in Router Advertisement messages sent
428            from the interface.
429
430            Prefixes that are advertised by default but do not have
431            their entries in the child 'prefix' list are advertised
432            with the default values of all parameters.
433
434            The link-local prefix SHOULD NOT be included in the list
435            of advertised prefixes.";
436         reference
437           "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) -
438            AdvPrefixList.";
439         list prefix {
440           key "prefix-spec";
441           description
442             "Configuration of an advertised prefix entry.";
443           leaf prefix-spec {
444             type inet:ipv6-prefix;
445             description
446               "IPv6 address prefix.";
447           }
448           choice control-adv-prefixes {
449             default "advertise";
450             description
451               "The prefix either may be explicitly removed from the
452                set of advertised prefixes, or parameters with which
453                it is advertised may be specified (default case).";
454             leaf no-advertise {
455               type empty;
456               description
457                 "The prefix will not be advertised.
458
459                  This can be used for removing the prefix from the
460                  default set of advertised prefixes.";
461             }
462             case advertise {
463               leaf valid-lifetime {
464                 type uint32;
465                 units "seconds";
466                 default "2592000";
467                 description
468                   "The value to be placed in the Valid Lifetime in
469                    the Prefix Information option. The designated
470                    value of all 1's (0xffffffff) represents
471                    infinity.";
472                 reference
473                   "RFC 4861: Neighbor Discovery for IP version 6
474                    (IPv6) - AdvValidLifetime.";
475               }
476               leaf on-link-flag {
477                 type boolean;
478                 default "true";
479                 description
480                   "The value to be placed in the on-link flag
481                    ('L-bit') field in the Prefix Information
482                    option.";
483                 reference
484                   "RFC 4861: Neighbor Discovery for IP version 6
485                    (IPv6) - AdvOnLinkFlag.";
486               }
487               leaf preferred-lifetime {
488                 type uint32;
489                 units "seconds";
490                 must ". <= ../valid-lifetime" {
491                   description
492                     "This value MUST NOT be greater than
493                      valid-lifetime.";
494                 }
495                 default "604800";
496                 description
497                   "The value to be placed in the Preferred Lifetime
498                    in the Prefix Information option. The designated
499                    value of all 1's (0xffffffff) represents
500                    infinity.";
501                 reference
502                   "RFC 4861: Neighbor Discovery for IP version 6
503                    (IPv6) - AdvPreferredLifetime.";
504               }
505               leaf autonomous-flag {
506                 type boolean;
507                 default "true";
508                 description
509                   "The value to be placed in the Autonomous Flag
510                    field in the Prefix Information option.";
511                 reference
512                   "RFC 4861: Neighbor Discovery for IP version 6
513                    (IPv6) - AdvAutonomousFlag.";
514               }
515             }
516           }
517         }
518       }
519     }
520   }
521
522   //NOTE - added same augmentation for operational state
523
524   augment "/rt:routing-state/rt:routing-instance/rt:routing-protocols/rt:routing-protocol/rt:static-routes" {
525       description
526         "This augment defines the configuration of the 'static'
527          pseudo-protocol with data specific to IPv6 unicast.";
528       container ipv6 {
529         description
530           "Configuration of a 'static' pseudo-protocol instance
531            consists of a list of routes.";
532         list route {
533           key "id";
534           ordered-by "user";
535           description
536             "A user-ordered list of static routes.";
537           leaf id {
538             type uint32 {
539               //WARNING - range changed from 1..max to be mappable on vpp table ids
540               range "0..max";
541             }
542             description
543               "Unique numeric identifier of the route.
544
545                This value is unrelated to system-assigned 'id'
546                parameters of routes in RIBs.";
547           }
548           leaf description {
549             type string;
550             description
551               "Textual description of the route.";
552           }
553           leaf destination-prefix {
554             type inet:ipv6-prefix;
555             mandatory "true";
556             description
557               "IPv6 destination prefix.";
558           }
559           choice next-hop-options {
560             mandatory "true";
561             description
562               "Options for expressing the next-hop in static routes.";
563             case special-next-hop {
564               //WARNING - changed, see ietf-routing.yang
565               uses rt:special-next-hop-grouping;
566             }
567             case simple-next-hop {
568               leaf next-hop {
569                 type inet:ipv6-address;
570                 description
571                   "IPv6 address of the next-hop.";
572               }
573               //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
574               leaf outgoing-interface {
575                 type leafref {
576                   path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
577                                      + "rt:name";
578                 }
579                 description
580                   "Name of the outgoing interface.
581
582                    Only interfaces configured for the ancestor routing
583                    instance can be given.";
584               }
585             }
586             case next-hop-list {
587               if-feature rt:multipath-routes;
588               container next-hop-list {
589                 description
590                   "Configuration of multiple next-hops.";
591                 list next-hop {
592                   key "id";
593                   description
594                     "An entry of a next-hop list.";
595                   leaf id {
596                     type uint32;
597                     description
598                       "Unique numeric identifier of the entry.
599
600                        This value is unrelated to system-assigned 'id'
601                        parameters of next-hops in RIBs.";
602                   }
603                   leaf address {
604                     type inet:ipv6-address;
605                     description
606                       "IPv6 address of the next-hop.";
607                   }
608                   //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
609                   leaf outgoing-interface {
610                     type leafref {
611                       path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
612                                          + "rt:name";
613                     }
614                     description
615                       "Name of the outgoing interface.
616
617                        Only interfaces configured for the ancestor
618                        routing instance can be given.";
619                   }
620                   uses rt:next-hop-classifiers {
621                     refine "priority" {
622                       default "primary";
623                     }
624                     refine "weight" {
625                       default "0";
626                     }
627                   }
628                 }
629               }
630             }
631           }
632
633           //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
634           container vpp-ipv6-route-state{
635               uses vpp-r:vpp-routing-state-attributes;
636           }
637         }
638       }
639     }
640
641   augment "/rt:routing/rt:routing-instance/rt:routing-protocols/rt:routing-protocol/rt:static-routes" {
642     description
643       "This augment defines the configuration of the 'static'
644        pseudo-protocol with data specific to IPv6 unicast.";
645     container ipv6 {
646       description
647         "Configuration of a 'static' pseudo-protocol instance
648          consists of a list of routes.";
649       list route {
650         key "id";
651         ordered-by "user";
652         description
653           "A user-ordered list of static routes.";
654         leaf id {
655           type uint32 {
656             //WARNING - range changed from 1..max to be mappable on vpp table ids
657             range "0..max";
658           }
659           description
660             "Unique numeric identifier of the route.
661
662              This value is unrelated to system-assigned 'id'
663              parameters of routes in RIBs.";
664         }
665         leaf description {
666           type string;
667           description
668             "Textual description of the route.";
669         }
670         leaf destination-prefix {
671           type inet:ipv6-prefix;
672           mandatory "true";
673           description
674             "IPv6 destination prefix.";
675         }
676         choice next-hop-options {
677           mandatory "true";
678           description
679             "Options for expressing the next-hop in static routes.";
680           case special-next-hop {
681             //WARNING - changed, see ietf-routing.yang
682             uses rt:special-next-hop-grouping;
683           }
684           case simple-next-hop {
685             leaf next-hop {
686               type inet:ipv6-address;
687               description
688                 "IPv6 address of the next-hop.";
689             }
690             //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
691             leaf outgoing-interface {
692               type leafref {
693                 path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
694                                    + "rt:name";
695               }
696               description
697                 "Name of the outgoing interface.
698
699                  Only interfaces configured for the ancestor routing
700                  instance can be given.";
701             }
702           }
703           case next-hop-list {
704             if-feature rt:multipath-routes;
705             container next-hop-list {
706               description
707                 "Configuration of multiple next-hops.";
708               list next-hop {
709                 key "id";
710                 description
711                   "An entry of a next-hop list.";
712                 leaf id {
713                   type uint32;
714                   description
715                     "Unique numeric identifier of the entry.
716
717                      This value is unrelated to system-assigned 'id'
718                      parameters of next-hops in RIBs.";
719                 }
720                 leaf address {
721                   type inet:ipv6-address;
722                   description
723                     "IPv6 address of the next-hop.";
724                 }
725                 //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
726                 leaf outgoing-interface {
727                   type leafref {
728                     path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
729                                        + "rt:name";
730                   }
731                   description
732                     "Name of the outgoing interface.
733
734                      Only interfaces configured for the ancestor
735                      routing instance can be given.";
736                 }
737                 uses rt:next-hop-classifiers {
738                   refine "priority" {
739                     default "primary";
740                   }
741                   refine "weight" {
742                     default "0";
743                   }
744                 }
745               }
746             }
747           }
748         }
749
750         //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
751         container vpp-ipv6-route{
752             uses vpp-r:vpp-routing-attributes;
753         }
754       }
755     }
756   }
757
758   /* RPC methods */
759
760   augment "/rt:active-route/rt:input/rt:destination-address" {
761     when "rt:address-family='v6ur:ipv6-unicast'" {
762       description
763         "This augment is valid only for IPv6 unicast.";
764     }
765     description
766       "This leaf augments the 'rt:destination-address' parameter of
767        the 'rt:active-route' operation.";
768     leaf address {
769       type inet:ipv6-address;
770       description
771         "IPv6 destination address.";
772     }
773   }
774
775   augment "/rt:active-route/rt:output/rt:route" {
776     when "rt:address-family='v6ur:ipv6-unicast'" {
777       description
778         "This augment is valid only for IPv6 unicast.";
779     }
780     description
781       "This leaf augments the reply to the 'rt:active-route'
782        operation.";
783     leaf destination-prefix {
784       type inet:ipv6-prefix;
785       description
786         "IPv6 destination prefix.";
787     }
788   }
789
790   augment "/rt:active-route/rt:output/rt:route/rt:next-hop-options/"
791         + "rt:simple-next-hop" {
792     when "rt:address-family='v6ur:ipv6-unicast'" {
793       description
794         "This augment is valid only for IPv6 unicast.";
795     }
796     description
797       "This leaf augments the 'simple-next-hop' case in the reply to
798        the 'rt:active-route' operation.";
799     leaf next-hop {
800       type inet:ipv6-address;
801       description
802         "IPv6 address of the next-hop.";
803     }
804   }
805
806   augment "/rt:active-route/rt:output/rt:route/rt:next-hop-options/"
807         + "rt:next-hop-list/rt:next-hop-list/rt:next-hop" {
808     when "../../rt:address-family='v6ur:ipv6-unicast'" {
809       description
810         "This augment is valid only for IPv6 unicast.";
811     }
812     if-feature rt:multipath-routes;
813     description
814       "This leaf augments the 'next-hop-list' case in the reply to
815        the 'rt:active-route' operation.";
816     leaf address {
817       type inet:ipv6-address;
818       description
819         "IPv6 address of the next-hop.";
820     }
821   }
822 }