module ietf-ipfix-psamp {
  namespace "urn:ietf:params:xml:ns:yang:ietf-ipfix-psamp";
  prefix ipfix;

  import ietf-yang-types { prefix yang; }
  import ietf-inet-types { prefix inet; }

  organization
    "IETF IPFIX Working Group";

  contact
    "WG Web:  <http://tools.ietf.org/wg/ipfix/>
    WG List:  <ipfix@ietf.org>

    WG Chair: Nevil Brownlee
              <n.brownlee@auckland.ac.nz>

    WG Chair: Juergen Quittek
              <quittek@neclab.eu>

    Editor:   Gerhard Muenz
              <muenz@net.in.tum.de>";

  description
    "IPFIX/PSAMP Configuration Data Model

    Copyright (c) 2012 IETF Trust and the persons identified as
    the document authors.  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).";

  revision 2012-09-05 {
    description "Initial version";
    reference "RFC 6728: Configuration Data Model for the IP Flow
      Information Export (IPFIX) and Packet Sampling (PSAMP)
      Protocols";
  }

  /*****************************************************************
  * Features
  *****************************************************************/

  feature exporter {
    description "If supported, the Monitoring Device can be used as
      an Exporter.  Exporting Processes can be configured.";
  }

  feature collector {
    description "If supported, the Monitoring Device can be used as
      a Collector.  Collecting Processes can be configured.";
  }

  feature meter {
    description "If supported, Observation Points, Selection
      Processes, and Caches can be configured.";
  }

  feature psampSampCountBased {
    description "If supported, the Monitoring Device supports
      count-based Sampling.  The Selector method sampCountBased can
      be configured.";
  }

  feature psampSampTimeBased {
    description "If supported, the Monitoring Device supports
      time-based Sampling.  The Selector method sampTimeBased can
      be configured.";
  }

  feature psampSampRandOutOfN {
    description "If supported, the Monitoring Device supports
      random n-out-of-N Sampling.  The Selector method
      sampRandOutOfN can be configured.";
  }

  feature psampSampUniProb {
    description "If supported, the Monitoring Device supports
      uniform probabilistic Sampling.  The Selector method
      sampUniProb can be configured.";
  }

  feature psampFilterMatch {
    description "If supported, the Monitoring Device supports
      property match Filtering.  The Selector method filterMatch
      can be configured.";
  }

  feature psampFilterHash {
    description "If supported, the Monitoring Device supports
      hash-based Filtering.  The Selector method filterHash can be
      configured.";
  }

  feature immediateCache {
    description "If supported, the Monitoring Device supports
      Caches generating PSAMP Packet Reports by configuration with
      immediateCache.";
  }

  feature timeoutCache {
    description "If supported, the Monitoring Device supports
      Caches generating IPFIX Flow Records by configuration with
      timeoutCache.";
  }

  feature naturalCache {
    description "If supported, the Monitoring Device supports
      Caches generating IPFIX Flow Records by configuration with
      naturalCache.";
  }

  feature permanentCache {
    description "If supported, the Monitoring Device supports
      Caches generating IPFIX Flow Records by configuration with
      permanentCache.";
  }

  feature udpTransport {
    description "If supported, the Monitoring Device supports UDP
      as the transport protocol.";
  }

  feature tcpTransport {
    description "If supported, the Monitoring Device supports TCP
      as the transport protocol.";
  }

  feature fileReader {
    description "If supported, the Monitoring Device supports the
      configuration of Collecting Processes as File Readers.";
  }

  feature fileWriter {
    description "If supported, the Monitoring Device supports the
      configuration of Exporting Processes as File Writers.";
  }

  /*****************************************************************
  * Identities
  *****************************************************************/

  /*** Hash function identities ***/
  identity hashFunction {
    description "Base identity for all hash functions used for
      hash-based packet Filtering.  Identities derived from
      this base are used by the leaf
      /ipfix/selectionProcess/selector/filterHash/hashFunction.";
  }
  identity BOB {
    base "hashFunction";
    description "BOB hash function";
    reference "RFC 5475, Section 6.2.4.1.";
  }
  identity IPSX {
    base "hashFunction";
    description "IPSX hash function";
    reference "RFC 5475, Section 6.2.4.1.";
  }
  identity CRC {
    base "hashFunction";
    description "CRC hash function";
    reference "RFC 5475, Section 6.2.4.1.";
  }

  /*** Export mode identities ***/
  identity exportMode {
    description "Base identity for different usages of export
      destinations configured for an Exporting Process.
      Identities derived from this base are used by the leaf
      /ipfix/exportingProcess/exportMode.";
  }
  identity parallel {
    base "exportMode";
    description "Parallel export of Data Records to all
      destinations configured for the Exporting Process.";
  }
  identity loadBalancing {
    base "exportMode";
    description "Load-balancing between the different destinations
      configured for the Exporting Process.";
  }
  identity fallback {
    base "exportMode";
    description "Export to the primary destination (i.e., the first
      SCTP, UDP, TCP, or file destination configured for the
      Exporting Process).  If the export to the primary destination
      fails, the Exporting Process tries to export to the secondary
      destination.  If the secondary destination fails as well, it
      continues with the tertiary, etc.";
  }

  /*** Options type identities ***/
  identity optionsType {
    description "Base identity for report types exported with
      options.  Identities derived from this base are used by the leaf
      /ipfix/exportingProcess/options/optionsType.";
  }
  identity meteringStatistics {
    base "optionsType";
    description "Metering Process Statistics.";
    reference "RFC 5101, Section 4.1.";
  }
  identity meteringReliability {
    base "optionsType";
    description "Metering Process Reliability Statistics.";
    reference "RFC 5101, Section 4.2.";
  }
  identity exportingReliability {
    base "optionsType";
    description "Exporting Process Reliability
      Statistics.";
    reference "RFC 5101, Section 4.3.";
  }
  identity flowKeys {
    base "optionsType";
    description "Flow Keys.";
    reference "RFC 5101, Section 4.4.";
  }
  identity selectionSequence {
    base "optionsType";
    description "Selection Sequence and Selector Reports.";
    reference "RFC 5476, Sections 6.5.1 and 6.5.2.";
  }
  identity selectionStatistics {
    base "optionsType";
    description "Selection Sequence Statistics Report.";
    reference "RFC 5476, Sections 6.5.3.";
  }
  identity accuracy {
    base "optionsType";
    description "Accuracy Report.";
    reference "RFC 5476, Section 6.5.4.";
  }
  identity reducingRedundancy {
    base "optionsType";
    description "Enables the utilization of Options Templates to
      reduce redundancy in the exported Data Records.";
    reference "RFC 5473.";
  }
  identity extendedTypeInformation {
    base "optionsType";
    description "Export of extended type information for
      enterprise-specific Information Elements used in the
      exported Templates.";
    reference "RFC 5610.";
  }

  /*****************************************************************
  * Type definitions
  *****************************************************************/

  typedef ieNameType {
    type string {
      length "1..max";
      pattern "\S+";
    }
    description "Type for Information Element names.  Whitespaces
      are not allowed.";
  }

  typedef ieIdType {
    type uint16 {
      range "1..32767" {
        description "Valid range of Information Element
            identifiers.";
        reference "RFC 5102, Section 4.";
      }
    }
    description "Type for Information Element identifiers.";
  }

  typedef nameType {
    type string {
      length "1..max";
      pattern "\S(.*\S)?";
    }
    description "Type for 'name' leafs, which are used to identify
      specific instances within lists, etc.
      Leading and trailing whitespaces are not allowed.";
  }

  typedef ifNameType {
    type string {
      length "1..255";
    }
    description "This corresponds to the DisplayString textual
      convention of SNMPv2-TC, which is used for ifName in the IF
      MIB module.";
    reference "RFC 2863 (ifName).";
  }

  typedef direction {
    type enumeration {
      enum ingress {
        description "This value is used for monitoring incoming
          packets.";
      }
      enum egress {
        description "This value is used for monitoring outgoing
          packets.";
      }
      enum both {
        description "This value is used for monitoring incoming and
          outgoing packets.";
      }
    }
    description "Direction of packets going through an interface or
      linecard.";
  }

  typedef transportSessionStatus {
    type enumeration {
      enum inactive {
        description "This value MUST be used for Transport Sessions
          that are specified in the system but currently not active.
          The value can be used for Transport Sessions that are
          backup (secondary) sessions.";
      }
      enum active {
        description "This value MUST be used for Transport Sessions
          that are currently active and transmitting or receiving
          data.";
      }
      enum unknown {
        description "This value MUST be used if the status of the
          Transport Sessions cannot be detected by the device.  This
          value should be avoided as far as possible.";
      }
    }
    description "Status of a Transport Session.";
    reference "RFC 6615, Section 8 (ipfixTransportSessionStatus).";
  }

  /*****************************************************************
  * Groupings
  *****************************************************************/

  grouping observationPointParameters {
    description "Interface as input to Observation Point.";
    leaf observationPointId {
      type uint32;
      config false;
      description "Observation Point ID (i.e., the value of the
        Information Element observationPointId) assigned by the
        Monitoring Device.";
      reference "IANA registry for IPFIX Entities,
        http://www.iana.org/assignments/ipfix.";
    }
    leaf observationDomainId {
      type uint32;
      mandatory true;
      description "The Observation Domain ID associates the
        Observation Point to an Observation Domain.  Observation
        Points with identical Observation Domain IDs belong to the
        same Observation Domain.
        Note that this parameter corresponds to
        ipfixObservationPointObservationDomainId in the IPFIX MIB
        module.";
      reference "RFC 5101; RFC 6615, Section 8
        (ipfixObservationPointObservationDomainId).";
    }
    leaf-list ifName {
      type ifNameType;
      description "List of names identifying interfaces of the
        Monitoring Device.  The Observation Point observes packets at
        the specified interfaces.";
    }
    leaf-list ifIndex {
      type uint32;
      description "List of ifIndex values pointing to entries in the
        ifTable of the IF-MIB module maintained by the Monitoring
        Device.  The Observation Point observes packets at the
        specified interfaces.
        This parameter SHOULD only be used if an SNMP agent enables
        access to the ifTable.
        Note that this parameter corresponds to
        ipfixObservationPointPhysicalInterface in the IPFIX MIB
        module.";
      reference "RFC 2863; RFC 6615, Section 8
        (ipfixObservationPointPhysicalInterface).";
    }
    leaf-list entPhysicalName {
      type string;
      description "List of names identifying physical entities of the
        Monitoring Device.  The Observation Point observes packets at
        the specified entities.";
    }
    leaf-list entPhysicalIndex {
      type uint32;
      description "List of entPhysicalIndex values pointing to
        entries in the entPhysicalTable of the ENTITY-MIB module
        maintained by the Monitoring Device.  The Observation Point
        observes packets at the specified entities.
        This parameter SHOULD only be used if an SNMP agent enables
        access to the entPhysicalTable.
        Note that this parameter corresponds to
        ipfixObservationPointPhysicalEntity in the IPFIX MIB
        module.";
      reference "RFC 4133; RFC 6615, Section 8
        (ipfixObservationPointPhysicalInterface).";
    }
    leaf direction {
      type direction;
      default both;
      description "Direction of packets.  If not applicable (e.g., in
        the case of a sniffing interface in promiscuous mode), this
        parameter is ignored.";
    }
  }

  grouping sampCountBasedParameters {
    description "Configuration parameters of a Selector applying
      systematic count-based packet Sampling to the packet
      stream.";
    reference "RFC 5475, Section 5.1; RFC 5476, Section 6.5.2.1.";
    leaf packetInterval {
      type uint32;
      units packets;
      mandatory true;
      description "The number of packets that are consecutively
        sampled between gaps of length packetSpace.
        This parameter corresponds to the Information Element
        samplingPacketInterval and to psampSampCountBasedInterval
        in the PSAMP MIB module.";
      reference "RFC 5477, Section 8.2.2; RFC 6727, Section 6
        (psampSampCountBasedInterval).";
    }
    leaf packetSpace {
      type uint32;
      units packets;
      mandatory true;
      description "The number of unsampled packets between two
        Sampling intervals.
        This parameter corresponds to the Information Element
        samplingPacketSpace and to psampSampCountBasedSpace
        in the PSAMP MIB module.";
      reference "RFC 5477, Section 8.2.3; RFC 6727, Section 6
        (psampSampCountBasedSpace).";
    }
  }

  grouping sampTimeBasedParameters {
    description "Configuration parameters of a Selector applying
      systematic time-based packet Sampling to the packet
      stream.";
    reference "RFC 5475, Section 5.1; RFC 5476, Section 6.5.2.2.";
    leaf timeInterval {
      type uint32;
      units microseconds;
      mandatory true;
      description "The time interval in microseconds during
        which all arriving packets are sampled between gaps
        of length timeSpace.
        This parameter corresponds to the Information Element
        samplingTimeInterval and to psampSampTimeBasedInterval
        in the PSAMP MIB module.";
      reference "RFC 5477, Section 8.2.4; RFC 6727, Section 6
        (psampSampTimeBasedInterval).";
    }
    leaf timeSpace {
      type uint32;
      units microseconds;
      mandatory true;
      description "The time interval in microseconds during
        which no packets are sampled between two Sampling
        intervals specified by timeInterval.
        This parameter corresponds to the Information Element
        samplingTimeInterval and to psampSampTimeBasedSpace
        in the PSAMP MIB module.";
      reference "RFC 5477, Section 8.2.5; RFC 6727, Section 6
        (psampSampTimeBasedSpace).";
    }
  }

  grouping sampRandOutOfNParameters {
    description "Configuration parameters of a Selector applying
      n-out-of-N packet Sampling to the packet stream.";
    reference "RFC 5475, Section 5.2.1; RFC 5476, Section 6.5.2.3.";
    leaf size {
      type uint32;
      units packets;
      mandatory true;
      description "The number of elements taken from the parent
        population.
        This parameter corresponds to the Information Element
        samplingSize and to psampSampRandOutOfNSize in the PSAMP
        MIB module.";
      reference "RFC 5477, Section 8.2.6; RFC 6727, Section 6
        (psampSampRandOutOfNSize).";
    }
    leaf population {
      type uint32;
      units packets;
      mandatory true;
      description "The number of elements in the parent
        population.
        This parameter corresponds to the Information Element
        samplingPopulation and to psampSampRandOutOfNPopulation
        in the PSAMP MIB module.";
      reference "RFC 5477, Section 8.2.7; RFC 6727, Section 6
        (psampSampRandOutOfNPopulation).";
    }
  }

  grouping sampUniProbParameters {
    description "Configuration parameters of a Selector applying
      uniform probabilistic packet Sampling (with equal
      probability per packet) to the packet stream.";
    reference "RFC 5475, Section 5.2.2.1;
      RFC 5476, Section 6.5.2.4.";
    leaf probability {
      type decimal64 {
        fraction-digits 18;
        range "0..1";
      }
      mandatory true;
      description "Probability that a packet is sampled,
        expressed as a value between 0 and 1.  The probability
        is equal for every packet.
        This parameter corresponds to the Information Element
        samplingProbability and to psampSampUniProbProbability
        in the PSAMP MIB module.";
      reference "RFC 5477, Section 8.2.8; RFC 6727, Section 6
        (psampSampUniProbProbability).";
    }
  }

  grouping filterMatchParameters {
    description "Configuration parameters of a Selector applying
      property match Filtering to the packet stream.
      The field to be matched is specified as an Information
      Element.";
    reference "RFC 5475, Section 6.1; RFC 5476, Section 6.5.2.5.";
    choice nameOrId {
      mandatory true;
      description "The field to be matched is specified by
        either the name or the identifier of the Information
        Element.";
      leaf ieName {
        type ieNameType;
        description "Name of the Information Element.";
      }
      leaf ieId {
        type ieIdType;
        description "Identifier of the Information Element.";
      }
    }
    leaf ieEnterpriseNumber {
      type uint32;
      default 0;
      description "If this parameter is zero, the Information
        Element is registered in the IANA registry of IPFIX
        Information Elements.
        If this parameter is configured with a non-zero private
        enterprise number, the Information Element is
        enterprise-specific.";
      reference "IANA registry for Private Enterprise Numbers,
        http://www.iana.org/assignments/enterprise-numbers;
        IANA registry for IPFIX Entities,
        http://www.iana.org/assignments/ipfix.";
    }
    leaf value {
      type string;
      mandatory true;
      description "Matching value of the Information Element.";
    }
  }

  grouping filterHashParameters {
    description "Configuration parameters of a Selector applying
      hash-based Filtering to the packet stream.";
    reference "RFC 5475, Section 6.2; RFC 5476, Section 6.5.2.6.";
    leaf hashFunction {
      type identityref {
        base "hashFunction";
      }
      default BOB;
      description "Hash function to be applied.  According to
        RFC 5475, Section 6.2.4.1, 'BOB' must be used in order to
        be compliant with PSAMP.
        This parameter functionally corresponds to
        psampFiltHashFunction in the PSAMP MIB module.";
      reference "RFC 6727, Section 6 (psampFiltHashFunction)";
    }
    leaf initializerValue {
      type uint64;
      description "Initializer value to the hash function.
        If not configured by the user, the Monitoring Device
        arbitrarily chooses an initializer value.
        This parameter corresponds to the Information Element
        hashInitialiserValue and to psampFiltHashInitializerValue
        in the PSAMP MIB module.";
      reference "RFC 5477, Section 8.3.9; RFC 6727, Section 6
        (psampFiltHashInitializerValue).";
    }
    leaf ipPayloadOffset {
      type uint64;
      units octets;
      default 0;
      description "IP payload offset indicating the position of
        the first payload byte considered as input to the hash
        function.
        Default value 0 corresponds to the minimum offset that
        must be configurable according to RFC 5476, Section
        6.5.2.6.
        This parameter corresponds to the Information Element
        hashIPPayloadOffset and to psampFiltHashIpPayloadOffset
        in the PSAMP MIB module.";
      reference "RFC 5477, Section 8.3.2; RFC 6727, Section 6
        (psampFiltHashIpPayloadOffset).";
    }
    leaf ipPayloadSize {
      type uint64;
      units octets;
      default 8;
      description "Number of IP payload bytes used as input to
        the hash function, counted from the payload offset.
        If the IP payload is shorter than the payload range,
        all available payload octets are used as input.
        Default value 8 corresponds to the minimum IP payload
        size that must be configurable according to RFC 5476,
        Section 6.5.2.6.
        This parameter corresponds to the Information Element
        hashIPPayloadSize and to psampFiltHashIpPayloadSize
        in the PSAMP MIB module.";
      reference "RFC 5477, Section 8.3.3; RFC 6727, Section 6
        (psampFiltHashIpPayloadSize).";
    }
    leaf digestOutput {
      type boolean;
      default false;
      description "If true, the output from this Selector is
        included in the Packet Report as a packet digest.
        Therefore, the configured Cache Layout needs to contain
        a digestHashValue field.
        This parameter corresponds to the Information Element
        hashDigestOutput.";
      reference "RFC 5477, Section 8.3.8.";
    }
    leaf outputRangeMin {
      type uint64;
      config false;
      description "Beginning of the hash function's potential
        range.
        This parameter corresponds to the Information Element
        hashOutputRangeMin and to psampFiltHashOutputRangeMin
        in the PSAMP MIB module.";
      reference "RFC 5477, Section 8.3.4; RFC 6727, Section 6
        (psampFiltHashOutputRangeMin).";
    }
    leaf outputRangeMax {
      type uint64;
      config false;
      description "End of the hash function's potential range.
        This parameter corresponds to the Information Element
        hashOutputRangeMax and to psampFiltHashOutputRangeMax
        in the PSAMP MIB module.";
      reference "RFC 5477, Section 8.3.5; RFC 6727, Section 6
        (psampFiltHashOutputRangeMax).";
    }
    list selectedRange {
      key name;
      min-elements 1;
      description "List of hash function return ranges for
        which packets are selected.";
      leaf name {
        type nameType;
        description "Key of this list.";
      }
      leaf min {
        type uint64;
        description "Beginning of the hash function's selected
          range.
          This parameter corresponds to the Information Element
          hashSelectedRangeMin and to psampFiltHashSelectedRangeMin
          in the PSAMP MIB module.";
        reference "RFC 5477, Section 8.3.6; RFC 6727, Section 6
        (psampFiltHashSelectedRangeMin).";
      }
      leaf max {
        type uint64;
        description "End of the hash function's selected range.
          This parameter corresponds to the Information Element
          hashSelectedRangeMax and to psampFiltHashSelectedRangeMax
          in the PSAMP MIB module.";
        reference "RFC 5477, Section 8.3.7; RFC 6727, Section 6
        (psampFiltHashSelectedRangeMax).";
      }
    }
  }

  grouping selectorParameters {
    description "Configuration and state parameters of a Selector.";
    choice Method {
      mandatory true;
      description "Packet selection method applied by the Selector.";
      leaf selectAll {
        type empty;
        description "Method that selects all packets.";
      }
      container sampCountBased {
        if-feature psampSampCountBased;
        description "Systematic count-based packet Sampling.";
        uses sampCountBasedParameters;
      }
      container sampTimeBased {
        if-feature psampSampTimeBased;
        description "Systematic time-based packet Sampling.";
        uses sampTimeBasedParameters;
      }
      container sampRandOutOfN {
        if-feature psampSampRandOutOfN;
        description "n-out-of-N packet Sampling.";
        uses sampRandOutOfNParameters;
      }
      container sampUniProb {
        if-feature psampSampUniProb;
        description "Uniform probabilistic packet Sampling.";
        uses sampUniProbParameters;
      }
      container filterMatch {
        if-feature psampFilterMatch;
        description "Property match Filtering.";
        uses filterMatchParameters;
      }
      container filterHash {
        if-feature psampFilterHash;
        description "Hash-based Filtering.";
        uses filterHashParameters;
      }
    }
    leaf packetsObserved {
      type yang:counter64;
      config false;
      description "The number of packets observed at the input of
        the Selector.
        If this is the first Selector in the Selection Process,
        this counter corresponds to the total number of packets in
        all Observed Packet Streams at the input of the Selection
        Process.  Otherwise, the counter corresponds to the total
        number of packets at the output of the preceding Selector.
        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
        selectorDiscontinuityTime.
        Note that this parameter corresponds to
        ipfixSelectorStatsPacketsObserved in the IPFIX MIB
        module.";
      reference "RFC 6615, Section 8
        (ipfixSelectorStatsPacketsObserved).";
    }
    leaf packetsDropped {
      type yang:counter64;
      config false;
      description "The total number of packets discarded by the
        Selector.
        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
        selectorDiscontinuityTime.
        Note that this parameter corresponds to
        ipfixSelectorStatsPacketsDropped in the IPFIX MIB
        module.";
      reference "RFC 6615, Section 8
        (ipfixSelectorStatsPacketsDropped).";
    }
    leaf selectorDiscontinuityTime {
      type yang:date-and-time;
      config false;
      description "Timestamp of the most recent occasion at which
        one or more of the Selector counters suffered a
        discontinuity.
        Note that this parameter functionally corresponds to
        ipfixSelectionProcessStatsDiscontinuityTime in the IPFIX
        MIB module.  In contrast to
        ipfixSelectionProcessStatsDiscontinuityTime, the time is
        absolute and not relative to sysUpTime.";
      reference "RFC 6615, Section 8
        (ipfixSelectionProcessStatsDiscontinuityTime).";
    }
  }
  grouping cacheLayoutParameters {
    description "Cache Layout parameters used by immediateCache,
      timeoutCache, naturalCache, and permanentCache.";
    container cacheLayout {
      description "Cache Layout parameters.";
      list cacheField {
        key name;
        min-elements 1;
        description "Superset of fields that are included in the
          Packet Reports or Flow Records generated by the Cache.";
        leaf name {
          type nameType;
          description "Key of this list.";
        }
        choice nameOrId {
          mandatory true;
          description "Name or identifier of the Information
            Element.";
          reference "RFC 5102, Section 2; IANA registry for IPFIX
            Entities, http://www.iana.org/assignments/ipfix.";
          leaf ieName {
            type ieNameType;
            description "Name of the Information Element.";
          }
          leaf ieId {
            type ieIdType;
            description "Identifier of the Information Element.";
          }
        }
        leaf ieLength {
          type uint16;
          units octets;
          description "Length of the field in which the Information
            Element is encoded.  A value of 65535 specifies a
            variable-length Information Element.  For Information
            Elements of integer and float type, the field length MAY
            be set to a smaller value than the standard length of
            the abstract data type if the rules of reduced size
            encoding are fulfilled.
            If not configured by the user, this parameter is set by
            the Monitoring Device.";
          reference "RFC 5101, Section 6.2.";
        }
        leaf ieEnterpriseNumber {
          type uint32;
          default 0;
          description "If this parameter is zero, the Information
            Element is registered in the IANA registry of IPFIX
            Information Elements.
            If this parameter is configured with a non-zero private
            enterprise number, the Information Element is
            enterprise-specific.
            If the enterprise number is set to 29305, this field
            contains a Reverse Information Element.  In this case,
            the Cache MUST generate Data Records in accordance to
            RFC 5103.";
          reference "RFC 5101; RFC 5103;
            IANA registry for Private Enterprise Numbers,
            http://www.iana.org/assignments/enterprise-numbers;
            IANA registry for IPFIX Entities,
            http://www.iana.org/assignments/ipfix.";
        }
        leaf isFlowKey {
          when "(name(../../..) != 'immediateCache')
            and
            ((count(../ieEnterpriseNumber) = 0)
            or
            (../ieEnterpriseNumber != 29305))" {
            description "This parameter is not available for
              Reverse Information Elements (which have enterprise
              number 29305).  It is also not available for
              immediateCache.";
          }
          type empty;
          description "If present, this is a flow key.";
        }
      }
    }
  }

  grouping flowCacheParameters {
    description "Configuration and state parameters of a Cache
      generating Flow Records.";
    leaf maxFlows {
      type uint32;
      units flows;
      description "This parameter configures the maximum number of
        Flows in the Cache, which is the maximum number of Flows
        that can be measured simultaneously.
        The Monitoring Device MUST ensure that sufficient resources
        are available to store the configured maximum number of
        Flows.
        If the maximum number of Flows is measured, an additional
        Flow can be measured only if an existing entry is removed.
        However, traffic that pertains to existing Flows can
        continue to be measured.";
    }
    leaf activeTimeout {
      when "(name(..) = 'timeoutCache') or
        (name(..) = 'naturalCache')" {
        description "This parameter is only available for
          timeoutCache and naturalCache.";
      }
      type uint32;
      units seconds;
      description "This parameter configures the time in
        seconds after which a Flow is expired even though packets
        matching this Flow are still received by the Cache.
        The parameter value zero indicates infinity, meaning that
        there is no active timeout.
        If not configured by the user, the Monitoring Device sets
        this parameter.
        Note that this parameter corresponds to
        ipfixMeteringProcessCacheActiveTimeout in the IPFIX
        MIB module.";
      reference "RFC 6615, Section 8
        (ipfixMeteringProcessCacheActiveTimeout).";
    }
    leaf idleTimeout {
      when "(name(..) = 'timeoutCache') or
        (name(..) = 'naturalCache')" {
        description "This parameter is only available for
          timeoutCache and naturalCache.";
      }
      type uint32;
      units seconds;
      description "This parameter configures the time in
        seconds after which a Flow is expired if no more packets
        matching this Flow are received by the Cache.
        The parameter value zero indicates infinity, meaning that
        there is no idle timeout.
        If not configured by the user, the Monitoring Device sets
        this parameter.
        Note that this parameter corresponds to
        ipfixMeteringProcessCacheIdleTimeout in the IPFIX
        MIB module.";
      reference "RFC 6615, Section 8
        (ipfixMeteringProcessCacheIdleTimeout).";
    }
    leaf exportInterval {
      when "name(..) = 'permanentCache'" {
        description "This parameter is only available for
          permanentCache.";
      }
      type uint32;
      units seconds;
      description "This parameter configures the interval (in
        seconds) for periodical export of Flow Records.
        If not configured by the user, the Monitoring Device sets
        this parameter.";
    }
    leaf activeFlows {
      type yang:gauge32;
      units flows;
      config false;
      description "The number of Flows currently active in this
        Cache.
        Note that this parameter corresponds to
        ipfixMeteringProcessCacheActiveFlows in the IPFIX MIB
        module.";
      reference "RFC 6615, Section 8
        (ipfixMeteringProcessCacheActiveFlows).";
    }
    leaf unusedCacheEntries {
      type yang:gauge32;
      units flows;
      config false;
      description "The number of unused Cache entries in this
        Cache.
        Note that this parameter corresponds to
        ipfixMeteringProcessCacheUnusedCacheEntries in the IPFIX
        MIB module.";
      reference "RFC 6615, Section 8
        (ipfixMeteringProcessCacheUnusedCacheEntries).";
    }
  }

  grouping exportingProcessParameters {
    description "Parameters of an Exporting Process.";
    leaf exportingProcessId {
      type uint32;
      config false;
      description "The identifier of the Exporting Process.
        This parameter corresponds to the Information Element
        exportingProcessId.  Its occurrence helps to associate
        Exporting Process parameters with Exporing Process
        statistics exported by the Monitoring Device using the
        Exporting Process Reliability Statistics Template as
        defined by the IPFIX protocol specification.";
      reference "RFC 5101, Section 4.3; IANA registry for IPFIX
        Entities, http://www.iana.org/assignments/ipfix.";
    }
    leaf exportMode {
      type identityref {
        base "exportMode";
      }
      default parallel;
      description "This parameter determines to which configured
        destination(s) the incoming Data Records are exported.";
    }
    list destination {
      key name;
      min-elements 1;
      description "List of export destinations.";
      leaf name {
        type nameType;
        description "Key of this list.";
      }
      choice DestinationParameters {
        mandatory true;
        description "Configuration parameters depend on whether
          SCTP, UDP, or TCP is used as transport protocol, and
          whether the destination is a file.";
        container sctpExporter {
          description "SCTP parameters.";
          uses sctpExporterParameters;
        }
        container udpExporter {
          if-feature udpTransport;
          description "UDP parameters.";
          uses udpExporterParameters;
        }
        container tcpExporter {
          if-feature tcpTransport;
          description "TCP parameters.";
          uses tcpExporterParameters;
        }
        container fileWriter {
          if-feature fileWriter;
          description "File Writer parameters.";
          uses fileWriterParameters;
        }
      }
    }
    list options {
      key name;
      description "List of options reported by the Exporting
        Process.";
      leaf name {
        type nameType;
        description "Key of this list.";
      }
      uses optionsParameters;
    }
  }

  grouping commonExporterParameters {
    description "Parameters of en export destination that are
      common to all transport protocols.";
    leaf ipfixVersion {
      type uint16;
      default 10;
      description "IPFIX version number.";
      reference "RFC 5101.";
    }
    leaf destinationPort {
      type inet:port-number;
      description "If not configured by the user, the Monitoring
        Device uses the default port number for IPFIX, which is
        4739 without TLS or DTLS and 4740 if TLS or DTLS is
        activated.";
    }
    choice indexOrName {
      description "Index or name of the interface as stored in the
        ifTable of IF-MIB.
        If configured, the Exporting Process MUST use the given
        interface to export IPFIX Messages to the export
        destination.
        If omitted, the Exporting Process selects the outgoing
        interface based on local routing decision and accepts
        return traffic, such as transport-layer acknowledgments,
        on all available interfaces.";
      reference "RFC 2863.";
      leaf ifIndex {
        type uint32;
        description "Index of an interface as stored in the ifTable
          of IF-MIB.";
        reference "RFC 2863.";
      }
      leaf ifName {
        type string;
        description "Name of an interface as stored in the ifTable
          of IF-MIB.";
        reference "RFC 2863.";
      }
    }
    leaf sendBufferSize {
      type uint32;
      units bytes;
      description "Size of the socket send buffer.
        If not configured by the user, this parameter is set by
        the Monitoring Device.";
    }
    leaf rateLimit {
      type uint32;
      units "bytes per second";
      description "Maximum number of bytes per second the Exporting
        Process may export to the given destination.  The number of
        bytes is calculated from the lengths of the IPFIX Messages
        exported.  If not configured, no rate limiting is performed.";
      reference "RFC 5476, Section 6.3.";
    }
    container transportLayerSecurity {
      presence "If transportLayerSecurity is present, DTLS is
        enabled if the transport protocol is SCTP or UDP, and TLS
        is enabled if the transport protocol is TCP.";
      description "TLS or DTLS configuration.";
      uses transportLayerSecurityParameters;
    }
    container transportSession {
      config false;
      description "State parameters of the Transport Session
        directed to the given destination.";
      uses transportSessionParameters;
    }
  }

  grouping sctpExporterParameters {
    description "SCTP-specific export destination parameters.";
    uses commonExporterParameters;
    leaf-list sourceIPAddress {
      type inet:ip-address;
      description "List of source IP addresses used by the
        Exporting Process.
        If configured, the specified addresses are eligible local
        IP addresses of the multihomed SCTP endpoint.
        If not configured, all locally assigned IP addresses are
        eligible local IP addresses.";
      reference "RFC 4960, Section 6.4.";
    }
    leaf-list destinationIPAddress {
      type inet:ip-address;
      min-elements 1;
      description "One or more IP addresses of the Collecting
        Process to which IPFIX Messages are sent.
        The user MUST ensure that all configured IP addresses
        belong to the same Collecting Process.
        The Exporting Process tries to establish an SCTP
        association to any of the configured destination IP
        addresses.";
      reference "RFC 4960, Section 6.4.";
    }
    leaf timedReliability {
      type uint32;
      units milliseconds;
      default 0;
      description "Lifetime in milliseconds until an IPFIX
        Message containing Data Sets only is 'abandoned' due to
        the timed reliability mechanism of PR-SCTP.
        If this parameter is set to zero, reliable SCTP
        transport is used for all Data Records.
        Regardless of the value of this parameter, the Exporting
        Process MAY use reliable SCTP transport for Data Sets
        associated with Options Templates.";
      reference "RFC 3758; RFC 4960.";
    }
  }

  grouping udpExporterParameters {
    description "Parameters of a UDP export destination.";
    uses commonExporterParameters;
    leaf sourceIPAddress {
      type inet:ip-address;
      description "Source IP address used by the Exporting Process.
      If not configured, the IP address assigned to the outgoing
      interface is used as source IP address.";
    }
    leaf destinationIPAddress {
      type inet:ip-address;
      mandatory true;
      description "IP address of the Collection Process to which
        IPFIX Messages are sent.";
    }
    leaf maxPacketSize {
      type uint16;
      units octets;
      description "This parameter specifies the maximum size of
        IP packets sent to the Collector.  If set to zero, the
        Exporting Device MUST derive the maximum packet size
        from path MTU discovery mechanisms.
        If not configured by the user, this parameter is set by
        the Monitoring Device.";
    }
    leaf templateRefreshTimeout {
      type uint32;
      units seconds;
      default 600;
      description "Sets time after which Templates are resent in the
        UDP Transport Session.
        Note that the configured lifetime MUST be adapted to the
        templateLifeTime parameter value at the receiving Collecting
        Process.
        Note that this parameter corresponds to
        ipfixTransportSessionTemplateRefreshTimeout in the IPFIX
        MIB module.";
      reference "RFC 5101, Section 10.3.6; RFC 6615, Section 8
        (ipfixTransportSessionTemplateRefreshTimeout).";
    }
    leaf optionsTemplateRefreshTimeout {
      type uint32;
      units seconds;
      default 600;
      description "Sets time after which Options Templates are
        resent in the UDP Transport Session.
        Note that the configured lifetime MUST be adapted to the
        optionsTemplateLifeTime parameter value at the receiving
        Collecting Process.
        Note that this parameter corresponds to
        ipfixTransportSessionOptionsTemplateRefreshTimeout in the
        IPFIX MIB module.";
      reference "RFC 5101, Section 10.3.6; RFC 6615, Section 8
        (ipfixTransportSessionOptionsTemplateRefreshTimeout).";
    }
    leaf templateRefreshPacket {
      type uint32;
      units "IPFIX Messages";
      description "Sets number of IPFIX Messages after which
        Templates are resent in the UDP Transport Session.
        Note that this parameter corresponds to
        ipfixTransportSessionTemplateRefreshPacket in the IPFIX
        MIB module.
        If omitted, Templates are only resent after timeout.";
      reference "RFC 5101, Section 10.3.6; RFC 6615, Section 8
        (ipfixTransportSessionTemplateRefreshPacket).";
    }
    leaf optionsTemplateRefreshPacket {
      type uint32;
      units "IPFIX Messages";
      description "Sets number of IPFIX Messages after which
        Options Templates are resent in the UDP Transport Session
        protocol.
        Note that this parameter corresponds to
        ipfixTransportSessionOptionsTemplateRefreshPacket in the
        IPFIX MIB module.
        If omitted, Templates are only resent after timeout.";
      reference "RFC 5101, Section 10.3.6; RFC 6615, Section 8
        (ipfixTransportSessionOptionsTemplateRefreshPacket).";
    }
  }

  grouping tcpExporterParameters {
    description "Parameters of a TCP export destination.";
    uses commonExporterParameters;
    leaf sourceIPAddress {
      type inet:ip-address;
      description "Source IP address used by the Exporting Process.
        If not configured by the user, this parameter is set by
        the Monitoring Device to an IP address assigned to the
        outgoing interface.";
    }
    leaf destinationIPAddress {
      type inet:ip-address;
      mandatory true;
      description "IP address of the Collection Process to which
        IPFIX Messages are sent.";
    }
  }

  grouping fileWriterParameters {
    description "File Writer parameters.";
    leaf ipfixVersion {
      type uint16;
      default 10;
      description "IPFIX version number.";
      reference "RFC 5101.";
    }
    leaf file {
      type inet:uri;
      mandatory true;
      description "URI specifying the location of the file.";
    }
    leaf bytes {
      type yang:counter64;
      units octets;
      config false;
      description "The number of bytes written by the File Writer.
        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
        fileWriterDiscontinuityTime.";
    }
    leaf messages {
      type yang:counter64;
      units "IPFIX Messages";
      config false;
      description "The number of IPFIX Messages written by the File
        Writer.
        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
        fileWriterDiscontinuityTime.";
    }
    leaf discardedMessages {
      type yang:counter64;
      units "IPFIX Messages";
      config false;
      description "The number of IPFIX Messages that could not be
        written by the File Writer due to internal buffer
        overflows, limited storage capacity, etc.
        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
        fileWriterDiscontinuityTime.";
    }
    leaf records {
      type yang:counter64;
      units "Data Records";
      config false;
      description "The number of Data Records written by the File
        Writer.
        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
        fileWriterDiscontinuityTime.";
    }
    leaf templates {
      type yang:counter32;
      units "Templates";
      config false;
      description "The number of Template Records (excluding
        Options Template Records) written by the File Writer.
        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
        fileWriterDiscontinuityTime.";
    }
    leaf optionsTemplates {
      type yang:counter32;
      units "Options Templates";
      config false;
      description "The number of Options Template Records written
        by the File Writer.
        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
        fileWriterDiscontinuityTime.";
    }
    leaf fileWriterDiscontinuityTime {
      type yang:date-and-time;
      config false;
      description "Timestamp of the most recent occasion at which
        one or more File Writer counters suffered a discontinuity.
        In contrast to discontinuity times in the IPFIX MIB module,
        the time is absolute and not relative to sysUpTime.";
    }
    list template {
      config false;
      description "This list contains the Templates and Options
        Templates that have been written by the File Reader.
        Withdrawn or invalidated (Options) Templates MUST be removed
        from this list.";
      uses templateParameters;
    }
  }

  grouping optionsParameters {
    description "Parameters specifying the data export using an
      Options Template.";
    leaf optionsType {
      type identityref {
        base "optionsType";
      }
      mandatory true;
      description "Type of the exported options data.";
    }
    leaf optionsTimeout {
      type uint32;
      units milliseconds;
      description "Time interval for periodic export of the options
        data.  If set to zero, the export is triggered when the
        options data has changed.
        If not configured by the user, this parameter is set by the
        Monitoring Device.";
    }
  }

  grouping collectingProcessParameters {
    description "Parameters of a Collecting Process.";
    list sctpCollector {
      key name;
      description "List of SCTP receivers (sockets) on which the
        Collecting Process receives IPFIX Messages.";
      leaf name {
        type nameType;
        description "Key of this list.";
      }
      uses sctpCollectorParameters;
    }
    list udpCollector {
      if-feature udpTransport;
      key name;
      description "List of UDP receivers (sockets) on which the
        Collecting Process receives IPFIX Messages.";
      leaf name {
        type nameType;
        description "Key of this list.";
      }
      uses udpCollectorParameters;
    }
    list tcpCollector {
      if-feature tcpTransport;
      key name;
      description "List of TCP receivers (sockets) on which the
        Collecting Process receives IPFIX Messages.";
      leaf name {
        type nameType;
        description "Key of this list.";
      }
      uses tcpCollectorParameters;
    }
    list fileReader {
      if-feature fileReader;
      key name;
      description "List of File Readers from which the Collecting
        Process reads IPFIX Messages.";
      leaf name {
        type nameType;
        description "Key of this list.";
      }
      uses fileReaderParameters;
    }
  }

  grouping commonCollectorParameters {
    description "Parameters of a Collecting Process that are
      common to all transport protocols.";
    leaf localPort {
      type inet:port-number;
      description "If not configured, the Monitoring Device uses the
        default port number for IPFIX, which is 4739 without
        TLS or DTLS and 4740 if TLS or DTLS is activated.";
    }
    container transportLayerSecurity {
      presence "If transportLayerSecurity is present, DTLS is enabled
        if the transport protocol is SCTP or UDP, and TLS is enabled
        if the transport protocol is TCP.";
      description "TLS or DTLS configuration.";
      uses transportLayerSecurityParameters;
    }
    list transportSession {
      config false;
      description "This list contains the currently established
        Transport Sessions terminating at the given socket.";
      uses transportSessionParameters;
    }
  }

  grouping sctpCollectorParameters {
    description "Parameters of a listening SCTP socket at a
      Collecting Process.";
    uses commonCollectorParameters;
    leaf-list localIPAddress {
      type inet:ip-address;
      description "List of local IP addresses on which the
        Collecting Process listens for IPFIX Messages.  The IP
        addresses are used as eligible local IP addresses of the
        multihomed SCTP endpoint.";
      reference "RFC 4960, Section 6.4.";
    }
  }

  grouping udpCollectorParameters {
    description "Parameters of a listening UDP socket at a
      Collecting Process.";
    uses commonCollectorParameters;
    leaf-list localIPAddress {
      type inet:ip-address;
      description "List of local IP addresses on which the Collecting
        Process listens for IPFIX Messages.";
    }
    leaf templateLifeTime {
      type uint32;
      units seconds;
      default 1800;
      description "Sets the lifetime of Templates for all UDP
        Transport Sessions terminating at this UDP socket.
        Templates that are not received again within the configured
        lifetime become invalid at the Collecting Process.
        As specified in RFC 5101, the Template lifetime MUST be at
        least three times higher than the templateRefreshTimeout
        parameter value configured on the corresponding Exporting
        Processes.
        Note that this parameter corresponds to
        ipfixTransportSessionTemplateRefreshTimeout in the IPFIX
        MIB module.";
      reference "RFC 5101, Section 10.3.7; RFC 6615, Section 8
        (ipfixTransportSessionTemplateRefreshTimeout).";
    }
    leaf optionsTemplateLifeTime {
      type uint32;
      units seconds;
      default 1800;
      description "Sets the lifetime of Options Templates for all
        UDP Transport Sessions terminating at this UDP socket.
        Options Templates that are not received again within the
        configured lifetime become invalid at the Collecting
        Process.
        As specified in RFC 5101, the Options Template lifetime MUST
        be at least three times higher than the
        optionsTemplateRefreshTimeout parameter value configured on
        the corresponding Exporting Processes.
        Note that this parameter corresponds to
        ipfixTransportSessionOptionsTemplateRefreshTimeout in the
        IPFIX MIB module.";
      reference "RFC 5101, Section 10.3.7; RFC 6615, Section 8
        (ipfixTransportSessionOptionsTemplateRefreshTimeout).";
    }
    leaf templateLifePacket {
      type uint32;
      units "IPFIX Messages";
      description "If this parameter is configured, Templates
        defined in a UDP Transport Session become invalid if they
        are neither included in a sequence of more than this number
        of IPFIX Messages nor received again within the period of
        time specified by templateLifeTime.
        Note that this parameter corresponds to
        ipfixTransportSessionTemplateRefreshPacket in the IPFIX
        MIB module.";
      reference "RFC 5101, Section 10.3.7; RFC 6615, Section 8
        (ipfixTransportSessionTemplateRefreshPacket).";
    }
    leaf optionsTemplateLifePacket {
      type uint32;
      units "IPFIX Messages";
      description "If this parameter is configured, Options
        Templates defined in a UDP Transport Session become
        invalid if they are neither included in a sequence of more
        than this number of IPFIX Messages nor received again
        within the period of time specified by
        optionsTemplateLifeTime.
        Note that this parameter corresponds to
        ipfixTransportSessionOptionsTemplateRefreshPacket in the
        IPFIX MIB module.";
      reference "RFC 5101, Section 10.3.7; RFC 6615, Section 8
        (ipfixTransportSessionOptionsTemplateRefreshPacket).";
    }
  }

  grouping tcpCollectorParameters {
    description "Parameters of a listening TCP socket at a
      Collecting Process.";
    uses commonCollectorParameters;
    leaf-list localIPAddress {
      type inet:ip-address;
      description "List of local IP addresses on which the Collecting
        Process listens for IPFIX Messages.";
    }
  }

  grouping fileReaderParameters {
    description "File Reader parameters.";
    leaf file {
      type inet:uri;
      mandatory true;
      description "URI specifying the location of the file.";
    }
    leaf bytes {
      type yang:counter64;
      units octets;
      config false;
      description "The number of bytes read by the File Reader.
        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
        fileReaderDiscontinuityTime.";
    }
    leaf messages {
      type yang:counter64;
      units "IPFIX Messages";
      config false;
      description "The number of IPFIX Messages read by the File
        Reader.
        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
        fileReaderDiscontinuityTime.";
    }
    leaf records {
      type yang:counter64;
      units "Data Records";
      config false;
      description "The number of Data Records read by the File
        Reader.
        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
        fileReaderDiscontinuityTime.";
    }
    leaf templates {
      type yang:counter32;
      units "Templates";
      config false;
      description "The number of Template Records (excluding
        Options Template Records) read by the File Reader.
        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
        fileReaderDiscontinuityTime.";
    }
    leaf optionsTemplates {
      type yang:counter32;
      units "Options Templates";
      config false;
      description "The number of Options Template Records read by
        the File Reader.
        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
        fileReaderDiscontinuityTime.";
    }
    leaf fileReaderDiscontinuityTime {
      type yang:date-and-time;
      config false;
      description "Timestamp of the most recent occasion at which
        one or more File Reader counters suffered a discontinuity.
        In contrast to discontinuity times in the IPFIX MIB module,
        the time is absolute and not relative to sysUpTime.";
    }
    list template {
      config false;
      description "This list contains the Templates and Options
        Templates that have been read by the File Reader.
        Withdrawn or invalidated (Options) Template MUST be removed
        from this list.";
      uses templateParameters;
    }
  }

  grouping transportLayerSecurityParameters {
    description "TLS or DTLS parameters.";
    leaf-list localCertificationAuthorityDN {
      type string;
      description "Distinguished names of certification authorities
        whose certificates may be used to identify the local
        endpoint.";
      reference "RFC 5280.";
    }
    leaf-list localSubjectDN {
      type string;
      description "Distinguished names that may be used in the
        certificates to identify the local endpoint.";
      reference "RFC 5280.";
    }
    leaf-list localSubjectFQDN {
      type inet:domain-name;
      description "Fully qualified domain names that may be used to
        in the certificates to identify the local endpoint.";
      reference "RFC 5280.";
    }
    leaf-list remoteCertificationAuthorityDN {
      type string;
      description "Distinguished names of certification authorities
        whose certificates are accepted to authorize remote
        endpoints.";
      reference "RFC 5280.";
    }
    leaf-list remoteSubjectDN {
      type string;
      description "Distinguished names which are accepted in
        certificates to authorize remote endpoints.";
      reference "RFC 5280.";
    }
    leaf-list remoteSubjectFQDN {
      type inet:domain-name;
      description "Fully qualified domain names that are accepted in
        certificates to authorize remote endpoints.";
      reference "RFC 5280.";
    }
  }

  grouping templateParameters {
    description "State parameters of a Template used by an Exporting
      Process or received by a Collecting Process in a specific
      Transport Session.  Parameter names and semantics correspond to
      the managed objects in IPFIX-MIB";
    reference "RFC 5101; RFC 6615, Section 8 (ipfixTemplateEntry,
      ipfixTemplateDefinitionEntry, ipfixTemplateStatsEntry)";
    leaf observationDomainId {
      type uint32;
      description "The ID of the Observation Domain for which this
        Template is defined.
        Note that this parameter corresponds to
        ipfixTemplateObservationDomainId in the IPFIX MIB module.";
      reference "RFC 6615, Section 8
        (ipfixTemplateObservationDomainId).";
    }
    leaf templateId {
      type uint16 {
        range "256..65535" {
          description "Valid range of Template IDs.";
          reference "RFC 5101";
        }
      }
      description "This number indicates the Template ID in the IPFIX
        message.
        Note that this parameter corresponds to ipfixTemplateId in
        the IPFIX MIB module.";
      reference "RFC 6615, Section 8 (ipfixTemplateId).";
    }
    leaf setId {
      type uint16;
      description "This number indicates the Set ID of the Template.
        Currently, there are two values defined.  The value 2 is used
        for Sets containing Template definitions.  The value 3 is
        used for Sets containing Options Template definitions.
        Note that this parameter corresponds to ipfixTemplateSetId
        in the IPFIX MIB module.";
      reference "RFC 6615, Section 8 (ipfixTemplateSetId).";
    }
    leaf accessTime {
      type yang:date-and-time;
      description "Used for Exporting Processes, this parameter
        contains the time when this (Options) Template was last
        sent to the Collector(s) or written to the file.
        Used for Collecting Processes, this parameter contains the
        time when this (Options) Template was last received from the
        Exporter or read from the file.
        Note that this parameter corresponds to
        ipfixTemplateAccessTime in the IPFIX MIB module.";
      reference "RFC 6615, Section 8 (ipfixTemplateAccessTime).";
    }
    leaf templateDataRecords {
      type yang:counter64;
      description "The number of transmitted or received Data
        Records defined by this (Options) Template.
        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
        templateDiscontinuityTime.
        Note that this parameter corresponds to
        ipfixTemplateDataRecords in the IPFIX MIB module.";
      reference "RFC 6615, Section 8 (ipfixTemplateDataRecords).";
    }
    leaf templateDiscontinuityTime {
      type yang:date-and-time;
      description "Timestamp of the most recent occasion at which
        the counter templateDataRecords suffered a discontinuity.
        Note that this parameter functionally corresponds to
        ipfixTemplateDiscontinuityTime in the IPFIX MIB module.
        In contrast to ipfixTemplateDiscontinuityTime, the time
        is absolute and not relative to sysUpTime.";
      reference "RFC 6615, Section 8
        (ipfixTemplateDiscontinuityTime).";
    }
    list field {
      description "This list contains the (Options) Template
        fields of which the (Options) Template is defined.
        The order of the list corresponds to the order of the fields
        in the (Option) Template Record.";
      leaf ieId {
        type ieIdType;
        description "This parameter indicates the Information
          Element identifier of the field.
          Note that this parameter corresponds to
          ipfixTemplateDefinitionIeId in the IPFIX MIB module.";
        reference "RFC 5101; RFC 6615, Section 8
          (ipfixTemplateDefinitionIeId).";
      }
      leaf ieLength {
        type uint16;
        units octets;
        description "This parameter indicates the length of the
          Information Element of the field.
          Note that this parameter corresponds to
          ipfixTemplateDefinitionIeLength in the IPFIX MIB
          module.";
        reference "RFC 5101; RFC 6615, Section 8
          (ipfixTemplateDefinitionIeLength).";
      }
      leaf ieEnterpriseNumber {
        type uint32;
        description "This parameter indicates the IANA enterprise
          number of the authority defining the Information Element
          identifier.
          If the Information Element is not enterprise-specific,
          this state parameter is zero.
          Note that this parameter corresponds to
          ipfixTemplateDefinitionIeEnterpriseNumber in the IPFIX
          MIB module.";
        reference "RFC 6615, Section 8
          (ipfixTemplateDefinitionIeEnterpriseNumber);
          IANA registry for Private Enterprise Numbers,
          http://www.iana.org/assignments/enterprise-numbers.";
      }
      leaf isFlowKey {
        when "../../setId = 2" {
          description "This parameter is available for non-Options
            Templates (Set ID is 2).";
        }
        type empty;
        description "If present, this is a Flow Key field.
          Note that this corresponds to flowKey(1) being set in
          ipfixTemplateDefinitionFlags.";
        reference "RFC 6615, Section 8
          (ipfixTemplateDefinitionFlags).";
      }
      leaf isScope {
        when "../../setId = 3" {
          description "This parameter is available for Options
            Templates (Set ID is 3).";
        }
        type empty;
        description "If present, this is a scope field.
          Note that this corresponds to scope(0) being set in
          ipfixTemplateDefinitionFlags.";
        reference "RFC 6615, Section 8
          (ipfixTemplateDefinitionFlags).";
      }
    }
  }

  grouping transportSessionParameters {
    description "State parameters of a Transport Session originating
      from an Exporting Process or terminating at a Collecting
      Process.  Parameter names and semantics correspond to the
      managed objects in IPFIX-MIB.";
    reference "RFC 5101; RFC 6615, Section 8
      (ipfixTransportSessionEntry,
       ipfixTransportSessionStatsEntry).";
    leaf ipfixVersion {
      type uint16;
      description "Used for Exporting Processes, this parameter
        contains the version number of the IPFIX protocol that the
        Exporter uses to export its data in this Transport Session.
        Hence, it is identical to the value of the configuration
        parameter ipfixVersion of the outer SctpExporter,
        UdpExporter, or TcpExporter node.
        Used for Collecting Processes, this parameter contains the
        version number of the IPFIX protocol it receives for
        this Transport Session.  If IPFIX Messages of different
        IPFIX protocol versions are received, this parameter
        contains the maximum version number.
        Note that this parameter corresponds to
        ipfixTransportSessionIpfixVersion in the IPFIX MIB
        module.";
      reference "RFC 6615, Section 8
        (ipfixTransportSessionIpfixVersion).";
    }
    leaf sourceAddress {
      type inet:ip-address;
      description "The source address of the Exporter of the
        IPFIX Transport Session.
        If the transport protocol is SCTP, this is one of the
        potentially many IP addresses of the Exporter.
        Preferably, the source IP address of the path that is
        usually selected by the Exporter to send IPFIX Messages to
        the Collector SHOULD be used.
        Note that this parameter functionally corresponds to
        ipfixTransportSessionSourceAddressType and
        ipfixTransportSessionSourceAddress in the IPFIX MIB
        module.";
      reference "RFC 6615, Section 8
        (ipfixTransportSessionSourceAddressType,
        ipfixTransportSessionSourceAddress);
        RFC 4960, Section 6.4.";
    }
    leaf destinationAddress {
      type inet:ip-address;
      description "The destination address of the Collector of
        the IPFIX Transport Session.
        If the transport protocol is SCTP, this is one of the
        potentially many IP addresses of the Collector.
        Preferably, the destination IP address of the path that is
        usually selected by the Exporter to send IPFIX Messages to
        the Collector SHOULD be used.
        Note that this parameter functionally corresponds to
        ipfixTransportSessionDestinationAddressType and
        ipfixTransportSessionDestinationAddress in the IPFIX MIB
        module.";
      reference "RFC 6615, Section 8
        (ipfixTransportSessionDestinationAddressType,
        ipfixTransportSessionDestinationAddress);
        RFC 4960, Section 6.4.";
    }
    leaf sourcePort {
      type inet:port-number;
      description "The transport-protocol port number of the
        Exporter of the IPFIX Transport Session.
        Note that this parameter corresponds to
        ipfixTransportSessionSourcePort in the IPFIX MIB module.";
      reference "RFC 6615, Section 8
        (ipfixTransportSessionSourcePort).";
    }
    leaf destinationPort {
      type inet:port-number;
      description "The transport-protocol port number of the
        Collector of the IPFIX Transport Session.
        Note that this parameter corresponds to
        ipfixTransportSessionDestinationPort in the IPFIX MIB
        module.";
      reference "RFC 6615, Section 8
        (ipfixTransportSessionDestinationPort).";
    }
    leaf sctpAssocId {
      type uint32;
      description "The association ID used for the SCTP session
        between the Exporter and the Collector of the IPFIX
        Transport Session.  It is equal to the sctpAssocId entry
        in the sctpAssocTable defined in the SCTP-MIB.
        This parameter is only available if the transport protocol
        is SCTP and if an SNMP agent on the same Monitoring Device
        enables access to the corresponding MIB objects in the
        sctpAssocTable.
        Note that this parameter corresponds to
        ipfixTransportSessionSctpAssocId in the IPFIX MIB
        module.";
      reference "RFC 6615, Section 8
        (ipfixTransportSessionSctpAssocId);
        RFC 3871";
    }
    leaf status {
      type transportSessionStatus;
      description "Status of the Transport Session.
        Note that this parameter corresponds to
        ipfixTransportSessionStatus in the IPFIX MIB module.";
      reference "RFC 6615, Section 8 (ipfixTransportSessionStatus).";
    }
    leaf rate {
      type yang:gauge32;
      units "bytes per second";
      description "The number of bytes per second transmitted by the
        Exporting Process or received by the Collecting Process.
        This parameter is updated every second.
        Note that this parameter corresponds to
        ipfixTransportSessionRate in the IPFIX MIB module.";
      reference "RFC 6615, Section 8 (ipfixTransportSessionRate).";
    }
    leaf bytes {
      type yang:counter64;
      units bytes;
      description "The number of bytes transmitted by the
        Exporting Process or received by the Collecting Process.
        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
        transportSessionDiscontinuityTime.
        Note that this parameter corresponds to
        ipfixTransportSessionBytes in the IPFIX MIB module.";
      reference "RFC 6615, Section 8 (ipfixTransportSessionBytes).";
    }
    leaf messages {
      type yang:counter64;
      units "IPFIX Messages";
      description "The number of messages transmitted by the
        Exporting Process or received by the Collecting Process.
        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
        transportSessionDiscontinuityTime.
        Note that this parameter corresponds to
        ipfixTransportSessionMessages in the IPFIX MIB module.";
      reference "RFC 6615, Section 8
        (ipfixTransportSessionMessages).";
    }
    leaf discardedMessages {
      type yang:counter64;
      units "IPFIX Messages";
      description "Used for Exporting Processes, this parameter
        indicates the number of messages that could not be sent due
        to internal buffer overflows, network congestion, routing
        issues, etc.  Used for Collecting Process, this parameter
        indicates the number of received IPFIX Message that are
        malformed, cannot be decoded, are received in the wrong
        order or are missing according to the sequence number.
        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
        transportSessionDiscontinuityTime.
        Note that this parameter corresponds to
        ipfixTransportSessionDiscardedMessages in the IPFIX MIB
        module.";
      reference "RFC 6615, Section 8
        (ipfixTransportSessionDiscardedMessages).";
    }
    leaf records {
      type yang:counter64;
      units "Data Records";
      description "The number of Data Records transmitted by the
        Exporting Process or received by the Collecting Process.
        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
        transportSessionDiscontinuityTime.
        Note that this parameter corresponds to
        ipfixTransportSessionRecords in the IPFIX MIB module.";
      reference "RFC 6615, Section 8
        (ipfixTransportSessionRecords).";
    }
    leaf templates {
      type yang:counter32;
      units "Templates";
      description "The number of Templates transmitted by the
        Exporting Process or received by the Collecting Process.
        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
        transportSessionDiscontinuityTime.
        Note that this parameter corresponds to
        ipfixTransportSessionTemplates in the IPFIX MIB module.";
      reference "RFC 6615, Section 8
        (ipfixTransportSessionTemplates).";
    }
    leaf optionsTemplates {
      type yang:counter32;
      units "Options Templates";
      description "The number of Option Templates transmitted by the
        Exporting Process or received by the Collecting Process.
        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
        transportSessionDiscontinuityTime.
        Note that this parameter corresponds to
        ipfixTransportSessionOptionsTemplates in the IPFIX MIB
        module.";
      reference "RFC 6615, Section 8
        (ipfixTransportSessionOptionsTemplates).";
    }
    leaf transportSessionStartTime {
      type yang:date-and-time;
      description "Timestamp of the start of the given Transport
        Session.
        This state parameter does not correspond to any object in
        the IPFIX MIB module.";
    }
    leaf transportSessionDiscontinuityTime {
      type yang:date-and-time;
      description "Timestamp of the most recent occasion at which
        one or more of the Transport Session counters suffered a
        discontinuity.
        Note that this parameter functionally corresponds to
        ipfixTransportSessionDiscontinuityTime in the IPFIX MIB
        module.  In contrast to
        ipfixTransportSessionDiscontinuityTime, the time is
        absolute and not relative to sysUpTime.";
      reference "RFC 6615, Section 8
        (ipfixTransportSessionDiscontinuityTime).";
    }
    list template {
      description "This list contains the Templates and Options
        Templates that are transmitted by the Exporting Process
        or received by the Collecting Process.
        Withdrawn or invalidated (Options) Templates MUST be removed
        from this list.";
      uses templateParameters;
    }
  }

  /*****************************************************************
  * Main container
  *****************************************************************/

  container ipfix {
    description "Top-level node of the IPFIX/PSAMP configuration
      data model.";
    list collectingProcess {
      if-feature collector;
      key name;
      description "Collecting Process of the Monitoring Device.";
      leaf name {
        type nameType;
        description "Key of this list.";
      }
      uses collectingProcessParameters;
      leaf-list exportingProcess {
        if-feature exporter;
        type leafref { path "/ipfix/exportingProcess/name"; }
        description "Export of received records without any
          modifications.  Records are processed by all Exporting
          Processes in the list.";
      }
    }

    list observationPoint {
      if-feature meter;
      key name;
      description "Observation Point of the Monitoring Device.";
      leaf name {
        type nameType;
        description "Key of this list.";
      }
      uses observationPointParameters;
      leaf-list selectionProcess {
        type leafref { path "/ipfix/selectionProcess/name"; }
        description "Selection Processes in this list process
          packets in parallel.";
      }
    }

    list selectionProcess {
      if-feature meter;
      key name;
      description "Selection Process of the Monitoring Device.";
      leaf name {
        type nameType;
        description "Key of this list.";
      }
      list selector {
        key name;
        min-elements 1;
        ordered-by user;
        description "List of Selectors that define the action of the
          Selection Process on a single packet.  The Selectors are
          serially invoked in the same order as they appear in this
          list.";
        leaf name {
          type nameType;
          description "Key of this list.";
        }
        uses selectorParameters;
      }
      list selectionSequence {
        config false;
        description "This list contains the Selection Sequence IDs
          that are assigned by the Monitoring Device to distinguish
          different Selection Sequences passing through the
          Selection Process.
          As Selection Sequence IDs are unique per Observation
          Domain, the corresponding Observation Domain IDs are
          included as well.
          With this information, it is possible to associate
          Selection Sequence (Statistics) Report Interpretations
          exported according to the PSAMP protocol with a Selection
          Process in the configuration data.";
        reference "RFC 5476.";
        leaf observationDomainId {
          type uint32;
          description "Observation Domain ID for which the
            Selection Sequence ID is assigned.";
        }
        leaf selectionSequenceId {
          type uint64;
          description "Selection Sequence ID used in the Selection
            Sequence (Statistics) Report Interpretation.";
        }
      }
      leaf cache {
        type leafref { path "/ipfix/cache/name"; }
        description "Cache that receives the output of the
          Selection Process.";
      }
    }

    list cache {
      if-feature meter;
      key name;
      description "Cache of the Monitoring Device.";
      leaf name {
        type nameType;
        description "Key of this list.";
      }
      leaf meteringProcessId {
        type uint32;
        config false;
        description "The identifier of the Metering Process this
          Cache belongs to.
          This parameter corresponds to the Information Element
          meteringProcessId.  Its occurrence helps to associate
          Cache parameters with Metering Process statistics
          exported by the Monitoring Device using the Metering
          Process (Reliability) Statistics Template as
          defined by the IPFIX protocol specification.";
        reference "RFC 5101, Sections 4.1 and 4.2;
          IANA registry for IPFIX Entities,
          http://www.iana.org/assignments/ipfix.";
      }
      leaf dataRecords {
        type yang:counter64;
        units "Data Records";
        config false;
        description "The number of Data Records generated by this
          Cache.
          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
          cacheDiscontinuityTime.
          Note that this parameter corresponds to
          ipfixMeteringProcessDataRecords in the IPFIX MIB
          module.";
        reference "RFC 6615, Section 8
          (ipfixMeteringProcessDataRecords).";
      }
      leaf cacheDiscontinuityTime {
        type yang:date-and-time;
        config false;
        description "Timestamp of the most recent occasion at which
          the counter dataRecords suffered a discontinuity.
          Note that this parameter functionally corresponds to
          ipfixMeteringProcessDiscontinuityTime in the IPFIX MIB
          module.  In contrast to
          ipfixMeteringProcessDiscontinuityTime, the time is
          absolute and not relative to sysUpTime.";
        reference "RFC 6615, Section 8
          (ipfixMeteringProcessDiscontinuityTime).";
      }
      choice CacheType {
        mandatory true;
        description "Type of Cache and specific parameters.";
        container immediateCache {
          if-feature immediateCache;
          description "Flow expiration after the first packet;
            generation of Packet Records.";
          uses cacheLayoutParameters;
        }
        container timeoutCache {
          if-feature timeoutCache;
          description "Flow expiration after active and idle
            timeout; generation of Flow Records.";
          uses flowCacheParameters;
          uses cacheLayoutParameters;
        }
        container naturalCache {
          if-feature naturalCache;
          description "Flow expiration after active and idle
            timeout, or on natural termination (e.g., TCP FIN or
            TCP RST) of the Flow; generation of Flow Records.";
          uses flowCacheParameters;
          uses cacheLayoutParameters;
        }
        container permanentCache {
          if-feature permanentCache;
          description "No flow expiration, periodical export with
            time interval exportInterval; generation of Flow
            Records.";
          uses flowCacheParameters;
          uses cacheLayoutParameters;
        }
      }
      leaf-list exportingProcess {
        if-feature exporter;
        type leafref { path "/ipfix/exportingProcess/name"; }
        description "Records are exported by all Exporting Processes
          in the list.";
      }
    }

    list exportingProcess {
      if-feature exporter;
      key name;
      description "Exporting Process of the Monitoring Device.";
      leaf name {
        type nameType;
        description "Key of this list.";
      }
      uses exportingProcessParameters;
    }
  }
}
