submodule openconfig-aft-ipv4 {
  belongs-to "openconfig-aft" {
    prefix "oc-aft";
  }

  import openconfig-extensions { prefix "oc-ext"; }
  import openconfig-inet-types { prefix "oc-inet"; }

  // Include common cross-AFT groupings from the common submodule.
  include openconfig-aft-common;

  organization
    "OpenConfig working group";

  contact
    "OpenConfig working group
    www.openconfig.net";

  description
    "Submodule containing definitions of groupings for the abstract
    forwarding tables for IPv4.";

  oc-ext:openconfig-version "2.2.0";

  revision "2022-06-16" {
    description
      "Add state-synced container under afts.";
    reference "2.2.0";
  }

  revision "2022-06-15" {
    description
      "Add decapsulate-header in NH AFT entry state";
    reference "2.1.0";
  }

  revision "2022-05-17" {
    description
      "Relocate next-hop-group/next-hop-group-network-instance
      from openconfig-aft-common to resolve absolute path
      leafref specific to network-instances";
    reference "2.0.0";
  }

  revision "2022-01-27" {
    description
      "Add next hop counters and prefix counters.";
    reference "1.0.0";
  }
  revision "2022-01-26" {
    description
      "Add vni-label and tunnel-src-ip-address properties under next-hops";
    reference "0.10.0";
  }

  revision "2021-12-09" {
    description
      "Add pop-top-label in NH AFT entry state";
    reference "0.9.0";
  }

  revision "2021-08-06" {
    description
      "Add references to the network instance within which to resolve
      a next-hop-group; fix defect where NHG could not be an ID defined
      outside the current NI; add metadata; add IP-in-IP encap.";
    reference "0.8.0";
  }

  revision "2021-07-15" {
    description
      "NHG-ID and NH-ID space management.";
    reference "0.7.0";
  }

  revision "2020-11-06" {
    description
      "Make AFT model read-only.";
    reference "0.6.0";
  }

  revision "2020-09-09" {
    description
      "Remove leafs that are not used as keys from config containers as
      AFT model is ready-only.
      * next-hop/interface-ref/config.
      * all leafs under policy-forwarding-entry/config except index.";
    reference "0.5.0";
  }

  revision "2019-11-07" {
    description
      "Move lsp-name leaf out of aft-common-entry-nexthop-state group.";
    reference "0.4.1";
  }

  revision "2019-08-02" {
    description
      "Add installing protocol for IPv[46] unicast entries.
      Add the ability to describe conditional next-hop groups
      outside of the policy forwarding module to allow for efficient
      handling of CBTS, where many prefixes may share the same next-hop
      criteria.";
    reference "0.4.0";
  }

  revision "2019-08-01" {
    description
      "Add lsp-name leaf to AFT next-hop.";
    reference "0.3.3";
  }

  revision "2018-11-21" {
    description
      "Add OpenConfig module metadata extensions.";
    reference "0.3.2";
  }

  revision 2017-08-24 {
    description
      "Formatting fixes";
    reference "0.3.1";
  }

  revision 2017-05-10 {
    description
      "Refactor to provide concretised per-AF schemas per AFT.";
    reference "0.3.0";
  }

  grouping aft-ipv4-unicast-structural {
    description
      "Structural grouping defining the schema for the IPv4 unicast
      abstract forwarding table.";

    list ipv4-entry {
      key "prefix";

      description
        "List of the IPv4 unicast entries within the abstract
        forwarding table. This list is keyed by the destination IPv4
        prefix.";

      leaf prefix {
        type leafref {
          path "../state/prefix";
        }
        description
          "Reference to the IPv4 unicast destination prefix which
          must be matched to utilise the AFT entry.";
      }

      container state {
        config false;
        description
          "Operational state parameters for the IPv4 unicast AFT
          entry.";
        uses aft-ipv4-unicast-entry-state;
      }
    }
  }

  grouping aft-ipv4-unicast-entry-state {
    description
      "Operational state parameters for the IPv4 unicast entry.";
    leaf prefix {
        type oc-inet:ipv4-prefix;
        description
          "The IPv4 destination prefix that should be matched to
          utilise the AFT entry.";
    }
    uses aft-common-entry-state {
      augment counters {
        description
          "The number of packets and octets matched the AFT entry
          and routed to next-hops within the backup next-hop-group";

        uses aft-common-backup-entry-counter-state;
      }
    }
    uses aft-common-ip-state;
  }
}