Add support for RFC8639 extensions
[yangtools.git] / parser / rfc8639-parser-support / src / test / resources / ietf-ip@2018-02-22.yang
1 module ietf-ip {
2   yang-version 1.1;
3   namespace "urn:ietf:params:xml:ns:yang:ietf-ip";
4   prefix ip;
5
6   import ietf-interfaces {
7     prefix if;
8   }
9   import ietf-inet-types {
10     prefix inet;
11   }
12   import ietf-yang-types {
13     prefix yang;
14   }
15
16   organization
17     "IETF NETMOD (Network Modeling) Working Group";
18
19   contact
20     "WG Web:   <https://datatracker.ietf.org/wg/netmod/>
21      WG List:  <mailto:netmod@ietf.org>
22
23      Editor:   Martin Bjorklund
24                <mailto:mbj@tail-f.com>";
25   description
26     "This module contains a collection of YANG definitions for
27      managing IP implementations.
28
29      Copyright (c) 2018 IETF Trust and the persons identified as
30      authors of the code.  All rights reserved.
31
32      Redistribution and use in source and binary forms, with or
33      without modification, is permitted pursuant to, and subject
34      to the license terms contained in, the Simplified BSD License
35      set forth in Section 4.c of the IETF Trust's Legal Provisions
36      Relating to IETF Documents
37      (https://trustee.ietf.org/license-info).
38
39      This version of this YANG module is part of RFC 8344; see
40      the RFC itself for full legal notices.";
41
42   revision 2018-02-22 {
43     description
44       "Updated to support NMDA.";
45     reference
46       "RFC 8344: A YANG Data Model for IP Management";
47   }
48
49   revision 2014-06-16 {
50     description
51       "Initial revision.";
52     reference
53       "RFC 7277: A YANG Data Model for IP Management";
54   }
55
56   /*
57    * Features
58    */
59
60   feature ipv4-non-contiguous-netmasks {
61     description
62       "Indicates support for configuring non-contiguous
63        subnet masks.";
64   }
65
66   feature ipv6-privacy-autoconf {
67     description
68       "Indicates support for privacy extensions for stateless address
69        autoconfiguration in IPv6.";
70     reference
71       "RFC 4941: Privacy Extensions for Stateless Address
72                  Autoconfiguration in IPv6";
73   }
74
75   /*
76    * Typedefs
77    */
78
79   typedef ip-address-origin {
80     type enumeration {
81       enum other {
82         description
83           "None of the following.";
84       }
85
86       enum static {
87         description
88           "Indicates that the address has been statically
89            configured -- for example, using the Network Configuration
90            Protocol (NETCONF) or a command line interface.";
91       }
92       enum dhcp {
93         description
94           "Indicates an address that has been assigned to this
95            system by a DHCP server.";
96       }
97       enum link-layer {
98         description
99           "Indicates an address created by IPv6 stateless
100            autoconfiguration that embeds a link-layer address in its
101            interface identifier.";
102       }
103       enum random {
104         description
105           "Indicates an address chosen by the system at
106            random, e.g., an IPv4 address within 169.254/16, a
107            temporary address as described in RFC 4941, or a
108            semantically opaque address as described in RFC 7217.";
109         reference
110           "RFC 4941: Privacy Extensions for Stateless Address
111                      Autoconfiguration in IPv6
112            RFC 7217: A Method for Generating Semantically Opaque
113                      Interface Identifiers with IPv6 Stateless
114                      Address Autoconfiguration (SLAAC)";
115       }
116     }
117     description
118       "The origin of an address.";
119   }
120
121   typedef neighbor-origin {
122     type enumeration {
123       enum other {
124         description
125           "None of the following.";
126       }
127       enum static {
128         description
129           "Indicates that the mapping has been statically
130            configured -- for example, using NETCONF or a command line
131            interface.";
132       }
133
134       enum dynamic {
135         description
136           "Indicates that the mapping has been dynamically resolved
137            using, for example, IPv4 ARP or the IPv6 Neighbor
138            Discovery protocol.";
139       }
140     }
141     description
142       "The origin of a neighbor entry.";
143   }
144
145   /*
146    * Data nodes
147    */
148
149   augment "/if:interfaces/if:interface" {
150     description
151       "IP parameters on interfaces.
152
153        If an interface is not capable of running IP, the server
154        must not allow the client to configure these parameters.";
155
156     container ipv4 {
157       presence
158         "Enables IPv4 unless the 'enabled' leaf
159          (which defaults to 'true') is set to 'false'";
160       description
161         "Parameters for the IPv4 address family.";
162
163       leaf enabled {
164         type boolean;
165         default true;
166         description
167           "Controls whether IPv4 is enabled or disabled on this
168            interface.  When IPv4 is enabled, this interface is
169            connected to an IPv4 stack, and the interface can send
170            and receive IPv4 packets.";
171       }
172       leaf forwarding {
173         type boolean;
174         default false;
175         description
176           "Controls IPv4 packet forwarding of datagrams received by,
177            but not addressed to, this interface.  IPv4 routers
178            forward datagrams.  IPv4 hosts do not (except those
179            source-routed via the host).";
180       }
181
182       leaf mtu {
183         type uint16 {
184           range "68..max";
185         }
186         units "octets";
187         description
188           "The size, in octets, of the largest IPv4 packet that the
189            interface will send and receive.
190
191            The server may restrict the allowed values for this leaf,
192            depending on the interface's type.
193
194            If this leaf is not configured, the operationally used MTU
195            depends on the interface's type.";
196         reference
197           "RFC 791: Internet Protocol";
198       }
199       list address {
200         key "ip";
201         description
202           "The list of IPv4 addresses on the interface.";
203
204         leaf ip {
205           type inet:ipv4-address-no-zone;
206           description
207             "The IPv4 address on the interface.";
208         }
209         choice subnet {
210           mandatory true;
211           description
212             "The subnet can be specified as a prefix length or,
213              if the server supports non-contiguous netmasks, as
214              a netmask.";
215           leaf prefix-length {
216             type uint8 {
217               range "0..32";
218             }
219             description
220               "The length of the subnet prefix.";
221           }
222           leaf netmask {
223             if-feature ipv4-non-contiguous-netmasks;
224             type yang:dotted-quad;
225             description
226               "The subnet specified as a netmask.";
227           }
228         }
229
230         leaf origin {
231           type ip-address-origin;
232           config false;
233           description
234             "The origin of this address.";
235         }
236       }
237       list neighbor {
238         key "ip";
239         description
240           "A list of mappings from IPv4 addresses to
241            link-layer addresses.
242
243            Entries in this list in the intended configuration are
244            used as static entries in the ARP Cache.
245
246            In the operational state, this list represents the ARP
247            Cache.";
248         reference
249           "RFC 826: An Ethernet Address Resolution Protocol";
250
251         leaf ip {
252           type inet:ipv4-address-no-zone;
253           description
254             "The IPv4 address of the neighbor node.";
255         }
256         leaf link-layer-address {
257           type yang:phys-address;
258           mandatory true;
259           description
260             "The link-layer address of the neighbor node.";
261         }
262         leaf origin {
263           type neighbor-origin;
264           config false;
265           description
266             "The origin of this neighbor entry.";
267         }
268       }
269     }
270
271     container ipv6 {
272       presence
273         "Enables IPv6 unless the 'enabled' leaf
274          (which defaults to 'true') is set to 'false'";
275       description
276         "Parameters for the IPv6 address family.";
277
278       leaf enabled {
279         type boolean;
280         default true;
281         description
282           "Controls whether IPv6 is enabled or disabled on this
283            interface.  When IPv6 is enabled, this interface is
284            connected to an IPv6 stack, and the interface can send
285            and receive IPv6 packets.";
286       }
287       leaf forwarding {
288         type boolean;
289         default false;
290         description
291           "Controls IPv6 packet forwarding of datagrams received by,
292            but not addressed to, this interface.  IPv6 routers
293            forward datagrams.  IPv6 hosts do not (except those
294            source-routed via the host).";
295         reference
296           "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
297                      Section 6.2.1, IsRouter";
298       }
299       leaf mtu {
300         type uint32 {
301           range "1280..max";
302         }
303         units "octets";
304         description
305           "The size, in octets, of the largest IPv6 packet that the
306            interface will send and receive.
307
308            The server may restrict the allowed values for this leaf,
309            depending on the interface's type.
310
311            If this leaf is not configured, the operationally used MTU
312            depends on the interface's type.";
313         reference
314           "RFC 8200: Internet Protocol, Version 6 (IPv6)
315                      Specification
316                      Section 5";
317       }
318
319       list address {
320         key "ip";
321         description
322           "The list of IPv6 addresses on the interface.";
323
324         leaf ip {
325           type inet:ipv6-address-no-zone;
326           description
327             "The IPv6 address on the interface.";
328         }
329         leaf prefix-length {
330           type uint8 {
331             range "0..128";
332           }
333           mandatory true;
334           description
335             "The length of the subnet prefix.";
336         }
337         leaf origin {
338           type ip-address-origin;
339           config false;
340           description
341             "The origin of this address.";
342         }
343         leaf status {
344           type enumeration {
345             enum preferred {
346               description
347                 "This is a valid address that can appear as the
348                  destination or source address of a packet.";
349             }
350             enum deprecated {
351               description
352                 "This is a valid but deprecated address that should
353                  no longer be used as a source address in new
354                  communications, but packets addressed to such an
355                  address are processed as expected.";
356             }
357             enum invalid {
358               description
359                 "This isn't a valid address, and it shouldn't appear
360                  as the destination or source address of a packet.";
361             }
362
363             enum inaccessible {
364               description
365                 "The address is not accessible because the interface
366                  to which this address is assigned is not
367                  operational.";
368             }
369             enum unknown {
370               description
371                 "The status cannot be determined for some reason.";
372             }
373             enum tentative {
374               description
375                 "The uniqueness of the address on the link is being
376                  verified.  Addresses in this state should not be
377                  used for general communication and should only be
378                  used to determine the uniqueness of the address.";
379             }
380             enum duplicate {
381               description
382                 "The address has been determined to be non-unique on
383                  the link and so must not be used.";
384             }
385             enum optimistic {
386               description
387                 "The address is available for use, subject to
388                  restrictions, while its uniqueness on a link is
389                  being verified.";
390             }
391           }
392           config false;
393           description
394             "The status of an address.  Most of the states correspond
395              to states from the IPv6 Stateless Address
396              Autoconfiguration protocol.";
397           reference
398             "RFC 4293: Management Information Base for the
399                        Internet Protocol (IP)
400                        - IpAddressStatusTC
401              RFC 4862: IPv6 Stateless Address Autoconfiguration";
402         }
403       }
404
405       list neighbor {
406         key "ip";
407         description
408           "A list of mappings from IPv6 addresses to
409            link-layer addresses.
410
411            Entries in this list in the intended configuration are
412            used as static entries in the Neighbor Cache.
413
414            In the operational state, this list represents the
415            Neighbor Cache.";
416         reference
417           "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)";
418
419         leaf ip {
420           type inet:ipv6-address-no-zone;
421           description
422             "The IPv6 address of the neighbor node.";
423         }
424         leaf link-layer-address {
425           type yang:phys-address;
426           mandatory true;
427           description
428             "The link-layer address of the neighbor node.
429
430              In the operational state, if the neighbor's 'state' leaf
431              is 'incomplete', this leaf is not instantiated.";
432         }
433         leaf origin {
434           type neighbor-origin;
435           config false;
436           description
437             "The origin of this neighbor entry.";
438         }
439         leaf is-router {
440           type empty;
441           config false;
442           description
443             "Indicates that the neighbor node acts as a router.";
444         }
445
446         leaf state {
447           type enumeration {
448             enum incomplete {
449               description
450                 "Address resolution is in progress, and the
451                  link-layer address of the neighbor has not yet been
452                  determined.";
453             }
454             enum reachable {
455               description
456                 "Roughly speaking, the neighbor is known to have been
457                  reachable recently (within tens of seconds ago).";
458             }
459             enum stale {
460               description
461                 "The neighbor is no longer known to be reachable, but
462                  until traffic is sent to the neighbor no attempt
463                  should be made to verify its reachability.";
464             }
465             enum delay {
466               description
467                 "The neighbor is no longer known to be reachable, and
468                  traffic has recently been sent to the neighbor.
469                  Rather than probe the neighbor immediately, however,
470                  delay sending probes for a short while in order to
471                  give upper-layer protocols a chance to provide
472                  reachability confirmation.";
473             }
474             enum probe {
475               description
476                 "The neighbor is no longer known to be reachable, and
477                  unicast Neighbor Solicitation probes are being sent
478                  to verify reachability.";
479             }
480           }
481           config false;
482           description
483             "The Neighbor Unreachability Detection state of this
484              entry.";
485           reference
486             "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
487                        Section 7.3.2";
488         }
489       }
490
491       leaf dup-addr-detect-transmits {
492         type uint32;
493         default 1;
494         description
495           "The number of consecutive Neighbor Solicitation messages
496            sent while performing Duplicate Address Detection on a
497            tentative address.  A value of zero indicates that
498            Duplicate Address Detection is not performed on
499            tentative addresses.  A value of one indicates a single
500            transmission with no follow-up retransmissions.";
501         reference
502           "RFC 4862: IPv6 Stateless Address Autoconfiguration";
503       }
504       container autoconf {
505         description
506           "Parameters to control the autoconfiguration of IPv6
507            addresses, as described in RFC 4862.";
508         reference
509           "RFC 4862: IPv6 Stateless Address Autoconfiguration";
510
511         leaf create-global-addresses {
512           type boolean;
513           default true;
514           description
515             "If enabled, the host creates global addresses as
516              described in RFC 4862.";
517           reference
518             "RFC 4862: IPv6 Stateless Address Autoconfiguration
519                        Section 5.5";
520         }
521         leaf create-temporary-addresses {
522           if-feature ipv6-privacy-autoconf;
523           type boolean;
524           default false;
525           description
526             "If enabled, the host creates temporary addresses as
527              described in RFC 4941.";
528           reference
529             "RFC 4941: Privacy Extensions for Stateless Address
530                        Autoconfiguration in IPv6";
531         }
532
533         leaf temporary-valid-lifetime {
534           if-feature ipv6-privacy-autoconf;
535           type uint32;
536           units "seconds";
537           default 604800;
538           description
539             "The time period during which the temporary address
540              is valid.";
541           reference
542             "RFC 4941: Privacy Extensions for Stateless Address
543                        Autoconfiguration in IPv6
544                        - TEMP_VALID_LIFETIME";
545         }
546         leaf temporary-preferred-lifetime {
547           if-feature ipv6-privacy-autoconf;
548           type uint32;
549           units "seconds";
550           default 86400;
551           description
552             "The time period during which the temporary address is
553              preferred.";
554           reference
555             "RFC 4941: Privacy Extensions for Stateless Address
556                        Autoconfiguration in IPv6
557                        - TEMP_PREFERRED_LIFETIME";
558         }
559       }
560     }
561   }
562
563   /*
564    * Legacy operational state data nodes
565    */
566
567   augment "/if:interfaces-state/if:interface" {
568     status deprecated;
569     description
570       "Data nodes for the operational state of IP on interfaces.";
571
572     container ipv4 {
573       presence
574         "Present if IPv4 is enabled on this interface";
575       config false;
576       status deprecated;
577       description
578         "Interface-specific parameters for the IPv4 address family.";
579
580       leaf forwarding {
581         type boolean;
582         status deprecated;
583         description
584           "Indicates whether IPv4 packet forwarding is enabled or
585            disabled on this interface.";
586       }
587       leaf mtu {
588         type uint16 {
589           range "68..max";
590         }
591         units "octets";
592         status deprecated;
593         description
594           "The size, in octets, of the largest IPv4 packet that the
595            interface will send and receive.";
596         reference
597           "RFC 791: Internet Protocol";
598       }
599       list address {
600         key "ip";
601         status deprecated;
602         description
603           "The list of IPv4 addresses on the interface.";
604
605         leaf ip {
606           type inet:ipv4-address-no-zone;
607           status deprecated;
608           description
609             "The IPv4 address on the interface.";
610         }
611         choice subnet {
612           status deprecated;
613           description
614             "The subnet can be specified as a prefix length or,
615              if the server supports non-contiguous netmasks, as
616              a netmask.";
617           leaf prefix-length {
618             type uint8 {
619               range "0..32";
620             }
621             status deprecated;
622             description
623               "The length of the subnet prefix.";
624           }
625           leaf netmask {
626             if-feature ipv4-non-contiguous-netmasks;
627             type yang:dotted-quad;
628             status deprecated;
629             description
630               "The subnet specified as a netmask.";
631           }
632         }
633         leaf origin {
634           type ip-address-origin;
635           status deprecated;
636           description
637             "The origin of this address.";
638         }
639       }
640       list neighbor {
641         key "ip";
642         status deprecated;
643         description
644           "A list of mappings from IPv4 addresses to
645            link-layer addresses.
646
647            This list represents the ARP Cache.";
648         reference
649           "RFC 826: An Ethernet Address Resolution Protocol";
650
651         leaf ip {
652           type inet:ipv4-address-no-zone;
653           status deprecated;
654           description
655             "The IPv4 address of the neighbor node.";
656         }
657
658         leaf link-layer-address {
659           type yang:phys-address;
660           status deprecated;
661           description
662             "The link-layer address of the neighbor node.";
663         }
664         leaf origin {
665           type neighbor-origin;
666           status deprecated;
667           description
668             "The origin of this neighbor entry.";
669         }
670       }
671     }
672
673     container ipv6 {
674       presence
675         "Present if IPv6 is enabled on this interface";
676       config false;
677       status deprecated;
678       description
679         "Parameters for the IPv6 address family.";
680
681       leaf forwarding {
682         type boolean;
683         default false;
684         status deprecated;
685         description
686           "Indicates whether IPv6 packet forwarding is enabled or
687            disabled on this interface.";
688         reference
689           "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
690                      Section 6.2.1, IsRouter";
691       }
692       leaf mtu {
693         type uint32 {
694           range "1280..max";
695         }
696         units "octets";
697         status deprecated;
698         description
699           "The size, in octets, of the largest IPv6 packet that the
700            interface will send and receive.";
701         reference
702           "RFC 8200: Internet Protocol, Version 6 (IPv6)
703                      Specification
704                      Section 5";
705       }
706       list address {
707         key "ip";
708         status deprecated;
709         description
710           "The list of IPv6 addresses on the interface.";
711
712         leaf ip {
713           type inet:ipv6-address-no-zone;
714           status deprecated;
715           description
716             "The IPv6 address on the interface.";
717         }
718         leaf prefix-length {
719           type uint8 {
720             range "0..128";
721           }
722           mandatory true;
723           status deprecated;
724           description
725             "The length of the subnet prefix.";
726         }
727         leaf origin {
728           type ip-address-origin;
729           status deprecated;
730           description
731             "The origin of this address.";
732         }
733         leaf status {
734           type enumeration {
735             enum preferred {
736               description
737                 "This is a valid address that can appear as the
738                  destination or source address of a packet.";
739             }
740             enum deprecated {
741               description
742                 "This is a valid but deprecated address that should
743                  no longer be used as a source address in new
744                  communications, but packets addressed to such an
745                  address are processed as expected.";
746             }
747             enum invalid {
748               description
749                 "This isn't a valid address, and it shouldn't appear
750                  as the destination or source address of a packet.";
751             }
752
753             enum inaccessible {
754               description
755                 "The address is not accessible because the interface
756                  to which this address is assigned is not
757                  operational.";
758             }
759             enum unknown {
760               description
761                 "The status cannot be determined for some reason.";
762             }
763             enum tentative {
764               description
765                 "The uniqueness of the address on the link is being
766                  verified.  Addresses in this state should not be
767                  used for general communication and should only be
768                  used to determine the uniqueness of the address.";
769             }
770             enum duplicate {
771               description
772                 "The address has been determined to be non-unique on
773                  the link and so must not be used.";
774             }
775             enum optimistic {
776               description
777                 "The address is available for use, subject to
778                  restrictions, while its uniqueness on a link is
779                  being verified.";
780             }
781           }
782           status deprecated;
783           description
784             "The status of an address.  Most of the states correspond
785              to states from the IPv6 Stateless Address
786              Autoconfiguration protocol.";
787           reference
788             "RFC 4293: Management Information Base for the
789                        Internet Protocol (IP)
790                        - IpAddressStatusTC
791              RFC 4862: IPv6 Stateless Address Autoconfiguration";
792         }
793       }
794
795       list neighbor {
796         key "ip";
797         status deprecated;
798         description
799           "A list of mappings from IPv6 addresses to
800            link-layer addresses.
801
802            This list represents the Neighbor Cache.";
803         reference
804           "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)";
805
806         leaf ip {
807           type inet:ipv6-address-no-zone;
808           status deprecated;
809           description
810             "The IPv6 address of the neighbor node.";
811         }
812         leaf link-layer-address {
813           type yang:phys-address;
814           status deprecated;
815           description
816             "The link-layer address of the neighbor node.";
817         }
818         leaf origin {
819           type neighbor-origin;
820           status deprecated;
821           description
822             "The origin of this neighbor entry.";
823         }
824         leaf is-router {
825           type empty;
826           status deprecated;
827           description
828             "Indicates that the neighbor node acts as a router.";
829         }
830         leaf state {
831           type enumeration {
832             enum incomplete {
833               description
834                 "Address resolution is in progress, and the
835                  link-layer address of the neighbor has not yet been
836                  determined.";
837             }
838             enum reachable {
839               description
840                 "Roughly speaking, the neighbor is known to have been
841                  reachable recently (within tens of seconds ago).";
842             }
843             enum stale {
844               description
845                 "The neighbor is no longer known to be reachable, but
846                  until traffic is sent to the neighbor no attempt
847                  should be made to verify its reachability.";
848             }
849             enum delay {
850               description
851                 "The neighbor is no longer known to be reachable, and
852                  traffic has recently been sent to the neighbor.
853                  Rather than probe the neighbor immediately, however,
854                  delay sending probes for a short while in order to
855                  give upper-layer protocols a chance to provide
856                  reachability confirmation.";
857             }
858             enum probe {
859               description
860                 "The neighbor is no longer known to be reachable, and
861                  unicast Neighbor Solicitation probes are being sent
862                  to verify reachability.";
863             }
864           }
865           status deprecated;
866           description
867             "The Neighbor Unreachability Detection state of this
868              entry.";
869           reference
870             "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
871                        Section 7.3.2";
872         }
873       }
874     }
875   }
876 }