d498da6283f97a7514bd652cbd8439c59249c295
[yangtools.git] / yang / yang-parser-impl / src / test / resources / bugs / identity-ietf-routing-test / ietf-interfaces@2014-05-08.yang
1 module ietf-interfaces {
2
3   namespace "urn:ietf:params:xml:ns:yang:ietf-interfaces";
4   prefix if;
5
6   import ietf-yang-types {
7     prefix yang;
8   }
9
10   organization
11     "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
12
13   contact
14     "WG Web:   <http://tools.ietf.org/wg/netmod/>
15      WG List:  <mailto:netmod@ietf.org>
16      WG Chair: Thomas Nadeau
17                <mailto:tnadeau@lucidvision.com>
18      WG Chair: Juergen Schoenwaelder
19                <mailto:j.schoenwaelder@jacobs-university.de>
20      Editor:   Martin Bjorklund
21                <mailto:mbj@tail-f.com>";
22
23   description
24     "This module contains a collection of YANG definitions for
25      managing network interfaces.
26      Copyright (c) 2014 IETF Trust and the persons identified as
27      authors of the code.  All rights reserved.
28      Redistribution and use in source and binary forms, with or
29      without modification, is permitted pursuant to, and subject
30      to the license terms contained in, the Simplified BSD License
31      set forth in Section 4.c of the IETF Trust's Legal Provisions
32      Relating to IETF Documents
33      (http://trustee.ietf.org/license-info).
34      This version of this YANG module is part of RFC 7223; see
35      the RFC itself for full legal notices.";
36
37   revision 2014-05-08 {
38     description
39       "Initial revision.";
40     reference
41       "RFC 7223: A YANG Data Model for Interface Management";
42   }
43
44   /*
45    * Typedefs
46    */
47
48   typedef interface-ref {
49     type leafref {
50       path "/if:interfaces/if:interface/if:name";
51     }
52     description
53       "This type is used by data models that need to reference
54        configured interfaces.";
55   }
56
57   typedef interface-state-ref {
58     type leafref {
59       path "/if:interfaces-state/if:interface/if:name";
60     }
61     description
62       "This type is used by data models that need to reference
63        the operationally present interfaces.";
64   }
65
66   /*
67    * Identities
68    */
69
70   identity interface-type {
71     description
72       "Base identity from which specific interface types are
73        derived.";
74   }
75
76   /*
77    * Features
78    */
79
80   feature arbitrary-names {
81     description
82       "This feature indicates that the device allows user-controlled
83        interfaces to be named arbitrarily.";
84   }
85   feature pre-provisioning {
86     description
87       "This feature indicates that the device supports
88        pre-provisioning of interface configuration, i.e., it is
89        possible to configure an interface whose physical interface
90        hardware is not present on the device.";
91   }
92
93   feature if-mib {
94     description
95       "This feature indicates that the device implements
96        the IF-MIB.";
97     reference
98       "RFC 2863: The Interfaces Group MIB";
99   }
100
101   /*
102    * Configuration data nodes
103    */
104
105   container interfaces {
106     description
107       "Interface configuration parameters.";
108
109     list interface {
110       key "name";
111
112       description
113         "The list of configured interfaces on the device.
114          The operational state of an interface is available in the
115          /interfaces-state/interface list.  If the configuration of a
116          system-controlled interface cannot be used by the system
117          (e.g., the interface hardware present does not match the
118          interface type), then the configuration is not applied to
119          the system-controlled interface shown in the
120          /interfaces-state/interface list.  If the configuration
121          of a user-controlled interface cannot be used by the system,
122          the configured interface is not instantiated in the
123          /interfaces-state/interface list.";
124
125      leaf name {
126         type string;
127         description
128           "The name of the interface.
129            A device MAY restrict the allowed values for this leaf,
130            possibly depending on the type of the interface.
131            For system-controlled interfaces, this leaf is the
132            device-specific name of the interface.  The 'config false'
133            list /interfaces-state/interface contains the currently
134            existing interfaces on the device.
135            If a client tries to create configuration for a
136            system-controlled interface that is not present in the
137            /interfaces-state/interface list, the server MAY reject
138            the request if the implementation does not support
139            pre-provisioning of interfaces or if the name refers to
140            an interface that can never exist in the system.  A
141            NETCONF server MUST reply with an rpc-error with the
142            error-tag 'invalid-value' in this case.
143            If the device supports pre-provisioning of interface
144            configuration, the 'pre-provisioning' feature is
145            advertised.
146            If the device allows arbitrarily named user-controlled
147            interfaces, the 'arbitrary-names' feature is advertised.
148            When a configured user-controlled interface is created by
149            the system, it is instantiated with the same name in the
150            /interface-state/interface list.";
151       }
152
153       leaf description {
154         type string;
155         description
156           "A textual description of the interface.
157            A server implementation MAY map this leaf to the ifAlias
158            MIB object.  Such an implementation needs to use some
159            mechanism to handle the differences in size and characters
160            allowed between this leaf and ifAlias.  The definition of
161            such a mechanism is outside the scope of this document.
162            Since ifAlias is defined to be stored in non-volatile
163            storage, the MIB implementation MUST map ifAlias to the
164            value of 'description' in the persistently stored
165            datastore.
166            Specifically, if the device supports ':startup', when
167            ifAlias is read the device MUST return the value of
168            'description' in the 'startup' datastore, and when it is
169            written, it MUST be written to the 'running' and 'startup'
170            datastores.  Note that it is up to the implementation to
171            decide whether to modify this single leaf in 'startup' or
172            perform an implicit copy-config from 'running' to
173            'startup'.
174            If the device does not support ':startup', ifAlias MUST
175            be mapped to the 'description' leaf in the 'running'
176            datastore.";
177         reference
178           "RFC 2863: The Interfaces Group MIB - ifAlias";
179       }
180
181       leaf type {
182         type identityref {
183           base interface-type;
184         }
185         mandatory true;
186         description
187           "The type of the interface.
188            When an interface entry is created, a server MAY
189            initialize the type leaf with a valid value, e.g., if it
190            is possible to derive the type from the name of the
191            interface.
192            If a client tries to set the type of an interface to a
193            value that can never be used by the system, e.g., if the
194            type is not supported or if the type does not match the
195            name of the interface, the server MUST reject the request.
196            A NETCONF server MUST reply with an rpc-error with the
197            error-tag 'invalid-value' in this case.";
198         reference
199           "RFC 2863: The Interfaces Group MIB - ifType";
200       }
201
202       leaf enabled {
203         type boolean;
204         default "true";
205         description
206           "This leaf contains the configured, desired state of the
207            interface.
208            Systems that implement the IF-MIB use the value of this
209            leaf in the 'running' datastore to set
210            IF-MIB.ifAdminStatus to 'up' or 'down' after an ifEntry
211            has been initialized, as described in RFC 2863.
212            Changes in this leaf in the 'running' datastore are
213            reflected in ifAdminStatus, but if ifAdminStatus is
214            changed over SNMP, this leaf is not affected.";
215         reference
216           "RFC 2863: The Interfaces Group MIB - ifAdminStatus";
217       }
218
219       leaf link-up-down-trap-enable {
220         if-feature if-mib;
221         type enumeration {
222           enum enabled {
223             value 1;
224           }
225           enum disabled {
226             value 2;
227           }
228         }
229         description
230           "Controls whether linkUp/linkDown SNMP notifications
231            should be generated for this interface.
232            If this node is not configured, the value 'enabled' is
233            operationally used by the server for interfaces that do
234            not operate on top of any other interface (i.e., there are
235            no 'lower-layer-if' entries), and 'disabled' otherwise.";
236         reference
237           "RFC 2863: The Interfaces Group MIB -
238                      ifLinkUpDownTrapEnable";
239       }
240     }
241   }
242
243   /*
244    * Operational state data nodes
245    */
246
247   container interfaces-state {
248     config false;
249     description
250       "Data nodes for the operational state of interfaces.";
251
252     list interface {
253       key "name";
254
255       description
256         "The list of interfaces on the device.
257          System-controlled interfaces created by the system are
258          always present in this list, whether they are configured or
259          not.";
260
261       leaf name {
262         type string;
263         description
264           "The name of the interface.
265            A server implementation MAY map this leaf to the ifName
266            MIB object.  Such an implementation needs to use some
267            mechanism to handle the differences in size and characters
268            allowed between this leaf and ifName.  The definition of
269            such a mechanism is outside the scope of this document.";
270         reference
271           "RFC 2863: The Interfaces Group MIB - ifName";
272       }
273
274       leaf type {
275         type identityref {
276           base interface-type;
277         }
278         mandatory true;
279         description
280           "The type of the interface.";
281         reference
282           "RFC 2863: The Interfaces Group MIB - ifType";
283       }
284
285       leaf admin-status {
286         if-feature if-mib;
287         type enumeration {
288           enum up {
289             value 1;
290             description
291               "Ready to pass packets.";
292           }
293           enum down {
294             value 2;
295             description
296               "Not ready to pass packets and not in some test mode.";
297           }
298
299           enum testing {
300             value 3;
301             description
302               "In some test mode.";
303           }
304         }
305         mandatory true;
306         description
307           "The desired state of the interface.
308            This leaf has the same read semantics as ifAdminStatus.";
309         reference
310           "RFC 2863: The Interfaces Group MIB - ifAdminStatus";
311       }
312
313       leaf oper-status {
314         type enumeration {
315           enum up {
316             value 1;
317             description
318               "Ready to pass packets.";
319           }
320           enum down {
321             value 2;
322             description
323               "The interface does not pass any packets.";
324           }
325           enum testing {
326             value 3;
327             description
328               "In some test mode.  No operational packets can
329                be passed.";
330           }
331           enum unknown {
332             value 4;
333             description
334               "Status cannot be determined for some reason.";
335           }
336           enum dormant {
337             value 5;
338             description
339               "Waiting for some external event.";
340           }
341           enum not-present {
342             value 6;
343             description
344               "Some component (typically hardware) is missing.";
345           }
346           enum lower-layer-down {
347             value 7;
348             description
349               "Down due to state of lower-layer interface(s).";
350           }
351         }
352         mandatory true;
353         description
354           "The current operational state of the interface.
355            This leaf has the same semantics as ifOperStatus.";
356         reference
357           "RFC 2863: The Interfaces Group MIB - ifOperStatus";
358       }
359
360       leaf last-change {
361         type yang:date-and-time;
362         description
363           "The time the interface entered its current operational
364            state.  If the current state was entered prior to the
365            last re-initialization of the local network management
366            subsystem, then this node is not present.";
367         reference
368           "RFC 2863: The Interfaces Group MIB - ifLastChange";
369       }
370
371       leaf if-index {
372         if-feature if-mib;
373         type int32 {
374           range "1..2147483647";
375         }
376         mandatory true;
377         description
378           "The ifIndex value for the ifEntry represented by this
379            interface.";
380         reference
381           "RFC 2863: The Interfaces Group MIB - ifIndex";
382       }
383
384       leaf phys-address {
385         type yang:phys-address;
386         description
387           "The interface's address at its protocol sub-layer.  For
388            example, for an 802.x interface, this object normally
389            contains a Media Access Control (MAC) address.  The
390            interface's media-specific modules must define the bit
391            and byte ordering and the format of the value of this
392            object.  For interfaces that do not have such an address
393            (e.g., a serial line), this node is not present.";
394         reference
395           "RFC 2863: The Interfaces Group MIB - ifPhysAddress";
396       }
397
398       leaf-list higher-layer-if {
399         type interface-state-ref;
400         description
401           "A list of references to interfaces layered on top of this
402            interface.";
403         reference
404           "RFC 2863: The Interfaces Group MIB - ifStackTable";
405       }
406
407       leaf-list lower-layer-if {
408         type interface-state-ref;
409         description
410           "A list of references to interfaces layered underneath this
411            interface.";
412         reference
413           "RFC 2863: The Interfaces Group MIB - ifStackTable";
414       }
415
416       leaf speed {
417         type yang:gauge64;
418         units "bits/second";
419         description
420             "An estimate of the interface's current bandwidth in bits
421              per second.  For interfaces that do not vary in
422              bandwidth or for those where no accurate estimation can
423              be made, this node should contain the nominal bandwidth.
424              For interfaces that have no concept of bandwidth, this
425              node is not present.";
426         reference
427           "RFC 2863: The Interfaces Group MIB -
428                      ifSpeed, ifHighSpeed";
429       }
430
431       container statistics {
432         description
433           "A collection of interface-related statistics objects.";
434
435         leaf discontinuity-time {
436           type yang:date-and-time;
437           mandatory true;
438           description
439             "The time on the most recent occasion at which any one or
440              more of this interface's counters suffered a
441              discontinuity.  If no such discontinuities have occurred
442              since the last re-initialization of the local management
443              subsystem, then this node contains the time the local
444              management subsystem re-initialized itself.";
445         }
446
447         leaf in-octets {
448           type yang:counter64;
449           description
450             "The total number of octets received on the interface,
451              including framing characters.
452              Discontinuities in the value of this counter can occur
453              at re-initialization of the management system, and at
454              other times as indicated by the value of
455              'discontinuity-time'.";
456           reference
457             "RFC 2863: The Interfaces Group MIB - ifHCInOctets";
458         }
459
460         leaf in-unicast-pkts {
461           type yang:counter64;
462           description
463             "The number of packets, delivered by this sub-layer to a
464              higher (sub-)layer, that were not addressed to a
465              multicast or broadcast address at this sub-layer.
466              Discontinuities in the value of this counter can occur
467              at re-initialization of the management system, and at
468              other times as indicated by the value of
469              'discontinuity-time'.";
470           reference
471             "RFC 2863: The Interfaces Group MIB - ifHCInUcastPkts";
472         }
473
474         leaf in-broadcast-pkts {
475           type yang:counter64;
476           description
477             "The number of packets, delivered by this sub-layer to a
478              higher (sub-)layer, that were addressed to a broadcast
479              address at this sub-layer.
480              Discontinuities in the value of this counter can occur
481              at re-initialization of the management system, and at
482              other times as indicated by the value of
483              'discontinuity-time'.";
484           reference
485             "RFC 2863: The Interfaces Group MIB -
486                        ifHCInBroadcastPkts";
487         }
488
489         leaf in-multicast-pkts {
490           type yang:counter64;
491           description
492             "The number of packets, delivered by this sub-layer to a
493              higher (sub-)layer, that were addressed to a multicast
494              address at this sub-layer.  For a MAC-layer protocol,
495              this includes both Group and Functional addresses.
496              Discontinuities in the value of this counter can occur
497              at re-initialization of the management system, and at
498              other times as indicated by the value of
499              'discontinuity-time'.";
500           reference
501             "RFC 2863: The Interfaces Group MIB -
502                        ifHCInMulticastPkts";
503         }
504
505         leaf in-discards {
506           type yang:counter32;
507           description
508             "The number of inbound packets that were chosen to be
509              discarded even though no errors had been detected to
510              prevent their being deliverable to a higher-layer
511              protocol.  One possible reason for discarding such a
512              packet could be to free up buffer space.
513              Discontinuities in the value of this counter can occur
514              at re-initialization of the management system, and at
515              other times as indicated by the value of
516              'discontinuity-time'.";
517
518           reference
519             "RFC 2863: The Interfaces Group MIB - ifInDiscards";
520         }
521
522         leaf in-errors {
523           type yang:counter32;
524           description
525             "For packet-oriented interfaces, the number of inbound
526              packets that contained errors preventing them from being
527              deliverable to a higher-layer protocol.  For character-
528              oriented or fixed-length interfaces, the number of
529              inbound transmission units that contained errors
530              preventing them from being deliverable to a higher-layer
531              protocol.
532              Discontinuities in the value of this counter can occur
533              at re-initialization of the management system, and at
534              other times as indicated by the value of
535              'discontinuity-time'.";
536           reference
537             "RFC 2863: The Interfaces Group MIB - ifInErrors";
538         }
539
540         leaf in-unknown-protos {
541           type yang:counter32;
542           description
543             "For packet-oriented interfaces, the number of packets
544              received via the interface that were discarded because
545              of an unknown or unsupported protocol.  For
546              character-oriented or fixed-length interfaces that
547              support protocol multiplexing, the number of
548              transmission units received via the interface that were
549              discarded because of an unknown or unsupported protocol.
550              For any interface that does not support protocol
551              multiplexing, this counter is not present.
552              Discontinuities in the value of this counter can occur
553              at re-initialization of the management system, and at
554              other times as indicated by the value of
555              'discontinuity-time'.";
556           reference
557             "RFC 2863: The Interfaces Group MIB - ifInUnknownProtos";
558         }
559
560         leaf out-octets {
561           type yang:counter64;
562           description
563             "The total number of octets transmitted out of the
564              interface, including framing characters.
565              Discontinuities in the value of this counter can occur
566              at re-initialization of the management system, and at
567              other times as indicated by the value of
568              'discontinuity-time'.";
569           reference
570             "RFC 2863: The Interfaces Group MIB - ifHCOutOctets";
571         }
572
573         leaf out-unicast-pkts {
574           type yang:counter64;
575           description
576             "The total number of packets that higher-level protocols
577              requested be transmitted, and that were not addressed
578              to a multicast or broadcast address at this sub-layer,
579              including those that were discarded or not sent.
580              Discontinuities in the value of this counter can occur
581              at re-initialization of the management system, and at
582              other times as indicated by the value of
583              'discontinuity-time'.";
584           reference
585             "RFC 2863: The Interfaces Group MIB - ifHCOutUcastPkts";
586         }
587
588         leaf out-broadcast-pkts {
589           type yang:counter64;
590           description
591             "The total number of packets that higher-level protocols
592              requested be transmitted, and that were addressed to a
593              broadcast address at this sub-layer, including those
594              that were discarded or not sent.
595              Discontinuities in the value of this counter can occur
596              at re-initialization of the management system, and at
597              other times as indicated by the value of
598              'discontinuity-time'.";
599           reference
600             "RFC 2863: The Interfaces Group MIB -
601                        ifHCOutBroadcastPkts";
602         }
603
604         leaf out-multicast-pkts {
605           type yang:counter64;
606           description
607             "The total number of packets that higher-level protocols
608              requested be transmitted, and that were addressed to a
609              multicast address at this sub-layer, including those
610              that were discarded or not sent.  For a MAC-layer
611              protocol, this includes both Group and Functional
612              addresses.
613              Discontinuities in the value of this counter can occur
614              at re-initialization of the management system, and at
615              other times as indicated by the value of
616              'discontinuity-time'.";
617           reference
618             "RFC 2863: The Interfaces Group MIB -
619                        ifHCOutMulticastPkts";
620         }
621
622         leaf out-discards {
623           type yang:counter32;
624           description
625             "The number of outbound packets that were chosen to be
626              discarded even though no errors had been detected to
627              prevent their being transmitted.  One possible reason
628              for discarding such a packet could be to free up buffer
629              space.
630              Discontinuities in the value of this counter can occur
631              at re-initialization of the management system, and at
632              other times as indicated by the value of
633              'discontinuity-time'.";
634           reference
635             "RFC 2863: The Interfaces Group MIB - ifOutDiscards";
636         }
637
638         leaf out-errors {
639           type yang:counter32;
640           description
641             "For packet-oriented interfaces, the number of outbound
642              packets that could not be transmitted because of errors.
643              For character-oriented or fixed-length interfaces, the
644              number of outbound transmission units that could not be
645              transmitted because of errors.
646              Discontinuities in the value of this counter can occur
647              at re-initialization of the management system, and at
648              other times as indicated by the value of
649              'discontinuity-time'.";
650           reference
651             "RFC 2863: The Interfaces Group MIB - ifOutErrors";
652         }
653       }
654     }
655   }
656 }