Adding OpenConfig YANG models.

Change-Id: I0a2fdd5826e80933cf4b9ae939ff3051acec02aa
diff --git a/models/openconfig/src/main/yang/ospf/openconfig-ospf-policy.yang b/models/openconfig/src/main/yang/ospf/openconfig-ospf-policy.yang
new file mode 100644
index 0000000..da80fae
--- /dev/null
+++ b/models/openconfig/src/main/yang/ospf/openconfig-ospf-policy.yang
@@ -0,0 +1,176 @@
+module openconfig-ospf-policy {
+  yang-version "1";
+
+  namespace "http://openconfig.net/yang/ospf-policy";
+
+  prefix "oc-ospf-pol";
+
+  import openconfig-routing-policy { prefix "oc-rpol"; }
+  import openconfig-extensions { prefix "oc-ext"; }
+  import openconfig-ospf-types { prefix "oc-ospf-types"; }
+
+  organization
+    "OpenConfig working group";
+
+  contact
+    "OpenConfig working group
+    www.openconfig.net";
+
+  description
+    "This module defines extensions to the OpenConfig policy
+    model to add extensions for OSPF. This module is intended
+    to be generic for both OSPFv2 and OSPFv3.";
+
+  oc-ext:openconfig-version "0.0.1";
+
+  revision "2016-08-22" {
+    description
+      "Initial revision";
+    reference "0.0.1";
+  }
+
+  grouping ospf-match-config {
+    description
+      "Configuration parameters for OSPF match conditions";
+
+    leaf area-eq {
+      type oc-ospf-types:ospf-area-identifier;
+      description
+        "Match prefixes which are within a particular OSPF area";
+    }
+  }
+
+  grouping ospf-match-conditions {
+    description
+      "Match conditions that are added by OSPF";
+
+    container ospf-conditions {
+      description
+        "Match conditions specific to OSPF";
+
+      container config {
+        description
+          "Configuration parameters relating to OSPF match conditions";
+
+        uses ospf-match-config;
+      }
+
+      container state {
+        config false;
+        description
+          "Operational state parameters relating to OSPF match conditions";
+
+        uses ospf-match-config;
+      }
+    }
+  }
+
+  grouping ospf-actions-config {
+    description
+      "Configuration parameters for OSPF policy actions";
+
+    leaf set-area {
+      type oc-ospf-types:ospf-area-identifier;
+      description
+        "Set the area for the matched route. This action is typically
+        used when importing prefixes into OSPF, such that a route can
+        be imported into a specific area within the instance.";
+    }
+  }
+
+  grouping ospf-actions-set-metric-config { 
+    description
+      "Configuration parameters relating to setting the OSPF metric";
+
+    leaf metric-type {
+      type enumeration {
+        enum EXTERNAL_TYPE_1 {
+          description
+            "Set the external type 1 metric";
+        }
+        enum EXTERNAL_TYPE_2 {
+          description
+            "Set the external type 2 metric";
+        }
+      }
+      default "EXTERNAL_TYPE_2";
+      description
+        "Specify the type of metric which is to be set by the policy";
+    }
+
+    leaf metric {
+      type oc-ospf-types:ospf-metric;
+      description
+        "Set the metric of the routes matching the policy to the value
+        specified by this leaf.";
+    }
+  }
+
+  grouping ospf-actions {
+    description
+      "Actions that are added by OSPF to the action framework";
+
+    container ospf-actions {
+      description
+        "Actions specific to OSPF";
+
+      container config {
+        description
+          "Configuration parameters for OSPF actions";
+
+        uses ospf-actions-config;
+      }
+
+      container state {
+        config false;
+        description
+          "Operational state parameters for OSPF actions";
+
+        uses ospf-actions-config;
+      }
+
+      container set-metric {
+        description
+          "Configuration and state parameters relating to manipulating
+          the OSPF metric";
+
+        container config {
+          description
+            "Configuration parameters relating to setting the OSPF metric";
+          uses ospf-actions-set-metric-config;
+        }
+
+        container state {
+          config false;
+          description
+            "Operational state parameters relating to setting the OSPF
+            metric";
+
+          uses ospf-actions-set-metric-config;
+        }
+      }
+    }
+  }
+
+  // augment the groupings into the routing policy model
+
+  // TODO: discuss whether igp-actions should be used or whether this should 
+  // be removed.
+
+  augment "/oc-rpol:routing-policy/oc-rpol:policy-definitions/" +
+            "oc-rpol:policy-definition/oc-rpol:statements/oc-rpol:statement/" +
+            "oc-rpol:conditions" {
+    description
+      "Add OSPF specific match conditions to the routing policy model";
+    uses ospf-match-conditions;
+  }
+
+  augment "/oc-rpol:routing-policy/oc-rpol:policy-definitions/" +
+            "oc-rpol:policy-definition/oc-rpol:statements/oc-rpol:statement/" +
+            "oc-rpol:actions" {
+    description
+      "Add OSPF specific actions to the routing policy model";
+    uses ospf-actions;
+  }
+
+}
\ No newline at end of file
diff --git a/models/openconfig/src/main/yang/ospf/openconfig-ospf-types.yang b/models/openconfig/src/main/yang/ospf/openconfig-ospf-types.yang
new file mode 100644
index 0000000..99271522
--- /dev/null
+++ b/models/openconfig/src/main/yang/ospf/openconfig-ospf-types.yang
@@ -0,0 +1,772 @@
+module openconfig-ospf-types {
+
+  yang-version "1";
+
+  // namespace
+  namespace "http://openconfig.net/yang/ospf-types";
+
+  prefix "oc-ospf-types";
+
+  // import some basic types
+  import ietf-yang-types { prefix "yang"; }
+  import openconfig-extensions { prefix "oc-ext"; }
+
+  // meta
+  organization "OpenConfig working group";
+
+  contact
+    "OpenConfig working group
+    www.openconfig.net";
+
+  description
+    "Type definitions for OSPF";
+
+  oc-ext:openconfig-version "0.1.0";
+
+  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";
+  }
+
+  // typedefs
+  typedef ospf-area-identifier {
+    type union {
+      type uint32;
+      type yang:dotted-quad;
+    }
+    description
+      "An identifier for an area with OSPF version 2 or 3. This value
+      is expressed as either a dotted-quad, or a unsigned 32-bit
+      number";
+  }
+
+  typedef ospf-metric {
+    type uint16;
+    description
+      "A common type that can be utilised to express an OSPF metric";
+  }
+
+  typedef sr-sid-type {
+    type enumeration {
+      enum LABEL {
+        description
+          "When the length of the SR/Label Sub-TLV is specified to be 3, then
+          the right-most 20-bits represent a label value within the SR/Label
+          Sub-TLV. When this leaf is set to a value of Label the first-entry
+          leaf should be interpreted to be an MPLS label.";
+      }
+      enum SID {
+        description
+          "When the length of the SR/Label Sub-TLV is specified to be 4, then
+          the value specified in the first-entry leaf should be specified to
+          be a segment identifier.";
+      }
+    }
+    description
+      "A common type used to express the type of segment identifier that is
+      used in LSDB entries relating to segment routing";
+  }
+
+  // identities
+  identity OSPF_LSA_TYPE {
+    description
+      "Base identity for an OSPF LSA type. This identity is intended
+      to be used across both OSPFv2 and OSPFv3. Identity values that
+      correspond to only one OSPF version are marked as such.";
+  }
+
+  identity ROUTER_LSA {
+    base "OSPF_LSA_TYPE";
+    description
+      "Type 1 - ROUTER_LSA. An LSA originated by each router within
+      the area describing the state and cost of the router's links
+      in the area.";
+    reference "RFC2328";
+  }
+
+  identity NETWORK_LSA {
+    base "OSPF_LSA_TYPE";
+    description
+      "Type 2 - NETWORK_LSA. An LSA originated for each broadcast and
+      non-broadcast multiple access (NBMA) in the area. This LSA is
+      originated by the designated router.";
+    reference "RFC2328";
+  }
+
+  identity SUMMARY_IP_NETWORK_LSA {
+    base "OSPF_LSA_TYPE";
+    description
+      "Type 3 - SUMMARY_IP_NETWORK_LSA. An LSA originated by area
+      border routers describing inter-area destinations. This LSA type
+      is used when the destination is an IP network";
+    reference "RFC2328";
+  }
+
+  identity SUMMARY_ASBR_LSA {
+    base "OSPF_LSA_TYPE";
+    description
+      "Type 4 - SUMMARY_ASBR_LSA. An LSA originated by an area border
+      router describing inter-area destinations. This LSA type is used
+      when the destination is an AS boundary router.";
+    reference "RFC2328";
+  }
+
+  identity AS_EXTERNAL_LSA {
+    base "OSPF_LSA_TYPE";
+    description
+      "Type 5 - AS_EXTERNAL_LSA. This LSA type is used to describe
+      destinations external to the autonomous system, and is
+      originated by an AS boundary router (ASBR).";
+    reference "RFC2328";
+  }
+
+  identity NSSA_AS_EXTERNAL_LSA {
+    base "OSPF_LSA_TYPE";
+    description
+      "Type 7 - NSSA_AS_EXTERNAL_LSA. This LSA type is used by
+      systems within a not-so-stubby-area (NSSA) to inject external
+      prefixes into the LSDB. They are translated to Type 5 LSAs
+      at an ABR device.";
+    reference "RFC3101";
+  }
+
+  identity OSPFV2_LINK_SCOPE_OPAQUE_LSA {
+    base "OSPF_LSA_TYPE";
+    description
+      "Type 9 - OSPFV2_LINK_SCOPE_OPAQUE_LSA. This LSA type is used
+      in OSPFv2 to distribute arbitrary information via the OSPF
+      protocol. The contents is specific to the application defining
+      the Opaque Type specified within the LSDB. LSAs with Type 9 have
+      a scope of the link that they are being transmitted on (and the
+      associated network or subnetwork).";
+    reference "RFC5250";
+  }
+
+  identity OSPFV2_AREA_SCOPE_OPAQUE_LSA {
+    base "OSPF_LSA_TYPE";
+    description
+      "Type 10 - OSPFV2_AREA_SCOPE_OPAQUE_LSA. This LSA type is used
+      in OSPFv2 to distribute arbitrary information via the OSPF
+      protocol. The contents is specific to the application defining
+      the Opaque Type specified within the LSDB. LSAs with Type 10 have
+      a scope of the area that they are transmitted within.";
+    reference "RFC5250";
+  }
+
+  identity OSPFV2_AS_SCOPE_OPAQUE_LSA {
+    base "OSPF_LSA_TYPE";
+    description
+      "Type 11 - OSPFV2_AS_SCOPE_OPAQUE_LSA. This LSA type is used
+      in OSPFv2 to distribute arbitrary information via the OSPF
+      protocol. The contents is specific to the application defining
+      the Opaque Type specified within the LSDB. LSAs with Type 11
+      have a scope of the autonomous system that they are transmitted
+      within.";
+    reference "RFC5250";
+  }
+
+  identity ROUTER_LSA_TYPES {
+    description
+      "Sub-types of the router LSA";
+  }
+
+  identity ROUTER_LSA_P2P {
+    base "ROUTER_LSA_TYPES";
+    description
+      "The LSA represents a point-to-point connection to another
+      router";
+  }
+
+  identity ROUTER_LSA_TRANSIT_NETWORK {
+    base "ROUTER_LSA_TYPES";
+    description
+      "The LSA represents a connection to a transit network";
+  }
+
+  identity ROUTER_LSA_STUB_NETWORK {
+    base "ROUTER_LSA_TYPES";
+    description
+      "The LSA represents a connection to a stub network";
+  }
+
+  identity ROUTER_LSA_VIRTUAL_LINK {
+    base "ROUTER_LSA_TYPES";
+    description
+      "The LSA represents a virtual link connection";
+  }
+
+  identity OSPF_NEIGHBOR_STATE {
+    description
+      "The state of an adjacency between the local system and a remote
+      device";
+  }
+
+  identity DOWN {
+    base "OSPF_NEIGHBOR_STATE";
+    description
+      "The initial state of a neighbor, indicating that no recent
+      information has been received from the neighbor.";
+    reference "RFC2328";
+  }
+
+  identity ATTEMPT {
+    base "OSPF_NEIGHBOR_STATE";
+    description
+      "Utilised for neighbors that are attached to NBMA networks, it
+      indicates that no information has been recently received from
+      the neighbor but that Hello packets should be directly sent
+      to that neighbor.";
+    reference "RFC2328";
+  }
+
+  identity INIT {
+    base "OSPF_NEIGHBOR_STATE";
+    description
+      "Indicates that a Hello packet has been received from the
+      neighbor but bi-directional communication has not yet been
+      established. That is to say that the local Router ID does
+      not appear in the list of neighbors in the remote system's
+      Hello packet.";
+    reference "RFC2328";
+  }
+
+  identity TWO_WAY {
+    base "OSPF_NEIGHBOR_STATE";
+    description
+      "Communication between the local and remote system is
+      bi-directional such that the local system's Router ID is listed
+      in the received remote system's Hello packet.";
+    reference "RFC2328";
+  }
+
+  identity EXSTART {
+    base "OSPF_NEIGHBOR_STATE";
+    description
+      "An adjacency with the remote system is being formed. The local
+      system is currently transmitting empty database description
+      packets in order to establish the master/slave relationship for
+      the adjacency.";
+    reference "RFC2328";
+  }
+
+  identity EXCHANGE {
+    base "OSPF_NEIGHBOR_STATE";
+    description
+      "The local and remote systems are currently exchanging database
+      description packets in order to determine which elements of
+      their local LSDBs are out of date.";
+    reference "RFC2328";
+  }
+
+  identity LOADING {
+    base "OSPF_NEIGHBOR_STATE";
+    description
+      "The local system is sending Link State Request packets to the
+      remote system in order to receive the more recently LSAs that
+      were discovered during the Exchange phase of the procedure
+      establishing the adjacency.";
+    reference "RFC2328";
+  }
+
+  identity FULL {
+    base "OSPF_NEIGHBOR_STATE";
+    description
+      "The neighboring routers are fully adjacent such that both
+      LSDBs are synchronized. The adjacency will appear in Router and
+      Network LSAs";
+    reference "RFC2328";
+  }
+
+  identity OSPF_NETWORK_TYPE {
+    description
+      "Types of network that OSPF should consider attached to an
+      interface";
+  }
+
+  identity POINT_TO_POINT_NETWORK {
+    base "OSPF_NETWORK_TYPE";
+    description
+      "A interface that connects two routers.";
+    reference "RFC2328";
+  }
+
+  identity BROADCAST_NETWORK {
+    base "OSPF_NETWORK_TYPE";
+    description
+      "An interface that supports >2 attached routers which has the
+      ability to address all connected systems via a single
+      (broadcast) address.";
+  }
+
+  identity NON_BROADCAST_NETWORK {
+    base "OSPF_NETWORK_TYPE";
+    description
+      "An interface that supports >2 attached rotuers which does not
+      have the ability to address all connected systems with a
+      broadcast address.";
+  }
+
+  // rjs TODO: Maybe need p2mp here.
+
+
+  identity OSPF_OPAQUE_LSA_TYPE {
+    description
+      "This identity is the base used for opaque LSA types. The values
+      that extend this base are those that are described in the IANA
+      OSPF Opaque Link-State Advertisements (LSA) Option Types registry";
+  }
+
+  identity TRAFFIC_ENGINEERING {
+    base "OSPF_OPAQUE_LSA_TYPE";
+    description
+      "The Traffic Engineering LSA. This type is used only with area-scope
+      Opaque LSAs - and is used to describe routers, point-to-point links
+      and connections to multi-access networks for traffic engineering
+      purposes.";
+    reference "RFC3630";
+  }
+
+  identity GRACE_LSA {
+    base "OSPF_OPAQUE_LSA_TYPE";
+    description
+      "Grace LSAs are announced by a system undergoing graceful-restart.
+      A system that is attempting an OSPF graceful restart announces
+      Grace-LSAs with a specified grace period, indicating the intention
+      to have completed an restart within the specified period.";
+    reference "RFC3623";
+  }
+
+  identity ROUTER_INFORMATION {
+    base "OSPF_OPAQUE_LSA_TYPE";
+    description
+      "The Router Information LSA is used by an OSPFv2 system to announce
+      optional capabilities of the local system, over and above those that
+      are included within the OSPF hello message field.  The flooding scope
+      of the LSA can be link-, area-, or AS-wide (i.e., the LSA type can
+      be 9, 10 or 11).";
+    reference "RFC7770";
+  }
+
+  identity OSPFV2_EXTENDED_PREFIX {
+    base "OSPF_OPAQUE_LSA_TYPE";
+    description
+      "The Extended Prefix LSA is used in OSPFv2 to carry a set of attributes
+      that are to be associated with a prefix that is advertised in OSPF. The
+      attributes are carried as one or more TLV tuples. The flooding scope
+      of the LSA can be link-, area-, or AS-wide as specified by the
+      advertising system. The flooding scope of the LSA may exceed the scope
+      of the corresponding prefix.";
+    reference "RFC7684";
+  }
+
+  identity OSPFV2_EXTENDED_LINK {
+    base "OSPF_OPAQUE_LSA_TYPE";
+    description
+      "The Extended Link LSA is used in OSPFv2 to carry a set of attributes
+      that are to be associated with a link that is advertised in OSPF. The
+      link attributes are carried as one or more TLV tuples. The flooding
+      scope of the link LSA is area-local - i.e., it is carried in a Type 10
+      opaque LSA.";
+    reference "RFC7684";
+  }
+
+  identity OSPF_TE_LSA_TLV_TYPE {
+    description
+      "This identity is the base used for the type field of TLVs that are
+      included within the Traffic Engineering Opaque LSA.";
+  }
+
+  identity TE_ROUTER_ADDRESS {
+    base "OSPF_TE_LSA_TLV_TYPE";
+    description
+      "A stable IP address of the advertising router that is always reachable
+      if the node has connectivity.";
+  }
+
+  identity TE_LINK {
+    base "OSPF_TE_LSA_TLV_TYPE";
+    description
+      "A single link within a traffic engineering topology. A set of sub-TLVs
+      are carried within this attribute to indicate traffic engineering
+      characteristics of the link.";
+  }
+
+  identity TE_ROUTER_IPV6_ADDRESS {
+    base "OSPF_TE_LSA_TLV_TYPE";
+    description
+      "A stable IPv6 address of the advertising router that is always
+      reachable if the node has connectivity. This TLV is used only with
+      OSPFv3";
+    reference "RFC5329";
+  }
+
+  identity TE_LINK_LOCAL {
+    base "OSPF_TE_LSA_TLV_TYPE";
+    description
+      "Attributes associated with the local link by the system.";
+    reference "RFC4203";
+  }
+
+  identity TE_NODE_ATTRIBUTE {
+    base "OSPF_TE_LSA_TLV_TYPE";
+    description
+      "Attributes associted with the local system";
+    reference "RFC5786";
+  }
+
+  identity TE_OPTICAL_NODE_PROPERTY {
+    base "OSPF_TE_LSA_TLV_TYPE";
+    description
+      "Attributes associated with the local optical node. A set of sub-TLVs
+      are carried within this TLV which are used within the GMPLS control
+      plane when using OSPF";
+  }
+
+  identity OSPF_TE_LINK_TLV_TYPE {
+    description
+      "This identity is the based used for the type field for sub-TLVs of the
+      Link TLV of the OSPF Traffic Engineering Opaque LSA";
+  }
+
+  identity TE_LINK_TYPE {
+    base "OSPF_TE_LINK_TLV_TYPE";
+    description
+      "The OSPF-TE Link Type sub-TLV appears exactly once per OSPF-TE Link
+      and describes the type of the link";
+  }
+
+  identity TE_LINK_ID {
+    base "OSPF_TE_LINK_TLV_TYPE";
+    description
+      "The OSPF-TE Link ID sub-TLV appears exactly once per OSPF-TE link and
+      identifies the remote end of the link.";
+  }
+
+  identity TE_LINK_LOCAL_IP {
+    base "OSPF_TE_LINK_TLV_TYPE";
+    description
+      "The OSPF-TE Local IP specifies a list of the interface addresses of the
+      local system corresponding to the traffic engineering link.";
+  }
+
+  identity TE_LINK_REMOTE_IP {
+    base "OSPF_TE_LINK_TLV_TYPE";
+    description
+      "The OSPF-TE Remote IP specifies a list of IP addresses of the remote
+      neighbors associated with the traffic engineering link.";
+  }
+
+  identity TE_LINK_METRIC {
+    base "OSPF_TE_LINK_TLV_TYPE";
+    description
+      "The OSPF-TE Metric specifies the link metric for traffic engineering
+      purposes";
+  }
+
+  identity TE_LINK_MAXIMUM_BANDWIDTH {
+    base "OSPF_TE_LINK_TLV_TYPE";
+    description
+      "The OSPF-TE Maximum Bandwidth specifies the maximum bandwidth of the
+      link that it is associated with.";
+  }
+
+  identity TE_LINK_MAXIMUM_RESERVABLE_BANDWIDTH {
+    base "OSPF_TE_LINK_TLV_TYPE";
+    description
+      "The OSPF-TE Maximum Reservable Bandwidth specifies the maximum
+      bandwidth that may be reserved on the link in bytes per second";
+  }
+
+  identity TE_LINK_UNRESERVED_BANDWIDTH {
+    base "OSPF_TE_LINK_TLV_TYPE";
+    description
+      "The OSPF-TE unreserved bandwidth indicates the amount of bandwidth
+      at each priority level that is currently not reserved";
+  }
+
+  identity TE_LINK_ADMIN_GROUP {
+    base "OSPF_TE_LINK_TLV_TYPE";
+    description
+      "The OSPF-TE administrative group indicates the administrative group
+      that the is assigned to the interface";
+  }
+
+  identity TE_NODE_ATTRIBUTE_TLV_TYPE {
+    description
+      "This identity forms the base for sub-TLVs of the Node Attribute TLV
+      of the Traffic Engineering LSA";
+  }
+
+  identity NODE_IPV4_LOCAL_ADDRESS {
+    base "TE_NODE_ATTRIBUTE_TLV_TYPE";
+    description
+      "The Node Attribute Sub-TLV contains a list of the IPv4 addresses of
+      the local system";
+  }
+
+  identity NODE_IPV6_LOCAL_ADDRESS {
+    base "TE_NODE_ATTRIBUTE_TLV_TYPE";
+    description
+      "The Node Attribute Sub-TLV contains a list of the IPv6 addresses of
+      the local system";
+  }
+
+  identity GRACE_LSA_TLV_TYPES {
+    description
+      "This identity is used as the base for TLVs within the Grace LSA";
+  }
+
+  identity GRACE_PERIOD {
+    base "GRACE_LSA_TLV_TYPES";
+    description
+      "This sub-TLV describes the period for which adjacencies should be
+      maintained with the restarting system";
+  }
+
+  identity GRACE_RESTART_REASON {
+    base "GRACE_LSA_TLV_TYPES";
+    description
+      "This sub-TLV describes the reason for the OSPF restart of the system
+      that is restarting";
+  }
+
+  identity GRACE_IP_INTERFACE_ADDRESS {
+    base "GRACE_LSA_TLV_TYPES";
+    description
+      "This sub-TLV specifies the restarting system's IP address on the
+      interface via which it is advertising the Grace LSA";
+  }
+
+  identity RI_LSA_TLV_TYPES {
+    description
+      "This identity is used as the base for the TLVs within the Router
+      Information LSA";
+    reference "RFC7770";
+  }
+
+  identity RI_INFORMATIONAL_CAPABILITIES {
+    base "RI_LSA_TLV_TYPES";
+    description
+      "Informational capabilities of the advertising system";
+    reference "RFC7770";
+  }
+
+  identity RI_FUNCTIONAL_CAPABILITIES {
+    base "RI_LSA_TLV_TYPES";
+    description
+      "Functional capabilities of the advertising system";
+    reference "RFC7770";
+  }
+
+  identity RI_NODE_ADMIN_TAG {
+    base "RI_LSA_TLV_TYPES";
+    description
+      "Operator-defined administrative tags associated with the advertising
+      system";
+    reference "RFC7777";
+  }
+
+  identity RI_SR_SID_LABEL_RANGE {
+    base "RI_LSA_TLV_TYPES";
+    description
+      "SID or Label ranges for use with segment routing when forwarding to
+      the advertising system";
+    reference "draft-ietf-ospf-segment-routing-extensions";
+  }
+
+  identity RI_SR_ALGORITHM {
+    base "RI_LSA_TLV_TYPES";
+    description
+      "The algorithms that are supported for segment routing by the
+      advertising system";
+    reference "draft-ietf-ospf-segment-routing-extensions";
+  }
+
+  // will be shared with IS-IS
+  identity SR_ALGORITHM {
+    description
+      "This identity is used as a base for the algorithms that can be
+      supported for segment routing and are advertised by a system in the RI
+      LSA";
+  }
+
+  identity SPF {
+    base "SR_ALGORITHM";
+    description
+      "The standard shortest path algorithm based on link metric,
+      as used by the OSPF protocol";
+  }
+
+  identity STRICT_SPF {
+    base "SR_ALGORITHM";
+    description
+      "The standard shortest path algorithm based on link metric, with the
+      requirement that all nodes along the path honor the SPF decision. That
+      is to say that the SPF decision cannot be altered by local policy at
+      the node";
+  }
+
+  identity OSPF_RI_SR_SID_LABEL_TLV_TYPES {
+    description
+      "This identity is used as a base for the sub-TLVs of the Segment
+      Routing SID/Label Range TLV";
+  }
+
+  identity SR_SID_LABEL_TLV {
+    base "OSPF_RI_SR_SID_LABEL_TLV_TYPES";
+    description
+      "A range of SID/Label values used by the local system";
+    reference "draft-ietf-ospf-segment-routing-extensions";
+  }
+
+  identity OSPFV2_ROUTER_LINK_TYPE {
+    description
+      "OSPFv2 Router Link Types as per the IANA registry defined in
+      RFC2740";
+  }
+
+  identity POINT_TO_POINT_LINK {
+    base "OSPFV2_ROUTER_LINK_TYPE";
+    description
+      "The link is a point-to-point connection to another router";
+  }
+
+  identity TRANSIT_NETWORK_LINK {
+    base "OSPFV2_ROUTER_LINK_TYPE";
+    description
+      "The link is a connection to a transit network";
+  }
+
+  identity STUB_NETWORK_LINK {
+    base "OSPFV2_ROUTER_LINK_TYPE";
+    description
+      "The link is a connection to a stub network";
+  }
+
+  identity VIRTUAL_LINK {
+    base "OSPFV2_ROUTER_LINK_TYPE";
+    description
+      "The link is a virtual connection to another router";
+  }
+
+  identity OSPFV2_EXTENDED_PREFIX_SUBTLV_TYPE {
+    description
+      "Sub-TLVs of the OSPFv2 Extended Prefix LSA as defined by
+      RFC7684";
+  }
+
+  identity EXTENDED_PREFIX_RANGE {
+    base "OSPFV2_EXTENDED_PREFIX_SUBTLV_TYPE";
+    description
+      "The attributes being described relate to a range of prefixes";
+  }
+
+  identity PREFIX_SID {
+    base "OSPFV2_EXTENDED_PREFIX_SUBTLV_TYPE";
+    description
+      "The TLV describes a Segment Routing Prefix Segment Identifier
+      associated with a prefix";
+  }
+
+  identity SID_LABEL_BINDING {
+    base "OSPFV2_EXTENDED_PREFIX_SUBTLV_TYPE";
+    description
+      "The TLV describes a binding of a SID to a path to the prefix,
+      which may have associated path characteristics";
+  }
+
+  identity OSPFV2_EXTENDED_PREFIX_SID_LABEL_BINDING_SUBTLV_TYPE {
+    description
+      "Sub-TLV types carried in the SID/Label Binding Sub-TLV of
+      the Extended Prefix Sub-TLV";
+  }
+
+  identity SID_MPLS_LABEL_BINDING {
+    base "OSPFV2_EXTENDED_PREFIX_SID_LABEL_BINDING_SUBTLV_TYPE";
+    description
+      "This sub-TLV indicates a binding between an SR SID and an
+      MPLS label and must be present in the sub-TLV";
+  }
+
+  identity ERO_METRIC {
+    base "OSPFV2_EXTENDED_PREFIX_SID_LABEL_BINDING_SUBTLV_TYPE";
+    description
+      "This sub-TLV indicates the cost of the ERO path being
+      advertised in the SID/Label TLV";
+  }
+
+  identity ERO_PATH {
+    base "OSPFV2_EXTENDED_PREFIX_SID_LABEL_BINDING_SUBTLV_TYPE";
+    description
+      "This sub-TLV indicates the path associated with an ERO
+      being advertised in the SID/Label TLV";
+  }
+
+  identity OSPFV2_EXTPREFIX_BINDING_ERO_PATH_SEGMENT_TYPE {
+    description
+      "The types of segment included within an ERO Path described
+      within the SID/Label binding sub-TLV";
+  }
+
+  identity IPV4_SEGMENT {
+    base "OSPFV2_EXTPREFIX_BINDING_ERO_PATH_SEGMENT_TYPE";
+    description
+      "The segment is specified as an IPv4 address";
+  }
+
+  identity UNNUMBERED_INTERFACE_SEGMENT {
+    base "OSPFV2_EXTPREFIX_BINDING_ERO_PATH_SEGMENT_TYPE";
+    description
+      "The segment is specified as an unnumbered interface of
+      a remote system";
+  }
+
+  identity OSPFV2_EXTENDED_LINK_SUBTLV_TYPE {
+    description
+      "Sub-TLVs of the Extended Link TLV for OSPFv2";
+  }
+
+  identity ADJACENCY_SID {
+    base "OSPFV2_EXTENDED_LINK_SUBTLV_TYPE";
+    description
+      "The extended link sub-TLV indicates an Adjacency SID";
+  }
+
+  identity MAX_METRIC_TRIGGER {
+    description
+      "Triggers which cause the maximum metric to be set for
+      entities advertised in OSPF";
+  }
+
+  identity MAX_METRIC_ON_SYSTEM_BOOT {
+    base "MAX_METRIC_TRIGGER";
+    description
+      "Set the maximum metric when the system boots.";
+  }
+
+  identity MAX_METRIC_INCLUDE {
+    description
+      "Entities that may optionally be included when advertising
+      the maximum metric.";
+  }
+
+  identity MAX_METRIC_INCLUDE_STUB {
+    base "MAX_METRIC_INCLUDE";
+    description
+      "Include stub networks when advertising the maximum metric.";
+  }
+
+  identity MAX_METRIC_INCLUDE_TYPE2_EXTERNAL {
+    base "MAX_METRIC_INCLUDE";
+    description
+      "Include OSPF Type 2 external routes when advertising
+      the maximum metric.";
+  }
+}
\ No newline at end of file
diff --git a/models/openconfig/src/main/yang/ospf/openconfig-ospfv2-area-interface.yang b/models/openconfig/src/main/yang/ospf/openconfig-ospfv2-area-interface.yang
new file mode 100644
index 0000000..81ce281
--- /dev/null
+++ b/models/openconfig/src/main/yang/ospf/openconfig-ospfv2-area-interface.yang
@@ -0,0 +1,460 @@
+submodule openconfig-ospfv2-area-interface {
+
+  belongs-to openconfig-ospfv2 {
+    prefix "oc-ospfv2";
+  }
+
+  import ietf-yang-types { prefix "yang"; }
+  import openconfig-extensions { prefix "oc-ext"; }
+  import openconfig-types { prefix "oc-types"; }
+  import openconfig-interfaces { prefix "oc-if"; }
+  import openconfig-ospf-types { prefix "oc-ospf-types"; }
+
+  // include common submodule
+  include openconfig-ospfv2-common;
+
+  // 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.1.0";
+
+  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-interface-config {
+    description
+      "Configuration parameters for an OSPF interface";
+
+    leaf id {
+      type string;
+      description
+        "An operator-specified string utilised to uniquely
+        reference this interface";
+    }
+
+    leaf network-type {
+      type identityref {
+        base "oc-ospf-types:OSPF_NETWORK_TYPE";
+      }
+      description
+        "The type of network that OSPFv2 should use for the specified
+        interface.";
+    }
+
+    leaf priority {
+      type uint8;
+      description
+        "The local system's priority to become the designated
+        router";
+    }
+
+    leaf multi-area-adjacency-primary {
+      type boolean;
+      default true;
+      description
+        "When the specified interface is included in more than one
+        area's configuration, this leaf marks whether the area should
+        be considered the primary (when the value is true). In the
+        case that this value is false, the area is considered a
+        secondary area.";
+    }
+
+    leaf authentication-type {
+      type string;
+      // rjs TODO: discuss with bogdanov@ what the approach for auth
+      // links should be.
+      description
+        "The type of authentication that should be used on this
+        interface";
+    }
+
+    leaf metric {
+      type oc-ospf-types:ospf-metric;
+      description
+        "The metric for the interface";
+    }
+
+    leaf passive {
+      type boolean;
+      description
+        "When this leaf is set to true, the interface should be
+        advertised within the OSPF area but OSPF adjacencies should
+        not be established over the interface";
+    }
+
+    leaf hide-network {
+      type boolean;
+      description
+        "When this leaf is set to true, the network connected to
+        the interface should be hidden from OSPFv2 advertisements
+        per the procedure described in RFC6860.";
+      reference
+        "RFC6860 - Hiding Transit-Only Networks in OSFF";
+    }
+  }
+
+  grouping ospfv2-area-interface-timers-config {
+    description
+      "Configuration parameters relating to per-interface OSPFv2
+      timers";
+
+    leaf dead-interval {
+      type uint32;
+      units seconds;
+      description
+        "The number of seconds that the local system should let
+        elapse before declaring a silent router down";
+      reference "RFC2328";
+    }
+
+    leaf hello-interval {
+      type uint32;
+      units seconds;
+      description
+        "The number of seconds the local system waits between the
+        transmission of subsequent Hello packets";
+    }
+
+    leaf retransmission-interval {
+      type uint32;
+      units seconds;
+      description
+        "The number of seconds that the local system waits before
+        retransmitting an unacknowledged LSA.";
+    }
+  }
+
+  grouping ospfv2-area-interface-mpls-config {
+    description
+      "Configuration parameters relating to MPLS extensions for OSPF";
+
+    leaf traffic-engineering-metric {
+      type uint32;
+      description
+        "A link metric that should only be considered for traffic
+        engineering purposes.";
+      reference "RFC3630, §2.5.5";
+    }
+  }
+
+  grouping ospfv2-area-interface-neighbor-config {
+    description
+      "Configuration parameters relating to an individual neighbor
+      system on an interface within an OSPF area";
+
+    leaf router-id {
+      type yang:dotted-quad;
+      description
+        "The router ID of the remote system.";
+    }
+
+    leaf metric {
+      type oc-ospf-types:ospf-metric;
+      description
+        "The metric that should be considered to the remote neighbor
+        over this interface. This configuration is only applicable
+        for multiple-access networks";
+    }
+  }
+
+  grouping ospfv2-area-interface-neighbor-state {
+    description
+      "Operational state parameters relating an individual neighbor
+      system on an interface within an OSPF area";
+
+    leaf priority {
+      type uint8;
+      description
+        "The remote system's priority to become the designated
+        router";
+    }
+
+    leaf dead-time {
+      // rjs TODO: discussion with aashaikh@ + hines@ around how this
+      // value should be represented, usually is a timer that
+      // continually counts down but this sounds challenging for
+      // telemetry.
+      type oc-types:timeticks64;
+      description
+        "The time at which this neighbor's adjacency will be
+        considered dead. This value is expressed as a number of
+        seconds since the Unix Epoch";
+    }
+
+    leaf designated-router {
+      type yang:dotted-quad;
+      description
+        "The designated router for the adjacency. This device
+        advertises the Network LSA for broadcast and NBMA networks.";
+    }
+
+    leaf backup-designated-router {
+      type yang:dotted-quad;
+      description
+        "The backup designated router for the adjacency.";
+    }
+
+    leaf optional-capabilities {
+      // rjs TODO: should this be anything more than the hex-string
+      // this is currently what is shown in IOS/JUNOS
+      type yang:hex-string;
+      description
+        "The optional capabilities field received in the Hello
+        message from the neighbor";
+    }
+
+    leaf last-established-time {
+      type oc-types:timeticks64;
+      units seconds;
+      // rjs TODO: check implementations - is FULL considered 'up'
+      // since the adjacency is probably up since ExStart
+      description
+        "The time at which the adjacency was last established with
+        the neighbor. That is to say the time at which the
+        adjacency last transitioned into the FULL state.
+
+        This value is expressed as the number of seconds, relative to
+        the Unix Epoch (Jan 1, 1970 00:00:00 UTC).";
+    }
+
+    leaf adjacency-state {
+      type identityref {
+        base "oc-ospf-types:OSPF_NEIGHBOR_STATE";
+      }
+      description
+        "The state of the adjacency with the neighbor.";
+    }
+
+    leaf state-changes {
+      type uint32;
+      description
+        "The number of transitions out of the FULL state that this
+        neighbor has been through";
+    }
+
+    leaf retranmission-queue-length {
+      type uint32;
+      description
+        "The number of LSAs that are currently in the queue to be
+        retransmitted to the neighbor";
+    }
+  }
+
+  grouping ospfv2-area-interface-lsa-filter-config {
+    description
+      "Configuration options relating to filtering LSAs
+      on an interface.";
+
+    leaf all {
+      type boolean;
+      description
+        "When this leaf is set to true, all LSAs should be
+        filtered to the neighbours with whom adjacencies are
+        formed on the interface.";
+    }
+
+    // NB: this container can be augmented to add additional
+    // filtering options which exist in some implementations.
+  }
+
+  grouping ospfv2-area-interface-mpls-igp-ldp-sync-state {
+    description
+      "Operational state parameters relating to MPLS LDP/IGP
+      synchronization on a per-neighbor basis";
+
+    leaf synchronized {
+      type boolean;
+      description
+        "When the value of this leaf is set to true, the
+        LDP neighbors reachable via this interface are considered
+        to be synchronized, and hence the link is considered
+        usable by the IGP.";
+    }
+  }
+
+  grouping ospfv2-area-interfaces-structure {
+    description
+      "Structural grouping for configuration and operational state
+      parameters that relate to an interface";
+
+    container interfaces {
+      description
+        "Enclosing container for a list of interfaces enabled within
+        this area";
+
+      list interface {
+        key "id";
+
+        description
+          "List of interfaces which are enabled within this area";
+
+        leaf id {
+          type leafref {
+            path "../config/id";
+          }
+          description
+            "A pointer to the identifier for the interface.";
+        }
+
+        container config {
+          description
+            "Configuration parameters for the interface on which
+            OSPFv2 is enabled";
+
+          uses ospfv2-area-interface-config;
+        }
+
+        container state {
+          config false;
+          description
+            "Operational state parameters for the interface on which
+            OSPFv2 is enabled";
+          uses ospfv2-area-interface-config;
+        }
+
+        uses oc-if:interface-ref;
+
+        container timers {
+          description
+            "Timers relating to OSPFv2 on the interface";
+
+          container config {
+            description
+              "Configuration parameters for OSPFv2 timers on the
+              interface";
+            uses ospfv2-area-interface-timers-config;
+          }
+
+          container state {
+            config false;
+            description
+              "Operational state parameters for OSPFv2 timers on
+              the interface";
+
+            uses ospfv2-area-interface-timers-config;
+          }
+        }
+
+        container mpls {
+          description
+            "Configuration and operational state parameters for
+            OSPFv2 extensions related to MPLS on the interface.";
+
+          container config {
+            description
+              "Configuration parameters for OSPFv2 extensions relating
+              to MPLS for the interface";
+            uses ospfv2-area-interface-mpls-config;
+          }
+
+          container state {
+            config false;
+            description
+              "Operational state for OSPFv2 extensions relating to
+              MPLS for the interface";
+            uses ospfv2-area-interface-mpls-config;
+          }
+
+          container igp-ldp-sync {
+            description
+              "OSPFv2 parameters relating to LDP/IGP synchronization";
+
+            container config {
+              description
+                "Configuration parameters relating to LDP/IG
+                synchronization.";
+              uses ospfv2-common-mpls-igp-ldp-sync-config;
+            }
+
+            container state {
+              config false;
+              description
+                "Operational state variables relating to LDP/IGP
+                synchronization";
+              uses ospfv2-common-mpls-igp-ldp-sync-config;
+              uses ospfv2-area-interface-mpls-igp-ldp-sync-state;
+            }
+          }
+        }
+
+        container lsa-filter {
+          description
+            "OSPFv2 parameters relating to filtering of LSAs to
+            neighbors the specified interface.";
+
+          container config {
+            description
+              "Configuration parameters relating to filtering LSAs
+              on the specified interface.";
+            uses ospfv2-area-interface-lsa-filter-config;
+          }
+
+          container state {
+            config false;
+            description
+              "Operational state parameters relating to filtering
+              LSAs on the specified interface";
+            uses ospfv2-area-interface-lsa-filter-config;
+          }
+        }
+
+        container neighbors {
+          description
+            "Enclosing container for the list of neighbors that
+            an adjacency has been established with on the interface";
+
+          list neighbor {
+            key "router-id";
+
+            description
+              "A neighbor with which an OSPFv2 adjacency has been
+              established within this area";
+
+            leaf router-id {
+              type leafref {
+                path "../config/router-id";
+              }
+              description
+                "Reference to the router ID of the adjacent system";
+            }
+
+            container config {
+              description
+                "Configuration parameters relating to the adjacent
+                system";
+              uses ospfv2-area-interface-neighbor-config;
+            }
+
+            container state {
+              config false;
+              description
+                "Operational state parameters relating to the adjacent
+                system";
+              uses ospfv2-area-interface-neighbor-config;
+              uses ospfv2-area-interface-neighbor-state;
+            }
+          }
+        }
+
+      }
+    }
+  }
+
+}
\ No newline at end of file
diff --git a/models/openconfig/src/main/yang/ospf/openconfig-ospfv2-area.yang b/models/openconfig/src/main/yang/ospf/openconfig-ospfv2-area.yang
new file mode 100644
index 0000000..5624a49
--- /dev/null
+++ b/models/openconfig/src/main/yang/ospf/openconfig-ospfv2-area.yang
@@ -0,0 +1,157 @@
+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.1.0";
+
+  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;
+        }
+      }
+    }
+  }
+}
diff --git a/models/openconfig/src/main/yang/ospf/openconfig-ospfv2-common.yang b/models/openconfig/src/main/yang/ospf/openconfig-ospfv2-common.yang
new file mode 100644
index 0000000..6510816
--- /dev/null
+++ b/models/openconfig/src/main/yang/ospf/openconfig-ospfv2-common.yang
@@ -0,0 +1,79 @@
+submodule openconfig-ospfv2-common {
+
+  belongs-to openconfig-ospfv2 {
+    prefix "oc-ospfv2";
+  }
+
+  import openconfig-extensions { prefix "oc-ext"; }
+
+  // meta
+  organization "OpenConfig working group";
+
+  contact
+    "OpenConfig working group
+    www.openconfig.net";
+
+  description
+    "This submodule provides OSPFv2 configuration and operational
+    state parameters that are shared across multiple contexts";
+
+  oc-ext:openconfig-version "0.1.0";
+
+  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-common-mpls-igp-ldp-sync-config {
+    description
+      "Configuration parameters used for OSPFv2 MPLS/IGP
+      synchronization";
+
+    leaf enabled {
+      type boolean;
+      description
+        "When this leaf is set to true, do not utilise this link for
+        forwarding via the IGP until such time as LDP adjacencies to
+        the neighbor(s) over the link are established.";
+    }
+
+    leaf post-session-up-delay {
+      type uint32;
+      units milliseconds;
+      description
+        "This leaf specifies a delay, expressed in units of milliseconds,
+        between the LDP session to the IGP neighbor being established, and
+        it being considered synchronized by the IGP.";
+    }
+  }
+
+  grouping ospfv2-common-timers {
+    description
+      "Common definition of the type of timers that the OSPFv2 implementation
+      uses";
+
+    leaf timer-type {
+      type enumeration {
+        enum LINEAR_BACKOFF {
+          description
+            "The backoff used by the OSPFv2 implementation is linear, such that
+            a common delay is added following each event.";
+        }
+        enum EXPONENTIAL_BACKOFF {
+          description
+            "The backoff used by the OSPFv2 implementation is exponential, such
+            that the delay added following each event increases.";
+        }
+      }
+      description
+        "The timer mode that is utilised by the implementation.";
+    }
+  }
+}
\ No newline at end of file
diff --git a/models/openconfig/src/main/yang/ospf/openconfig-ospfv2-global.yang b/models/openconfig/src/main/yang/ospf/openconfig-ospfv2-global.yang
new file mode 100644
index 0000000..05f46c0
--- /dev/null
+++ b/models/openconfig/src/main/yang/ospf/openconfig-ospfv2-global.yang
@@ -0,0 +1,497 @@
+submodule openconfig-ospfv2-global {
+
+  belongs-to openconfig-ospfv2 {
+    prefix "oc-ospfv2";
+  }
+
+  import ietf-yang-types { prefix "yang"; }
+  import openconfig-extensions { prefix "oc-ext"; }
+  import openconfig-routing-policy { prefix "oc-rpol"; }
+  import openconfig-ospf-types { prefix "oc-ospft"; }
+
+  // Include common submodule
+  include openconfig-ospfv2-common;
+
+  // meta
+  organization "OpenConfig working group";
+
+  contact
+    "OpenConfig working group
+    www.openconfig.net";
+
+  description
+    "This submodule provides OSPFv2 configuration and operational
+    state parameters that are global to a particular OSPF instance";
+
+  oc-ext:openconfig-version "0.1.0";
+
+  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-global-config {
+    description
+      "Global configuration for OSPFv2";
+
+    leaf router-id {
+      type yang:dotted-quad;
+      description
+        "A 32-bit number represented as a dotted quad assigned to
+        each router running the OSPFv2 protocol. This number should
+        be unique within the autonomous system";
+      reference "rfc2828";
+    }
+
+    leaf summary-route-cost-mode {
+      type enumeration {
+        enum RFC1583_COMPATIBLE {
+          description
+            "Specify that summary routes should assume the cost of
+            the lowest-cost more-specific route as per the behaviour
+            specified in RFC1583";
+        }
+        enum RFC2328_COMPATIBLE {
+          description
+            "Specify that summary routes should assume the cost of the
+            highest-cost more-specific route as per the revised
+            behaviour specified in RFC2328";
+        }
+      }
+      default "RFC2328_COMPATIBLE";
+      description
+        "Specify how costs for the summary routes should be specified
+        as per the behaviour in the original OSPF specification
+        RFC1583, or alternatively whether the revised behaviour
+        described in RFC2328 should be utilised";
+    }
+
+    leaf igp-shortcuts {
+      type boolean;
+      description
+        "When this leaf is set to true, OSPFv2 will route traffic to
+        a remote system via any LSP to the system that is marked as
+        shortcut eligible.";
+    }
+
+    leaf log-adjacency-changes {
+      type boolean;
+      description
+        "When this leaf is set to true, a log message will be
+        generated when the state of an OSPFv2 neighbour changes.";
+    }
+
+    leaf hide-transit-only-networks {
+      type boolean;
+      description
+        "When this leaf is set to true, do not advertise prefixes
+        into OSPFv2 that correspond to transit interfaces, as per
+        the behaviour discussed in RFC6860.";
+      reference
+        "RFC6860 - Hiding Transit-Only Networks in OSPF";
+    }
+  }
+
+  grouping ospfv2-global-spf-timers-config {
+    description
+      "Configuration parameters relating to global SPF timer
+      parameters for OSPFv2";
+
+    leaf initial-delay {
+      // rjs TODO: IS-IS model has this as decimal64 - should it be
+      // that or uint32 msec?
+      type uint32;
+      units msec;
+      description
+        "The value of this leaf specifies the time between a change
+        in topology being detected and the first run of the SPF
+        algorithm.";
+    }
+
+    leaf maximum-delay {
+      // rjs TODO: same question as above
+      type uint32;
+      units msec;
+      description
+        "The value of this leaf specifies the maximum delay between
+        a topology change being detected and the SPF algorithm
+        running. This value is used for implementations that support
+        increasing the wait time between SPF runs.";
+    }
+
+    // rjs TODO: some questions here around what we should specify:
+    // JUNOS has rapid-runs and holddown
+    // Cisco has maximum time between runs, and then a doubling of
+    // the wait interval up to that maximum.
+    // ALU has first-wait, second-wait, max-wait
+  }
+
+  grouping ospfv2-global-lsa-generation-timers-config {
+    description
+      "Configuration parameters relating to global LSA generation
+      parameters for OSPFv2";
+
+    leaf initial-delay {
+      type uint32;
+      units msec;
+      description
+        "The value of this leaf specifies the time between the first
+        time an LSA is generated and advertised and the subsequent
+        generation of that LSA.";
+    }
+
+    leaf maximum-delay {
+      type uint32;
+      units msec;
+      description
+        "The value of this leaf specifies the maximum time between the
+        generation of an LSA and the subsequent re-generation of that
+        LSA. This value is used in implementations that support
+        increasing delay between generation of an LSA";
+    }
+  }
+
+  grouping ospfv2-global-spf-timers-state {
+    description
+      "Operational state parameters relating to OSPFv2 global
+      timers";
+
+    uses ospfv2-common-timers;
+  }
+
+  grouping ospfv2-global-lsa-generation-timers-state {
+    description
+      "Operational state parameters relating to OSPFv2 global
+      timers";
+
+    uses ospfv2-common-timers;
+  }
+
+  grouping ospfv2-global-graceful-restart-config {
+    description
+      "Configuration parameters relating to graceful restart for
+      OSPFv2";
+
+    leaf enabled {
+      type boolean;
+      description
+        "When the value of this leaf is set to true, graceful restart
+        is enabled on the local system. In this case, the system will
+        use Grace-LSAs to signal that it is restarting to its
+        neighbors.";
+    }
+
+    leaf helper-only {
+      type boolean;
+      description
+        "Operate graceful-restart only in helper mode. When this leaf
+        is set to true, the local system does not use Grace-LSAs to
+        indicate that it is restarting, but will accept Grace-LSAs
+        from remote systems, and suppress withdrawl of adjacencies
+        of the system for the grace period specified";
+    }
+  }
+
+  grouping ospfv2-global-mpls-config {
+    description
+      "Configuration parameters for OSPFv2 options which
+      relate to MPLS";
+
+    leaf traffic-engineering-extensions {
+      type boolean;
+      description
+        "When this leaf is set to true, use traffic engineering
+        extensions for OSPF to advertise TE parameters via type 10
+        Opaque LSAs";
+    }
+  }
+
+  grouping ospfv2-global-inter-areapp-config { 
+    description
+      "Configuration parameters for OSPFv2 policies which propagate
+      prefixes between areas";
+
+    leaf src-area {
+      type leafref {
+        // we are at ospf/global/inter-area-propagation-policies/...
+        // inter-area-propagation-policy/config/src-area
+        path "../../../../../areas/area/identifier";
+      }
+      description
+        "The area from which prefixes are to be exported.";
+    }
+
+    leaf dst-area { 
+      type leafref {
+        // we are at ospf/global/inter-area-propagation-policies/...
+        // inter-area-propagation-policy/config/src-area
+        path "../../../../../areas/area/identifier";
+      }
+      description
+        "The destination area to which prefixes are to be imported";
+    }
+
+    uses oc-rpol:apply-policy-import-config;
+  }
+
+  grouping ospfv2-global-max-metric-config {
+    description
+      "Configuration paramters relating to setting the OSPFv2
+      maximum metric.";
+
+    leaf set {
+      type boolean;
+      description
+        "When this leaf is set to true, all non-stub interfaces of
+        the local system are advertised with the maximum metric,
+        such that the router does not act as a transit system,
+        (similarly to the IS-IS overload functionality).";
+      reference
+        "RFC3137 - OSPF Stub Router Advertisement";
+    }
+
+    leaf timeout {
+      type uint64;
+      units "seconds";
+      description
+        "The delay, in seconds, after which the advertisement of
+        entities with the maximum metric should be cleared, and
+        the system reverts to the default, or configured, metrics.";
+    }
+
+    leaf-list include {
+      type identityref {
+        base "oc-ospft:MAX_METRIC_INCLUDE";
+      }
+      description
+        "By default, the maximum metric is advertised for all
+        non-stub interfaces of a device. When identities are
+        specified within this leaf-list, additional entities
+        are also advertised with the maximum metric according
+        to the values within the list.";
+    }
+
+    leaf-list trigger {
+      type identityref {
+        base "oc-ospft:MAX_METRIC_TRIGGER";
+      }
+      description
+        "By default, the maximum metric is only advertised
+        when the max-metric/set leaf is specified as true.
+        In the case that identities are specified within this
+        list, they provide additional triggers (e.g., system
+        boot) that may cause the max-metric to be set. In this
+        case, the system should still honour the timeout specified
+        by the max-metric/timeout leaf, and clear the max-metric
+        advertisements after the expiration of this timer.";
+    }
+  }
+
+  grouping ospfv2-global-structural {
+    description
+      "Top level structural grouping for OSPFv2 global parameters";
+
+    container global {
+      description
+        "Configuration and operational state parameters for settings
+        that are global to the OSPFv2 instance";
+
+      container config {
+        description
+          "Global configuration parameters for OSPFv2";
+        uses ospfv2-global-config;
+      }
+
+      container state {
+        config false;
+        description
+          "Operational state parameters for OSPFv2";
+        uses ospfv2-global-config;
+      }
+
+      container timers {
+        description
+          "Configuration and operational state parameters for OSPFv2
+          timers";
+
+        container spf {
+          description
+            "Configuration and operational state parameters relating
+            to timers governing the operation of SPF runs";
+
+          container config {
+            description
+              "Configuration parameters relating to global OSPFv2
+              SPF timers";
+            uses ospfv2-global-spf-timers-config;
+          }
+
+          container state {
+            config false;
+            description
+              "Operational state parameters relating to the global
+              OSPFv2 SPF timers";
+            uses ospfv2-global-spf-timers-config;
+            uses ospfv2-global-spf-timers-state;
+          }
+        }
+
+        container max-metric {
+          description
+            "Configuration and operational state parameters relating
+            to setting the OSPFv2 maximum metric.";
+
+          container config {
+            description
+              "Configuration parameters relating to setting the OSPFv2
+              maximum metric for a set of advertised entities.";
+            uses ospfv2-global-max-metric-config;
+          }
+
+          container state {
+            config false;
+            description
+              "Operational state parameters relating to setting the
+              OSPFv2 maximum metric for a set of advertised entities.";
+            uses ospfv2-global-max-metric-config;
+          }
+        }
+
+        container lsa-generation {
+          description
+            "Configuration and operational state parameters relating
+            to timers governing the generation of LSAs by the local
+            system";
+
+          container config {
+            description
+              "Configuration parameters relating to the generation of
+              LSAs by the local system";
+            uses ospfv2-global-lsa-generation-timers-config;
+          }
+
+          container state {
+            config false;
+            description
+              "Operational state parameters relating to the generation
+              of LSAs by the local system";
+            uses ospfv2-global-lsa-generation-timers-config;
+            uses ospfv2-global-lsa-generation-timers-state;
+          }
+        }
+      }
+
+      container graceful-restart {
+        description
+          "Configuration and operational state parameters for OSPFv2
+          graceful restart";
+
+        container config {
+          description
+            "Configuration parameters relating to OSPFv2 graceful
+            restart";
+          uses ospfv2-global-graceful-restart-config;
+        }
+
+        container state {
+          config false;
+          description
+            "Operational state parameters relating to OSPFv2 graceful
+            restart";
+          uses ospfv2-global-graceful-restart-config;
+        }
+      }
+
+      container mpls {
+        description
+          "OSPFv2 parameters relating to MPLS";
+
+        container config {
+          description
+            "Configuration parameters relating to MPLS for OSPFv2";
+          uses ospfv2-global-mpls-config;
+        }
+
+        container state {
+          config false;
+          description
+            "Operational state parameters relating to MPLS for
+            OSPFv2";
+          uses ospfv2-global-mpls-config;
+        }
+
+        container igp-ldp-sync {
+          description
+            "OSPFv2 parameters relating to LDP/IGP synchronization";
+
+          container config {
+            description
+              "Configuration parameters relating to LDP/IG
+              synchronization.";
+            uses ospfv2-common-mpls-igp-ldp-sync-config;
+          }
+
+          container state {
+            config false;
+            description
+              "Operational state variables relating to LDP/IGP
+              synchronization";
+            uses ospfv2-common-mpls-igp-ldp-sync-config;
+          }
+        }
+      }
+
+      container inter-area-propagation-policies {
+        description
+          "Policies defining how inter-area propagation should be performed
+          by the OSPF instance";
+
+        list inter-area-propagation-policy {
+          key "src-area dst-area";
+          description
+            "A list of connections between pairs of areas - routes are
+            propagated from the source (src) area to the destination (dst)
+            area according to the policy specified";
+
+          leaf src-area {
+            type leafref {
+              path "../config/src-area";
+            }
+            description
+              "Reference to the source area";
+          }
+
+          leaf dst-area {
+            type leafref {
+              path "../config/dst-area";
+            }
+            description
+              "Reference to the destination area";
+          }
+
+          container config {
+            description
+              "Configuration parameters relating to the inter-area
+              propagation policy";
+            uses ospfv2-global-inter-areapp-config;
+          }
+
+          container state {
+            config false;
+            description
+              "Operational state parameters relating to the inter-area
+              propagation policy";
+            uses ospfv2-global-inter-areapp-config;
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/models/openconfig/src/main/yang/ospf/openconfig-ospfv2-lsdb.yang b/models/openconfig/src/main/yang/ospf/openconfig-ospfv2-lsdb.yang
new file mode 100644
index 0000000..9964191
--- /dev/null
+++ b/models/openconfig/src/main/yang/ospf/openconfig-ospfv2-lsdb.yang
@@ -0,0 +1,2343 @@
+submodule openconfig-ospfv2-lsdb {
+
+  belongs-to openconfig-ospfv2 {
+    prefix "oc-ospfv2";
+  }
+
+  // import some basic types
+  import ietf-yang-types { prefix "yang"; }
+  import ietf-inet-types { prefix "inet"; }
+  import openconfig-types { prefix "oc-types"; }
+  import openconfig-extensions { prefix "oc-ext"; }
+  import openconfig-ospf-types { prefix "oc-ospf-types"; }
+
+  // meta
+  organization "OpenConfig working group";
+
+  contact
+    "OpenConfig working group
+    www.openconfig.net";
+
+  description
+    "An OpenConfig model for the Open Shortest Path First (OSPF)
+    version 2 link-state database (LSDB)";
+
+  oc-ext:openconfig-version "0.1.0";
+
+  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-lsdb-common-prefix-properties {
+    description
+      "Common properties used in the LSDB that relate to IPv4 prefixes";
+
+    leaf prefix-length {
+      type uint8 {
+        range "0..32";
+      }
+      description
+        "The length of the IPv4 prefix contained in the Extended Prefix LSA";
+    }
+
+    leaf address-family {
+      // TODO: should this be an identity?
+      type enumeration {
+        enum IPV4_UNICAST {
+          value 0;
+          description
+            "The prefix contained within the Extended Prefix LSA is an IPv4
+            unicast prefix";
+        }
+      }
+      description
+        "The address family of the prefix contained in the Extended Prefix
+        LSA";
+    }
+  }
+
+  grouping ospfv2-lsdb-common-link-specification {
+    description
+      "Generic attributes used to identify links within OSPFv2";
+
+    leaf link-id {
+      type yang:dotted-quad;
+      description
+        "The identifier for the link specified. The value of the link
+        identifier is dependent upon the type of the LSA. The value is
+        specified to be, per sub-type:
+          1) Neighbouring router's router ID.
+          2) IP address of DR.
+          3) IP network address.
+          4) Neighbouring router router's ID.";
+    }
+
+    leaf link-data {
+      type union {
+        type yang:dotted-quad;
+        type uint32;
+      }
+      description
+        "The data associated with the link type. The value is
+        dependent upon the subtype of the LSA. When the connection is
+        to a stub network it represents the mask; for p2p connections
+        that are unnumbered it represents the ifIndex value of the
+        router's interface; for all other connections it represents
+        the local system's IP address";
+    }
+
+  }
+
+  grouping ospfv2-lsdb-common-unknown-tlv {
+    description
+      "A generic specification of a TLV to be used when the
+      value cannot be decoded by the local system";
+
+    leaf type {
+      type uint16;
+      description
+        "The type value of the unknown TLV";
+    }
+
+    leaf length {
+      type uint16;
+      description
+        "The length value of the unknown TLV";
+    }
+
+    leaf value {
+      type binary;
+      description
+        "The value portion of the unknwon TLV";
+    }
+  }
+
+  grouping ospfv2-lsdb-common-unknown-tlv-structure {
+    description
+      "A generic specification of an unknown TLV";
+
+    container unknown-tlv {
+      description
+        "An unknown TLV within the context. Unknown TLVs are
+        defined to be the set of TLVs that are not modelled
+        within the OpenConfig model, or are unknown to the
+        local system such that it cannot decode their value.";
+
+      container state {
+        description
+          "Contents of an unknown TLV within the LSA";
+        uses ospfv2-lsdb-common-unknown-tlv;
+      }
+    }
+  }
+
+  grouping ospfv2-lsdb-common-unknown-subtlv-structure {
+    description
+      "A generic specification of an unknown TLV";
+
+    container unknown-subtlv {
+      description
+        "An unknown SubTLV within the context. Unknown Sub-TLV
+        are defined to be the set of SubTLVs that are not modelled
+        by the OpenConfig schema, or are unknown to the local system
+        such that it cannot decode their value.";
+
+      container state {
+        description
+          "Contents of an unknown TLV within the LSA";
+        uses ospfv2-lsdb-common-unknown-tlv;
+      }
+    }
+  }
+
+  grouping ospfv2-lsdb-common-tos-metric {
+    description
+      "Common LSDB LSA parameters for type of service and metric";
+
+    leaf tos {
+      type uint8;
+      description
+        "OSPF encoding of the type of service referred to by this
+        LSA. Encoding for OSPF TOS are described in RFC2328.";
+    }
+
+    leaf metric {
+      type oc-ospf-types:ospf-metric;
+      description
+        "The metric value to be used for the TOS specified. This value
+        represents the cost of use of the link for the specific type
+        of service.";
+    }
+  }
+
+  grouping ospfv2-lsdb-common-sr-sid-spec {
+    description
+      "Re-usable specification of a segment routing SID";
+
+    leaf sid-type {
+      type oc-ospf-types:sr-sid-type;
+      description
+        "The type of the value contained within the sub-TLV";
+    }
+
+    leaf sid-value {
+      type uint32;
+      description
+        "The value of the binding included within the sub-TLV. The type of
+        this binding is indicated by the type leaf.";
+    }
+  }
+
+  grouping ospfv2-lsdb-area-state {
+    description
+      "Per-area operational state parameters for an OSPFv2 area";
+
+    leaf identifier {
+      type oc-ospf-types:ospf-area-identifier;
+      description
+        "An identifier for the area, expressed as a dotted quad or
+        an unsigned 32-bit integer";
+    }
+  }
+
+  grouping ospfv2-lsdb-area-lsa-type-state {
+    description
+      "Per-LSA type operational state parameters for an OSPFv2 area";
+
+    leaf type {
+      type identityref {
+        base "oc-ospf-types:OSPF_LSA_TYPE";
+      }
+      description
+        "The type of LSA being described. The type of the LSA is
+        expressed as a canonical name.";
+    }
+  }
+
+  grouping ospfv2-lsdb-area-lsa-state {
+    description
+      "Generic parameters of an OSPFv2 LSA";
+
+    leaf link-state-id {
+      type yang:dotted-quad;
+      description
+        "The Link State ID for the specified LSA type. The exact
+        defined value of the Link State ID is dependent on the LSA
+        type.";
+    }
+
+    leaf advertising-router {
+      type yang:dotted-quad;
+      description
+        "The router ID of the router that originated the LSA";
+    }
+
+    leaf sequence-number {
+      type int32;
+      description
+        "A signed 32-bit integer used to detect old and duplicate
+        LSAs. The greater the sequence number the more recent the
+        LSA.";
+    }
+
+    leaf checksum {
+      type uint16;
+      description
+        "The checksum of the complete contents of the LSA excluding
+        the age field.";
+    }
+
+    leaf age {
+      type uint16;
+      units seconds;
+      description
+        "The time since the LSA's generation in seconds";
+    }
+  }
+
+  grouping ospfv2-lsdb-router-lsa-structure {
+    description
+      "Structural grouping for Router LSA contents within the LSDB";
+
+    container router-lsa {
+      description
+        "Contents of the router LSA";
+
+      container state {
+        description
+          "State parameters of the router LSA";
+        uses ospfv2-lsdb-router-lsa-state;
+      }
+
+      uses ospfv2-lsdb-generic-lsa-tos-metric-structure;
+    }
+  }
+
+  grouping ospfv2-lsdb-generic-lsa-tos-metric-structure {
+    description
+      "Grouping including a generic TOS/metric structure for an
+      LSA";
+
+    container types-of-service {
+      description
+        "Breakdown of LSA contents specifying multiple
+        TOS values";
+
+      list type-of-service {
+        key "tos";
+        description
+          "Per-type of service parameters for the LSA";
+
+        leaf tos {
+          type leafref {
+            path "../state/tos";
+          }
+          description
+            "Reference to the type of service identifier which is
+            specified in the LSA";
+        }
+
+        container state {
+          description
+            "Per-TOS parameters for the LSA";
+
+          uses ospfv2-lsdb-generic-lsa-tos-metric-state;
+        }
+      }
+    }
+  }
+
+  grouping ospfv2-lsdb-network-lsa-structure {
+    description
+      "Structural grouping for Network LSA contents within the LSDB";
+
+    container network-lsa {
+      description
+        "Contents of the network LSA";
+
+      container state {
+        description
+          "State parameters of the network LSA";
+        uses ospfv2-lsdb-network-lsa-state;
+      }
+    }
+  }
+
+  grouping ospfv2-lsdb-summary-lsa-structure {
+    description
+      "Structural grouping for the Summary LSA contents within the
+      LSDB";
+
+    container summary-lsa {
+      description
+        "Contents of the summary LSA";
+
+      container state {
+        description
+          "State parameters of the summary LSA";
+        uses ospfv2-lsdb-summary-lsa-state;
+      }
+
+      uses ospfv2-lsdb-generic-lsa-tos-metric-structure;
+    }
+  }
+
+  grouping ospfv2-lsdb-asexternal-lsa-structure {
+    description
+      "Structural grouping for the AS External LSA contents within
+      the LSDB";
+
+    container as-external-lsa {
+      description
+        "Contents of the AS External LSA";
+
+      container state {
+        description
+          "State parameters for the AS external LSA";
+        uses ospfv2-lsdb-asexternal-lsa-state;
+      }
+
+      container types-of-service {
+        description
+          "Breakdown of External LSA contents specifying multiple
+          TOS values";
+
+        list type-of-service {
+          key "tos";
+          description
+            "Per-type of service parameters for the AS External LSA";
+
+          leaf tos {
+            type leafref {
+              path "../state/tos";
+            }
+            description
+              "Reference to the type of service identifier which is
+              specified in the AS External LSA";
+          }
+
+          container state {
+            description
+              "Per-TOS parameters for the LSA";
+
+            uses ospfv2-lsdb-asexternal-tos-state;
+          }
+        }
+      }
+
+    }
+  }
+
+  grouping ospfv2-lsdb-nssa-external-lsa-structure {
+    description
+      "Structural grouping for the NSSA External LSA contents within
+      the LSDB";
+
+    container nssa-external-lsa {
+      description
+        "Contents of the NSSA External LSA";
+
+      container state {
+        description
+          "State parameters for the AS external LSA";
+        // Type 7 LSAs are are a super-set of Type 5 LSAs so we simply
+        // include the Type 5
+        uses ospfv2-lsdb-asexternal-lsa-state;
+        uses ospfv2-lsdb-nssa-external-lsa-state;
+      }
+
+      container types-of-service {
+        description
+          "Breakdown of the NSSA External LSA contents specifying multiple
+          TOS values";
+
+        list type-of-service {
+          key "tos";
+          description
+            "Per-type of service parameters for the NSSA external LSA";
+
+          leaf tos {
+            type leafref {
+              path "../state/tos";
+            }
+            description
+              "Reference to the type of services identifier which is specified
+              in the NSSA External LSA";
+          }
+
+          container state {
+            description
+              "Per-TOS parameters for the LSA";
+            uses ospfv2-lsdb-asexternal-tos-state;
+          }
+        }
+      }
+    }
+  }
+
+  grouping ospfv2-lsdb-opaque-lsa-structure {
+    description
+      "Structural grouping for Opaque LSA contents within the LSDB";
+
+    container opaque-lsa {
+      description
+        "Contents of the opaque LSA";
+
+      container state {
+        description
+          "State parameters for the opaque LSA";
+        uses ospfv2-lsdb-opaque-lsa-state;
+      }
+
+      container traffic-engineering {
+        when "../state/type = 'TRAFFIC_ENGINEERING'" {
+          description
+            "Include the traffic-engineering information when
+            the Opaque LSA being described is a Traffic Engineering
+            LSA";
+        }
+        description
+          "Contents of the Traffic Engineering Opaque LSA";
+
+        container tlvs {
+          description
+            "The TLVs contained in the TE Opaque LSA";
+          list tlv {
+            // this is an unkeyed list
+            description
+              "The Type-Length-Value tuples included in the TE LSA";
+
+            container state {
+              description
+                "The contents of the TLV tuple within the TE LSA";
+              uses ospfv2-lsdb-opaque-lsa-te-tlv-state;
+            }
+
+            uses ospfv2-lsdb-common-unknown-tlv-structure;
+
+            container router-address {
+              when "../state/type = 'TE_ROUTER_ADDRESS'" {
+                description
+                  "Include the router address container only when the type
+                  of the TLV is Router Address";
+              }
+
+              description
+                "Parameters included in the Router Address TLV";
+
+              container state {
+                description
+                  "State parameters of the router address TLV";
+                uses ospfv2-lsdb-opaque-te-router-address-state;
+              }
+            }
+
+            container link {
+              when "../state/type = 'TE_ROUTER_LINK'" {
+                description
+                  "Include the link container only when the type of the
+                  TLV describes a traffic engineering link";
+              }
+
+              description
+                "Parameters included in the Link TLV";
+              container sub-tlvs {
+                description
+                  "Sub-TLVs included in the Link TLV";
+
+                list sub-tlv {
+                  // unkeyed list
+                  description
+                    "The Sub-TLVs included within the Traffic Engineering
+                    LSA's sub-TLV";
+
+                  container state {
+                    description
+                      "State parameters of the Link Sub-TLV";
+
+                    uses ospfv2-lsdb-opaque-te-link-state;
+                  }
+
+                  uses ospfv2-lsdb-common-unknown-subtlv-structure;
+
+                  container unreserved-bandwidths {
+                    description
+                      "The unreserved link bandwidths for the Traffic
+                      Engineering LSA - utilised when the sub-TLV type
+                      indicates that the sub-TLV describes unreserved
+                      bandwidth";
+
+                    list unreserved-bandwidth {
+                      key "priority";
+
+                      description
+                        "The unreserved bandwidth at each priority level";
+
+                      leaf priority {
+                        type leafref {
+                          path "../state/priority";
+                        }
+                        description
+                          "A reference to the priority level being described";
+                      }
+
+                      container state {
+                        description
+                          "State parameters relating to the unreserved
+                          bandwidth of the link being described";
+                        uses ospfv2-lsdb-opaque-te-link-unreserved-bw-state;
+                      }
+                    }
+                  }
+
+                  container administrative-groups {
+                    description
+                      "The administrative groups that are set for the
+                      Traffic Engineering LSA - utilised when the sub-TLV type
+                      indicates that the sub-TLV describes administrative
+                      groups";
+
+                    list admin-group {
+                      key "bit-index";
+
+                      description
+                        "The administrative group described within the
+                        sub-TLV";
+
+                      leaf bit-index {
+                        type leafref {
+                          path "../state/bit-index";
+                        }
+                        description
+                          "A reference to the bit index being described";
+                      }
+
+                      container state {
+                        description
+                          "State parameters relating to the administrative
+                          groups being described for the link";
+                        uses ospfv2-lsdb-opaque-te-link-admin-group-state;
+                      }
+                    }
+                  }
+                }
+              }
+            }
+
+            container node-attribute {
+              when "../state/type = 'TE_NODE_ATTRIBUTE'" {
+                description
+                  "Include the node-attribute container only when the type of
+                  the TLV describes a node attribute";
+              }
+
+              description
+                "Parameters included in the Node Attribute TLV";
+
+              container sub-tlvs {
+                description
+                  "Sub-TLVs of the Node Attribute TLV of the Traffic
+                  Engineering LSA";
+
+                list sub-tlv {
+                  // unkeyed list
+                  description
+                    "List of the Sub-TLVs contained within the Node Attribute
+                    TLV";
+
+                  container state {
+                    description
+                      "State parameters of the Node Attribute TLV sub-TLV";
+                    uses ospfv2-lsdb-opaque-te-node-attribute-state;
+                  }
+
+                  uses ospfv2-lsdb-common-unknown-subtlv-structure;
+                }
+              }
+            }
+
+            // A set of TLVs are omitted here - based on operational
+            // requirements, these are:
+            // * link-local
+            // * ipv6-address (OSPFv3 only)
+            // * optical-node-property
+          }
+        }
+      } // traffic-engineering
+
+      container grace-lsa {
+        when "../state/type = 'GRACE_LSA'" {
+          description
+            "Include the grace-lsa container when the opaque LSA is specified
+            to be of that type.";
+        }
+
+        description
+          "The Grace LSA is utilised when a remote system is undergoing
+          graceful restart";
+
+        container tlvs {
+          description
+            "TLVs of the Grace LSA";
+
+          list tlv {
+            description
+              "TLV entry in the Grace LSA, advertised by a system undergoing
+              graceful restart";
+
+            // unkeyed list
+            container state {
+              description
+                "Per-TLV state parameters of the Grace LSA";
+              uses ospfv2-lsdb-opaque-grace-state;
+            }
+            uses ospfv2-lsdb-common-unknown-tlv-structure;
+          }
+        }
+      } // grace LSA
+
+      container router-information {
+        when "../state/type = 'ROUTER_INFORMATION_LSA'" {
+          description
+            "Include the router-information container when the opaque LSA
+            type is specified to be an RI LSA";
+        }
+
+        description
+          "The router information LSA is utilised to advertise capabilities
+          of a system to other systems who receive the LSA";
+
+        container tlvs {
+          description
+            "The TLVs included within the Router Information LSA.";
+
+          list tlv {
+            description
+              "TLV entry in the Router Information LSA";
+
+            // unkeyed list
+            container state {
+              description
+                "Per-TLV state parameters of the RI LSA";
+              uses ospfv2-lsdb-opaque-ri-state;
+            }
+
+            uses ospfv2-lsdb-common-unknown-tlv-structure;
+
+            container informational-capabilities {
+              when "../state/type = 'RI_INFORMATIONAL_CAPABILITIES'" {
+                description
+                  "Include the informational capabilities specification when
+                  the TLV of the RI LSA is specified to be of this type";
+              }
+
+              description
+                "Information related to the capabilities of the advertising
+                router within the scope that the opaque RI LSA is being
+                advertised";
+
+              container state {
+                description
+                  "State parameters of the informational capabilitis of the
+                  RI LSA";
+                uses ospfv2-lsdb-opaque-ri-informational-state;
+              }
+            }
+
+            container node-administrative-tags {
+              when "../state/type = 'RI_NODE_ADMIN_TAG'" {
+                description
+                  "Include the node administrative tags specification when
+                  the TLV of the RI LSA is specified to be of this type";
+              }
+
+              description
+                "Per-node administrative tags associated with the local system
+                specified by the operator";
+
+              container state {
+                description
+                  "State parameters of the node administrative tags advertised
+                  in the RI LSA";
+                uses ospfv2-lsdb-opaque-ri-admintag-state;
+              }
+            }
+
+            container segment-routing-algorithm {
+              when "../state/type = 'RI_SR_ALGORITHM'" {
+                description
+                  "Include the segment routing algorithm specific parameters when
+                  the TLV of the RI LSA is specified to be of this type";
+              }
+
+              description
+                "The algorithms supported for Segment Routing by the local system";
+
+              container state {
+                description
+                  "State parameters of the Segment Routing algorithm advertised in
+                  the RI LSA";
+                uses ospfv2-lsdb-opaque-ri-sralgo-state;
+              }
+            }
+
+            container segment-routing-sid-label-range {
+              when "../state/type = 'RI_SR_SID_LABEL_RANGE'" {
+                description
+                  "Include the segment routing SID/Label range TLV specific state when
+                  the TLV of the RI LSA is specified to be of this type";
+              }
+
+              description
+                "The Segment Identifier (SID) or label ranges that are supported by
+                the local system for Segment Routing";
+
+              container tlvs {
+                description
+                  "Sub-TLVs of the SID/Label range TLV of the RI LSA";
+
+                list tlv {
+                  // unkeyed list
+                  description
+                    "Sub-TLVs of the SID/Label range TLV";
+
+                  uses ospfv2-lsdb-common-unknown-tlv-structure;
+
+                  container state {
+                    description
+                      "State parameters of the sub-TLVs of the SR/Label range TLV";
+                    uses ospfv2-lsdb-opaque-ri-srrange-tlv-state;
+                  }
+
+                  container sid-label {
+                    description
+                      "Sub-TLV used to advertise the SID or label associated with the
+                      subset of the SRGB being advertised";
+
+                    container state {
+                      description
+                        "State parameters of the SID/Label sub-TLV of the SR/Label
+                        range TLV of the RI LSA";
+                      uses ospfv2-lsdb-opaque-ri-srrange-sid-label-tlv-state;
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      } // router-information
+
+      container extended-prefix {
+        when "../state/type = 'OSPFV2_EXTENDED_PREFIX'" {
+          description
+            "Include the extended-prefix container when the opaque LSA
+            type is specified to be an extended prefix LSA";
+        }
+
+        description
+          "An OSPFv2 Extended Prefix Opaque LSA, used to encapsulate
+          TLV attributes associated with a prefix advertised in OSPF.";
+
+        reference "RFC7684 - OSPFv2 Prefix/Link Attribute Advertisement";
+
+        container state {
+          description
+            "State parameters of the Extended Prefix LSA";
+          uses ospfv2-lsdb-extended-prefix-state;
+        }
+
+        container tlvs {
+          description
+            "TLVs contained within the Extended Prefix LSA";
+
+          list tlv {
+            // unkeyed list
+            description
+              "A TLV contained within the extended prefix LSA";
+
+            container state {
+              description
+                "State parameters relating to the sub-TLV of the extended
+                prefix LSA";
+              uses ospfv2-lsdb-extended-prefix-tlv-state;
+            }
+
+            container extended-prefix-range {
+              when "../state/type = 'EXTENDED_PREFIX_RANGE'" {
+                description
+                  "Include the prefix range sub-TLV when the type of the
+                  sub-TLV is specified as such";
+              }
+
+              description
+                "State parameters relating to the extended prefix range
+                sub-TLV of the extended prefix LSA";
+
+              container state {
+                description
+                  "State parameters relating to the Extended Prefix Range
+                  sub-TLV of the Extended Prefix LSA";
+                uses ospfv2-lsdb-extended-prefix-range-state;
+              }
+            }
+
+            container prefix-sid {
+              when "../state/type = 'PREFIX_SID'" {
+                description
+                  "Include parameters relating to the Prefix SID when the type
+                  of the sub-TLV is indicated as such";
+              }
+
+              description
+                "State parameters relating to the Prefix SID sub-TLV of the
+                extended prefix LSA";
+
+              container state {
+                description
+                  "State parameters relating to the Prefix SID sub-TLV of the
+                  extended prefix LSA";
+                uses ospfv2-lsdb-extended-prefix-prefix-sid-state;
+              }
+            } // prefix-sid
+
+            container sid-label-binding {
+              when "../state/type = 'SID_LABEL_BINDING'" {
+                description
+                  "Include parameters relating to the SID/Label binding sub-TLV
+                  only when the type is indicated as such";
+              }
+
+              description
+                "State parameters relating to the SID/Label binding sub-TLV
+                of the extended prefix LSA";
+
+              container state {
+                description
+                  "State parameters relating to the SID/Label binding sub-TLV
+                  of the extended prefix LSA";
+                uses ospfv2-lsdb-extended-prefix-sid-label-binding-state;
+              }
+
+              container tlvs {
+                description
+                  "TLVs contained within the SID/Label Binding sub-TLV of the
+                  SID/Label Binding TLV";
+
+                list tlv {
+                  description
+                    "A TLV contained within the SID/Label Binding sub-TLV";
+
+                  container state {
+                    description
+                      "State parameters relating to the SID/Label Binding
+                      sub-TLV";
+                    uses ospfv2-lsdb-extended-prefix-sid-label-binding-tlv-state;
+                  }
+
+                  container sid-label-binding {
+                    when "../state/type = 'SID_LABEL_BINDING'" {
+                      description
+                        "Include the SID/Label Binding sub-TLV parameters only
+                        when the type is indicated as such";
+                    }
+
+                    description
+                      "Parameters for the SID/Label Binding sub-TLV of the
+                      SID/Label binding TLV";
+
+                    container state {
+                      description
+                        "State parameteres relating to the SID/Label Binding
+                        sub-TLV";
+                      uses ospfv2-lsdb-extprefix-sid-label-binding-state;
+                    }
+                  } // sid-label-binding
+
+                  container ero-metric {
+                    when "../state/type = 'ERO_METRIC'" {
+                      description
+                        "Include the ERO Metric sub-TLV parameters only when
+                        the type is indicated as such";
+                    }
+
+                    description
+                      "Parameters for the ERO Metric Sub-TLV of the SID/Label
+                      binding TLV";
+
+                    container state {
+                      description
+                        "State parameters relating to the ERO Metric Sub-TLV of
+                        the SID/Label binding TLV";
+                      uses ospfv2-lsdb-extprefix-sid-label-ero-metric-state;
+                    }
+                  } // ero-metric
+
+                  container ero-path {
+                    when "../state/type = 'ERO_PATH'" {
+                      description
+                        "Include the ERO Path sub-TLV parameters only when the
+                        type is indicated as such";
+                    }
+
+                    description
+                      "Parameters for the ERO Path Sub-TLV of the SID/Label
+                      binding TLV";
+
+                    container segments {
+                      description
+                        "Segments of the path described within the SID/Label
+                        Binding sub-TLV";
+
+                      list segment {
+                        description
+                          "A segment of the path described within the sub-TLV";
+
+                        container state {
+                          description
+                            "State parameters relating to the path segment
+                            contained within the sub-TLV";
+                          uses ospfv2-lsdb-extprefix-sid-lbl-ero-path-seg-state;
+                        }
+
+                        container ipv4-segment {
+                          when "../state/type = 'IPV4_SEGMENT'" {
+                            description
+                              "Include the IPv4 segment only when the type is
+                              indicated as such";
+                          }
+
+                          description
+                            "Details of the IPv4 segment interface of the ERO";
+
+                          container state {
+                            description
+                              "State parameters of the IPv4 segment of the ERO";
+                            uses ospfv2-lsdb-extprefix-sid-lbl-ero-ipv4-state;
+                          }
+                        } // ipv4-segment
+
+                        container unnumbered-hop {
+                          when "../state/type = 'UNNUMBERED_INTERFACE_SEGMENT'" {
+                            description
+                              "Include the unnumbered segment only when the
+                              type is indicated as such";
+                          }
+
+                          description
+                            "Details of the unnumbered interface segment of the
+                            ERO";
+
+                          container state {
+                            description
+                              "State parameters of the unnumbered interface
+                              segment of the ERO";
+                            uses ospfv2-lsdb-extprefix-sid-lbl-ero-unnum-state;
+                          }
+                        } // unnumbered-hop
+                      } // tlv
+                    } // tlvs
+                  }
+                }
+              }
+            } // sid-label-binding
+
+            uses ospfv2-lsdb-common-unknown-tlv-structure;
+          }
+        }
+      } // extended-prefix
+
+      container extended-link {
+        description
+          "The OSPFv2 Extended Link Opaque LSA, used to encapsulate TLV
+          attributes associated with a link advertised in OSPF.";
+
+        reference "RFC7684 - OSPFv2 Prefix/Link Attribute Advertisement";
+
+        container state {
+          description
+            "State parameters of the Extended Link LSA";
+          uses ospfv2-lsdb-extended-link-state;
+        }
+
+        container tlvs {
+          description
+            "TLVs contained within the Extended Link LSA";
+
+          list tlv {
+            description
+              "List of TLVs within the Extended Link LSA";
+
+            container state {
+              description
+                "State parameters relating to the sub-TLV of the extended link
+                LSA";
+              uses ospfv2-lsdb-extended-link-tlv-state;
+            }
+
+            uses ospfv2-lsdb-common-unknown-tlv-structure;
+
+            container adjacency-sid {
+              when "../state/type = 'ADJACENCY_SID'" {
+                description
+                  "Include the Adjacency SID parameters only when the type of
+                  the sub-TLV is indicated as such";
+              }
+
+              description
+                "Parameters relating to an Adjacency SID sub-TLV of the
+                extended link LSA";
+
+              container state {
+                description
+                  "State parameters relating to an Adjacency SID";
+
+                uses ospfv2-lsdb-extended-link-adj-sid-state;
+              }
+            }
+          }
+        }
+
+      } // extended-link
+
+      uses ospfv2-lsdb-common-unknown-tlv-structure;
+    }
+  }
+
+  grouping ospfv2-lsdb-generic-lsa-tos-metric-state {
+    description
+      "Per-TOS state parameters for the Router LSA";
+
+    uses ospfv2-lsdb-common-tos-metric;
+  }
+
+  grouping ospfv2-lsdb-router-lsa-state {
+    description
+      "Parameters of the router LSA";
+
+    leaf type {
+      type identityref {
+        base "oc-ospf-types:ROUTER_LSA_TYPES";
+      }
+      description
+        "The sub-type of the Router LSA.";
+    }
+
+    uses ospfv2-lsdb-common-link-specification;
+
+    leaf metric {
+      type oc-ospf-types:ospf-metric;
+      description
+        "The cost of utilising the link specified independent of TOS";
+    }
+
+    leaf number-links {
+      type uint16;
+      description
+        "The number of links that are described within the LSA";
+    }
+
+    leaf number-tos-metrics {
+      type uint16;
+      description
+        "The number of different TOS metrics given for this link, not
+        including the link metric (which is referred to as TOS 0).";
+    }
+  }
+
+  grouping ospfv2-lsdb-network-lsa-state {
+    description
+      "Parameters of the Network LSA";
+
+    leaf network-mask {
+      type uint8 {
+        range "0..32";
+      }
+      description
+        "The mask of the network described by the Network LSA
+        represented as a CIDR mask.";
+    }
+
+    leaf-list attached-router {
+      type yang:dotted-quad;
+      description
+        "A list of the router ID of the routers that are attached to
+        the network described by the Network LSA";
+    }
+  }
+
+  grouping ospfv2-lsdb-summary-lsa-state {
+    description
+      "Parameters of the Summary LSA";
+
+    leaf network-mask {
+      type uint8 {
+        range "0..32";
+      }
+      description
+        "The mask of the network described by the Summary LSA
+        represented as a CIDR mask.";
+    }
+  }
+
+  grouping ospfv2-lsdb-asexternal-lsa-common-parameters {
+    description
+      "Common parameters that are used for OSPFv2 AS External LSAs";
+
+    leaf forwarding-address {
+      type inet:ipv4-address-no-zone;
+      description
+        "The destination to which traffic for the external prefix
+        should be advertised. When this value is set to 0.0.0.0 then
+        traffic should be forwarded to the LSA's originator";
+    }
+
+    leaf external-route-tag {
+      type uint32;
+      description
+        "An opaque tag that set by the LSA originator to carry
+        information relating to the external route";
+    }
+  }
+
+  grouping ospfv2-lsdb-asexternal-lsa-state {
+    description
+      "Parameters for the AS External LSA";
+
+    leaf mask {
+      type uint8 {
+        range "0..32";
+      }
+      description
+        "The subnet mask for the advertised destination";
+    }
+
+    leaf metric-type {
+      type enumeration {
+        enum "TYPE_1" {
+          description
+            "When the metric of a prefix is specified as Type 1
+            then it is considered to be expressed in the same units as
+            the link-state metrics carried in OSPF. That is to say
+            that the metric advertised is directly compared to the
+            internal cost";
+        }
+        enum "TYPE_2" {
+          description
+            "When the metric of a prefix is specified as Type 2 then
+            it is considered to be expressed as a cost in addition to
+            that of the link-state metric to the advertising router.
+            That is to say that the metric is considered to be the
+            cost to the advertising router plus the advertised metric
+            for the external entity";
+        }
+      }
+      description
+        "The type of metric included within the AS External LSA.";
+    }
+
+    leaf metric {
+      type oc-ospf-types:ospf-metric;
+      description
+        "The cost to reach the external network specified. The exact
+        interpretation of this cost is dependent on the type of
+        metric specified";
+    }
+
+    uses ospfv2-lsdb-asexternal-lsa-common-parameters;
+  }
+
+  grouping ospfv2-lsdb-asexternal-tos-state {
+    description
+      "Per-TOS parameters for the AS External LSA";
+
+    uses ospfv2-lsdb-asexternal-lsa-common-parameters;
+    uses ospfv2-lsdb-common-tos-metric;
+  }
+
+  grouping ospfv2-lsdb-nssa-external-lsa-state {
+    description
+      "Operational state parameters specific to the NSSA External
+      LSA";
+
+    leaf propagate {
+      type boolean;
+      description
+        "When this bit is set to true, an NSSA border router will
+        translate a Type 7 LSA (NSSA External) to a Type 5 LSA
+        (AS External).";
+      reference "RFC3101, Section 2.3";
+    }
+  }
+
+  grouping ospfv2-lsdb-opaque-lsa-state {
+    description
+      "Operational state parameters specific to an Opaque LSA";
+
+    leaf scope {
+      type enumeration {
+        enum LINK {
+          description
+            "The scope of the LSA is the current link. The LSA
+            is not flooded beyond the local network. This
+            enumeration denotes a Type 9 LSA.";
+        }
+        enum AREA {
+          description
+            "The scope of the LSA is the local area. The LSA
+            is not flooded beyond the area of origin. This
+            enumeration denotes a Type 10 LSA.";
+        }
+        enum AS {
+          description
+            "The scope of the LSA is the local autonomous
+            system (AS). The flooding domain is the same
+            as a Type 5 LSA - it is not flooded into
+            stub areas or NSSAs. This enumeration denotes a
+            Type 11 LSA.";
+        }
+      }
+      description
+        "The scope of the opaque LSA. The type of the LSA
+        indicates its scope - the value of this leaf
+        determines both the flooding domain, and the type
+        of the LSA.";
+    }
+
+    leaf type {
+      type identityref {
+        base "oc-ospf-types:OSPF_OPAQUE_LSA_TYPE";
+      }
+      description
+        "The Opaque Type of the LSA. This value is used to
+        indicate the type of data carried by the opaque LSA";
+    }
+  }
+
+  grouping ospfv2-lsdb-opaque-lsa-te-tlv-state {
+    description
+      "The contents of the Traffic Engineering LSA";
+
+    leaf type {
+      type identityref {
+        base "oc-ospf-types:OSPF_TE_LSA_TLV_TYPE";
+      }
+      description
+        "The type of TLV within the Traffic Engineering LSA";
+    }
+  }
+
+  grouping ospfv2-lsdb-opaque-te-unknown-state {
+    description
+      "The contents of the unknown TLV within the Traffic Engineering LSA";
+
+    uses ospfv2-lsdb-common-unknown-tlv;
+  }
+
+  grouping ospfv2-lsdb-opaque-te-link-state {
+    description
+      "The contents of the sub-TLVs of a Traffic Engineering LSA Link TLV";
+
+    leaf type {
+      type union {
+        type identityref {
+          base "oc-ospf-types:OSPF_TE_LINK_TLV_TYPE";
+        }
+        type enumeration {
+          enum UNKNOWN {
+            description
+              "The sub-TLV received in the LSA is unknown to the local
+              system";
+          }
+        }
+      }
+      description
+        "The sub-TLV type specified in the Link TLV. When the value is
+        known by the local system, a canonical name of the sub-TLV is utilised
+        - the special UNKNOWN value indicates that the system did not
+        support the sub-TLV type received in the LSA.";
+    }
+
+    leaf unknown-type {
+      when "../type = 'UNKNOWN'" {
+        description
+          "Include the unknown type field only when the sub-TLV was not
+          known to the local system";
+      }
+
+      type uint16;
+      description
+        "The value of the type field of an unknown sub-TLV";
+    }
+
+    leaf unknown-value {
+      when "../type = 'UNKNOWN'" {
+        description
+          "Include the unknown value field only when the sub-TLV was not
+          known to the local system";
+      }
+
+      type binary;
+      description
+        "The binary contents of the unknown TLV";
+    }
+
+    leaf link-type {
+      when "../type = 'TE_LINK_TYPE'" {
+        description
+          "Include the link-type field only when the sub-TLV type was a TE
+          link type";
+      }
+
+      type enumeration {
+        enum POINT_TO_POINT {
+          description
+            "The link being described by the TE LSA Link sub-TLV is a
+            point-to-point link to exactly one other system";
+        }
+        enum MULTI_ACCESS {
+          description
+            "The link being described by the TE LSA Link sub-TLV is a
+            multi-access link that supports connectivity to multiple remote
+            systems";
+        }
+        enum UNKNOWN {
+          description
+            "The link type received was unknown to the local system";
+        }
+      }
+      description
+        "The type of the link that is being described by the TE LSA Link
+        sub-TLV";
+    }
+
+    leaf link-id {
+      when "../type = 'TE_LINK_ID'" {
+        description
+          "Include the link ID field only when the sub-TLV type was a TE
+          Link identifier";
+      }
+
+      type yang:dotted-quad;
+      description
+        "The ID of the remote system. For point-to-point links, this is the
+        router ID of the neighbor. For multi-access links it is the address
+        of the designated router.";
+    }
+
+    leaf-list local-ip-address {
+      when "../type = 'TE_LINK_LOCAL_IP'" {
+        description
+          "Include the local IP address field only when the sub-TLV type was
+          a local IP address";
+      }
+
+      type inet:ipv4-address-no-zone;
+      description
+        "The IP address(es) of the local system that correspond to the
+        specified TE link";
+    }
+
+    leaf-list remote-ip-address {
+      when "../type = 'TE_LINK_REMOTE_IP'" {
+        description
+          "Include the remote IP address field only when the sub-TLV type was
+          a remote IP address";
+      }
+
+      type inet:ipv4-address-no-zone;
+      description
+        "The IP address(es) of the remote systems that are attached to the
+        specified TE link";
+    }
+
+    leaf metric {
+      when "../type = 'TE_LINK_METRIC'" {
+        description
+          "Include the traffic engineering metric only when the sub-TLV type
+          is a TE metric";
+      }
+
+      type uint32;
+      description
+        "The metric of the link that should be used for traffic engineering
+        purposes. This link may be different than the standard OSPF link
+        metric.";
+    }
+
+    leaf maximum-bandwidth {
+      when "../type = 'TE_LINK_MAXIMUM_BANDWIDTH'" {
+        description
+          "Include the traffic engineering metric only when the sub-TLV type
+          is the maximum bandwidth";
+      }
+
+      type oc-types:ieeefloat32;
+      units "bytes per second";
+      description
+        "The maximum bandwidth of the link. This value reflects the actual
+        bandwidth of the link expressed asn IEEE 32-bit floating point
+        number";
+    }
+
+    leaf maximum-reservable-bandwidth {
+      when "../type = 'TE_LINK_MAXIUMUM_RESERVABLE_BANDWIDTH'" {
+        description
+          "Include the maximum reservable bandwidth field only when the
+          sub-TLV type is the maximum reservable bandwidth";
+      }
+
+      type oc-types:ieeefloat32;
+      units "bytes per second";
+      description
+        "The maximum reservable bandwidth for the link. This value represents
+        the total bandwidth which may be used for traffic engineering
+        purposes. The value may exceed the maximum-bandwidth value
+        in cases where the link is oversubscribed. The value is reflected as
+        a 32-bit IEEE floating-point number";
+    }
+  }
+
+  grouping ospfv2-lsdb-opaque-te-link-unreserved-bw-state {
+    description
+      "The per-priority unreserved bandwidth described within the unreserved
+      bandwidth sub-TLV of the Link TLV of the Traffic Engineering LSA";
+
+    leaf priority {
+      type uint8 {
+        range "0..7";
+      }
+      description
+        "The priority level being described";
+    }
+
+    leaf unreserved-bandwidth {
+      type oc-types:ieeefloat32;
+      description
+        "The unreserved bandwidth for at priority level P, where P is
+        equal to the priority of the current list entry. The reservable
+        bandwidth at priority P is equal to the sum of the reservable
+        bandwidth at all levels 0..P.";
+    }
+  }
+
+  grouping ospfv2-lsdb-opaque-te-link-admin-group-state {
+    description
+      "Per bit administrative group status";
+
+    leaf bit-index {
+      type uint8 {
+        range "0..31";
+      }
+      description
+        "The index of the bit within the 32-bit administrative group field
+        of the Administrative Group sub-TLV of the Traffic Engineering LSA";
+    }
+
+    leaf set {
+      type boolean;
+      default false;
+      description
+        "Whether the bit is set within the administrative group field";
+    }
+  }
+
+  grouping ospfv2-lsdb-opaque-te-node-attribute-state {
+    description
+      "State parameters relating to the Traffic Engineering Node Attribute
+      TLV of the Traffic Engineering LSA";
+
+    leaf type {
+      type union {
+        type identityref {
+          base "oc-ospf-types:TE_NODE_ATTRIBUTE_TLV_TYPE";
+        }
+        type enumeration {
+          enum UNKNOWN {
+            description
+              "The sub-TLV type received within the TE LSA Node Attribute TLV
+              was unknown the the local system";
+          }
+        }
+      }
+      description
+        "The type of the sub-TLV of the Node Attribute TLV contained within
+        the TE LSA. If the local system can interpret the value received the
+        canonical name of the type is utilised, otherwise the special UNKNOWN
+        value is used";
+    }
+
+    leaf-list local-ipv4-addresses {
+      when "../type = 'NODE_IPV4_LOCAL_ADDRESS'" {
+        description
+          "Include the local IPv4 addresses when the type of the sub-TLV
+          indicates that this is the contained data";
+      }
+
+      type inet:ipv4-prefix;
+      description
+        "The local IPv4 addresses of the node expressed in CIDR notation";
+    }
+
+    leaf-list local-ipv6-addresses {
+      when "../type = 'NODE_LOCAL_IPV6_ADDRESS'" {
+        description
+          "Include the local IPv6 addresses when the type of the sub-TLV
+          indicfates that this is the contained data";
+      }
+
+      type inet:ipv6-prefix;
+      description
+        "The local IPv6 addreses of the node";
+    }
+  }
+
+  grouping ospfv2-lsdb-opaque-te-router-address-state {
+    description
+      "The contents of the value field of the Router Address TLV of the
+      Traffic Engineering LSA.";
+
+    leaf address {
+      type inet:ipv4-address-no-zone;
+      description
+        "A stable IP address of the advertising router, that is always
+        reachable when the router is connected to the network. Typically this
+        is a loopback address.";
+    }
+  }
+
+  grouping ospfv2-lsdb-opaque-grace-state {
+    description
+      "State parameters on a per-TLV basis of the Grace LSA";
+
+    leaf type {
+      type identityref {
+        base "oc-ospf-types:GRACE_LSA_TLV_TYPES";
+      }
+      description
+        "The type of the sub-TLV received within the Grace LSA";
+    }
+
+    leaf period {
+      when "../type = 'GRACE_PERIOD'" {
+        description
+          "Include the period specification when the sub-TLV type is indicated
+          to be of this type";
+      }
+
+      type uint32;
+      units seconds;
+      description
+        "The number of seconds that the router's neighbors should advertise
+        the local system as fully adjacent regardless of database
+        synchronization state";
+      reference "RFC3623";
+    }
+
+    leaf reason {
+      when "../type = 'GRACE_RESTART_REASON'" {
+        description
+          "Include the restart reason when the sub-TLV type specifies this
+          is included";
+      }
+
+      type enumeration {
+        enum UNKNOWN {
+          value 0;
+          description
+            "The reason for the graceful restart is unknown";
+        }
+        enum SOFTWARE_RESTART {
+          value 1;
+          description
+            "The local system is restarting due to a software component
+            restart";
+        }
+        enum SOFTWARE_RELOAD_UPGRADE {
+          value 2;
+          description
+            "The local system is restarting due to a software reload or
+            upgrade";
+        }
+        enum CONTROL_PROCESSOR_SWITCH {
+          value 3;
+          description
+            "The local system is restarting due to a switch to a redundant
+            control plane element";
+        }
+      }
+      description
+        "The reason for the graceful restart event occurring, as advertised
+        by the restarting system";
+      reference "RFC3623";
+    }
+
+    leaf ip-interface-address {
+      when "../type = 'GRACE_IP_INTERFACE_ADDRESS'" {
+        description
+          "Include the interface address when the sub-TLV type specifies that
+          it is included";
+      }
+
+      type inet:ipv4-address-no-zone;
+      description
+        "The restarting system's IP address on the interface via which the
+        Grace LSA is being advertised.";
+    }
+  }
+
+  grouping ospfv2-lsdb-opaque-ri-state {
+    description
+      "State parameters of the Router Information Opaque LSA";
+
+    leaf type {
+      type union {
+        type identityref {
+          base "oc-ospf-types:RI_LSA_TLV_TYPES";
+        }
+        type enumeration {
+          enum UNKNOWN {
+            description
+              "The TLV received within the RI LSA is unknown";
+          }
+        }
+      }
+      description
+        "The type of sub-TLV of the Router Information opaque LSA";
+    }
+  }
+
+  grouping ospfv2-lsdb-opaque-ri-informational-state {
+    description
+      "State parmaeters of the Router Information Informational Capabilities
+      sub-TLV";
+
+    leaf graceful-restart-capable {
+      type boolean;
+      default false;
+      description
+        "When this leaf is set to true, the advertising system is capable of
+        OSPF graceful restart.";
+    }
+
+    leaf graceful-restart-helper {
+      type boolean;
+      default false;
+      description
+        "When this leaf is set to true, the advertising system is capable of
+        being a helper for OSPF graceful restart";
+    }
+
+    leaf stub-router {
+      type boolean;
+      default false;
+      description
+        "When this leaf is set to true, the advertising system is able to
+        advertise its status as a stub router";
+      reference "RFC6987";
+    }
+
+    leaf traffic-engineering {
+      type boolean;
+      default false;
+      description
+        "When this leaf is set to true, the advertising system supports OSPFv2
+        traffic engineering capabilities";
+    }
+
+    leaf point-to-point-over-lan {
+      type boolean;
+      default false;
+      description
+        "When this leaf is set to true, the advertising system supports treating
+        LAN adjacencies as though they were point to point";
+      reference "RFC5309";
+    }
+
+    leaf experimental-te {
+      type boolean;
+      default false;
+      description
+        "When this leaf is set to ture, the advertising system supports the
+        experimental extensions to OSPF for TE described in RFC4973";
+      reference "RFC4973";
+    }
+  }
+
+  grouping ospfv2-lsdb-opaque-ri-admintag-state {
+    description
+      "State parameters relating to the administrative tags specified for
+      a node within the RI LSA";
+
+    leaf-list administrative-tags {
+      type uint32;
+      description
+        "The set of administrative tags assigned to the local system by
+        the network operator. The meaning of these tags is opaque to OSPF
+        - and their interpretation is per-domain specific";
+      reference "RFC7777";
+    }
+  }
+
+  grouping ospfv2-lsdb-opaque-ri-unknown-state {
+    description
+      "State parameters relating to an unknown TLV within the RI LSA";
+    uses ospfv2-lsdb-common-unknown-tlv;
+  }
+
+  grouping ospfv2-lsdb-opaque-ri-sralgo-state {
+    description
+      "State parameters relating to the SR Algorithms TLV of the RI LSA";
+
+    leaf-list supported-algorithms {
+      type identityref {
+        base "oc-ospf-types:SR_ALGORITHM";
+      }
+      description
+        "A list of the algorithms that are supported for segment routing
+        by the advertising system";
+    }
+  }
+
+  grouping ospfv2-lsdb-opaque-ri-srrange-tlv-state {
+    description
+      "State parameters relating to the SR SID/Label range TLV of the
+      RI LSA";
+
+    leaf type {
+      type union {
+        type identityref {
+          base "oc-ospf-types:OSPF_RI_SR_SID_LABEL_TLV_TYPES";
+        }
+        type enumeration {
+          enum UNKNOWN {
+            description
+              "The type of the sub-TLV advertised with the SID/Label range
+              TLV of the RI LSA is unknown to the receiving system";
+          }
+        }
+      }
+      description
+        "The type of the sub-TLV received by the local system within the
+        SR SID/Label Range TLV of the RI LSA";
+    }
+
+    leaf range-size {
+      type uint32 {
+        range "0..16777216";
+      }
+      description
+        "The number of entries within the range being described within the
+        SID/Label range TLV";
+    }
+  }
+
+  grouping ospfv2-lsdb-opaque-ri-srrange-sid-label-tlv-state {
+    description
+      "State parameters relating to the SR SID/Label sub-TLV of the SR SID/Label
+      range TLV of the RI LSA";
+
+    leaf entry-type {
+      type oc-ospf-types:sr-sid-type;
+      description
+        "The type of entry that is contained within the sub-TLV. The range may
+        be represented as either a range of MPLS labels, or numeric segment
+        identifiers";
+    }
+
+    leaf first-value {
+      type uint32;
+      description
+        "The first value within the SRGB range being specified. The type of the
+        entry is determined based on the value of the entry type as this value
+        may represent either a segment identifier or an MPLS label.";
+    }
+  }
+
+  grouping ospfv2-lsdb-extended-prefix-state {
+    description
+      "State parameters relating to an Extended Prefix LSA";
+
+    leaf route-type {
+      type enumeration {
+        enum UNSPECIFIED {
+          value 0;
+          description
+            "The prefix described in the extended prefix LSA is of an
+            unspecified type";
+        }
+        enum INTRA_AREA {
+          value 1;
+          description
+            "The prefix described in the extended prefix LSA is an intra-area
+            prefix for the advertising system";
+        }
+        enum INTER_AREA {
+          value 3;
+          description
+            "The prefix described in the extended prefix LSA is an inter-area
+            prefix for the advertising system";
+        }
+        enum AS_EXTERNAL {
+          value 5;
+          description
+            "The prefix described in the extended prefix LSA is external to the
+            autonomous system of the advertising system";
+        }
+        enum NSSA_EXTERNAL {
+          value 7;
+          description
+            "The prefix described in the extended prefix LSA externally
+            advertised from an NSSA area visibile to the advertising system";
+        }
+      }
+      description
+        "The type of prefix that is contained within the Extended Prefix LSA.
+        The information contained in sub-TLVs of the attribute is applicable
+        regardless of this value.";
+    }
+
+    uses ospfv2-lsdb-common-prefix-properties;
+
+    leaf attached {
+      type boolean;
+      default false;
+      description
+        "If this value is set to true, the prefix being advertised was
+        generated by an ABR for an inter-area prefix. The value corresponds
+        to the A-flag of the flags field of the Extended Prefix LSA";
+    }
+
+    leaf node {
+      type boolean;
+      default false;
+      description
+        "If this value is set to true, the prefix being advertised represents
+        the advertising router. Typically, the prefix within the LSA is
+        expected to be globally-reachable prefix associated with a loopback
+        interface";
+    }
+
+    leaf prefix {
+      type inet:ipv4-address-no-zone;
+      description
+        "The IPv4 prefix contained within the extended prefix LSA";
+    }
+  }
+
+  grouping ospfv2-lsdb-extended-link-state {
+    description
+      "State parameters related to an extended link LSA";
+
+    leaf link-type {
+      type identityref {
+        base "oc-ospf-types:OSPFV2_ROUTER_LINK_TYPE";
+      }
+      description
+        "The type of link with which extended attributes are associated";
+    }
+
+    uses ospfv2-lsdb-common-link-specification;
+
+  }
+
+  grouping ospfv2-lsdb-extended-link-tlv-state {
+    description
+      "State parameters relating to a sub-TLV of the extended link LSA";
+
+    leaf type {
+      type identityref {
+        base "oc-ospf-types:OSPFV2_EXTENDED_LINK_SUBTLV_TYPE";
+      }
+      description
+        "The type of the sub-TLV contained within the extended link TLV";
+    }
+  }
+
+  grouping ospfv2-lsdb-extended-prefix-tlv-state {
+    description
+      "State parameters related to a sub-TLV of an Extended Prefix LSA";
+
+    leaf type {
+      type identityref {
+        base "oc-ospf-types:OSPFV2_EXTENDED_PREFIX_SUBTLV_TYPE";
+      }
+      description
+        "The type of sub-TLV as indicated by the Extended Prefix LSA";
+    }
+  }
+
+  grouping ospfv2-lsdb-extended-prefix-range-state {
+    description
+      "Parameters of the Extended Prefix Range SubTLV";
+
+    uses ospfv2-lsdb-common-prefix-properties;
+
+    leaf range-size {
+      type uint16;
+      description
+        "The number of prefixes that are covered by the advertisement.";
+    }
+
+    leaf inter-area {
+      type boolean;
+      default false;
+      description
+        "When this leaf is set to true, then the prefix range is inter-area -
+        the flag is set by the ABR that advertises the Extended Prefix Range
+        TLV";
+    }
+
+    leaf prefix {
+      type inet:ipv4-prefix;
+      description
+        "The first prefix in the range of prefixes being described by the
+        extended prefix range sub-TLV";
+    }
+  }
+
+  grouping ospfv2-lsdb-extended-prefix-prefix-sid-state {
+    description
+      "Parameters of the Prefix-SID sub-TLV";
+
+    leaf no-php {
+      type boolean;
+      default false;
+      description
+        "If this leaf is set the advertising system has indicated that the
+        prefix SID must not be popped before delivering packets to it";
+    }
+
+    leaf mapping-server {
+      type boolean;
+      default false;
+      description
+        "If this leaf is set the SID was advertised by a Segment Routing
+        mapping server";
+    }
+
+    leaf explicit-null {
+      type boolean;
+      default false;
+      description
+        "If this leaf is set, the advertising system has requested that the
+        prefix SID value should be replaced with the explicit null label
+        value";
+    }
+
+    leaf sid-value-type {
+      type enumeration {
+        enum ABSOLUTE {
+          description
+            "The SID contained in the Prefix-SID sub-TLV is an absolute
+            value";
+        }
+        enum INDEX {
+          description
+            "The SID contained in the Prefix-SID sub-TLV is an index to the
+            SRGB";
+        }
+      }
+      description
+        "Specifies the type of the value specified within the Prefix SID
+        sub-TLV - in particular, whether the value is an index or an
+        absolute value. This value corresponds with the V-flag of the Prefix
+        SID sub-TLV";
+    }
+
+    leaf sid-scope {
+      type enumeration {
+        enum LOCAL {
+          description
+            "The value of the SID is
+            significant only to the advertising system";
+        }
+        enum GLOBAL {
+          description
+            "The value of the SID is globally significant";
+        }
+      }
+      description
+        "Specifies the scope of the SID advertisement within the Prefix SID
+        sub-TLV. The scope of the SID is independent of whether the SID
+        contained is an index, or an absolute value";
+    }
+
+    leaf multi-topology-identifier {
+      type uint8;
+      description
+        "The identifier for the topology to which the Prefix SID relates. The
+        value of this leaf is a MT-ID as defined in RFC4915";
+    }
+
+    leaf algorithm {
+      type uint8;
+      description
+        "The algorithm that computes the path associated with the Prefix SID";
+    }
+
+    leaf sid-value {
+      type uint32;
+      description
+        "The value of the Prefix SID. The meaning of this value is dependent
+        upon the type of SID, and its scope. The value contained is either a
+        32-bit value indicating the index of the SID, or a 24-bit label where
+        the 20 right-most bits are used for encoding the label value";
+    }
+  }
+
+  grouping ospfv2-lsdb-extended-prefix-sid-label-binding-state {
+    description
+      "State parameters relating to the extended prefix SID SID/Label binding
+      sub-TLV";
+
+    leaf mirroring {
+      type boolean;
+      default false;
+      description
+        "When set to true, this indicates that the SID/Label Binding sub-TLV
+        entries contained within this TLV are indicative of a mirroring
+        context";
+    }
+
+    leaf multi-topology-identifier {
+      type uint8;
+      description
+        "The identifier for the topology to which the SID/Label Binding
+        sub-TLV is associated. The value of this leaf is a MT-ID as defined
+        in RFC4915";
+    }
+
+    leaf weight {
+      type uint8;
+      description
+        "The weight of the advertised binding when used for load-balancing
+        purposes";
+    }
+  }
+
+  grouping ospfv2-lsdb-extended-prefix-sid-label-binding-tlv-state {
+    description
+      "State parameters directly relating to the SID/Label Binding TLV";
+
+    leaf type {
+      type identityref {
+        base
+         "oc-ospf-types:OSPFV2_EXTENDED_PREFIX_SID_LABEL_BINDING_SUBTLV_TYPE";
+      }
+      description
+        "The type of sub-TLV that is being contained within the SID/Label
+        sub-TLV";
+    }
+  }
+
+  grouping ospfv2-lsdb-extprefix-sid-label-binding-state {
+    description
+      "State parameters relating to the SID/Label binding sub-TLV of the
+      SID/Label/Binding TLV";
+
+    uses ospfv2-lsdb-common-sr-sid-spec;
+  }
+
+  grouping ospfv2-lsdb-extprefix-sid-label-ero-metric-state {
+    description
+      "State parameters relating to the ERO Metric Sub-TLV of the SID/Label
+      Binding TLV";
+
+    leaf metric {
+      type uint32;
+      description
+        "The metric representing the aggregate IGP or TE path cost for the
+        binding included within the SID/Label Binding TLV";
+    }
+  }
+
+  grouping ospfv2-lsdb-extprefix-sid-lbl-ero-path-seg-state {
+    description
+      "State parameters relating to the a segment included within the
+      ERO Path Sub-TLV of the SID/Label Binding TLV";
+
+    leaf type {
+      type identityref {
+        base "oc-ospf-types:OSPFV2_EXTPREFIX_BINDING_ERO_PATH_SEGMENT_TYPE";
+      }
+      description
+        "The type of the segment being specified as part of the ERO";
+    }
+
+    leaf loose {
+      type boolean;
+      default false;
+      description
+        "If this leaf is set the segment is identifier as a loose path
+        segment, otherwise the path strictly follows the path specified";
+    }
+  }
+
+  grouping ospfv2-lsdb-extprefix-sid-lbl-ero-ipv4-state {
+    description
+      "State parameters relating to an IPv4 address segment included within
+      the ERO path";
+
+    leaf address {
+      type inet:ipv4-address-no-zone;
+      description
+        "The IPv4 address of the hop within the ERO";
+    }
+  }
+
+  grouping ospfv2-lsdb-extprefix-sid-lbl-ero-unnum-state {
+    description
+      "State parameters relating to an unnumbered hop within the ERO path";
+
+    leaf router-id {
+      type inet:ipv4-address-no-zone;
+      description
+        "The IPv4 router identtifier of the remote system";
+    }
+
+    leaf interface-id {
+      type uint32;
+      description
+        "The identifier assigned to the link by the remote system";
+    }
+  }
+
+  grouping ospfv2-lsdb-extended-link-adj-sid-state {
+    description
+      "State parameters relating to the Adjacency SID sub-TLV of the
+      Extended Link LSA";
+
+    leaf backup {
+      type boolean;
+      default false;
+      description
+        "When this flag is set, it indicates that the adjacency SID refers to
+        an adjacency which is eligible for protection";
+    }
+
+    leaf group {
+      type boolean;
+      default false;
+      description
+        "When this flag is set it indicates that the adjacency SID refers to
+        a group of adjacencies that have a common value";
+    }
+
+    uses ospfv2-lsdb-common-sr-sid-spec;
+
+    leaf weight {
+      type uint8;
+      description
+        "The weight of the Adjacency SID when used for load-balancing";
+    }
+
+    leaf multi-topology-identifier {
+      type uint8;
+      description
+        "The multi-topology identifier with which the adjacency SID is
+        associated";
+    }
+  }
+
+  grouping ospfv2-lsdb-structure {
+    description
+      "Structural grouping for per-area LSDB contents";
+
+    container lsdb {
+      // Top-level RO, if this were ever to become writeable then
+      // the state containers lower down need config false added
+      config false;
+      description
+        "The link-state database for the OSPFv2 area";
+
+      container state {
+        description
+          "Operational state parameters relating to the OSPFv2
+          area";
+
+        uses ospfv2-lsdb-area-state;
+      }
+
+      container lsa-types {
+        description
+          "Enclosing container for a list of LSA types that are
+          in the LSDB for the specified area";
+
+        list lsa-type {
+          key "type";
+
+          description
+            "List of LSA types in the LSDB for the specified
+            area";
+
+          leaf type {
+            type leafref {
+              path "../state/type";
+            }
+            description
+              "A reference for the LSA type being described within
+              the LSDB";
+          }
+
+          container state {
+            description
+              "Top-level operational state parameters relating to
+              an LSA within the area";
+            uses ospfv2-lsdb-area-lsa-type-state;
+          }
+
+          container lsas {
+            description
+              "Enclosing container for a list of the LSAs of
+              the specified type received by the system";
+
+            list lsa {
+              key "link-state-id";
+
+              description
+                "List of the LSAs of a specified type in the
+                LSDB for the specified area";
+
+              leaf link-state-id {
+                type leafref {
+                  path "../state/link-state-id";
+                }
+                description
+                  "Reference to the Link State ID of the LSA";
+              }
+
+              container state {
+                description
+                  "Operational state parameters relating to all
+                  LSA types";
+                uses ospfv2-lsdb-area-lsa-state;
+              }
+
+              uses ospfv2-lsdb-router-lsa-structure {
+                when "../../../state/type = 'ROUTER_LSA'" {
+                  description
+                    "Include the router LSA hierarchy solely when
+                    that LSA type is being described";
+                }
+              }
+
+              uses ospfv2-lsdb-network-lsa-structure {
+                when "../../../state/type = 'NETWORK_LSA'" {
+                  description
+                    "Include the network LSA hierarchy solely when
+                    that LSA type is being described";
+                }
+              }
+
+              uses ospfv2-lsdb-summary-lsa-structure {
+                // rjs TODO: check this syntax
+                when "../../../state/type = " +
+                  "'SUMMARY_IP_NETWORK_LSA' or " +
+                  "../../../state/type = 'SUMMARY_ASBR_LSA'" {
+                  description
+                    "Include the summary LSA hierarchy solely when
+                    that LSA type is being described";
+                }
+              }
+
+              uses ospfv2-lsdb-asexternal-lsa-structure {
+                when "../../../state/type = 'AS_EXTERNAL_LSA'" {
+                  description
+                    "Include the AS external LSA hierarchy solely when
+                    that LSA type is being described";
+                }
+              }
+
+              uses ospfv2-lsdb-nssa-external-lsa-structure {
+                when "../../../state/type = 'NSSA_AS_EXTERNAL_LSA'" {
+                  description
+                    "Include the NSSA External LSA hierarchy solely
+                    when that LSA type is being described";
+                }
+              }
+
+              uses ospfv2-lsdb-opaque-lsa-structure {
+                when "../../../state/type = 'OSPFV2_LINK_SCOPE_OPAQUE_LSA'
+                  or ../../../state/type = 'OSPFV2_AREA_SCOPE_OPAQUE_LSA'
+                  or ../../../state/type = 'OSPFV2_AS_SCOPE_OPAQUE_LSA'" {
+                  description
+                    "Include the Opaque LSA structure when type of entry
+                    being described in an opaque LSA";
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
diff --git a/models/openconfig/src/main/yang/ospf/openconfig-ospfv2.yang b/models/openconfig/src/main/yang/ospf/openconfig-ospfv2.yang
new file mode 100644
index 0000000..afe163e
--- /dev/null
+++ b/models/openconfig/src/main/yang/ospf/openconfig-ospfv2.yang
@@ -0,0 +1,86 @@
+module openconfig-ospfv2 {
+
+  yang-version "1";
+
+  // namespace
+  namespace "http://openconfig.net/yang/ospfv2";
+
+  prefix "oc-ospfv2";
+
+  // import some basic types
+  //import ietf-inet-types { prefix inet; }
+  import openconfig-extensions { prefix "oc-ext"; }
+
+  // Include submodules
+  // Global:  All global context groupings;
+  include openconfig-ospfv2-global;
+  // Area:    Config/opstate for an area
+  include openconfig-ospfv2-area;
+  // Area Interface:  Config/opstate for an Interface
+  include openconfig-ospfv2-area-interface;
+  // LSDB: Operational state model covering the LSDB
+  include openconfig-ospfv2-lsdb;
+  // Common:  Content included in >1 context
+  include openconfig-ospfv2-common;
+
+  // meta
+  organization "OpenConfig working group";
+
+  contact
+    "OpenConfig working group
+    www.openconfig.net";
+
+  description
+    "An OpenConfig model for Open Shortest Path First (OSPF)
+    version 2";
+
+  oc-ext:openconfig-version "0.1.0";
+
+  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-top {
+    description
+      "Top-level OSPF configuration and operational state";
+
+    container ospfv2 {
+      description
+        "Top-level configuration and operational state for
+        Open Shortest Path First (OSPF) v2";
+
+      uses ospfv2-global-structural;
+
+      container areas {
+        description
+          "Configuration and operational state relating to an
+	  OSPFv2 area.";
+
+        list area {
+          key "identifier";
+
+          description
+            "The OSPFv2 areas within which the local system exists";
+
+          leaf identifier {
+            type leafref {
+              path "../config/identifier";
+            }
+            description
+              "A reference to the identifier for the area.";
+          }
+
+          uses ospfv2-area-structure;
+        }
+      }
+    }
+  }
+}