Trying out bgp-api with apidoc explorer
[unimgr.git] / bgp-api / src / main / yang / ietf-interfaces-common@2019-03-05.yang
diff --git a/bgp-api/src/main/yang/ietf-interfaces-common@2019-03-05.yang b/bgp-api/src/main/yang/ietf-interfaces-common@2019-03-05.yang
new file mode 100644 (file)
index 0000000..e9d846a
--- /dev/null
@@ -0,0 +1,498 @@
+ module ietf-interfaces-common {
+   yang-version 1.1;
+
+   namespace "urn:ietf:params:xml:ns:yang:ietf-interfaces-common";
+
+   prefix if-cmn;
+
+   import ietf-yang-types {
+     prefix yang;
+   }
+
+   import ietf-interfaces {
+     prefix if;
+   }
+
+   import iana-if-type {
+     prefix ianaift;
+   }
+
+   organization
+     "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+   contact
+     "WG Web:   <http://tools.ietf.org/wg/netmod/>
+      WG List:  <mailto:netmod@ietf.org>
+
+      WG Chair: Lou Berger
+                <mailto:lberger@labn.net>
+
+      WG Chair: Joel Jaeggli
+                <mailto:joelja@gmail.com>
+
+      WG Chair: Kent Watsen
+                <mailto:kwatsen@juniper.net>
+
+      Editor:   Robert Wilton
+                <mailto:rwilton@cisco.com>";
+
+   description
+     "This module contains common definitions for extending the IETF
+      interface YANG model (RFC 8343) with common configurable layer 2
+      properties.
+
+      Copyright (c) 2016-2019 IETF Trust and the persons identified
+      as authors of the code.  All rights reserved.
+
+      Redistribution and use in source and binary forms, with or
+      without modification, is permitted pursuant to, and subject
+
+      to the license terms contained in, the Simplified BSD License
+      set forth in Section 4.c of the IETF Trust's Legal Provisions
+      Relating to IETF Documents
+       (http://trustee.ietf.org/license-info).
+
+      This version of this YANG module is part of XXX; see the RFC
+      itself for full legal notices.";
+
+   revision 2019-03-05 {
+     description
+       "Initial version";
+
+     reference "Internet draft: draft-ietf-netmod-intf-ext-yang-07";
+   }
+
+   feature carrier-delay {
+     description
+       "This feature indicates that configurable interface
+        carrier delay is supported, which is a feature is used to
+        limit the propagation of very short interface link state
+        flaps.";
+     reference "RFC XXX, Section 3.1 Carrier Delay";
+   }
+
+   feature dampening {
+     description
+       "This feature indicates that the device supports interface
+        dampening, which is a feature that is used to limit the
+        propagation of interface link state flaps over longer
+        periods";
+     reference "RFC XXX, Section 3.2 Dampening";
+   }
+
+   feature loopback {
+     description
+       "This feature indicates that configurable interface loopback
+        is supported.";
+     reference "RFC XXX, Section 3.4 Loopback";
+   }
+
+   feature configurable-l2-mtu {
+     description
+       "This feature indicates that the device supports configuring
+        layer 2 MTUs on interfaces.  Such MTU configurations include
+        the layer 2 header overheads (but exclude any FCS overhead).
+        The payload MTU available to higher layer protocols is either
+        derived from the layer 2 MTU, taking into account the size of
+        the layer 2 header, or is further restricted by explicit layer
+
+        3 or protocol specific MTU configuration.";
+     reference "RFC XXX, Section 3.5 Layer 2 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 "RFC XXX, Section 3.6 Sub-interface";
+   }
+
+   feature forwarding-mode {
+     description
+       "This feature indicates that the device supports the
+        configurable forwarding mode leaf";
+     reference "RFC XXX, Section 3.7 Forwarding Mode";
+   }
+
+   /*
+    * Define common identities to help allow interface types to be
+    * assigned properties.
+    */
+   identity sub-interface {
+     description
+       "Base type for generic sub-interfaces.
+
+        New or custom interface types can derive from this type to
+        inherit generic sub-interface configuration";
+     reference "RFC XXX, Section 3.6 Sub-interface";
+   }
+
+   identity ethSubInterface{
+     base ianaift:l2vlan;
+     base sub-interface;
+
+     description
+       "This identity represents the child sub-interface of any
+        interface types that uses Ethernet framing (with or without
+        802.1Q tagging)";
+   }
+
+   identity loopback {
+     description "Base identity for interface loopback options";
+     reference "RFC XXX, section 3.4";
+   }
+
+   identity loopback-internal {
+     base loopback;
+     description
+       "All egress traffic on the interface is internally looped back
+        within the interface to be received on the ingress path.";
+     reference "RFC XXX, section 3.4";
+   }
+   identity loopback-line {
+     base loopback;
+     description
+       "All ingress traffic received on the interface is internally
+        looped back within the interface to the egress path.";
+     reference "RFC XXX, section 3.4";
+   }
+   identity loopback-connector {
+     base loopback;
+     description
+       "The interface has a physical loopback connector attached
+        that loops all egress traffic back into the interface's
+        ingress path, with equivalent semantics to loopback-internal";
+     reference "RFC XXX, section 3.4";
+   }
+
+   identity forwarding-mode {
+     description "Base identity for forwarding-mode options.";
+     reference "RFC XXX, section 3.7";
+   }
+   identity optical-layer {
+     base forwarding-mode;
+     description
+       "Traffic is being forwarded at the optical layer.  This
+        includes DWDM or OTN based switching.";
+     reference "RFC XXX, section 3.7";
+   }
+   identity layer-2-forwarding {
+     base forwarding-mode;
+     description
+       "Layer 2 based forwarding, such as Ethernet/VLAN based
+        switching, or L2VPN services.";
+     reference "RFC XXX, section 3.7";
+   }
+   identity network-layer {
+     base forwarding-mode;
+     description
+       "Network layer based forwarding, such as IP, MPLS, or L3VPNs.";
+     reference "RFC XXX, section 3.7";
+   }
+
+   /*
+    * Augments the IETF interfaces model with leaves to configure
+    * and monitor carrier-delay 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.";
+
+     /*
+      * Defines standard YANG for the Carrier Delay feature.
+      */
+     container carrier-delay {
+       if-feature "carrier-delay";
+       description
+         "Holds carrier delay related feature configuration";
+       leaf down {
+         type uint32;
+         units milliseconds;
+         description
+           "Delays the propagation of a 'loss of carrier signal' event
+            that would cause the interface state to go down, i.e. the
+            command allows short link flaps to be suppressed. The
+            configured value indicates the minimum time interval (in
+            milliseconds) that the carrier signal must be continuously
+            down before the interface state is brought down. If not
+            configured, the behaviour on loss of carrier signal is
+            vendor/interface specific, but with the general
+            expectation that there should be little or no delay.";
+       }
+       leaf up {
+         type uint32;
+         units milliseconds;
+         description
+           "Defines the minimum time interval (in milliseconds) that
+            the carrier signal must be continuously present and error
+            free before the interface state is allowed to transition
+            from down to up.  If not configured, the behaviour is
+            vendor/interface specific, but with the general
+            expectation that sufficient default delay should be used
+            to ensure that the interface is stable when enabled before
+            being reported as being up.  Configured values that are
+            too low for the hardware capabilties may be rejected.";
+       }
+       leaf carrier-transitions {
+         type yang:counter64;
+         units transitions;
+
+         config false;
+         description
+           "Defines the number of times the underlying carrier state
+            has changed to, or from, state up.  This counter should be
+            incremented even if the high layer interface state changes
+            are being suppressed by a running carrier-delay timer.";
+       }
+       leaf timer-running {
+         type enumeration {
+           enum none {
+             description
+               "No carrier delay timer is running.";
+           }
+           enum up {
+             description
+               "Carrier-delay up timer is running.  The underlying
+                carrier state is up, but interface state is not
+                reported as up.";
+           }
+           enum down {
+             description
+               "Carrier-delay down timer is running.  Interface state
+                is reported as up, but the underlying carrier state is
+                actually down.";
+           }
+         }
+         default "none";
+         config false;
+         description
+           "Reports whether a carrier delay timer is actively running,
+            in which case the interface state does not match the
+            underlying carrier state.";
+       }
+
+       reference "RFC XXX, Section 3.1 Carrier Delay";
+     }
+
+     /*
+      * Augments the IETF interfaces model with a container to hold
+      * generic interface dampening
+      */
+     container dampening {
+       if-feature "dampening";
+       presence
+         "Enable interface link flap dampening with default settings
+          (that are vendor/device specific)";
+       description
+         "Interface dampening limits the propagation of interface link
+
+          state flaps over longer periods";
+       reference "RFC XXX, Section 3.2 Dampening";
+       leaf half-life {
+         type uint32;
+         units seconds;
+         description
+           "The Time (in seconds) after which a penalty reaches half
+            its original value. Once the interface has been assigned
+            a penalty, the penalty is decreased by half after the
+            half-life period. For some devices, the allowed values may
+            be restricted to particular multiples of seconds. The
+            default value is vendor/device specific.";
+         reference "RFC XXX, Section 3.3.2 Half-Life Period";
+       }
+       leaf reuse {
+         type uint32;
+         description
+           "Penalty value below which a stable interface is
+            unsuppressed (i.e. brought up) (no units).  The default
+            value is vendor/device specific.  The penalty value for a
+            link up->down state change is nominally 1000 units.";
+         reference "RFC XXX, Section 3.2.3 Reuse Threshold";
+       }
+
+       leaf suppress {
+         type uint32;
+         description
+           "Limit at which an interface is suppressed (i.e. held down)
+            when its penalty exceeds that limit (no units). The value
+            must be greater than the reuse threshold.  The default
+            value is vendor/device specific.  The penalty value for a
+            link up->down state change is nominally 1000 units.";
+         reference "RFC XXX, Section 3.2.1 Suppress Threshold";
+       }
+
+       leaf max-suppress-time {
+         type uint32;
+         units seconds;
+         description
+           "Maximum time (in seconds) that an interface can be
+            suppressed. This value effectively acts as a ceiling that
+            the penalty value cannot exceed.  The default value is
+            vendor/device specific.";
+         reference "RFC XXX, Section 3.2.4 Maximum Suppress Time";
+       }
+
+       leaf penalty {
+         type uint32;
+
+         config false;
+         description
+           "The current penalty value for this interface.  When the
+            penalty value exceeds the 'suppress' leaf then the
+            interface is suppressed (i.e. held down).";
+         reference "RFC XXX, Section 3.2 Dampening";
+       }
+
+       leaf suppressed {
+         type boolean;
+         default "false";
+         config false;
+         description
+           "Represents whether the interface is suppressed (i.e. held
+            down) because the 'penalty' leaf value exceeds the
+            'suppress' leaf.";
+         reference "RFC XXX, Section 3.2 Dampening";
+       }
+
+       leaf time-remaining {
+         when '../suppressed = "true"' {
+           description
+             "Only suppressed interfaces should have a time remaining.";
+         }
+         type uint32;
+         units seconds;
+         config false;
+         description
+           "For a suppressed interface, this leaf represents how long
+            (in seconds) that the interface will remain suppressed
+            before it is allowed to go back up again.";
+         reference "RFC XXX, Section 3.2 Dampening";
+       }
+     }
+
+     /*
+      * 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,
+                               'ianaift:ethernetCsmacd') or
+          derived-from-or-self(../if:type,
+
+                               'ianaift:ieee8023adLag') or
+          derived-from-or-self(../if:type, 'ianaift:pos') or
+          derived-from-or-self(../if:type,
+                               'ianaift:atmSubInterface') or
+          derived-from-or-self(../if:type, 'ethSubInterface')" {
+
+         description
+           "All interface types that can have a configurable L2
+            encapsulation";
+       }
+
+       description
+         "Holds the OSI layer 2 encapsulation associated with an
+          interface";
+       choice encaps-type {
+         description
+           "Extensible choice of layer 2 encapsulations";
+         reference "RFC XXX, Section 3.3 Encapsulation";
+       }
+     }
+
+      /*
+       * Various types of interfaces support loopback configuration,
+       * any that are supported by YANG should be listed here.
+       */
+     leaf loopback {
+       when "derived-from-or-self(../if:type,
+                                  'ianaift:ethernetCsmacd') or
+             derived-from-or-self(../if:type, 'ianaift:sonet') or
+             derived-from-or-self(../if:type, 'ianaift:atm') or
+             derived-from-or-self(../if:type, 'ianaift:otnOtu')" {
+         description
+           "All interface types that support loopback configuration.";
+       }
+       if-feature "loopback";
+       type identityref {
+         base loopback;
+       }
+       description "Enables traffic loopback.";
+       reference "RFC XXX, Section 3.4 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) 802.1Q VLAN tags.";
+       reference "RFC XXX, Section 3.5 Layer 2 MTU";
+     }
+
+     /*
+      * Augments the IETF interfaces model with a leaf that indicates
+      * which mode, or layer, is being used to forward the traffic.
+      */
+     leaf forwarding-mode {
+       if-feature "forwarding-mode";
+       type identityref {
+         base forwarding-mode;
+       }
+
+       description
+         "The forwarding mode that the interface is operating in.";
+       reference "RFC XXX, Section 3.7 Forwarding Mode";
+     }
+   }
+
+   /*
+    * 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, 'sub-interface') or
+           derived-from-or-self(if:type, 'ianaift:atmSubInterface') or
+           derived-from-or-self(if:type, 'ianaift:frameRelay')"  {
+       description
+         "Any ianaift:types that explicitly represent sub-interfaces
+          or any types that derive from the sub-interface identity";
+     }
+     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.";
+       reference "RFC XXX, Section 3.6 Sub-interface";
+     }
+   }
+}
\ No newline at end of file