module example-ietf-interfaces-common { yang-version 1.1; namespace "urn:ietf:params:xml:ns:yang:example-ietf-interfaces-common"; prefix if-cmn; import ietf-interfaces { prefix if; } import iana-if-type { prefix ianaift; } import iana-if-property-type { prefix ianaifp; } organization "IETF NETMOD (NETCONF Data Modeling Language) Working Group"; contact "WG Web: WG List: WG Chair: Lou Berger WG Chair: Kent Watsen Editor: Robert Wilton "; description "Example of using when statements with interface properties"; revision 2017-06-27 { description "Examples of using when statements with interface properties"; reference "Internet draft: draft-ietf-netmod-intf-ext-yang-04"; } feature bandwidth { description ""; reference "Section 3.1 Bandwidth"; } feature carrier-delay { description ""; reference "Section 3.2 Carrier Delay"; } feature dampening { description ""; reference "Section 3.3 Dampening"; } feature loopback { description ""; reference "Section 3.5 Loopback"; } feature configurable-l2-mtu { description ""; reference "Section 3.6 MTU"; } feature sub-interfaces { description "This feature indicates that the device supports the instantiation of sub-interfaces. Sub-interfaces are defined as logical child interfaces that allow features and forwarding decisions to be applied to a subset of the traffic processed on the specified parent interface."; reference "Section 3.7 Sub-interface"; } feature forwarding-mode { description ""; reference "Section 3.8 Forwarding Mode"; } /* * Define common identities to help allow interface types to be * assigned properties. */ identity loopback { description "Base identity for interface loopback options"; } identity loopback-internal { base loopback; description ""; } identity loopback-line { base loopback; description ""; } identity loopback-connector { base loopback; description ""; } /* * Augments the IETF interfaces model with a leaf to explicitly * specify the bandwidth available on an interface. */ augment "/if:interfaces/if:interface" { description "Augments the IETF interface model with optional common interface level commands that are not formally covered by any specific standard"; // Various features/nodes elided. /* * Various types of interfaces support a configurable layer 2 * encapsulation, any that are supported by YANG should be * listed here. * * Different encapsulations can hook into the common encaps-type * choice statement. */ container encapsulation { when "derived-from-or-self(../if:type, 'ianaifp:ethernet-like') or derived-from-or-self(../if:type, 'ianaifp:sub-interface')" { description "All interface types that can have a configurable L2 encapsulation"; /* * TODO - Should we introduce an abstract type to make this * extensible to new interface types, or vendor * specific interface types? */ } description "Holds the OSI layer 2 encapsulation associated with an interface"; choice encaps-type { description "Extensible choice of L2 encapsulations"; } } /* * Various types of interfaces support loopback configuration, * any that are supported by YANG should be listed here. */ leaf loopback { when "derived-from(if:type, 'ianaifp:physical')" { description "Applies to all interfaces that derive from the physical interface property."; } if-feature "loopback"; type identityref { base loopback; } description "Enables traffic loopback."; } /* * Many types of interfaces support a configurable layer 2 MTU. */ leaf l2-mtu { if-feature "configurable-l2-mtu"; type uint16 { range "64 .. 65535"; } description "The maximum size of layer 2 frames that may be transmitted or received on the interface (excluding any FCS overhead). In the case of Ethernet interfaces it also excludes the 4-8 byte overhead of any known (i.e. explicitly matched by a child sub-interface) 801.1Q VLAN tags."; } } /* * Add generic support for sub-interfaces. * * This should be extended to cover all interface types that are * child interfaces of other interfaces. */ augment "/if:interfaces/if:interface" { when "derived-from(if:type, 'ianaifp:sub-interface')" { description "Applies to all interfaces that derive from the Ethernet-like interface property."; } if-feature "sub-interfaces"; description "Add a parent interface field to interfaces that model sub-interfaces"; leaf parent-interface { type if:interface-ref; mandatory true; description "This is the reference to the parent interface of this sub-interface."; } } }