blob: 4abde5d569ac9935fe919a33942ed299a5edbc2a [file] [log] [blame]
hiroki4ecc8712018-05-08 13:23:37 -07001module openconfig-interfaces {
2
3 // namespace
4 namespace "http://openconfig.net/yang/interfaces";
5
6 prefix "oc-if";
7
8 // import some basic types
9 import ietf-interfaces {
10 prefix ietf-if;
11 }
12 import ietf-yang-types {
13 prefix yang;
14 }
15 import openconfig-extensions {
16 prefix oc-ext;
17 revision-date "2015-10-09";
18 }
19
20 // import tailf-common {prefix "tailf";}
21 // tailf:export netconf;
22 // tailf:export rest;
23
24 // meta
25 organization "OpenConfig working group";
26
27 contact
28 "OpenConfig working group
29 netopenconfig@googlegroups.com";
30
31 description
32 "Model for managing network interfaces and subinterfaces. This
33 module also defines convenience types / groupings for other
34 models to create references to interfaces:
35 base-interface-ref (type) - reference to a base interface
36 interface-ref (grouping) - container for reference to a
37 interface + subinterface
38 interface-ref-state (grouping) - container for read-only
39 (opstate) reference to interface + subinterface
40 This model reuses data items defined in the IETF YANG model for
41 interfaces described by RFC 7223 with an alternate structure
42 (particularly for operational state data) and and with
43 additional configuration items.";
44
45 oc-ext:openconfig-version "1.0.2";
46
47 revision "2016-05-26" {
48 description
49 "OpenConfig public release";
50 reference "1.0.2";
51 }
52
53
54 // typedef statements
55
56 typedef base-interface-ref {
57 type leafref {
58 path "/oc-if:interfaces/oc-if:interface/oc-if:name";
59 }
60 description
61 "Reusable type for by-name reference to a base interface.
62 This type may be used in cases where ability to reference
63 a subinterface is not required.";
64 }
65
66 typedef interface-id {
67 type string;
68 description
69 "User-defined identifier for an interface, generally used to
70 name a interface reference. The id can be arbitrary but a
71 useful convention is to use a combination of base interface
72 name and subinterface index.";
73 }
74
75 // grouping statements
76
77 grouping interface-ref-common {
78 description
79 "Reference leafrefs to interface / subinterface";
80
81 leaf interface {
82 type leafref {
83 path "/oc-if:interfaces/oc-if:interface/oc-if:name";
84 }
85 description
86 "Reference to a base interface. If a reference to a
87 subinterface is required, this leaf must be specified
88 to indicate the base interface.";
89 }
90
91 leaf subinterface {
92 type leafref {
93 path "/oc-if:interfaces/" +
94 "oc-if:interface[oc-if:name=current()/../interface]/" +
95 "oc-if:subinterfaces/oc-if:subinterface/oc-if:index";
96 }
97 description
98 "Reference to a subinterface -- this requires the base
99 interface to be specified using the interface leaf in
100 this container. If only a reference to a base interface
101 is requuired, this leaf should not be set.";
102 }
103 }
104
105 grouping interface-ref-state-container {
106 description
107 "Reusable opstate w/container for a reference to an
108 interface or subinterface";
109
110 container state {
111 config false;
112 description
113 "Operational state for interface-ref";
114
115 uses interface-ref-common;
116 }
117 }
118
119 grouping interface-ref {
120 description
121 "Reusable definition for a reference to an interface or
122 subinterface";
123
124 container interface-ref {
125 description
126 "Reference to an interface or subinterface";
127
128 container config {
129 description
130 "Configured reference to interface / subinterface";
131
132 uses interface-ref-common;
133 }
134
135 uses interface-ref-state-container;
136 }
137 }
138
139 grouping interface-ref-state {
140 description
141 "Reusable opstate w/container for a reference to an
142 interface or subinterface";
143
144 container interface-ref {
145 description
146 "Reference to an interface or subinterface";
147
148 uses interface-ref-state-container;
149 }
150 }
151
152
153 grouping interface-common-config {
154 description
155 "Configuration data data nodes common to physical interfaces
156 and subinterfaces";
157
158 leaf name {
159 type string;
160 description
161 "[adapted from IETF interfaces model (RFC 7223)]
162 The name of the interface.
163 A device MAY restrict the allowed values for this leaf,
164 possibly depending on the type of the interface.
165 For system-controlled interfaces, this leaf is the
166 device-specific name of the interface. The 'config false'
167 list interfaces/interface[name]/state contains the currently
168 existing interfaces on the device.
169 If a client tries to create configuration for a
170 system-controlled interface that is not present in the
171 corresponding state list, the server MAY reject
172 the request if the implementation does not support
173 pre-provisioning of interfaces or if the name refers to
174 an interface that can never exist in the system. A
175 NETCONF server MUST reply with an rpc-error with the
176 error-tag 'invalid-value' in this case.
177 The IETF model in RFC 7223 provides YANG features for the
178 following (i.e., pre-provisioning and arbitrary-names),
179 however they are omitted here:
180 If the device supports pre-provisioning of interface
181 configuration, the 'pre-provisioning' feature is
182 advertised.
183 If the device allows arbitrarily named user-controlled
184 interfaces, the 'arbitrary-names' feature is advertised.
185 When a configured user-controlled interface is created by
186 the system, it is instantiated with the same name in the
187 /interfaces/interface[name]/state list.";
188 reference
189 "RFC 7223: A YANG Data Model for Interface Management";
190 }
191
192 leaf description {
193 type string;
194 description
195 "[adapted from IETF interfaces model (RFC 7223)]
196 A textual description of the interface.
197 A server implementation MAY map this leaf to the ifAlias
198 MIB object. Such an implementation needs to use some
199 mechanism to handle the differences in size and characters
200 allowed between this leaf and ifAlias. The definition of
201 such a mechanism is outside the scope of this document.
202 Since ifAlias is defined to be stored in non-volatile
203 storage, the MIB implementation MUST map ifAlias to the
204 value of 'description' in the persistently stored
205 datastore.
206 Specifically, if the device supports ':startup', when
207 ifAlias is read the device MUST return the value of
208 'description' in the 'startup' datastore, and when it is
209 written, it MUST be written to the 'running' and 'startup'
210 datastores. Note that it is up to the implementation to
211 decide whether to modify this single leaf in 'startup' or
212 perform an implicit copy-config from 'running' to
213 'startup'.
214 If the device does not support ':startup', ifAlias MUST
215 be mapped to the 'description' leaf in the 'running'
216 datastore.";
217 reference
218 "RFC 2863: The Interfaces Group MIB - ifAlias";
219 }
220
221 leaf enabled {
222 type boolean;
223 default "true";
224 description
225 "[adapted from IETF interfaces model (RFC 7223)]
226 This leaf contains the configured, desired state of the
227 interface.
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 Changes in this leaf in the 'running' datastore are
233 reflected in ifAdminStatus, but if ifAdminStatus is
234 changed over SNMP, this leaf is not affected.";
235 reference
236 "RFC 2863: The Interfaces Group MIB - ifAdminStatus";
237 }
238
239 }
240
241 grouping interface-phys-config {
242 description
243 "Configuration data for physical interfaces";
244
245 leaf type {
246 type identityref {
247 base ietf-if:interface-type;
248 }
249 mandatory true;
250 description
251 "[adapted from IETF interfaces model (RFC 7223)]
252 The type of the interface.
253 When an interface entry is created, a server MAY
254 initialize the type leaf with a valid value, e.g., if it
255 is possible to derive the type from the name of the
256 interface.
257 If a client tries to set the type of an interface to a
258 value that can never be used by the system, e.g., if the
259 type is not supported or if the type does not match the
260 name of the interface, the server MUST reject the request.
261 A NETCONF server MUST reply with an rpc-error with the
262 error-tag 'invalid-value' in this case.";
263 reference
264 "RFC 2863: The Interfaces Group MIB - ifType";
265 }
266
267 leaf mtu {
268 type uint16;
269 description
270 "Set the max transmission unit size in octets
271 for the physical interface. If this is not set, the mtu is
272 set to the operational default -- e.g., 1514 bytes on an
273 Ethernet interface.";
274 }
275
276 uses interface-common-config;
277 }
278
279 grouping interface-phys-holdtime-config {
280 description
281 "Configuration data for interface hold-time settings --
282 applies to physical interfaces.";
283
284 leaf up {
285 type uint32;
286 units milliseconds;
287 default 0;
288 description
289 "Dampens advertisement when the interface
290 transitions from down to up. A zero value means dampening
291 is turned off, i.e., immediate notification.";
292 }
293
294 leaf down {
295 type uint32;
296 units milliseconds;
297 default 0;
298 description
299 "Dampens advertisement when the interface transitions from
300 up to down. A zero value means dampening is turned off,
301 i.e., immediate notification.";
302 }
303 }
304
305 grouping interface-phys-holdtime-state {
306 description
307 "Operational state data for interface hold-time.";
308 }
309
310 grouping interface-phys-holdtime-top {
311 description
312 "Top-level grouping for setting link transition
313 dampening on physical and other types of interfaces.";
314
315 container hold-time {
316 description
317 "Top-level container for hold-time settings to enable
318 dampening advertisements of interface transitions.";
319
320 container config {
321 description
322 "Configuration data for interface hold-time settings.";
323
324 uses interface-phys-holdtime-config;
325 }
326
327 container state {
328
329 config false;
330
331 description
332 "Operational state data for interface hold-time.";
333
334 uses interface-phys-holdtime-config;
335 uses interface-phys-holdtime-state;
336 }
337 }
338 }
339
340 grouping interface-common-state {
341 description
342 "Operational state data (in addition to intended configuration)
343 at the global level for this interface";
344
345 leaf ifindex {
346 type uint32;
347 description
348 "System assigned number for each interface. Corresponds to
349 ifIndex object in SNMP Interface MIB";
350 reference
351 "RFC 2863 - The Interfaces Group MIB";
352 }
353
354 leaf admin-status {
355 type enumeration {
356 enum UP {
357 description
358 "Ready to pass packets.";
359 }
360 enum DOWN {
361 description
362 "Not ready to pass packets and not in some test mode.";
363 }
364 enum TESTING {
365 //TODO: This is generally not supported as a configured
366 //admin state, though it's in the standard interfaces MIB.
367 //Consider removing it.
368 description
369 "In some test mode.";
370 }
371 }
372 //TODO:consider converting to an identity to have the
373 //flexibility to remove some values defined by RFC 7223 that
374 //are not used or not implemented consistently.
375 mandatory true;
376 description
377 "[adapted from IETF interfaces model (RFC 7223)]
378 The desired state of the interface. In RFC 7223 this leaf
379 has the same read semantics as ifAdminStatus. Here, it
380 reflects the administrative state as set by enabling or
381 disabling the interface.";
382 reference
383 "RFC 2863: The Interfaces Group MIB - ifAdminStatus";
384 }
385
386 leaf oper-status {
387 type enumeration {
388 enum UP {
389 value 1;
390 description
391 "Ready to pass packets.";
392 }
393 enum DOWN {
394 value 2;
395 description
396 "The interface does not pass any packets.";
397 }
398 enum TESTING {
399 value 3;
400 description
401 "In some test mode. No operational packets can
402 be passed.";
403 }
404 enum UNKNOWN {
405 value 4;
406 description
407 "Status cannot be determined for some reason.";
408 }
409 enum DORMANT {
410 value 5;
411 description
412 "Waiting for some external event.";
413 }
414 enum NOT_PRESENT {
415 value 6;
416 description
417 "Some component (typically hardware) is missing.";
418 }
419 enum LOWER_LAYER_DOWN {
420 value 7;
421 description
422 "Down due to state of lower-layer interface(s).";
423 }
424 }
425 //TODO:consider converting to an identity to have the
426 //flexibility to remove some values defined by RFC 7223 that
427 //are not used or not implemented consistently.
428 mandatory true;
429 description
430 "[adapted from IETF interfaces model (RFC 7223)]
431 The current operational state of the interface.
432 This leaf has the same semantics as ifOperStatus.";
433 reference
434 "RFC 2863: The Interfaces Group MIB - ifOperStatus";
435 }
436
437 leaf last-change {
438 type yang:timeticks;
439 description
440 "Date and time of the last state change of the interface
441 (e.g., up-to-down transition). This corresponds to the
442 ifLastChange object in the standard interface MIB.";
443 reference
444 "RFC 2863: The Interfaces Group MIB - ifLastChange";
445 }
446
447 }
448
449
450 grouping interface-counters-state {
451 description
452 "Operational state representing interface counters
453 and statistics. Some of these are adapted from RFC 7223";
454
455 //TODO: we may need to break this list of counters into those
456 //that would appear for physical vs. subinterface or logical
457 //interfaces. For now, just replicating the full stats
458 //grouping to both interface and subinterface.
459
460 container counters {
461 description
462 "A collection of interface-related statistics objects.";
463
464 reference
465 "RFC 7223 - A YANG Data Model for Interface
466 Management";
467
468 leaf in-octets {
469 type yang:counter64;
470 description
471 "[adapted from IETF interfaces model (RFC 7223)]
472 The total number of octets received on the interface,
473 including framing characters.
474 Discontinuities in the value of this counter can occur
475 at re-initialization of the management system, and at
476 other times as indicated by the value of
477 'discontinuity-time'.";
478 reference
479 "RFC 2863: The Interfaces Group MIB - ifHCInOctets";
480 }
481
482 leaf in-unicast-pkts {
483 type yang:counter64;
484 description
485 "[adapted from IETF interfaces model (RFC 7223)]
486 The number of packets, delivered by this sub-layer to a
487 higher (sub-)layer, that were not addressed to a
488 multicast or broadcast address at this sub-layer.
489 Discontinuities in the value of this counter can occur
490 at re-initialization of the management system, and at
491 other times as indicated by the value of
492 'discontinuity-time'.";
493 reference
494 "RFC 2863: The Interfaces Group MIB - ifHCInUcastPkts";
495 }
496
497 leaf in-broadcast-pkts {
498 type yang:counter64;
499 description
500 "[adapted from IETF interfaces model (RFC 7223)]
501 The number of packets, delivered by this sub-layer to a
502 higher (sub-)layer, that were addressed to a broadcast
503 address at this sub-layer.
504 Discontinuities in the value of this counter can occur
505 at re-initialization of the management system, and at
506 other times as indicated by the value of
507 'discontinuity-time'.";
508 reference
509 "RFC 2863: The Interfaces Group MIB -
510 ifHCInBroadcastPkts";
511 }
512
513 leaf in-multicast-pkts {
514 type yang:counter64;
515 description
516 "[adapted from IETF interfaces model (RFC 7223)]
517 The number of packets, delivered by this sub-layer to a
518 higher (sub-)layer, that were addressed to a multicast
519 address at this sub-layer. For a MAC-layer protocol,
520 this includes both Group and Functional addresses.
521 Discontinuities in the value of this counter can occur
522 at re-initialization of the management system, and at
523 other times as indicated by the value of
524 'discontinuity-time'.";
525 reference
526 "RFC 2863: The Interfaces Group MIB -
527 ifHCInMulticastPkts";
528 }
529
530 leaf in-discards {
531 type yang:counter64;
532 description
533 "[adapted from IETF interfaces model (RFC 7223)]
534 Changed the counter type to counter64.
535 The number of inbound packets that were chosen to be
536 discarded even though no errors had been detected to
537 prevent their being deliverable to a higher-layer
538 protocol. One possible reason for discarding such a
539 packet could be to free up buffer space.
540 Discontinuities in the value of this counter can occur
541 at re-initialization of the management system, and at
542 other times as indicated by the value of
543 'discontinuity-time'.";
544
545
546 reference
547 "RFC 2863: The Interfaces Group MIB - ifInDiscards";
548 }
549
550 leaf in-errors {
551 type yang:counter64;
552 description
553 "[adapted from IETF interfaces model (RFC 7223)]
554 Changed the counter type to counter64.
555 For packet-oriented interfaces, the number of inbound
556 packets that contained errors preventing them from being
557 deliverable to a higher-layer protocol. For character-
558 oriented or fixed-length interfaces, the number of
559 inbound transmission units that contained errors
560 preventing them from being deliverable to a higher-layer
561 protocol.
562 Discontinuities in the value of this counter can occur
563 at re-initialization of the management system, and at
564 other times as indicated by the value of
565 'discontinuity-time'.";
566 reference
567 "RFC 2863: The Interfaces Group MIB - ifInErrors";
568 }
569
570 leaf in-unknown-protos {
571 type yang:counter32;
572 description
573 "[adapted from IETF interfaces model (RFC 7223)]
574 Changed the counter type to counter64.
575 For packet-oriented interfaces, the number of packets
576 received via the interface that were discarded because
577 of an unknown or unsupported protocol. For
578 character-oriented or fixed-length interfaces that
579 support protocol multiplexing, the number of
580 transmission units received via the interface that were
581 discarded because of an unknown or unsupported protocol.
582 For any interface that does not support protocol
583 multiplexing, this counter is not present.
584 Discontinuities in the value of this counter can occur
585 at re-initialization of the management system, and at
586 other times as indicated by the value of
587 'discontinuity-time'.";
588 reference
589 "RFC 2863: The Interfaces Group MIB - ifInUnknownProtos";
590 }
591
592 leaf out-octets {
593 type yang:counter64;
594 description
595 "[adapted from IETF interfaces model (RFC 7223)]
596 Changed the counter type to counter64.
597 The total number of octets transmitted out of the
598 interface, including framing characters.
599 Discontinuities in the value of this counter can occur
600 at re-initialization of the management system, and at
601 other times as indicated by the value of
602 'discontinuity-time'.";
603 reference
604 "RFC 2863: The Interfaces Group MIB - ifHCOutOctets";
605 }
606
607 leaf out-unicast-pkts {
608 type yang:counter64;
609 description
610 "[adapted from IETF interfaces model (RFC 7223)]
611 The total number of packets that higher-level protocols
612 requested be transmitted, and that were not addressed
613 to a multicast or broadcast address at this sub-layer,
614 including those that were discarded or not sent.
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
618 'discontinuity-time'.";
619 reference
620 "RFC 2863: The Interfaces Group MIB - ifHCOutUcastPkts";
621 }
622
623 leaf out-broadcast-pkts {
624 type yang:counter64;
625 description
626 "[adapted from IETF interfaces model (RFC 7223)]
627 The total number of packets that higher-level protocols
628 requested be transmitted, and that were addressed to a
629 broadcast address at this sub-layer, including those
630 that were discarded or not sent.
631 Discontinuities in the value of this counter can occur
632 at re-initialization of the management system, and at
633 other times as indicated by the value of
634 'discontinuity-time'.";
635 reference
636 "RFC 2863: The Interfaces Group MIB -
637 ifHCOutBroadcastPkts";
638 }
639
640
641 leaf out-multicast-pkts {
642 type yang:counter64;
643 description
644 "[adapted from IETF interfaces model (RFC 7223)]
645 Changed the counter type to counter64.
646 The total number of packets that higher-level protocols
647 requested be transmitted, and that were addressed to a
648 multicast address at this sub-layer, including those
649 that were discarded or not sent. For a MAC-layer
650 protocol, this includes both Group and Functional
651 addresses.
652 Discontinuities in the value of this counter can occur
653 at re-initialization of the management system, and at
654 other times as indicated by the value of
655 'discontinuity-time'.";
656 reference
657 "RFC 2863: The Interfaces Group MIB -
658 ifHCOutMulticastPkts";
659 }
660
661 leaf out-discards {
662 type yang:counter64;
663 description
664 "[adapted from IETF interfaces model (RFC 7223)]
665 Changed the counter type to counter64.
666 The number of outbound packets that were chosen to be
667 discarded even though no errors had been detected to
668 prevent their being transmitted. One possible reason
669 for discarding such a packet could be to free up buffer
670 space.
671 Discontinuities in the value of this counter can occur
672 at re-initialization of the management system, and at
673 other times as indicated by the value of
674 'discontinuity-time'.";
675 reference
676 "RFC 2863: The Interfaces Group MIB - ifOutDiscards";
677 }
678
679 leaf out-errors {
680 type yang:counter64;
681 description
682 "[adapted from IETF interfaces model (RFC 7223)]
683 Changed the counter type to counter64.
684 For packet-oriented interfaces, the number of outbound
685 packets that could not be transmitted because of errors.
686 For character-oriented or fixed-length interfaces, the
687 number of outbound transmission units that could not be
688 transmitted because of errors.
689 Discontinuities in the value of this counter can occur
690 at re-initialization of the management system, and at
691 other times as indicated by the value of
692 'discontinuity-time'.";
693 reference
694 "RFC 2863: The Interfaces Group MIB - ifOutErrors";
695 }
696
697 leaf last-clear {
698 type yang:date-and-time;
699 description
700 "Indicates the last time the interface counters were
701 cleared.";
702 }
703 }
704 }
705
706 // data definition statements
707
708 grouping sub-unnumbered-config {
709 description
710 "Configuration data for unnumbered subinterfaces";
711
712 leaf enabled {
713 type boolean;
714 default false;
715 description
716 "Indicates that the subinterface is unnumbered. By default
717 the subinterface is numbered, i.e., expected to have an
718 IP address configuration.";
719 }
720 }
721
722 grouping sub-unnumbered-state {
723 description
724 "Operational state data unnumbered subinterfaces";
725 }
726
727 grouping sub-unnumbered-top {
728 description
729 "Top-level grouping unnumbered subinterfaces";
730
731 container unnumbered {
732 description
733 "Top-level container for setting unnumbered interfaces.
734 Includes reference the interface that provides the
735 address information";
736
737 container config {
738 description
739 "Configuration data for unnumbered interface";
740
741 uses sub-unnumbered-config;
742 }
743
744 container state {
745
746 config false;
747
748 description
749 "Operational state data for unnumbered interfaces";
750
751 uses sub-unnumbered-config;
752 uses sub-unnumbered-state;
753 }
754
755 uses oc-if:interface-ref;
756 }
757 }
758
759 grouping subinterfaces-config {
760 description
761 "Configuration data for subinterfaces";
762
763 leaf index {
764 type uint32;
765 default 0;
766 description
767 "The index of the subinterface, or logical interface number.
768 On systems with no support for subinterfaces, or not using
769 subinterfaces, this value should default to 0, i.e., the
770 default subinterface.";
771 }
772
773 uses interface-common-config;
774
775 }
776
777 grouping subinterfaces-state {
778 description
779 "Operational state data for subinterfaces";
780
781 uses interface-common-state;
782 uses interface-counters-state;
783 }
784
785 grouping subinterfaces-top {
786 description
787 "Subinterface data for logical interfaces associated with a
788 given interface";
789
790 container subinterfaces {
791 description
792 "Enclosing container for the list of subinterfaces associated
793 with a physical interface";
794
795 list subinterface {
796 key "index";
797
798 description
799 "The list of subinterfaces (logical interfaces) associated
800 with a physical interface";
801
802 leaf index {
803 type leafref {
804 path "../config/index";
805 }
806 description
807 "The index number of the subinterface -- used to address
808 the logical interface";
809 }
810
811 container config {
812 description
813 "Configurable items at the subinterface level";
814
815 uses subinterfaces-config;
816 }
817
818 container state {
819
820 config false;
821 description
822 "Operational state data for logical interfaces";
823
824 uses subinterfaces-config;
825 uses subinterfaces-state;
826 }
827 }
828 }
829 }
830
831 grouping interfaces-top {
832 description
833 "Top-level grouping for interface configuration and
834 operational state data";
835
836 container interfaces {
837 description
838 "Top level container for interfaces, including configuration
839 and state data.";
840
841
842 list interface {
843 key "name";
844
845 description
846 "The list of named interfaces on the device.";
847
848 leaf name {
849 type leafref {
850 path "../config/name";
851 }
852 description
853 "References the configured name of the interface";
854 //TODO: need to consider whether this should actually
855 //reference the name in the state subtree, which
856 //presumably would be the system-assigned name, or the
857 //configured name. Points to the config/name now
858 //because of YANG 1.0 limitation that the list
859 //key must have the same "config" as the list, and
860 //also can't point to a non-config node.
861 }
862
863 container config {
864 description
865 "Configurable items at the global, physical interface
866 level";
867
868 uses interface-phys-config;
869 }
870
871 container state {
872
873 config false;
874 description
875 "Operational state data at the global interface level";
876
877 uses interface-phys-config;
878 uses interface-common-state;
879 uses interface-counters-state;
880 }
881
882 uses interface-phys-holdtime-top;
883 uses subinterfaces-top;
884 }
885 }
886 }
887
888 uses interfaces-top;
889
890
891}