netconfcentral logo

example-ietf-interfaces@2017-06-27



  module example-ietf-interfaces {

    yang-version 1.1;

    namespace
      "urn:ietf:params:xml:ns:yang:example-ietf-interfaces";

    prefix if;

    import ietf-yang-types {
      prefix yang;
    }
    import iana-if-property-type {
      prefix ianaifp;
    }

    organization
      "IETF NETMOD (NETCONF Data Modeling Language) Working Group";

    contact "<elided>";

    description
      "Example of when statements for refining interface statistics";

    revision "2017-06-27" {
      description
        "Example of how some interface statistics could make use of
       interface properties";
      reference
        "RFC 7223: A YANG Data Model for Interface Management";

    }


    typedef interface-state-ref {
      type leafref {
        path "/if:interfaces-state/if:interface/if:name";
      }
      description
        "This type is used by data models that need to reference
       the operationally present interfaces.";
    }

    identity interface-type {
      base 
      description
        "Base identity from which specific interface types are
       derived.";
    }

    container interfaces-state {
      config false;
      description
        "Data nodes for the operational state of interfaces.";
      list interface {
        key "name";
        description
          "The list of interfaces on the device.
         System-controlled interfaces created by the system are
         always present in this list, whether they are configured or
         not.";
        leaf name {
          type string;
          description
            "The name of the interface.
           A server implementation MAY map this leaf to the ifName
           MIB object.  Such an implementation needs to use some
           mechanism to handle the differences in size and characters
           allowed between this leaf and ifName.  The definition of
           such a mechanism is outside the scope of this document.";
          reference
            "RFC 2863: The Interfaces Group MIB - ifName";

        }

        leaf type {
          type identityref {
            base interface-type;
          }
          mandatory true;
          description
            "The type of the interface.";
          reference
            "RFC 2863: The Interfaces Group MIB - ifType";

        }

        container statistics {
          description
            "A collection of interface-related statistics objects.";
          leaf discontinuity-time {
            type yang:date-and-time;
            mandatory true;
            description
              "<description elided>";
          }

          leaf in-octets {
            type yang:counter64;
            description
              "<description elided>";
            reference
              "RFC 2863: The Interfaces Group MIB - ifHCInOctets";

          }

          leaf in-unicast-pkts {
            type yang:counter64;
            description
              "The number of packets, delivered by this sub-layer to a
             higher (sub-)layer, that were not addressed to a
             multicast or broadcast address at this sub-layer.
             Discontinuities in the value of this counter can occur
             at re-initialization of the management system, and at
             other times as indicated by the value of
             'discontinuity-time'.";
            reference
              "RFC 2863: The Interfaces Group MIB - ifHCInUcastPkts";

          }

          leaf in-broadcast-pkts {
            when
              "derived-from(if:type, 'ianaifp:multicast')" {
              description
                "Applies to interfaces that inherit the multicast
               interface property.";
            }
            type yang:counter64;
            description
              "The number of packets, delivered by this sub-layer to a
             higher (sub-)layer, that were addressed to a broadcast
             address at this sub-layer.
             Discontinuities in the value of this counter can occur
             at re-initialization of the management system, and at
             other times as indicated by the value of
             'discontinuity-time'.";
            reference
              "RFC 2863: The Interfaces Group MIB -
              	  ifHCInBroadcastPkts";

          }

          leaf in-multicast-pkts {
            when
              "derived-from(if:type, 'ianaifp:multicast')" {
              description
                "Applies to interfaces that inherit the multicast
               interface property.";
            }
            type yang:counter64;
            description
              "The number of packets, delivered by this sub-layer to a
             higher (sub-)layer, that were addressed to a multicast
             address at this sub-layer.  For a MAC-layer protocol,
             this includes both Group and Functional addresses.
             Discontinuities in the value of this counter can occur
             at re-initialization of the management system, and at
             other times as indicated by the value of
             'discontinuity-time'.";
            reference
              "RFC 2863: The Interfaces Group MIB -
              	  ifHCInMulticastPkts";

          }
        }  // container statistics
      }  // list interface
    }  // container interfaces-state
  }  // module example-ietf-interfaces