1 module openconfig-interfaces {
6 namespace "http://openconfig.net/yang/interfaces";
10 // import some basic types
11 import ietf-interfaces { prefix ietf-if; }
12 import openconfig-yang-types { prefix oc-yang; }
13 import openconfig-types { prefix oc-types; }
14 import openconfig-extensions { prefix oc-ext; }
17 organization "OpenConfig working group";
20 "OpenConfig working group
21 netopenconfig@googlegroups.com";
24 "Model for managing network interfaces and subinterfaces. This
25 module also defines convenience types / groupings for other
26 models to create references to interfaces:
28 base-interface-ref (type) - reference to a base interface
29 interface-ref (grouping) - container for reference to a
30 interface + subinterface
31 interface-ref-state (grouping) - container for read-only
32 (opstate) reference to interface + subinterface
34 This model reuses data items defined in the IETF YANG model for
35 interfaces described by RFC 7223 with an alternate structure
36 (particularly for operational state data) and with
37 additional configuration items.
39 Portions of this code were derived from IETF RFC 7223.
40 Please reproduce this note if possible.
42 IETF code is subject to the following copyright and license:
43 Copyright (c) IETF Trust and the persons identified as authors of
47 Redistribution and use in source and binary forms, with or without
48 modification, is permitted pursuant to, and subject to the license
49 terms contained in, the Simplified BSD License set forth in
50 Section 4.c of the IETF Trust's Legal Provisions Relating
51 to IETF Documents (http://trustee.ietf.org/license-info).";
53 oc-ext:openconfig-version "2.3.0";
55 revision "2018-01-05" {
57 "Add logical loopback to interface.";
61 revision "2017-12-22" {
63 "Add IPv4 proxy ARP configuration.";
67 revision "2017-12-21" {
69 "Added IPv6 router advertisement configuration.";
73 revision "2017-07-14" {
75 "Added Ethernet/IP state data; Add dhcp-client;
76 migrate to OpenConfig types modules; Removed or
77 renamed opstate values";
81 revision "2017-04-03" {
83 "Update copyright notice.";
87 revision "2016-12-22" {
89 "Fixes to Ethernet interfaces model";
96 typedef base-interface-ref {
98 path "/oc-if:interfaces/oc-if:interface/oc-if:name";
101 "Reusable type for by-name reference to a base interface.
102 This type may be used in cases where ability to reference
103 a subinterface is not required.";
106 typedef interface-id {
109 "User-defined identifier for an interface, generally used to
110 name a interface reference. The id can be arbitrary but a
111 useful convention is to use a combination of base interface
112 name and subinterface index.";
115 // grouping statements
117 grouping interface-ref-common {
119 "Reference leafrefs to interface / subinterface";
123 path "/oc-if:interfaces/oc-if:interface/oc-if:name";
126 "Reference to a base interface. If a reference to a
127 subinterface is required, this leaf must be specified
128 to indicate the base interface.";
133 path "/oc-if:interfaces/" +
134 "oc-if:interface[oc-if:name=current()/../interface]/" +
135 "oc-if:subinterfaces/oc-if:subinterface/oc-if:index";
138 "Reference to a subinterface -- this requires the base
139 interface to be specified using the interface leaf in
140 this container. If only a reference to a base interface
141 is requuired, this leaf should not be set.";
145 grouping interface-ref-state-container {
147 "Reusable opstate w/container for a reference to an
148 interface or subinterface";
153 "Operational state for interface-ref";
155 uses interface-ref-common;
159 grouping interface-ref {
161 "Reusable definition for a reference to an interface or
164 container interface-ref {
166 "Reference to an interface or subinterface";
170 "Configured reference to interface / subinterface";
172 uses interface-ref-common;
175 uses interface-ref-state-container;
179 grouping interface-ref-state {
181 "Reusable opstate w/container for a reference to an
182 interface or subinterface";
184 container interface-ref {
186 "Reference to an interface or subinterface";
188 uses interface-ref-state-container;
192 grouping base-interface-ref-state {
194 "Reusable opstate w/container for a reference to a
195 base interface (no subinterface).";
200 "Operational state for base interface reference";
203 type base-interface-ref;
205 "Reference to a base interface.";
211 grouping interface-common-config {
213 "Configuration data data nodes common to physical interfaces
219 "A textual description of the interface.
221 A server implementation MAY map this leaf to the ifAlias
222 MIB object. Such an implementation needs to use some
223 mechanism to handle the differences in size and characters
224 allowed between this leaf and ifAlias. The definition of
225 such a mechanism is outside the scope of this document.
227 Since ifAlias is defined to be stored in non-volatile
228 storage, the MIB implementation MUST map ifAlias to the
229 value of 'description' in the persistently stored
232 Specifically, if the device supports ':startup', when
233 ifAlias is read the device MUST return the value of
234 'description' in the 'startup' datastore, and when it is
235 written, it MUST be written to the 'running' and 'startup'
236 datastores. Note that it is up to the implementation to
238 decide whether to modify this single leaf in 'startup' or
239 perform an implicit copy-config from 'running' to
242 If the device does not support ':startup', ifAlias MUST
243 be mapped to the 'description' leaf in the 'running'
246 "RFC 2863: The Interfaces Group MIB - ifAlias";
253 "This leaf contains the configured, desired state of the
256 Systems that implement the IF-MIB use the value of this
257 leaf in the 'running' datastore to set
258 IF-MIB.ifAdminStatus to 'up' or 'down' after an ifEntry
259 has been initialized, as described in RFC 2863.
261 Changes in this leaf in the 'running' datastore are
262 reflected in ifAdminStatus, but if ifAdminStatus is
263 changed over SNMP, this leaf is not affected.";
265 "RFC 2863: The Interfaces Group MIB - ifAdminStatus";
270 grouping interface-phys-config {
272 "Configuration data for physical interfaces";
277 "The name of the interface.
279 A device MAY restrict the allowed values for this leaf,
280 possibly depending on the type of the interface.
281 For system-controlled interfaces, this leaf is the
282 device-specific name of the interface. The 'config false'
283 list interfaces/interface[name]/state contains the currently
284 existing interfaces on the device.
286 If a client tries to create configuration for a
287 system-controlled interface that is not present in the
288 corresponding state list, the server MAY reject
289 the request if the implementation does not support
290 pre-provisioning of interfaces or if the name refers to
291 an interface that can never exist in the system. A
292 NETCONF server MUST reply with an rpc-error with the
293 error-tag 'invalid-value' in this case.
295 The IETF model in RFC 7223 provides YANG features for the
296 following (i.e., pre-provisioning and arbitrary-names),
297 however they are omitted here:
299 If the device supports pre-provisioning of interface
300 configuration, the 'pre-provisioning' feature is
303 If the device allows arbitrarily named user-controlled
304 interfaces, the 'arbitrary-names' feature is advertised.
306 When a configured user-controlled interface is created by
307 the system, it is instantiated with the same name in the
308 /interfaces/interface[name]/state list.";
313 base ietf-if:interface-type;
317 "The type of the interface.
319 When an interface entry is created, a server MAY
320 initialize the type leaf with a valid value, e.g., if it
321 is possible to derive the type from the name of the
324 If a client tries to set the type of an interface to a
325 value that can never be used by the system, e.g., if the
326 type is not supported or if the type does not match the
327 name of the interface, the server MUST reject the request.
328 A NETCONF server MUST reply with an rpc-error with the
329 error-tag 'invalid-value' in this case.";
331 "RFC 2863: The Interfaces Group MIB - ifType";
337 "Set the max transmission unit size in octets
338 for the physical interface. If this is not set, the mtu is
339 set to the operational default -- e.g., 1514 bytes on an
340 Ethernet interface.";
347 "When set to true, the interface is logically looped back,
348 such that packets that are forwarded via the interface
349 are received on the same interface.";
352 uses interface-common-config;
355 grouping interface-phys-holdtime-config {
357 "Configuration data for interface hold-time settings --
358 applies to physical interfaces.";
365 "Dampens advertisement when the interface
366 transitions from down to up. A zero value means dampening
367 is turned off, i.e., immediate notification.";
375 "Dampens advertisement when the interface transitions from
376 up to down. A zero value means dampening is turned off,
377 i.e., immediate notification.";
381 grouping interface-phys-holdtime-state {
383 "Operational state data for interface hold-time.";
386 grouping interface-phys-holdtime-top {
388 "Top-level grouping for setting link transition
389 dampening on physical and other types of interfaces.";
391 container hold-time {
393 "Top-level container for hold-time settings to enable
394 dampening advertisements of interface transitions.";
398 "Configuration data for interface hold-time settings.";
400 uses interface-phys-holdtime-config;
408 "Operational state data for interface hold-time.";
410 uses interface-phys-holdtime-config;
411 uses interface-phys-holdtime-state;
416 grouping interface-common-state {
418 "Operational state data (in addition to intended configuration)
419 at the global level for this interface";
424 "System assigned number for each interface. Corresponds to
425 ifIndex object in SNMP Interface MIB";
427 "RFC 2863 - The Interfaces Group MIB";
434 "Ready to pass packets.";
438 "Not ready to pass packets and not in some test mode.";
441 //TODO: This is generally not supported as a configured
442 //admin state, though it's in the standard interfaces MIB.
443 //Consider removing it.
445 "In some test mode.";
448 //TODO:consider converting to an identity to have the
449 //flexibility to remove some values defined by RFC 7223 that
450 //are not used or not implemented consistently.
453 "The desired state of the interface. In RFC 7223 this leaf
454 has the same read semantics as ifAdminStatus. Here, it
455 reflects the administrative state as set by enabling or
456 disabling the interface.";
458 "RFC 2863: The Interfaces Group MIB - ifAdminStatus";
466 "Ready to pass packets.";
471 "The interface does not pass any packets.";
476 "In some test mode. No operational packets can
482 "Status cannot be determined for some reason.";
487 "Waiting for some external event.";
492 "Some component (typically hardware) is missing.";
494 enum LOWER_LAYER_DOWN {
497 "Down due to state of lower-layer interface(s).";
500 //TODO:consider converting to an identity to have the
501 //flexibility to remove some values defined by RFC 7223 that
502 //are not used or not implemented consistently.
505 "The current operational state of the interface.
507 This leaf has the same semantics as ifOperStatus.";
509 "RFC 2863: The Interfaces Group MIB - ifOperStatus";
513 type oc-types:timeticks64;
516 "This timestamp indicates the time of the last state change
517 of the interface (e.g., up-to-down transition). This
518 corresponds to the ifLastChange object in the standard
521 The value is the timestamp in nanoseconds relative to
522 the Unix Epoch (Jan 1, 1970 00:00:00 UTC).";
524 "RFC 2863: The Interfaces Group MIB - ifLastChange";
530 grouping interface-counters-state {
532 "Operational state representing interface counters
535 //TODO: we may need to break this list of counters into those
536 //that would appear for physical vs. subinterface or logical
537 //interfaces. For now, just replicating the full stats
538 //grouping to both interface and subinterface.
542 "A collection of interface-related statistics objects.";
545 type oc-yang:counter64;
547 "The total number of octets received on the interface,
548 including framing characters.
550 Discontinuities in the value of this counter can occur
551 at re-initialization of the management system, and at
552 other times as indicated by the value of
555 "RFC 2863: The Interfaces Group MIB - ifHCInOctets";
558 leaf in-unicast-pkts {
559 type oc-yang:counter64;
561 "The number of packets, delivered by this sub-layer to a
562 higher (sub-)layer, that were not addressed to a
563 multicast or broadcast address at this sub-layer.
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
570 "RFC 2863: The Interfaces Group MIB - ifHCInUcastPkts";
573 leaf in-broadcast-pkts {
574 type oc-yang:counter64;
576 "The number of packets, delivered by this sub-layer to a
577 higher (sub-)layer, that were addressed to a broadcast
578 address at this sub-layer.
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
585 "RFC 2863: The Interfaces Group MIB -
586 ifHCInBroadcastPkts";
589 leaf in-multicast-pkts {
590 type oc-yang:counter64;
592 "The number of packets, delivered by this sub-layer to a
593 higher (sub-)layer, that were addressed to a multicast
594 address at this sub-layer. For a MAC-layer protocol,
595 this includes both Group and Functional addresses.
597 Discontinuities in the value of this counter can occur
598 at re-initialization of the management system, and at
599 other times as indicated by the value of
602 "RFC 2863: The Interfaces Group MIB -
603 ifHCInMulticastPkts";
607 type oc-yang:counter64;
609 "The number of inbound packets that were chosen to be
610 discarded even though no errors had been detected to
611 prevent their being deliverable to a higher-layer
612 protocol. One possible reason for discarding such a
613 packet could be to free up buffer space.
615 Discontinuities in the value of this counter can occur
616 at re-initialization of the management system, and at
617 other times as indicated by the value of
622 "RFC 2863: The Interfaces Group MIB - ifInDiscards";
626 type oc-yang:counter64;
628 "For packet-oriented interfaces, the number of inbound
629 packets that contained errors preventing them from being
630 deliverable to a higher-layer protocol. For character-
631 oriented or fixed-length interfaces, the number of
632 inbound transmission units that contained errors
633 preventing them from being deliverable to a higher-layer
636 Discontinuities in the value of this counter can occur
637 at re-initialization of the management system, and at
638 other times as indicated by the value of
641 "RFC 2863: The Interfaces Group MIB - ifInErrors";
644 leaf in-unknown-protos {
645 type oc-yang:counter64;
647 "For packet-oriented interfaces, the number of packets
648 received via the interface that were discarded because
649 of an unknown or unsupported protocol. For
650 character-oriented or fixed-length interfaces that
651 support protocol multiplexing, the number of
652 transmission units received via the interface that were
653 discarded because of an unknown or unsupported protocol.
654 For any interface that does not support protocol
655 multiplexing, this counter is not present.
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
662 "RFC 2863: The Interfaces Group MIB - ifInUnknownProtos";
666 type oc-yang:counter64;
668 "Number of received packets which had errors in the
669 frame check sequence (FCS), i.e., framing errors.
671 Discontinuities in the value of this counter can occur
672 when the device is re-initialization as indicated by the
673 value of 'last-clear'.";
677 type oc-yang:counter64;
679 "The total number of octets transmitted out of the
680 interface, including framing characters.
682 Discontinuities in the value of this counter can occur
683 at re-initialization of the management system, and at
684 other times as indicated by the value of
687 "RFC 2863: The Interfaces Group MIB - ifHCOutOctets";
690 leaf out-unicast-pkts {
691 type oc-yang:counter64;
693 "The total number of packets that higher-level protocols
694 requested be transmitted, and that were not addressed
695 to a multicast or broadcast address at this sub-layer,
696 including those that were discarded or not sent.
698 Discontinuities in the value of this counter can occur
699 at re-initialization of the management system, and at
700 other times as indicated by the value of
703 "RFC 2863: The Interfaces Group MIB - ifHCOutUcastPkts";
706 leaf out-broadcast-pkts {
707 type oc-yang:counter64;
709 "The total number of packets that higher-level protocols
710 requested be transmitted, and that were addressed to a
711 broadcast address at this sub-layer, including those
712 that were discarded or not sent.
714 Discontinuities in the value of this counter can occur
715 at re-initialization of the management system, and at
716 other times as indicated by the value of
719 "RFC 2863: The Interfaces Group MIB -
720 ifHCOutBroadcastPkts";
724 leaf out-multicast-pkts {
725 type oc-yang:counter64;
727 "The total number of packets that higher-level protocols
728 requested be transmitted, and that were addressed to a
729 multicast address at this sub-layer, including those
730 that were discarded or not sent. For a MAC-layer
731 protocol, this includes both Group and Functional
734 Discontinuities in the value of this counter can occur
735 at re-initialization of the management system, and at
736 other times as indicated by the value of
739 "RFC 2863: The Interfaces Group MIB -
740 ifHCOutMulticastPkts";
744 type oc-yang:counter64;
746 "The number of outbound packets that were chosen to be
747 discarded even though no errors had been detected to
748 prevent their being transmitted. One possible reason
749 for discarding such a packet could be to free up buffer
752 Discontinuities in the value of this counter can occur
753 at re-initialization of the management system, and at
754 other times as indicated by the value of
757 "RFC 2863: The Interfaces Group MIB - ifOutDiscards";
761 type oc-yang:counter64;
763 "For packet-oriented interfaces, the number of outbound
764 packets that could not be transmitted because of errors.
765 For character-oriented or fixed-length interfaces, the
766 number of outbound transmission units that could not be
767 transmitted because of errors.
769 Discontinuities in the value of this counter can occur
770 at re-initialization of the management system, and at
771 other times as indicated by the value of
774 "RFC 2863: The Interfaces Group MIB - ifOutErrors";
777 leaf carrier-transitions {
778 type oc-yang:counter64;
780 "Number of times the interface state has transitioned
781 between up and down since the time the device restarted
782 or the last-clear time, whichever is most recent.";
786 type oc-types:timeticks64;
789 "Timestamp of the last time the interface counters were
792 The value is the timestamp in nanoseconds relative to
793 the Unix Epoch (Jan 1, 1970 00:00:00 UTC).";
798 // data definition statements
800 grouping sub-unnumbered-config {
802 "Configuration data for unnumbered subinterfaces";
808 "Indicates that the subinterface is unnumbered. By default
809 the subinterface is numbered, i.e., expected to have an
810 IP address configuration.";
814 grouping sub-unnumbered-state {
816 "Operational state data unnumbered subinterfaces";
819 grouping sub-unnumbered-top {
821 "Top-level grouping unnumbered subinterfaces";
823 container unnumbered {
825 "Top-level container for setting unnumbered interfaces.
826 Includes reference the interface that provides the
827 address information";
831 "Configuration data for unnumbered interface";
833 uses sub-unnumbered-config;
841 "Operational state data for unnumbered interfaces";
843 uses sub-unnumbered-config;
844 uses sub-unnumbered-state;
847 uses oc-if:interface-ref;
851 grouping subinterfaces-config {
853 "Configuration data for subinterfaces";
859 "The index of the subinterface, or logical interface number.
860 On systems with no support for subinterfaces, or not using
861 subinterfaces, this value should default to 0, i.e., the
862 default subinterface.";
865 uses interface-common-config;
869 grouping subinterfaces-state {
871 "Operational state data for subinterfaces";
876 "The system-assigned name for the sub-interface. This MAY
877 be a combination of the base interface name and the
878 subinterface index, or some other convention used by the
882 uses interface-common-state;
883 uses interface-counters-state;
886 grouping subinterfaces-top {
888 "Subinterface data for logical interfaces associated with a
891 container subinterfaces {
893 "Enclosing container for the list of subinterfaces associated
894 with a physical interface";
900 "The list of subinterfaces (logical interfaces) associated
901 with a physical interface";
905 path "../config/index";
908 "The index number of the subinterface -- used to address
909 the logical interface";
914 "Configurable items at the subinterface level";
916 uses subinterfaces-config;
923 "Operational state data for logical interfaces";
925 uses subinterfaces-config;
926 uses subinterfaces-state;
932 grouping interfaces-top {
934 "Top-level grouping for interface configuration and
935 operational state data";
937 container interfaces {
939 "Top level container for interfaces, including configuration
947 "The list of named interfaces on the device.";
951 path "../config/name";
954 "References the configured name of the interface";
955 //TODO: need to consider whether this should actually
956 //reference the name in the state subtree, which
957 //presumably would be the system-assigned name, or the
958 //configured name. Points to the config/name now
959 //because of YANG 1.0 limitation that the list
960 //key must have the same "config" as the list, and
961 //also can't point to a non-config node.
966 "Configurable items at the global, physical interface
969 uses interface-phys-config;
976 "Operational state data at the global interface level";
978 uses interface-phys-config;
979 uses interface-common-state;
980 uses interface-counters-state;
983 uses interface-phys-holdtime-top;
984 uses subinterfaces-top;