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