submodule openconfig-ospfv2-area {

  belongs-to openconfig-ospfv2 {
    prefix "oc-ospfv2";
  }

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

  // include other required submodules
  include openconfig-ospfv2-area-interface;
  include openconfig-ospfv2-lsdb;

  // meta
  organization "OpenConfig working group";

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

  description
    "This submodule provides OSPFv2 configuration and operational
    state parameters that are specific to the area context";

  oc-ext:openconfig-version "0.4.0";

   revision "2022-02-10" {
    description
      "Fix spelling error in retransmission-queue-length leaf.";
    reference "0.4.0";
  }

  revision "2021-07-28" {
    description
      "Add prefix to qualify when statements.";
    reference "0.3.1";
  }

  revision "2021-03-17" {
    description
      "Add bfd support without augmentation.";
    reference "0.3.0";
  }

  revision "2019-11-28" {
    description
      "Revert path changes in when statements in LSDB model";
    reference "0.2.2";
  }

  revision "2019-11-05" {
    description
      "Fix paths in when statements in LSDB model";
    reference "0.2.1";
  }

  revision "2019-07-09" {
    description
      "Normalise all timeticks64 to be expressed in nanoseconds.";
    reference "0.2.0";
  }

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

  revision "2018-06-05" {
    description
      "Bug fixes in when statements in lsdb";
    reference "0.1.2";
  }

  revision "2017-08-24" {
    description
      "Minor formatting fixes.";
    reference "0.1.1";
  }

  revision "2017-02-28"{
    description
      "Initial public release of OSPFv2";
    reference "0.1.0";
  }

  revision "2016-06-24" {
    description
      "Initial revision";
    reference "0.0.1";
  }

  grouping ospfv2-area-config {
    description
      "Configuration parameters relating to an OSPF area";

    leaf identifier {
      type oc-ospf-types:ospf-area-identifier;
      description
        "An identifier for the OSPFv2 area - described as either a
        32-bit unsigned integer, or a dotted-quad";
    }
  }

  grouping ospfv2-area-mpls-config {
    description
      "Configuration parameters relating to OSPFv2 extensions for
      MPLS";

    leaf traffic-engineering-enabled {
      type boolean;
      description
        "Specifies whether traffic engineering extensions should be
        advertised within the area";
    }
  }

  grouping ospfv2-area-virtual-link-config {
    description
      "Configuration parameters relating to a virtual-link within
      the OSPF area";

    leaf remote-router-id {
      type inet:ipv4-address-no-zone;
      description
        "The router ID of the device which terminates the remote end
        of the virtual link";
    }
  }

  grouping ospfv2-area-structure {
    description
      "Structural grouping for configuration and operational state
      parameters that relate to an individual area";

    container config {
      description
        "Configuration parameters relating to an OSPFv2 area";

      uses ospfv2-area-config;
    }

    container state {
      config false;
      description
        "Operational state parameters relating to an OSPFv2 area";
      uses ospfv2-area-config;
    }

    container mpls {
      description
        "Configuration and operational state parameters for OSPFv2
        extensions relating to MPLS";

      container config {
        description
          "Configuration parameters relating to MPLS extensions for
          OSPFv2";
        uses ospfv2-area-mpls-config;
      }

      container state {
        config false;
        description
          "Operational state parameters relating to MPLS extensions
          for OSPFv2";
        uses ospfv2-area-mpls-config;
      }
    }

    uses ospfv2-lsdb-structure;
    uses ospfv2-area-interfaces-structure;

    container virtual-links {
      description
        "Configuration and state parameters relating to virtual
        links from the source area to a remote router";

      list virtual-link {
        key "remote-router-id";

        description
          "Configuration and state parameters relating to a
          virtual link";

        leaf remote-router-id {
          type leafref {
            path "../config/remote-router-id";
          }
          description
            "Reference to the remote router ID";
        }

        container config {
          description
            "Configuration parameters relating to the OSPF virtual link";
          uses ospfv2-area-virtual-link-config;
        }

        container state {
          config false;
          description
            "State parameters relating to the OSPF virtual link";
          uses ospfv2-area-virtual-link-config;
          uses ospfv2-area-interface-neighbor-state;
        }
      }
    }
  }
}