netconfcentral logo

org-openroadm-ospf@2020-05-29



  module org-openroadm-ospf {

    yang-version 1;

    namespace "http://org/openroadm/ospf";

    prefix org-openroadm-ospf;

    import ietf-inet-types {
      prefix inet;
      revision-date "2013-07-15";
    }
    import ietf-yang-types {
      prefix yang;
      revision-date "2013-07-15";
    }
    import org-openroadm-device {
      prefix org-openroadm-device;
      revision-date "2020-05-29";
    }
    import org-openroadm-routing {
      prefix org-openroadm-routing;
      revision-date "2020-05-29";
    }
    import org-openroadm-key-chain {
      prefix org-openroadm-key-chain;
      revision-date "2019-11-29";
    }

    organization "Open ROADM MSA";

    contact "OpenROADM.org";

    description
      "This model defines the Yang model for ospf.

     This model reuses data items defined in the IETF YANG model for
     OSPF described by draft-ietf-ospf-yang-00.

     Some attributes which are not required in Open ROADM MSA are removed.
     Yang file included are changed to fit into Open ROADM MSA yang structure.

     IETF code is subject to the following copyright and license:
     Copyright (c) IETF Trust and the persons identified as authors of
     the code.
     All rights reserved.

     Redistribution and use in source and binary forms, with or without
     modification, is permitted pursuant to, and subject to the license
     terms contained in, the Simplified BSD License set forth in
     Section 4.c of the IETF Trust's Legal Provisions Relating
     to IETF Documents (http://trustee.ietf.org/license-info).";

    revision "2020-05-29" {
      description "Version 7.1.0";
    }

    revision "2020-03-27" {
      description "Version 7.0.0";
    }

    revision "2019-11-29" {
      description "Version 6.1.0";
    }

    revision "2019-09-27" {
      description "Version 6.0.0";
    }

    revision "2019-05-31" {
      description "Version 5.1.0";
    }

    revision "2019-03-29" {
      description "Version 5.0.0";
    }

    revision "2018-03-30" {
      description "Initial revision.";
    }


    feature multi-topology {
      description "Support MTR.";
    }

    feature multi-area-adj {
      description
        "OSPF multi-area adjacency support as in RFC 5185.";
    }

    feature router-id {
      description
        "Set router ID per instance.";
    }

    feature demand-circuit {
      description
        "OSPF demand circuit support as in RFC 1793.";
    }

    feature mtu-ignore {
      description
        "Disable OSPF MTU mismatch detection on receiving
       DBD packets.";
    }

    feature lls {
      description
        "OSPF link-local signaling (LLS) as in RFC 5613.";
    }

    feature prefix-suppression {
      description
        "OSPF prefix suppression support as in RFC 6860.";
    }

    feature bfd {
      description "OSPF BFD support.";
    }

    feature ttl-security {
      description "OSPF ttl security check.";
    }

    feature nsr {
      description "Non-Stop-Routing (NSR).";
    }

    feature graceful-restart {
      description
        "Graceful OSPF Restart as defined in RFC3623 and RFC5187.";
    }

    feature protocol-shutdown {
      description "Shutdown the protocol.";
    }

    feature auto-cost {
      description
        "Calculate OSPF interface cost according to
       reference bandwidth.";
    }

    feature max-ecmp {
      description
        "Setting maximum number of ECMP paths.";
    }

    feature max-lsa {
      description
        "Setting maximum number of LSAs OSPF will receive.";
    }

    feature te-rid {
      description "TE router-id.";
    }

    feature ldp-igp-sync {
      description "LDP IGP synchronization.";
    }

    feature ldp-igp-autoconfig {
      description "LDP IGP auto-config.";
    }

    feature protocol-if-shutdown {
      description
        "Shutdown the protocol over an interface.";
    }

    feature ospfv3-authentication-ipsec {
      description
        "Use IPsec for OSPFv3 authentication.";
    }

    feature instance-inheritance {
      description
        "Support instance inheritance";
    }

    feature area-inheritance {
      description "Support area inheritance";
    }

    feature interface-inheritance {
      description
        "Support interface inheritance";
    }

    identity ospf {
      base org-openroadm-routing:routing-protocol;
      description "OSPF Protocol";
    }

    identity ospfv2 {
      base ospf;
      description "OSPFv2";
    }

    identity ospfv3 {
      base ospf;
      description "OSPFv3";
    }

    identity operation-mode {
      base 
      description "OSPF operation mode.";
    }

    identity ships-in-the-night {
      base operation-mode;
      description
        "Ships-in-the-night operation mode in which
       each OSPF instance carries only one address family";
    }

    identity area-type {
      base 
      description
        "Base identity for OSPF area type.";
    }

    identity normal {
      base area-type;
      description "OSPF normal area.";
    }

    identity stub {
      base area-type;
      description "OSPF stub area.";
    }

    identity nssa {
      base area-type;
      description "OSPF NSSA area.";
    }

    identity if-link-type {
      base 
      description
        "Base identity for OSPF interface link type.";
    }

    identity if-link-type-normal {
      base if-link-type;
      description
        "OSPF interface link type normal.";
    }

    identity if-link-type-virtual-link {
      base if-link-type;
      description
        "OSPF interface link type virtual link.";
    }

    identity if-link-type-sham-link {
      base if-link-type;
      description
        "OSPF interface link type sham link.";
    }

    typedef uint24 {
      type uint32 {
        range "0 .. 16777215";
      }
      description "24-bit unsigned integer.";
    }

    typedef area-id-type {
      type union {
        type uint32;
        type yang:dotted-quad;
      }
      description "Area ID type.";
    }

    typedef if-state-type {
      type enumeration {
        enum "Down" {
          value 1;
          description "Interface down state";
        }
        enum "Loopback" {
          value 2;
          description
            "Interface loopback state";
        }
        enum "Waiting" {
          value 3;
          description
            "Interface waiting state";
        }
        enum "Point-to-Point" {
          value 4;
          description
            "Interface point-to-point state";
        }
        enum "DR" {
          value 5;
          description
            "Interface Designated Router (DR) state";
        }
        enum "BDR" {
          value 6;
          description
            "Interface Backup Designated Router (BDR) state";
        }
        enum "DR-Other" {
          value 7;
          description
            "Interface Other Designated Router state";
        }
      }
      description
        "OSPF interface state type.";
    }

    typedef nbr-state-type {
      type enumeration {
        enum "Down" {
          value 1;
          description "Neighbor down state";
        }
        enum "Attempt" {
          value 2;
          description
            "Neighbor attempt state";
        }
        enum "Init" {
          value 3;
          description "Neighbor init state";
        }
        enum "2-Way" {
          value 4;
          description "Neighbor 2-Way state";
        }
        enum "ExStart" {
          value 5;
          description
            "Neighbor exchange start state";
        }
        enum "Exchange" {
          value 6;
          description
            "Neighbor exchange state";
        }
        enum "Loading" {
          value 7;
          description
            "Neighbor loading state";
        }
        enum "Full" {
          value 8;
          description "Neighbor full state";
        }
      }
      description
        "OSPF neighbor state type.";
    }

    typedef restart-helper-status-type {
      type enumeration {
        enum "Not-Helping" {
          value 1;
          description
            "Restart helper status not helping.";
        }
        enum "Helping" {
          value 2;
          description
            "Restart helper status helping.";
        }
      }
      description
        "Restart helper status type.";
    }

    typedef restart-exit-reason-type {
      type enumeration {
        enum "None" {
          value 1;
          description "Not attempted.";
        }
        enum "InProgress" {
          value 2;
          description "Restart in progress.";
        }
        enum "Completed" {
          value 3;
          description
            "Successfully completed.";
        }
        enum "TimedOut" {
          value 4;
          description "Timed out.";
        }
        enum "TopologyChanged" {
          value 5;
          description
            "Aborted due to topology change.";
        }
      }
      description
        "Describes the outcome of the last attempt at a
       graceful restart, either by itself or acting
       as a helper.";
    }

    typedef packet-type {
      type enumeration {
        enum "Hello" {
          value 1;
          description "OSPF hello packet.";
        }
        enum "Database-Descripton" {
          value 2;
          description
            "OSPF database description packet.";
        }
        enum "Link-State-Request" {
          value 3;
          description
            "OSPF link state request packet.";
        }
        enum "Link-State-Update" {
          value 4;
          description
            "OSPF link state update packet.";
        }
        enum "Link-State-Ack" {
          value 5;
          description
            "OSPF link state acknowlegement packet.";
        }
      }
      description "OSPF packet type.";
    }

    typedef nssa-translator-state-type {
      type enumeration {
        enum "Enabled" {
          value 1;
          description
            "NSSA translator enabled state.";
        }
        enum "Elected" {
          value 2;
          description
            "NSSA translator elected state.";
        }
        enum "Disabled" {
          value 3;
          description
            "NSSA translator disabled state.";
        }
      }
      description
        "OSPF NSSA translator state type.";
    }

    typedef restart-status-type {
      type enumeration {
        enum "Not-Restarting" {
          value 1;
          description
            "Router is not restarting.";
        }
        enum "Planned-Restart" {
          value 2;
          description
            "Router is going through planned restart.";
        }
        enum "Unplanned-Restart" {
          value 3;
          description
            "Router is going through unplanned restart.";
        }
      }
      description
        "OSPF graceful restart status type.";
    }

    grouping interface-common-config {
      description
        "Common configuration for all types of interfaces,
       including virtual link and sham link";
      leaf cost {
        type uint16 {
          range "1..65535" {
            error-message
              "Configured value is out of range";
          }
        }
        description "Interface cost.";
      }

      leaf hello-interval {
        type uint16 {
          range "1..65535" {
            error-message
              "Configured value is out of range";
          }
        }
        units "seconds";
        description
          "Time between hello packets.";
      }

      leaf dead-interval {
        type uint16 {
          range "1..65535" {
            error-message
              "Configured value is out of range";
          }
        }
        units "seconds";
        must
          '../dead-interval > ../hello-interval' {
          error-message
            "The dead interval must be larger than the hello interval";
          description
            "The value MUST be greater than 'hello-internval'.";
        }
        description
          "Interval after which a neighbor is declared dead.";
      }

      leaf rtrPriority {
        type uint8 {
          range "0..255";
        }
        description
          "Router priority for DR election.";
      }

      leaf retransmit-interval {
        type uint16 {
          range "1..65535" {
            error-message
              "Configured value is out of range";
          }
        }
        units "seconds";
        description
          "Time between retransmitting unacknowledged Link State
         Advertisements (LSAs).";
      }

      leaf transmit-delay {
        type uint16 {
          range "1..65535" {
            error-message
              "Configured value is out of range";
          }
        }
        units "seconds";
        description
          "Estimated time needed to send link-state update.";
      }

      leaf mtu-ignore {
        if-feature mtu-ignore;
        type boolean;
        description
          "Enable/Disable ignoring of MTU in DBD packets.";
      }

      container authentication {
        description
          "Authentication configuration.";
        choice auth-type-selection {
          description
            "Options for expressing authentication setting";
          case auth-ipsec {
            when
              "../../../../../org-openroadm-routing:type = 'ospfv3'" {
              description
                "Applied to OSPFv3 only";
            }
            if-feature ospfv3-authentication-ipsec;
            leaf sa {
              type string;
              description "SA name";
            }
          }  // case auth-ipsec
          leaf key-chain {
            type org-openroadm-key-chain:key-chain-ref;
            description "key-chain name";
          }
          leaf key {
            type string {
              length "1..8" {
                error-message
                  "Configured string exceeds the maximum length";
              }
            }
            description
              "Key string in ASCII format.";
          }
        }  // choice auth-type-selection
      }  // container authentication
    }  // grouping interface-common-config

    grouping interface-config {
      description
        "Configuration for real interfaces.";
      leaf network-type {
        type enumeration {
          enum "broadcast" {
            value 0;
            description
              "Specify OSPF broadcast multi-access network.";
          }
          enum "non-broadcast" {
            value 1;
            description
              "Specify OSPF Non-Broadcast Multi-Access
             (NBMA) network.";
          }
          enum "point-to-multipoint" {
            value 2;
            description
              "Specify OSPF point-to-multipoint network.";
          }
          enum "point-to-point" {
            value 3;
            description
              "Specify OSPF point-to-point network.";
          }
        }
        description "Network type.";
      }

      leaf passive {
        type boolean;
        description
          "Enable/Disable passive.";
      }

      uses interface-common-config;
    }  // grouping interface-config

    grouping tlv {
      description "TLV";
      leaf type {
        type uint16;
        description "TLV type.";
      }

      leaf length {
        type uint16;
        description "TLV length.";
      }

      leaf value {
        type yang:hex-string;
        description "TLV value.";
      }
    }  // grouping tlv

    grouping ospfv2-lsa-body {
      description "OSPFv2 LSA body.";
      container router {
        when '../../header/type = 1' {
          description
            "Only apply to Router-LSA.";
        }
        description "Router LSA.";
        leaf flags {
          type bits {
            bit V {
              position 0;
              description
                "When set, the router is an endpoint of one or
               more virtual links.";
            }
            bit E {
              position 1;
              description
                "When set, the router is an AS Boundary Router
               (ASBR).";
            }
            bit B {
              position 2;
              description
                "When set, the router is an Area Border Router (ABR).";
            }
          }
          description "Flags";
        }

        leaf num-of-links {
          type uint16;
          description "Number of links.";
        }

        list link {
          key "link-id link-data";
          description "Router LSA link.";
          leaf link-id {
            type union {
              type inet:ipv4-address;
              type yang:dotted-quad;
            }
            description "Link ID";
          }

          leaf link-data {
            type union {
              type inet:ipv4-address;
              type uint32;
            }
            description "Link data.";
          }

          leaf type {
            type uint8;
            description "Link type.";
          }

          list topology {
            key "mt-id";
            description
              "Topology specific information.";
            leaf mt-id {
              type uint8;
              description
                "The MT-ID for topology enabled on the link.";
            }

            leaf metric {
              type uint16;
              description
                "Metric for the topology.";
            }
          }  // list topology
        }  // list link
      }  // container router

      container network {
        when '../../header/type = 2' {
          description
            "Only apply to network LSA.";
        }
        description "Network LSA.";
        leaf network-mask {
          type inet:ipv4-address;
          description
            "The IP address mask for the network";
        }

        leaf-list attached-router {
          type yang:dotted-quad;
          description
            "List of the routers attached to the network.";
        }
      }  // container network

      container summary {
        when
          '../../header/type = 3 or ../../header/type = 4' {
          description
            "Only apply to Summary-LSA.";
        }
        description "Summary LSA.";
        leaf network-mask {
          type inet:ipv4-address;
          description
            "The IP address mask for the network";
        }

        list topology {
          key "mt-id";
          description
            "Topology specific information.";
          leaf mt-id {
            type uint8;
            description
              "The MT-ID for topology enabled on the link.";
          }

          leaf metric {
            type uint24;
            description
              "Metric for the topology.";
          }
        }  // list topology
      }  // container summary

      container external {
        when
          '../../header/type = 5 or ../../header/type = 7' {
          description
            "Only apply to AS-external-LSA and NSSA-LSA.";
        }
        description "External LSA.";
        leaf network-mask {
          type inet:ipv4-address;
          description
            "The IP address mask for the network";
        }

        list topology {
          key "mt-id";
          description
            "Topology specific information.";
          leaf mt-id {
            type uint8;
            description
              "The MT-ID for topology enabled on the link.";
          }

          leaf flags {
            type bits {
              bit E {
                position 0;
                description
                  "When set, the metric specified is a Type 2
                 external metric.";
              }
            }
            description "Flags.";
          }

          leaf metric {
            type uint24;
            description
              "Metric for the topology.";
          }

          leaf forwarding-address {
            type inet:ipv4-address;
            description
              "Forwarding address.";
          }

          leaf external-route-tag {
            type uint32;
            description "Route tag.";
          }
        }  // list topology
      }  // container external
    }  // grouping ospfv2-lsa-body

    grouping ospfv3-lsa-options {
      description "OSPFv3 LSA options";
      leaf options {
        type bits {
          bit DC {
            position 0;
            description
              "When set, the router support demand circuits.";
          }
          bit R {
            position 1;
            description
              "When set, the originator is an active router.";
          }
          bit N {
            position 2;
            description
              "If set, the router is attached to an NSSA";
          }
          bit E {
            position 3;
            description
              "This bit describes the way AS-external-LSAs
             are flooded";
          }
          bit V6 {
            position 4;
            description
              "If clear, the router/link should be excluded
             from IPv6 routing calculaton";
          }
        }
        mandatory true;
        description "OSPFv3 LSA options.";
      }
    }  // grouping ospfv3-lsa-options

    grouping ospfv3-lsa-prefix {
      description "OSPFv3 LSA prefix.";
      leaf prefix {
        type inet:ip-prefix;
        description "Prefix";
      }

      leaf prefix-options {
        type bits {
          bit NU {
            position 0;
            description
              "When set, the prefix should be excluded
             from IPv6 unicast calculations.";
          }
          bit LA {
            position 1;
            description
              "When set, the prefix is actually an IPv6 interface
             address of the Advertising Router.";
          }
          bit P {
            position 2;
            description
              "When set, the NSSA area prefix should be
             readvertised by the translating NSSA area border.";
          }
          bit DN {
            position 3;
            description
              "When set, the inter-area-prefix-LSA or
             AS-external-LSA prefix has been advertised in a VPN
             environment.";
          }
        }
        mandatory true;
        description "Prefix options.";
      }
    }  // grouping ospfv3-lsa-prefix

    grouping ospfv3-lsa-external {
      description
        "AS-External and NSSA LSA.";
      leaf metric {
        type uint24;
        description "Metric";
      }

      leaf flags {
        type bits {
          bit E {
            position 0;
            description
              "When set, the metric specified is a Type 2
             external metric.";
          }
        }
        description "Flags.";
      }

      leaf referenced-ls-type {
        type uint16;
        description
          "Referenced Link State type.";
      }

      uses ospfv3-lsa-prefix;

      leaf forwarding-address {
        type inet:ipv6-address;
        description "Forwarding address.";
      }

      leaf external-route-tag {
        type uint32;
        description "Route tag.";
      }

      leaf referenced-link-state-id {
        type uint32;
        description
          "Referenced Link State ID.";
      }
    }  // grouping ospfv3-lsa-external

    grouping ospfv3-lsa-body {
      description "OSPFv3 LSA body.";
      container router {
        when '../../header/type = 8193' {
          description
            "Only apply to Router-LSA.";
        }
        description "Router LSA.";
        leaf flags {
          type bits {
            bit V {
              position 0;
              description
                "When set, the router is an endpoint of one or
               more virtual links.";
            }
            bit E {
              position 1;
              description
                "When set, the router is an AS Boundary Router
               (ASBR).";
            }
            bit B {
              position 2;
              description
                "When set, the router is an Area Border Router (ABR).";
            }
            bit Nt {
              position 3;
              description
                "When set, the router is an NSSA border router
               that is unconditionally translating NSSA-LSAs
               into AS-external-LSAs.";
            }
          }
          mandatory true;
          description "LSA option.";
        }

        uses ospfv3-lsa-options;

        list link {
          key "interface-id neighbor-interface-id neighbor-router-id";
          description "Router LSA link.";
          leaf interface-id {
            type uint32;
            description "Interface ID.";
          }

          leaf neighbor-interface-id {
            type uint32;
            description
              "Neighbor Interface ID.";
          }

          leaf neighbor-router-id {
            type yang:dotted-quad;
            description "Neighbor Router ID";
          }

          leaf type {
            type uint8;
            description "Link type.";
          }

          leaf metric {
            type uint16;
            description "Metric.";
          }
        }  // list link
      }  // container router

      container network {
        when '../../header/type = 8194' {
          description
            "Only apply to network LSA.";
        }
        description "Network LSA.";
        uses ospfv3-lsa-options;

        leaf-list attached-router {
          type yang:dotted-quad;
          description
            "List of the routers attached to the network.";
        }
      }  // container network

      container inter-area-prefix {
        when '../../header/type = 8195' {
          description
            "Only apply to inter-area-prefix LSA.";
        }
        description "Inter-Area-Prefix LSA.";
        leaf metric {
          type uint24;
          description "Metric";
        }

        uses ospfv3-lsa-prefix;
      }  // container inter-area-prefix

      container inter-area-router {
        when '../../header/type = 8196' {
          description
            "Only apply to inter-area-router LSA.";
        }
        description "Inter-Area-Router LSA.";
        uses ospfv3-lsa-options;

        leaf metric {
          type uint24;
          description "Metric";
        }

        leaf destination-router-id {
          type yang:dotted-quad;
          description
            "The Router ID of the router being described by the LSA.";
        }
      }  // container inter-area-router

      container as-external {
        when '../../header/type = 16389' {
          description
            "Only apply to as-external LSA.";
        }
        description "AS-External LSA.";
        uses ospfv3-lsa-external;
      }  // container as-external

      container nssa {
        when '../../header/type = 8199' {
          description
            "Only apply to nssa LSA.";
        }
        description "NSSA LSA.";
        uses ospfv3-lsa-external;
      }  // container nssa

      container link {
        when '../../header/type = 8' {
          description
            "Only apply to link LSA.";
        }
        description "Link LSA.";
        leaf rtr-priority {
          type uint8;
          description
            "Router Priority of the interface.";
        }

        uses ospfv3-lsa-options;

        leaf link-local-interface-address {
          type inet:ipv6-address;
          description
            "The originating router's link-local
           interface address on the link.";
        }

        leaf num-of-prefixes {
          type uint32;
          description "Number of prefixes.";
        }

        list prefix {
          key "prefix";
          description
            "List of prefixes associated with the link.";
          uses ospfv3-lsa-prefix;
        }  // list prefix
      }  // container link

      container intra-area-prefix {
        when '../../header/type = 8201' {
          description
            "Only apply to intra-area-prefix LSA.";
        }
        description "Intra-Area-Prefix LSA.";
        leaf referenced-ls-type {
          type uint16;
          description
            "Referenced Link State type.";
        }

        leaf referenced-link-state-id {
          type uint32;
          description
            "Referenced Link State ID.";
        }

        leaf referenced-adv-router {
          type inet:ipv4-address;
          description
            "Referenced Advertising Router.";
        }

        leaf num-of-prefixes {
          type uint16;
          description "Number of prefixes.";
        }

        list prefix {
          key "prefix";
          description
            "List of prefixes associated with the link.";
          uses ospfv3-lsa-prefix;

          leaf metric {
            type uint24;
            description "Metric";
          }
        }  // list prefix
      }  // container intra-area-prefix
    }  // grouping ospfv3-lsa-body

    grouping lsa-header {
      description
        "Common LSA for OSPFv2 and OSPFv3";
      leaf age {
        type uint16;
        mandatory true;
        description "LSA age.";
      }

      leaf type {
        type uint16;
        mandatory true;
        description "LSA type.";
      }

      leaf adv-router {
        type yang:dotted-quad;
        mandatory true;
        description
          "LSA advertising router.";
      }

      leaf seq-num {
        type uint32;
        mandatory true;
        description "LSA sequence number.";
      }

      leaf checksum {
        type uint16;
        mandatory true;
        description "LSA checksum.";
      }

      leaf length {
        type uint16;
        mandatory true;
        description "LSA length.";
      }
    }  // grouping lsa-header

    grouping ospfv2-lsa {
      description "OSPFv2 LSA.";
      container header {
        description
          "Decoded OSPFv2 LSA header data.";
        leaf option {
          type bits {
            bit DC {
              position 0;
              description
                "When set, the router support demand circuits.";
            }
            bit P {
              position 1;
              description
                "Only used in type-7 LSA. When set, the NSSA
               border router should translate the type-7 LSA
               to type-5 LSA.";
            }
            bit MC {
              position 2;
              description
                "When set, the router support MOSPF.";
            }
            bit E {
              position 3;
              description
                "This bit describes the way AS-external-LSAs
               are flooded";
            }
          }
          mandatory true;
          description "LSA option.";
        }

        leaf lsa-id {
          type inet:ipv4-address;
          mandatory true;
          description "LSA ID.";
        }

        leaf opaque-type {
          when
            '../../header/type = 9 or ../../header/type = 10 or ../../header/type = 11' {
            description
              "Only apply to opaque LSA.";
          }
          type uint8;
          mandatory true;
          description "Opaque type.";
        }

        leaf opaque-id {
          when
            '../../header/type = 9 or ../../header/type = 10 or ../../header/type = 11' {
            description
              "Only apply to opaque LSA.";
          }
          type uint24;
          mandatory true;
          description "Opaque id.";
        }

        uses lsa-header;
      }  // container header

      container body {
        description
          "Decoded OSPFv2 LSA body data.";
        uses ospfv2-lsa-body;
      }  // container body
    }  // grouping ospfv2-lsa

    grouping ospfv3-lsa {
      description "Decoded OSPFv3 LSA.";
      container header {
        description
          "Decoded OSPFv3 LSA header data.";
        leaf lsa-id {
          type uint32;
          mandatory true;
          description "LSA ID.";
        }

        uses lsa-header;
      }  // container header

      container body {
        description
          "Decoded OSPF LSA body data.";
        uses ospfv3-lsa-body;
      }  // container body
    }  // grouping ospfv3-lsa

    grouping lsa-common {
      description
        "Common field for OSPF LSA represenation.";
      leaf decoded-completed {
        type boolean;
        description
          "The OSPF LSA body is fully decoded.";
      }
    }  // grouping lsa-common

    grouping link-scope-lsa {
      description "OSPF link-scope LSA.";
      uses lsa-common;

      choice version {
        description
          "OSPFv2 or OSPFv3 LSA body.";
        container ospfv2 {
          when
            "../../../../../../../org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2'" {
            description
              "Applied to OSPFv2 only";
          }
          description "OSPFv2 LSA";
          uses ospfv2-lsa;
        }  // container ospfv2
        container ospfv3 {
          when
            "../../../../../../../org-openroadm-routing:type = 'ospfv3'" {
            description
              "Applied to OSPFv3 only";
          }
          description "OSPFv3 LSA";
          uses ospfv3-lsa;
        }  // container ospfv3
      }  // choice version
    }  // grouping link-scope-lsa

    grouping area-scope-lsa {
      description "OSPF area-scope LSA.";
      uses lsa-common;

      choice version {
        description
          "OSPFv2 or OSPFv3 LSA body.";
        container ospfv2 {
          when
            "../../../../../../org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2'" {
            description
              "Applied to OSPFv2 only";
          }
          description "OSPFv2 LSA";
          uses ospfv2-lsa;
        }  // container ospfv2
        container ospfv3 {
          when
            "../../../../../../org-openroadm-routing:type = 'ospfv3'" {
            description
              "Applied to OSPFv3 only";
          }
          description "OSPFv3 LSA";
          uses ospfv3-lsa;
        }  // container ospfv3
      }  // choice version
    }  // grouping area-scope-lsa

    grouping as-scope-lsa {
      description "OSPF AS-scope LSA.";
      uses lsa-common;

      choice version {
        description
          "OSPFv2 or OSPFv3 LSA body.";
        container ospfv2 {
          when
            "../../../../../org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2'" {
            description
              "Applied to OSPFv2 only";
          }
          description "OSPFv2 LSA";
          uses ospfv2-lsa;
        }  // container ospfv2
        container ospfv3 {
          when
            "../../../../../org-openroadm-routing:type = 'ospfv3'" {
            description
              "Applied to OSPFv3 only";
          }
          description "OSPFv3 LSA";
          uses ospfv3-lsa;
        }  // container ospfv3
      }  // choice version
    }  // grouping as-scope-lsa

    grouping lsa-key {
      description "OSPF LSA key.";
      leaf lsa-id {
        type union {
          type inet:ipv4-address;
          type uint32;
        }
        description "LSA ID.";
      }

      leaf adv-router {
        type inet:ipv4-address;
        description "Advertising router.";
      }
    }  // grouping lsa-key

    grouping af-area-config {
      description
        "OSPF address-family specific area config state.";
      list range {
        key "prefix";
        description
          "Summarize routes matching address/mask (border
         routers only)";
        leaf prefix {
          type inet:ip-prefix;
          description "IPv4 or IPv6 prefix";
        }

        leaf advertise {
          type boolean;
          description "Advertise or hide.";
        }

        leaf cost {
          type uint24 {
            range "0..16777214";
          }
          description
            "Cost of summary route.";
        }
      }  // list range
    }  // grouping af-area-config

    grouping area-config {
      description "OSPF area config state.";
      leaf area-type {
        type identityref {
          base area-type;
        }
        default "normal";
        description "Area type.";
      }

      leaf summary {
        when
          "../area-type = 'stub' or ../area-type = 'nssa'" {
          description
            "Summary generation valid for stub/NSSA area.";
        }
        type boolean;
        description
          "Enable/Disable summary generation to the stub or
         NSSA area.";
      }

      leaf default-cost {
        when
          "../area-type = 'stub' or ../area-type = 'nssa'" {
          description
            "Default cost for LSA advertised into stub or
           NSSA area.";
        }
        type uint32 {
          range "1..16777215";
        }
        description
          "Set the summary default-cost for a stub or NSSA area.";
      }

      uses af-area-config {
        when
          "/org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing/org-openroadm-routing:routing-instance/org-openroadm-routing:routing-protocols/org-openroadm-routing:routing-protocol/org-openroadm-ospf:ospf/org-openroadm-ospf:operation-mode = 'org-openroadm-ospf:ships-in-the-night'" {
          description
            "Ships in the night configuration.";
        }
      }
    }  // grouping area-config

    grouping instance-config {
      description
        "OSPF instance config state.";
      leaf router-id {
        if-feature router-id;
        type yang:dotted-quad;
        mandatory true;
        description
          "Defined in RFC 2328. A 32-bit number
         that uniquely identifies the router.";
      }

      container admin-distance {
        description
          "Admin distance config state.";
        choice granularity {
          description
            "Options for expressing admin distance
           for intra-area and inter-area route";
          case detail {
            leaf intra-area {
              type uint8 {
                range "1..255" {
                  error-message
                    "Configured value is out of range";
                }
              }
              description
                "Admin distance for intra-area route.";
            }

            leaf inter-area {
              type uint8 {
                range "1..255" {
                  error-message
                    "Configured value is out of range";
                }
              }
              description
                "Admin distance for inter-area route.";
            }
          }  // case detail
        }  // choice granularity

        leaf external {
          type uint8 {
            range "1..255" {
              error-message
                "Configured value is out of range";
            }
          }
          description
            "Admin distance for both external route.";
        }
      }  // container admin-distance

      container graceful-restart {
        if-feature graceful-restart;
        description
          "Graceful restart config state.";
        leaf enable {
          type boolean;
          description
            "Enable/Disable graceful restart as defined in RFC 3623.";
        }

        leaf helper-enable {
          type boolean;
          default "true";
          description
            "Enable RestartHelperSupport in RFC 3623 Section B.2.";
        }

        leaf restart-interval {
          type uint16 {
            range "1..1800";
          }
          units "seconds";
          default "120";
          description
            "RestartInterval option in RFC 3623 Section B.1.";
        }

        leaf helper-strict-lsa-checking {
          type boolean;
          description
            "RestartHelperStrictLSAChecking option in RFC 3623
           Section B.2.";
        }
      }  // container graceful-restart

      container auto-cost {
        if-feature auto-cost;
        description
          "Auto cost config state.";
        leaf enable {
          type boolean;
          description
            "Enable/Disable auto cost.";
        }

        leaf reference-bandwidth {
          type uint32 {
            range "1..4294967";
          }
          units "Mbits";
          description
            "Configure reference bandwidth in term of Mbits";
        }
      }  // container auto-cost
    }  // grouping instance-config

    grouping interface-operation {
      description
        "OSPF interface operation state.";
      reference
        "RFC2328 Section 9";

      uses interface-config;

      leaf state {
        type if-state-type;
        description "Interface state.";
      }

      leaf hello-timer {
        type uint32;
        units "milliseconds";
        description "Hello timer.";
      }

      leaf wait-timer {
        type uint32;
        units "milliseconds";
        description "Wait timer.";
      }

      leaf dr {
        type inet:ipv4-address;
        description "DR.";
      }

      leaf bdr {
        type inet:ipv4-address;
        description "BDR.";
      }
    }  // grouping interface-operation

    grouping neighbor-operation {
      description
        "OSPF neighbor operation data.";
      leaf address {
        type inet:ip-address;
        description "Neighbor address.";
      }

      leaf dr {
        type inet:ipv4-address;
        description "Designated Router.";
      }

      leaf bdr {
        type inet:ipv4-address;
        description
          "Backup Designated Router.";
      }

      leaf state {
        type nbr-state-type;
        description "OSPF neighbor state.";
      }
    }  // grouping neighbor-operation

    grouping instance-operation {
      description
        "OSPF Address Family operation state.";
      leaf router-id {
        type yang:dotted-quad;
        description
          "Defined in RFC 2328. A 32-bit number
         that uniquely identifies the router.";
      }
    }  // grouping instance-operation

    grouping route-content {
      description
        "This grouping defines OSPF-specific route attributes.";
      leaf metric {
        type uint32;
        description "OSPF route metric.";
      }

      leaf tag {
        type uint32;
        default "0";
        description "OSPF route tag.";
      }

      leaf route-type {
        type enumeration {
          enum "intra-area" {
            value 0;
            description
              "OSPF intra-area route";
          }
          enum "inter-area" {
            value 1;
            description
              "OSPF inter-area route";
          }
          enum "external-1" {
            value 2;
            description
              "OSPF external route type 1";
          }
          enum "external-2" {
            value 3;
            description
              "OSPF External route type 2";
          }
          enum "nssa-1" {
            value 4;
            description
              "OSPF NSSA external route type 1";
          }
          enum "nssa-2" {
            value 5;
            description
              "OSPF NSSA external route type 2";
          }
        }
        description "OSPF route type";
      }
    }  // grouping route-content

    grouping notification-instance-hdr {
      description
        "This group describes common instance specific
       data for notifications.";
      leaf routing-instance {
        type org-openroadm-routing:routing-instance-ref;
        description
          "Describe the routing instance.";
      }

      leaf routing-protocol-name {
        type string;
        description
          "Describes the name of the OSPF routing protocol.";
      }

      container instance-af {
        description
          "Describes the address family of the OSPF instance.";
        leaf af {
          type identityref {
            base org-openroadm-routing:address-family;
          }
          description
            "Address-family of the instance.";
        }
      }  // container instance-af
    }  // grouping notification-instance-hdr

    notification if-state-change {
      description
        "This notification is sent when interface
       state change is detected.";
      uses notification-instance-hdr;

      leaf link-type {
        type identityref {
          base if-link-type;
        }
        description
          "Type of OSPF interface.";
      }

      container interface {
        description "Normal interface.";
        leaf interface {
          type org-openroadm-device:interface-ref;
          description "Interface.";
        }
      }  // container interface

      container virtual-link {
        description "virtual-link.";
        leaf area-id {
          type uint32;
          description "Area ID.";
        }

        leaf neighbor-router-id {
          type yang:dotted-quad;
          description "Neighbor router id.";
        }
      }  // container virtual-link

      container sham-link {
        description "sham-link.";
        leaf area-id {
          type uint32;
          description "Area ID.";
        }

        leaf local-ip-addr {
          type inet:ip-address;
          description
            "Sham link local address.";
        }

        leaf remote-ip-addr {
          type inet:ip-address;
          description
            "Sham link remote address.";
        }
      }  // container sham-link

      leaf state {
        type if-state-type;
        description "Interface state.";
      }
    }  // notification if-state-change

    notification if-config-error {
      description
        "This notification is sent when interface
       config error is detected.";
      uses notification-instance-hdr;

      leaf link-type {
        type identityref {
          base if-link-type;
        }
        description
          "Type of OSPF interface.";
      }

      container interface {
        description "Normal interface.";
        leaf interface {
          type org-openroadm-device:interface-ref;
          description "Interface.";
        }

        leaf packet-source {
          type yang:dotted-quad;
          description "Source address.";
        }
      }  // container interface

      container virtual-link {
        description "virtual-link.";
        leaf area-id {
          type uint32;
          description "Area ID.";
        }

        leaf neighbor-router-id {
          type yang:dotted-quad;
          description "Neighbor router id.";
        }
      }  // container virtual-link

      container sham-link {
        description "sham-link.";
        leaf area-id {
          type uint32;
          description "Area ID.";
        }

        leaf local-ip-addr {
          type inet:ip-address;
          description
            "Sham link local address.";
        }

        leaf remote-ip-addr {
          type inet:ip-address;
          description
            "Sham link remote address.";
        }
      }  // container sham-link

      leaf packet-type {
        type packet-type;
        description "OSPF packet type.";
      }

      leaf error {
        type enumeration {
          enum "badVersion" {
            value 0;
            description "Bad version";
          }
          enum "areaMismatch" {
            value 1;
            description "Area mistmatch";
          }
          enum "unknownNbmaNbr" {
            value 2;
            description
              "Unknown NBMA neighbor";
          }
          enum "unknownVirtualNbr" {
            value 3;
            description
              "Unknown virtual link neighbor";
          }
          enum "authTypeMismatch" {
            value 4;
            description "Auth type mismatch";
          }
          enum "authFailure" {
            value 5;
            description "Auth failure";
          }
          enum "netMaskMismatch" {
            value 6;
            description
              "Network mask mismatch";
          }
          enum "helloIntervalMismatch" {
            value 7;
            description
              "Hello interval mismatch";
          }
          enum "deadIntervalMismatch" {
            value 8;
            description
              "Dead interval mismatch";
          }
          enum "optionMismatch" {
            value 9;
            description "Option mismatch";
          }
          enum "mtuMismatch" {
            value 10;
            description "MTU mismatch";
          }
          enum "duplicateRouterId" {
            value 11;
            description
              "Duplicate router ID";
          }
          enum "noError" {
            value 12;
            description "No error";
          }
        }
        description "Error code.";
      }
    }  // notification if-config-error

    notification nbr-state-change {
      description
        "This notification is sent when neighbor
       state change is detected.";
      uses notification-instance-hdr;

      leaf link-type {
        type identityref {
          base if-link-type;
        }
        description
          "Type of OSPF interface.";
      }

      container interface {
        description "Normal interface.";
        leaf interface {
          type org-openroadm-device:interface-ref;
          description "Interface.";
        }

        leaf neighbor-router-id {
          type yang:dotted-quad;
          description "Neighbor router id.";
        }

        leaf neighbor-ip-addr {
          type yang:dotted-quad;
          description "Neighbor address.";
        }
      }  // container interface

      container virtual-link {
        description "virtual-link.";
        leaf area-id {
          type uint32;
          description "Area ID.";
        }

        leaf neighbor-router-id {
          type yang:dotted-quad;
          description "Neighbor router id.";
        }
      }  // container virtual-link

      container sham-link {
        description "sham-link.";
        leaf area-id {
          type uint32;
          description "Area ID.";
        }

        leaf local-ip-addr {
          type inet:ip-address;
          description
            "Sham link local address.";
        }

        leaf neighbor-router-id {
          type yang:dotted-quad;
          description "Neighbor router id.";
        }

        leaf neighbor-ip-addr {
          type yang:dotted-quad;
          description "Neighbor address.";
        }
      }  // container sham-link

      leaf state {
        type nbr-state-type;
        description "Neighbor state.";
      }
    }  // notification nbr-state-change

    notification nbr-restart-helper-status-change {
      description
        "This notification is sent when neighbor restart
       helper status change is detected.";
      uses notification-instance-hdr;

      leaf link-type {
        type identityref {
          base if-link-type;
        }
        description
          "Type of OSPF interface.";
      }

      container interface {
        description "Normal interface.";
        leaf interface {
          type org-openroadm-device:interface-ref;
          description "Interface.";
        }

        leaf neighbor-router-id {
          type yang:dotted-quad;
          description "Neighbor router id.";
        }

        leaf neighbor-ip-addr {
          type yang:dotted-quad;
          description "Neighbor address.";
        }
      }  // container interface

      container virtual-link {
        description "virtual-link.";
        leaf area-id {
          type uint32;
          description "Area ID.";
        }

        leaf neighbor-router-id {
          type yang:dotted-quad;
          description "Neighbor router id.";
        }
      }  // container virtual-link

      leaf status {
        type restart-helper-status-type;
        description "Restart helper status.";
      }

      leaf age {
        type uint32;
        units "seconds";
        description
          "Remaining time in current OSPF graceful restart
         interval, if the router is acting as a restart
         helper for the neighbor.";
      }

      leaf exit-reason {
        type restart-exit-reason-type;
        description
          "Restart helper exit reason.";
      }
    }  // notification nbr-restart-helper-status-change

    notification rx-bad-packet {
      description
        "This notification is sent when an OSPF packet
       has been received on a interface that cannot be parsed.";
      uses notification-instance-hdr;

      leaf link-type {
        type identityref {
          base if-link-type;
        }
        description
          "Type of OSPF interface.";
      }

      container interface {
        description "Normal interface.";
        leaf interface {
          type org-openroadm-device:interface-ref;
          description "Interface.";
        }

        leaf packet-source {
          type yang:dotted-quad;
          description "Source address.";
        }
      }  // container interface

      container virtual-link {
        description "virtual-link.";
        leaf area-id {
          type uint32;
          description "Area ID.";
        }

        leaf neighbor-router-id {
          type yang:dotted-quad;
          description "Neighbor router id.";
        }
      }  // container virtual-link

      container sham-link {
        description "sham-link.";
        leaf area-id {
          type uint32;
          description "Area ID.";
        }

        leaf local-ip-addr {
          type inet:ip-address;
          description
            "Sham link local address.";
        }

        leaf remote-ip-addr {
          type inet:ip-address;
          description
            "Sham link remote address.";
        }
      }  // container sham-link

      leaf packet-type {
        type packet-type;
        description "OSPF packet type.";
      }
    }  // notification rx-bad-packet

    notification lsdb-approaching-overflow {
      description
        "This notification is sent when the number of LSAs
       in the router's link state database has exceeded
       ninety percent of the ext-lsdb-limit.";
      uses notification-instance-hdr;

      leaf ext-lsdb-limit {
        type uint32;
        description
          "The maximum number of non-default AS-external LSAs
         entries that can be stored in the link state database.";
      }
    }  // notification lsdb-approaching-overflow

    notification lsdb-overflow {
      description
        "This notification is sent when the number of LSAs
       in the router's link state database has exceeded
       ext-lsdb-limit.";
      uses notification-instance-hdr;

      leaf ext-lsdb-limit {
        type uint32;
        description
          "The maximum number of non-default AS-external LSAs
         entries that can be stored in the link state database.";
      }
    }  // notification lsdb-overflow

    notification nssa-translator-status-change {
      description
        "This notification is sent when there is a change
       in the router's ability to translate OSPF NSSA LSAs
       OSPF AS-External LSAs.";
      uses notification-instance-hdr;

      leaf area-id {
        type uint32;
        description "Area ID.";
      }

      leaf status {
        type nssa-translator-state-type;
        description
          "NSSA translator status.";
      }
    }  // notification nssa-translator-status-change

    notification restart-status-change {
      description
        "This notification is sent when the graceful restart
       state for the router has changed.";
      uses notification-instance-hdr;

      leaf status {
        type restart-status-type;
        description "Restart status.";
      }

      leaf restart-interval {
        type uint16 {
          range "1..1800";
        }
        units "seconds";
        default "120";
        description "Restart interval.";
      }

      leaf exit-reason {
        type restart-exit-reason-type;
        description "Restart exit reason.";
      }
    }  // notification restart-status-change

    grouping ospf-grp {
      description "Grouping for OSPF";
      container ospf {
        description "OSPF.";
        container all-instances-inherit {
          if-feature instance-inheritance;
          description
            "Inheritance support to all instances.";
          container area {
            description
              "Area config to be inherited by all areas in
             all instances.";
          }  // container area

          container interface {
            description
              "Interface config to be inherited by all interfaces
             in all instances.";
          }  // container interface
        }  // container all-instances-inherit

        leaf operation-mode {
          type identityref {
            base operation-mode;
          }
          default
            "org-openroadm-ospf:ships-in-the-night";
          description "OSPF operation mode.";
        }

        list instance {
          key "routing-instance af";
          description
            "An OSPF routing protocol instance.";
          leaf routing-instance {
            type org-openroadm-routing:routing-instance-ref;
            description
              "For protocol centric model, which is supported in
             default-instance only, this could reference any layer 3
             routing-instance.
             For routing-instance centric model, must reference the
             enclosing routing-instance.";
          }

          leaf af {
            type identityref {
              base org-openroadm-routing:address-family;
            }
            description
              "Address-family of the instance.";
          }

          uses instance-config;

          container all-areas-inherit {
            if-feature area-inheritance;
            description
              "Inheritance for all areas.";
            container area {
              description
                "Area config to be inherited by all areas.";
            }  // container area

            container interface {
              description
                "Interface config to be inherited by all interfaces
               in all areas.";
            }  // container interface
          }  // container all-areas-inherit

          list area {
            key "area-id";
            description "List of ospf areas";
            leaf area-id {
              type yang:dotted-quad;
              description "Area ID.";
            }

            uses area-config;

            container all-interfaces-inherit {
              if-feature interface-inheritance;
              description
                "Inheritance for all interfaces";
              container interface {
                description
                  "Interface config to be inherited by all
                 interfaces.";
              }  // container interface
            }  // container all-interfaces-inherit

            list virtual-link {
              when
                "../area-id != '0' and ../area-type = 'normal'" {
                description
                  "Transit area must be non-backbone normal area.";
              }
              key "router-id";
              description
                "OSPF virtual link";
              leaf router-id {
                type yang:dotted-quad;
                description
                  "Virtual link router ID.";
              }

              uses interface-common-config;
            }  // list virtual-link

            list interface {
              key "interface";
              description
                "List of OSPF interfaces.";
              leaf interface {
                type org-openroadm-device:interface-ref;
                description "Interface.";
              }

              uses interface-config;
            }  // list interface
          }  // list area
        }  // list instance
      }  // container ospf
    }  // grouping ospf-grp

    augment /org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing/org-openroadm-routing:routing-instance/org-openroadm-routing:routing-protocols/org-openroadm-routing:routing-protocol {
      when
        "org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2' or org-openroadm-routing:type = 'org-openroadm-ospf:ospfv3'" {
        description
          "This augment is only valid for a routing protocol instance
         of OSPF (type 'ospfv2' or 'ospfv3').";
      }
      description "OSPF augmentation.";
      uses ospf-grp;
    }

    augment /org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing/org-openroadm-routing:routing-instance/org-openroadm-routing:routing-protocols/org-openroadm-routing:routing-protocol/org-openroadm-ospf:ospf/org-openroadm-ospf:instance {
      when
        "../../org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2' or
          ../../org-openroadm-routing:type = 'org-openroadm-ospf:ospfv3'" {
        description
          "This augment is only valid for OSPF
           (type 'ospfv2' or 'ospfv3').";
      }
      if-feature multi-topology;
      description
        "OSPF multi-topology routing-protocol augmentation.";
    }

    grouping topology-cost-grp {
      description
        "Grouping for topology cost";
      list topology {
        key "name";
        description
          "OSPF interface topology.";
        leaf name {
          type leafref {
            path
              "/org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing/org-openroadm-routing:routing-instance/org-openroadm-routing:ribs/org-openroadm-routing:rib/org-openroadm-routing:name";
          }
          description
            "One of the topology enabled on this interface";
        }

        leaf cost {
          type uint32;
          description
            "Interface cost for this topology";
        }
      }  // list topology
    }  // grouping topology-cost-grp

    augment /org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing/org-openroadm-routing:routing-instance/org-openroadm-routing:routing-protocols/org-openroadm-routing:routing-protocol/org-openroadm-ospf:ospf/org-openroadm-ospf:instance/org-openroadm-ospf:area/org-openroadm-ospf:interface {
      when
        "../../../../org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2'" {
        description
          "This augment is only valid for OSPFv2.";
      }
      if-feature org-openroadm-ospf:multi-topology;
      description
        "OSPF multi-topology interface augmentation.";
      uses topology-cost-grp;
    }

    grouping ospf-lsa-grp {
      description "Grouping for ospf lsa";
      container ospf {
        description "OSPF";
        list instance {
          key "routing-instance af";
          description
            "An OSPF routing protocol instance.";
          leaf routing-instance {
            type org-openroadm-routing:routing-instance-ref;
            description
              "For protocol centric model, which is supported in
             default-instance only, this could reference any layer 3
             routing-instance.
             For routing-instance centric model, must reference the
             enclosing routing-instance.";
          }

          leaf af {
            type identityref {
              base org-openroadm-routing:address-family;
            }
            description
              "Address-family of the instance.";
          }

          uses instance-operation;

          list area {
            key "area-id";
            description "List of OSPF areas";
            leaf area-id {
              type area-id-type;
              description "Area ID.";
            }

            list interface {
              key "interface";
              description
                "List of OSPF interfaces.";
              leaf interface {
                type org-openroadm-device:interface-ref;
                description "Interface.";
              }

              uses interface-operation;

              list neighbor {
                key "neighbor-id";
                description
                  "List of OSPF neighbors.";
                leaf neighbor-id {
                  type inet:ipv4-address;
                  description "Neighbor ID.";
                }

                uses neighbor-operation;
              }  // list neighbor

              list link-scope-lsas {
                when
                  "../../../../../org-openroadm-routing:type = 'ospfv3'" {
                  description
                    "Link scope LSA only exists in OSPFv3.";
                }
                key "lsa-type";
                description
                  "List OSPF link scope LSA databases";
                leaf lsa-type {
                  type uint8;
                  description
                    "OSPF link scope LSA type.";
                }

                list link-scope-lsa {
                  key "lsa-id adv-router";
                  description
                    "List of OSPF link scope LSAs";
                  uses lsa-key;

                  uses link-scope-lsa;
                }  // list link-scope-lsa
              }  // list link-scope-lsas
            }  // list interface

            list area-scope-lsas {
              key "lsa-type";
              description
                "List OSPF area scope LSA databases";
              leaf lsa-type {
                type uint8;
                description
                  "OSPF area scope LSA type.";
              }

              list area-scope-lsa {
                key "lsa-id adv-router";
                description
                  "List of OSPF area scope LSAs";
                uses lsa-key;

                uses area-scope-lsa;
              }  // list area-scope-lsa
            }  // list area-scope-lsas
          }  // list area

          list as-scope-lsas {
            key "lsa-type";
            description
              "List OSPF AS scope LSA databases";
            leaf lsa-type {
              type uint8;
              description
                "OSPF AS scope LSA type.";
            }

            list as-scope-lsa {
              key "lsa-id adv-router";
              description
                "List of OSPF AS scope LSAs";
              uses lsa-key;

              uses as-scope-lsa;
            }  // list as-scope-lsa
          }  // list as-scope-lsas
        }  // list instance
      }  // container ospf
    }  // grouping ospf-lsa-grp

    augment /org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing-state/org-openroadm-routing:routing-instance/org-openroadm-routing:routing-protocols/org-openroadm-routing:routing-protocol {
      when
        "org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2' or org-openroadm-routing:type = 'org-openroadm-ospf:ospfv3'" {
        description
          "This augment is only valid for a routing protocol instance
         of type 'ospfv2' or 'ospfv3'.";
      }
      description "OSPF configuration.";
      uses ospf-lsa-grp;
    }

    grouping topology-area-grp {
      description
        "Grouping for topology area";
      list topology {
        key "name";
        description "OSPF topology.";
        leaf name {
          type leafref {
            path
              "/org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing/org-openroadm-routing:routing-instance/org-openroadm-routing:ribs/org-openroadm-routing:rib/org-openroadm-routing:name";
          }
          description "RIB";
        }

        list area {
          key "area-id";
          description "List of ospf areas";
          leaf area-id {
            type area-id-type;
            description "Area ID.";
          }
        }  // list area
      }  // list topology
    }  // grouping topology-area-grp

    augment /org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing-state/org-openroadm-routing:routing-instance/org-openroadm-routing:routing-protocols/org-openroadm-routing:routing-protocol/org-openroadm-ospf:ospf/org-openroadm-ospf:instance {
      when
        "../../org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2'" {
        description
          "This augment is only valid for OSPFv2.";
      }
      if-feature multi-topology;
      description
        "OSPF multi-topology routing-protocol augmentation.";
      uses topology-area-grp;
    }

    grouping topology-grp {
      description "Grouping for topology";
      list topology {
        key "name";
        description
          "OSPF interface topology.";
        leaf name {
          type leafref {
            path
              "/org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing/org-openroadm-routing:routing-instance/org-openroadm-routing:ribs/org-openroadm-routing:rib/org-openroadm-routing:name";
          }
          description
            "One of the topology enabled on this interface";
        }
      }  // list topology
    }  // grouping topology-grp

    augment /org-openroadm-device:org-openroadm-device/org-openroadm-routing:routing-state/org-openroadm-routing:routing-instance/org-openroadm-routing:routing-protocols/org-openroadm-routing:routing-protocol/org-openroadm-ospf:ospf/org-openroadm-ospf:instance/org-openroadm-ospf:area/org-openroadm-ospf:interface {
      when
        "../../../../org-openroadm-routing:type = 'org-openroadm-ospf:ospfv2'" {
        description
          "This augment is only valid for OSPFv2.";
      }
      if-feature org-openroadm-ospf:multi-topology;
      description
        "OSPF multi-topology interface augmentation.";
      uses topology-grp;
    }
  }  // module org-openroadm-ospf