netconfcentral logo

ietf-ospf

HTML

ietf-ospf@2017-10-30



  module ietf-ospf {

    yang-version 1;

    namespace
      "urn:ietf:params:xml:ns:yang:ietf-ospf";

    prefix ospf;

    import ietf-inet-types {
      prefix inet;
    }
    import ietf-yang-types {
      prefix yang;
    }
    import ietf-interfaces {
      prefix if;
    }
    import ietf-routing-types {
      prefix rt-types;
    }
    import iana-routing-types {
      prefix iana-rt-types;
    }
    import ietf-routing {
      prefix rt;
    }
    import ietf-key-chain {
      prefix key-chain;
    }

    organization
      "IETF OSPF - OSPF Working Group";

    contact
      "WG Web:   <http://datatracker.ietf.org/group/ospf/>
     WG List:  <mailto:ospf@ietf.org>

     Editor:   Derek Yeung
               <mailto:derek@arrcus.com>
     Author:   Acee Lindem
               <mailto:acee@cisco.com>
     Author:   Yingzhen Qu
               <mailto:yingzhen.qu@huawei.com>
     Author:   Jeffrey Zhang
               <mailto:zzhang@juniper.net>
     Author:   Ing-Wher Chen
               <mailto:ing-wher_chen@jabil.com>
     Author:   Dean Bogdanovic
               <mailto:ivandean@gmail.com>
     Author:   Kiran Agrahara Sreenivasa
               <mailto:kkoushik@cisco.com>";

    description
      "This YANG module defines the generic configuration and
      operational state for the OSPF protocol common to all
      vendor implementations. It is intended that the module
      will be extended by vendors to define vendor-specific
      OSPF configuration parameters and policies,
      for example route maps or route policies.

      Copyright (c) 2017 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).

       This version of this YANG module is part of RFC XXXX;
       see the RFC itself for full legal notices.";

    reference
      "RFC XXXX";


    revision "2017-10-30" {
      description
        "* Address iana-routing-types address-family type change.
       * Complete NMDA change for routing-state augmentation.
      ";
      reference
        "RFC XXXX: A YANG Data Model for OSPF.";

    }

    revision "2017-07-01" {
      description
        "* Restructure model to conform to NMDA.
       * Remove features for instance, area and interface
         inheritance.
       * Update static neighbor identifier description to
         allow for router-id, ipv4-address, and ipv6-address.
       * Added spf-log and lsa-log.
       * Use dotted-quad for OSPFv2 LSA ID.
       * Fix virtual-link transit-area-id leafref path and
         must statement.
      ";
      reference
        "RFC XXXX: A YANG Data Model for OSPF.";

    }

    revision "2017-03-12" {
      description
        "* Update authors information.
       * Rename admin distance to preference.
       * Rename network type to interface type.
       * Add ietf-spf-delay as a feature.
       * Add node-tag as a feature and update LSA
         definition accordingly.
       * Remove LDP IGP autoconfig.
       * Add BFD as a feature instead of a separate module.
       * Change TE router ID to support IPv4 and IPv6 router ID.
       * Replace key-chain:crypto-algorithm-types with
         key-chain:crypto-algorithm.
       * Remove type ieee-bandwidth.
       * Import ietf-routing-types and make use of
         router-id, address-family and bandwidth-ieee-float32
         type definitions.
       * Simplify notification header.
       * Fix compilation issue in multiple must statements.
      ";
      reference
        "RFC XXXX: A YANG Data Model for OSPF.";

    }

    revision "2016-10-31" {
      description
        "* Update authors information.
       * Rename candidate-disabled to candidiate-enable
         and set the default value to TRUE.
       * Rename node identifiers that end with
         'enabled' to 'enable'.
       * Set the default value of
         ospf/instance/areas/area/interfaces/interface/
         fast-reroute/lfa/enable (previously named 'enabled')
         to FALSE.
       * Set the default value of
         ospf/instance/areas/area/interfaces/interface/
         fast-reroute/remote-lfa/enable (previously named 'enabled')
         to FALSE.
       * Rename
         ospf/instance/areas/area/interfaces/interface/
         static-neighbors/neighbor/address to 'identifier'
         with type inet:ip-address
       * Add 'dead-timer' to
         ospf-state/instance/areas/area/interfaces/interface/
         neighbors/neighbor.
       * Remove 'mtu-ignore' and 'prefix-suppression' from
         virtual-link configuration.
       * Adjust range specifications from 'transmit-delay',
         'dead-interval', and 'retransmit-interval' in
         ospf/instance/areas/area/interfaces/interface.
       * Change the type of
         ospf/instance/areas/area/interface/interface/dead-interval
         to uint32 to match RFC2328 Appendix A.3.2.
       * Change hello-timer and wait-timer unit to seconds.
       * Update hello-timer, dead-timer and wait-timer descriptions.
       * Add IEEE bandwidth type and update all TE bandwidth fields
         to use it.
       * Add Nt-bit to OSPFv2 router LSA.
       * Remove L-bit from OSPFv2 router LSA.
      ";
      reference
        "RFC XXXX: A YANG Data Model for OSPF.";

    }

    revision "2016-07-07" {
      description
        "* Add ospfv3 AF bit.
       * Add ospfv2 MT, L, O, DN bit.
       * Add interface priority config.
       * Change bdr-ip-address to type ip-address.
       * Rename leaf interface to name.
       * Rename rx-bad-packet to if-rx-bad-packet.
       * Move virtual link placement to backbone area.
       * Remove cost configuration from virtual link.
       * Move if-feature multi-area-adj statement.
       * Add type checksum16-type.
       * Change LSA header checksum to use checksum16-type.
       * Change routing-protocol to control-plane-protocol.
       * Change import module name to ietf-key-chain.";
      reference
        "RFC XXXX: A YANG Data Model for OSPF.";

    }

    revision "2016-03-20" {
      description
        "* Reorganize *-config and *-operation groupings.
       * Use *-config under state tree for applied config.
       * Rename config router-id to explicit-router-id.
       * Rename feature router-id to explicit-router-id.
       * Add OSPFv3 instance ID.
       * Add OSPFv3 interface ID.
       * Add ip-address for DR and BDR.
       * Remove routing-instance.
       * Change import module name to ietf-routing-key-chain.";
      reference
        "RFC XXXX: A YANG Data Model for OSPF.";

    }

    revision "2015-10-19" {
      description
        "* Remove the abstract identity ospf.
       * Make area-id-type dotted-quad only.
       * Use area-id-type for all area-id leafs.
       * Restructure notifications.
       * Move BFD support to the new ietf-ospf-bfd module.
       * Update author information.
       * Editorial changes.";
      reference
        "RFC XXXX: A YANG Data Model for OSPF.";

    }

    revision "2015-09-02" {
      description
        "* Author information update.
       * Editorial changes";
      reference
        "RFC XXXX: A YANG Data Model for OSPF.";

    }

    revision "2015-07-06" {
      description
        "* Remove support for protocol-centric config.
       * Enclose list in container, except for instance.
       * Replace protocol-shutdown with admin-control.
       * Add IP-FRR per-interface config.
       * Reorganize max-path etc node.
       * Add node-flag.
       * Align config/operation hierarchy.
       * Use relative path for reference to rib.
       * Add ability to set single admin distance.
       * Make unreserved bandwidth into list.
       * Add F and T bit to OSPFv3 external LSA.
       * Remove key statement inside LSA body.
       * Add stub router support.
       * Fix usage of af-area-config.
       * Add statistics to operation data.
       * Add local rib.
       * Use dotted-quad for all router-id fields.
       * Support more than one multi-area per interface.
       * Use uint16 for LSA type.
       * Update grouping notification-instance-hdr.
       * Rework condition for opaque type and id in OSPFv2 LSA.
       * Rename local-remote-ipv4-addr with remote-if-ipv4-addr.
       * Add virtual-link/sham-link to operation state.
       * Allow multiple link TLVs in one LSA.
       * Fix bug in as-scope-lsas.
       * Remove OSPFv3 restriction in link-scope-lsas.
       * Editorial changes.";
      reference
        "RFC XXXX: A YANG Data Model for OSPF.";

    }

    revision "2015-03-09" {
      description "Initial revision.";
      reference
        "RFC XXXX: A YANG Data Model for OSPF.";

    }


    feature multi-topology {
      description
        "Support Multiple-Topolgy Routing (MTR).";
    }

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

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

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

    feature mtu-ignore {
      description
        "Disable OSPF Database Description packet MTU
       mismatch checking.";
    }

    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 ttl-security {
      description "OSPF TTL security check.";
    }

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

    feature graceful-restart {
      description
        "Graceful OSPF Restart as defined in RFC 3623 and
       RFC 5187.";
    }

    feature admin-control {
      description
        "Administrative control of the protocol state.";
    }

    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 the OSPF instance
       will accept.";
    }

    feature te-rid {
      description "TE Router-ID.";
    }

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

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

    feature fast-reroute {
      description
        "Support of IP Fast Reroute (IP-FRR).";
    }

    feature node-flag {
      description "Support of node flag.";
    }

    feature node-tag {
      description "Support of node tag.";
    }

    feature lfa {
      description
        "Support of Loop Free Alternates (LFAs).";
    }

    feature remote-lfa {
      description
        "Support of Remote Loop Free Alternates (R-LFA).";
    }

    feature stub-router {
      description
        "Support of RFC 6987 OSPF Stub Router Advertisement.";
    }

    feature pe-ce-protocol {
      description "Support PE-CE protocol";
    }

    feature ietf-spf-delay {
      description
        "Support of IETF SPF delay algorithm.";
    }

    feature bfd {
      description "Support of BFD.";
    }

    identity ospfv2 {
      base rt:routing-protocol;
      description "OSPFv2";
    }

    identity ospfv3 {
      base rt:routing-protocol;
      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 lsa-log-reason {
      base 
      description
        "Base identity for an LSA log reason.";
    }

    identity lsa-refresh {
      base lsa-log-reason;
      description
        "Identity used when the LSA is logged
       as a result of receiving a refresh LSA.";
    }

    identity lsa-content-change {
      base lsa-log-reason;
      description
        "Identity used when the LSA is logged
       as a result of a change in the content
       of the LSA.";
    }

    identity lsa-purge {
      base lsa-log-reason;
      description
        "Identity used when the LSA is logged
       as a result of being purged.";
    }

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

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

    typedef 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 type 1 external route.";
        }
        enum "external-2" {
          value 3;
          description
            "OSPF type 2 external route.";
        }
        enum "nssa-1" {
          value 4;
          description
            "OSPF type 1 NSSA route.";
        }
        enum "nssa-2" {
          value 5;
          description
            "OSPF type 2 NSSA route.";
        }
      }
      description "OSPF route 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.";
    }

    typedef checksum16-type {
      type string {
        pattern '(0x)?[0-9a-fA-F]{4}';
      }
      description
        "16-bit checksum in hex-string format 0xXXXX.";
    }

    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 unknown-tlvs {
      description
        "Unknown TLVs grouping - Used for unknown TLVs or
       unknown sub-TLVs.";
      container unknown-tlvs {
        description "All unknown TLVs.";
        list unknown-tlv {
          description "Unknown TLV.";
          uses tlv;
        }  // list unknown-tlv
      }  // container unknown-tlvs
    }  // grouping unknown-tlvs

    grouping node-tag-tlv {
      description
        "OSPF Node Admin Tag TLV grouping.";
      list node-tag {
        description "List of tags.";
        leaf tag {
          type uint32;
          description "Node tag value.";
        }
      }  // list node-tag
    }  // grouping node-tag-tlv

    grouping ospfv2-router-link {
      description "OSPFv2 router 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.";
      }
    }  // grouping ospfv2-router-link

    grouping ospfv2-lsa-body {
      description "OSPFv2 LSA body.";
      container router {
        when "../../header/type = 1" {
          description
            "Only applies to Router LSAs.";
        }
        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.";
            }
          }
          description "Flags.";
        }

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

        container links {
          description "All router Links.";
          list link {
            description "Router LSA link.";
            uses ospfv2-router-link;

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

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

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

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

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

        container topologies {
          description
            "All topologies for the summary LSA.";
          list topology {
            description
              "Topology specific information.";
            leaf mt-id {
              type uint8;
              description
                "The MT-ID for the topology enabled for
               the summary.";
            }

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

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

        container topologies {
          description
            "All topologies for the external.";
          list topology {
            description
              "Topology specific information.";
            leaf mt-id {
              type uint8;
              description
                "The MT-ID for the topology enabled for the
               external or NSSA prefix.";
            }

            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 for the topology.";
            }
          }  // list topology
        }  // container topologies
      }  // container external

      container opaque {
        when
          "../../header/type = 9 or "
            + "../../header/type = 10 or "
            + "../../header/type = 11" {
          description
            "Only applies to Opaque LSAs.";
        }
        description "Opaque LSA.";
        uses unknown-tlvs;

        container node-tag-tlvs {
          description "All node tag tlvs.";
          list node-tag-tlv {
            description "Node tag tlv.";
            uses node-tag-tlv;
          }  // list node-tag-tlv
        }  // container node-tag-tlvs

        container router-address-tlv {
          description "Router address TLV.";
          leaf router-address {
            type inet:ipv4-address;
            description "Router address.";
          }
        }  // container router-address-tlv

        container link-tlvs {
          description
            "All link TLVs in the LSA.";
          list link-tlv {
            description "Link TLV.";
            leaf link-type {
              type uint8;
              mandatory true;
              description "Link type.";
            }

            leaf link-id {
              type union {
                type inet:ipv4-address;
                type yang:dotted-quad;
              }
              mandatory true;
              description "Link ID.";
            }

            container local-if-ipv4-addrs {
              description
                "All local interface IPv4 addresses.";
              leaf-list local-if-ipv4-addr {
                type inet:ipv4-address;
                description
                  "List of local interface IPv4 addresses.";
              }
            }  // container local-if-ipv4-addrs

            container remote-if-ipv4-addrs {
              description
                "All remote interface IPv4 addresses.";
              leaf-list remote-if-ipv4-addr {
                type inet:ipv4-address;
                description
                  "List of remote interface IPv4 addresses.";
              }
            }  // container remote-if-ipv4-addrs

            leaf te-metric {
              type uint32;
              description "TE metric.";
            }

            leaf max-bandwidth {
              type rt-types:bandwidth-ieee-float32;
              description
                "Maximum bandwidth.";
            }

            leaf max-reservable-bandwidth {
              type rt-types:bandwidth-ieee-float32;
              description
                "Maximum reservable bandwidth.";
            }

            container unreserved-bandwidths {
              description
                "All unreserved bandwidths.";
              list unreserved-bandwidth {
                description
                  "List of unreserved bandwidths for different
                 priorities.";
                leaf priority {
                  type uint8 {
                    range "0 .. 7";
                  }
                  description
                    "Priority from 0 to 7.";
                }

                leaf unreserved-bandwidth {
                  type rt-types:bandwidth-ieee-float32;
                  description
                    "Unreserved bandwidth.";
                }
              }  // list unreserved-bandwidth
            }  // container unreserved-bandwidths

            leaf admin-group {
              type uint32;
              description
                "Administrative group/Resource Class/Color.";
            }

            uses unknown-tlvs;
          }  // list link-tlv
        }  // container link-tlvs

        container extended-prefix-tlvs {
          description
            "All extended prefix TLVs in the LSA.";
          list extended-prefix-tlv {
            description
              "Extended prefix TLV.";
            leaf route-type {
              type enumeration {
                enum "unspecified" {
                  value 0;
                  description "Unspecified.";
                }
                enum "intra-area" {
                  value 1;
                  description
                    "OSPF intra-area route.";
                }
                enum "inter-area" {
                  value 3;
                  description
                    "OSPF inter-area route.";
                }
                enum "external" {
                  value 5;
                  description
                    "OSPF External route.";
                }
                enum "nssa" {
                  value 7;
                  description
                    "OSPF NSSA external route.";
                }
              }
              description "Route type.";
            }

            leaf flags {
              type bits {
                bit A {
                  position 0;
                  description "Attach flag.";
                }
                bit N {
                  position 1;
                  description "Node flag.";
                }
              }
              description "Flags.";
            }

            leaf prefix {
              type inet:ip-prefix;
              description "Address prefix.";
            }

            uses unknown-tlvs;
          }  // list extended-prefix-tlv
        }  // container extended-prefix-tlvs

        container extended-link-tlvs {
          description
            "All extended link TLVs in the LSA.";
          list extended-link-tlv {
            description "Extended link TLV.";
            uses ospfv2-router-link;

            uses unknown-tlvs;
          }  // list extended-link-tlv
        }  // container extended-link-tlvs
      }  // container opaque
    }  // grouping ospfv2-lsa-body

    grouping ospfv3-lsa-options {
      description "OSPFv3 LSA options";
      leaf options {
        type bits {
          bit AF {
            position 0;
            description
              "When set, the router supprts OSPFv3 AFs as in RFC5838.";
          }
          bit DC {
            position 1;
            description
              "When set, the router supports demand circuits.";
          }
          bit R {
            position 2;
            description
              "When set, the originator is an active router.";
          }
          bit N {
            position 3;
            description
              "If set, the router is attached to an NSSA";
          }
          bit E {
            position 4;
            description
              "This bit describes the way AS-external LSAs
             are flooded";
          }
          bit V6 {
            position 5;
            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
             translated to an AS External LSA and readvertised
             by the translating NSSA Border Router.";
          }
          bit DN {
            position 3;
            description
              "When set, the inter-area-prefix LSA or
             AS-external LSA prefix has been advertised as an
             L3VPN prefix.";
          }
        }
        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.";
          }
          bit F {
            position 1;
            description
              "When set, a Forwarding Address is included
             in the LSA.";
          }
          bit T {
            position 2;
            description
              "When set, an External Route Tag is included
             in the LSA.";
          }
        }
        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 applies to Router LSAs.";
        }
        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 "Router LSA flags.";
        }

        uses ospfv3-lsa-options;

        container links {
          description "All router link.";
          list link {
            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 rt-types:router-id;
              description
                "Neighbor Router ID.";
            }

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

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

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

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

      container inter-area-prefix {
        when "../../header/type = 8195" {
          description
            "Only applies to Inter-Area-Prefix LSAs.";
        }
        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 applies to Inter-Area-Router LSAs.";
        }
        description "Inter-Area-Router LSA.";
        uses ospfv3-lsa-options;

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

        leaf destination-router-id {
          type rt-types:router-id;
          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 applies to AS-external LSAs.";
        }
        description "AS-External LSA.";
        uses ospfv3-lsa-external;
      }  // container as-external

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

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

        uses ospfv3-lsa-options;

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

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

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

      container intra-area-prefix {
        when "../../header/type = 8201" {
          description
            "Only applies 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.";
        }

        container prefixes {
          description
            "All prefixes in this LSA.";
          list prefix {
            description
              "List of prefixes in this LSA.";
            uses ospfv3-lsa-prefix;

            leaf metric {
              type uint24;
              description "Prefix Metric.";
            }
          }  // list prefix
        }  // container prefixes
      }  // container intra-area-prefix

      container router-information {
        when
          "../../header/type = 32780 or "
            + "../../header/type = 40972 or "
            + "../../header/type = 49164 or "
            + "../../header/type = 57356" {
          description
            "Only applies to Router Information LSAs (RFC7770).";
        }
        description
          "Router Information LSA.";
        container node-tag-tlvs {
          description "All node tag tlvs.";
          list node-tag-tlv {
            description "Node tag tlv.";
            uses node-tag-tlv;
          }  // list node-tag-tlv
        }  // container node-tag-tlvs
      }  // container router-information
    }  // 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 checksum16-type;
        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 {
        must
          "(type = 9 or type = 10 or type = 11) and "
            + "opaque-id and opaque-type "
            + "or (type != 9 and type != 10 and type != 11) "
            + "and not(opaque-id) and "
            + "not(opaque-type)" {
          description
            "Opaque type and ID only apply to Opaque LSAs.";
        }
        description
          "Decoded OSPFv2 LSA header data.";
        leaf option {
          type bits {
            bit MT {
              position 0;
              description
                "When set, the router supports multi-topology as
               in RFC 4915.";
            }
            bit DC {
              position 1;
              description
                "When set, the router supports demand circuits.";
            }
            bit P {
              position 2;
              description
                "Only used in type-7 LSA. When set, an NSSA
               border router should translate the type-7 LSA
               to a type-5 LSA.";
            }
            bit MC {
              position 3;
              description
                "When set, the router supports MOSPF.";
            }
            bit E {
              position 4;
              description
                "This bit describes the way AS-external LSAs
               are flooded.";
            }
            bit O {
              position 5;
              description
                "When set, the router is opaque-capable as in
               RFC 5250.";
            }
            bit DN {
              position 6;
              description
                "When a type 3, 5 or 7 LSA is sent from a PE to a CE,
               the DN bit must be set. See RFC 4576.";
            }
          }
          mandatory true;
          description "LSA options.";
        }

        leaf lsa-id {
          type yang:dotted-quad;
          mandatory true;
          description "LSA ID.";
        }

        leaf opaque-type {
          type uint8;
          description "Opaque type.";
        }

        leaf opaque-id {
          type uint24;
          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.";
      }

      leaf raw-data {
        type yang:hex-string;
        description
          "The complete LSA in network byte
         order hexadecimal as received or originated.";
      }
    }  // grouping lsa-common

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

      choice version {
        description
          "OSPFv2 or OSPFv3 LSA body.";
        container ospfv2 {
          description "OSPFv2 LSA";
          uses ospfv2-lsa;
        }  // container ospfv2
        container ospfv3 {
          description "OSPFv3 LSA";
          uses ospfv3-lsa;
        }  // container ospfv3
      }  // choice version
    }  // grouping lsa

    grouping lsa-key {
      description "OSPF LSA key.";
      leaf lsa-id {
        type union {
          type yang:dotted-quad;
          type uint32;
        }
        description "LSA ID.";
      }

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

    grouping instance-stat {
      description "Per-instance statistics";
      leaf originate-new-lsa-count {
        type yang:counter32;
        description
          "The number of new LSAs originated.";
      }

      leaf rx-new-lsas-count {
        type yang:counter32;
        description
          "The number of LSAs received.";
      }

      leaf as-scope-lsa-count {
        type yang:gauge32;
        description
          "The number of AS Scope LSAs.";
      }

      leaf as-scope-lsa-chksum-sum {
        type uint32;
        description
          "The sum of the LSA checksums for AS Scope LSAs.";
      }

      container database {
        description
          "Container for per AS-scope LSA statistics.";
        list as-scope-lsa-type {
          description
            "List of AS-scope LSA statistics";
          leaf lsa-type {
            type uint16;
            description "AS-scope LSA type.";
          }

          leaf lsa-count {
            type yang:gauge32;
            description
              "The number of LSAs of the LSA type.";
          }

          leaf lsa-cksum-sum {
            type int32;
            description
              "The sum of the LSA checksums of the LSA type.";
          }
        }  // list as-scope-lsa-type
      }  // container database
    }  // grouping instance-stat

    grouping area-stat {
      description "Per-area statistics.";
      leaf spf-runs-count {
        type yang:counter32;
        description
          "The number of times the intra-area SPF has run.";
      }

      leaf abr-count {
        type yang:gauge32;
        description
          "The total number of Area Border Routers (ABRs)
         reachable within this area.";
      }

      leaf asbr-count {
        type yang:gauge32;
        description
          "The total number of AS Border Routers (ASBRs).";
      }

      leaf ar-nssa-translator-event-count {
        type yang:counter32;
        description
          "The number of NSSA translator-state changes.";
      }

      leaf area-scope-lsa-count {
        type yang:gauge32;
        description
          "The number of area scope LSAs in the area.";
      }

      leaf area-scope-lsa-cksum-sum {
        type int32;
        description
          "The sum of the area scope LSAs checksums.";
      }

      container database {
        description
          "Container for area scope LSA type statistics.";
        list area-scope-lsa-type {
          description
            "List of area scope LSA statistics";
          leaf lsa-type {
            type uint16;
            description
              "Area scope LSA type.";
          }

          leaf lsa-count {
            type yang:gauge32;
            description
              "The number of LSAs of the LSA type.";
          }

          leaf lsa-cksum-sum {
            type int32;
            description
              "The sum of the LSA checksums of the LSA type.";
          }
        }  // list area-scope-lsa-type
      }  // container database
    }  // grouping area-stat

    grouping interface-stat {
      description "Per-interface statistics";
      leaf if-event-count {
        type yang:counter32;
        description
          "The number of times this interface has changed its
         state or an error has occurred.";
      }

      leaf link-scope-lsa-count {
        type yang:gauge32;
        description
          "The number of link scope LSAs.";
      }

      leaf link-scope-lsa-cksum-sum {
        type uint32;
        description
          "The sum of link scope LSA checksums.";
      }

      container database {
        description
          "Container for link scope LSA type statistics.";
        list link-scope-lsa-type {
          description
            "List of link scope LSA statistics";
          leaf lsa-type {
            type uint16;
            description
              "Link scope LSA type.";
          }

          leaf lsa-count {
            type yang:gauge32;
            description
              "The number of LSAs of the LSA type.";
          }

          leaf lsa-cksum-sum {
            type int32;
            description
              "The sum of the LSA checksums of the LSA type.";
          }
        }  // list link-scope-lsa-type
      }  // container database
    }  // grouping interface-stat

    grouping neighbor-stat {
      description "Per-neighbor statistics.";
      leaf nbr-event-count {
        type yang:counter32;
        description
          "The number of times this neighbor has changed
         state or an error has occurred.";
      }

      leaf nbr-retrans-qlen {
        type yang:gauge32;
        description
          "The current length of the retransmission queue.";
      }
    }  // grouping neighbor-stat

    grouping instance-fast-reroute-config {
      description
        "This group defines global configuration of IP-FRR.";
      container fast-reroute {
        if-feature fast-reroute;
        description
          "This container may be augmented with global
         parameters for IP-FRR.";
        container lfa {
          if-feature lfa;
          description
            "This container may be augmented with
           global parameters for LFA. Container creation
           has no effect on LFA activation.";
        }  // container lfa
      }  // container fast-reroute
    }  // grouping instance-fast-reroute-config

    grouping interface-fast-reroute-config {
      description
        "This group defines interface configuration of IP-FRR.";
      container fast-reroute {
        if-feature fast-reroute;
        description
          "IP Fast-reroute configuration.";
        container lfa {
          if-feature lfa;
          description "LFA configuration.";
          leaf candidate-enable {
            type boolean;
            default 'true';
            description
              "Enable the interface to be used as backup.";
          }

          leaf enable {
            type boolean;
            default 'false';
            description
              "Activates LFA - Per-prefix LFA computation
             is assumed.";
          }

          container remote-lfa {
            if-feature remote-lfa;
            description
              "Remote LFA configuration.";
            leaf enable {
              type boolean;
              default 'false';
              description
                "Activates Remote LFA (R-LFA).";
            }
          }  // container remote-lfa
        }  // container lfa
      }  // container fast-reroute
    }  // grouping interface-fast-reroute-config

    grouping interface-physical-link-config {
      description
        "Interface cost configuration that only applies to
       physical interfaces and sham links.";
      leaf cost {
        type uint16 {
          range "1..65535";
        }
        description "Interface cost.";
      }

      leaf mtu-ignore {
        if-feature mtu-ignore;
        type boolean;
        description
          "Enable/Disable bypassing the MTU mismatch check in
         Database Description packets.";
      }

      leaf prefix-suppression {
        if-feature prefix-suppression;
        type boolean;
        description
          "Suppress advertisement of the prefixes associated
         with the interface.";
      }
    }  // grouping interface-physical-link-config

    grouping interface-common-config {
      description
        "Common configuration for all types of interfaces,
       including virtual links and sham links.";
      leaf hello-interval {
        type uint16 {
          range "1..65535";
        }
        units "seconds";
        description
          "Interval between hello packets in seconds.";
      }

      leaf dead-interval {
        type uint32 {
          range "1..2147483647";
        }
        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 down in seconds.";
      }

      leaf retransmit-interval {
        type uint16 {
          range "1..3600";
        }
        units "seconds";
        description
          "Interval between retransmitting unacknowledged Link
         State Advertisements (LSAs) in seconds.";
      }

      leaf transmit-delay {
        type uint16 {
          range "1..3600";
        }
        units "seconds";
        description
          "Estimated time needed to transmit Link State Update
         packets on the interface in seconds.";
      }

      leaf lls {
        if-feature lls;
        type boolean;
        description
          "Enable/Disable link-local signaling (LLS) support.";
      }

      container ttl-security {
        if-feature ttl-security;
        description "TTL security check.";
        leaf enable {
          type boolean;
          description
            "Enable/Disable TTL security check.";
        }

        leaf hops {
          type uint8 {
            range "1..254";
          }
          description
            "Maximum number of hops that an OSPF packet may
           have traversed before reception.";
        }
      }  // container ttl-security

      leaf enable {
        if-feature admin-control;
        type boolean;
        default 'true';
        description
          "Enable/disable protocol on the interface.";
      }

      container authentication {
        description
          "Authentication configuration.";
        choice auth-type-selection {
          description
            "Options for expressing authentication setting.";
          case auth-ipsec {
            when
              "../../../../../../../rt:type = 'ospf:ospfv3'" {
              description
                "Applied to OSPFv3 only.";
            }
            if-feature ospfv3-authentication-ipsec;
            leaf sa {
              type string;
              description
                "Security Association name.";
            }
          }  // case auth-ipsec
          leaf key-chain {
            type key-chain:key-chain-ref;
            description "key-chain name.";
          }

          case auth-trailer-key {
            leaf key {
              type string;
              description
                "Key string in ASCII format.";
            }

            leaf crypto-algorithm {
              type identityref {
                base key-chain:crypto-algorithm;
              }
              description
                "Cryptographic algorithm associated with key.";
            }
          }  // case auth-trailer-key
        }  // choice auth-type-selection
      }  // container authentication
    }  // grouping interface-common-config

    grouping interface-config {
      description
        "Configuration for real interfaces.";
      leaf interface-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 "Interface type.";
      }

      leaf passive {
        type boolean;
        description
          "Enable/Disable passive interface - a passive interface's
         prefix will be advertised but no neighbor adjacencies
         will be formed on the interface.";
      }

      leaf demand-circuit {
        if-feature demand-circuit;
        type boolean;
        description
          "Enable/Disable demand circuit.";
      }

      leaf priority {
        type uint8;
        description
          "Configure OSPF router priority.";
      }

      container multi-areas {
        if-feature multi-area-adj;
        description
          "Container for multi-area config.";
        list multi-area {
          key "multi-area-id";
          description
            "Configure OSPF multi-area adjacency.";
          leaf multi-area-id {
            type area-id-type;
            description
              "Multi-area adjacency area ID.";
          }

          leaf cost {
            type uint16;
            description
              "Interface cost for multi-area adjacency.";
          }
        }  // list multi-area
      }  // container multi-areas

      container static-neighbors {
        description
          "Statically configured neighbors.";
        list neighbor {
          key "identifier";
          description
            "Specify a static OSPF neighbor.";
          leaf identifier {
            type inet:ip-address;
            description
              "Neighbor router ID, IPv4 address, or IPv6 address.";
          }

          leaf cost {
            type uint16 {
              range "1..65535";
            }
            description "Neighbor cost.";
          }

          leaf poll-interval {
            type uint16 {
              range "1..65535";
            }
            units "seconds";
            description
              "Neighbor poll interval in seconds.";
          }

          leaf priority {
            type uint8 {
              range "1..255";
            }
            description
              "Neighbor priority for DR election.";
          }
        }  // list neighbor
      }  // container static-neighbors

      leaf node-flag {
        if-feature node-flag;
        type boolean;
        default 'false';
        description
          "Set prefix as a node representative prefix.";
      }

      container bfd {
        if-feature bfd;
        description "BFD configuration.";
        leaf enable {
          type boolean;
          default 'false';
          description
            "True if BFD is enabled for the OSPF interface.";
        }
      }  // container bfd

      uses interface-fast-reroute-config;

      uses interface-common-config;

      uses interface-physical-link-config;
    }  // grouping interface-config

    grouping neighbor-state {
      description
        "OSPF neighbor operational state.";
      leaf address {
        type inet:ip-address;
        config false;
        description "Neighbor address.";
      }

      leaf dr-router-id {
        type rt-types:router-id;
        config false;
        description
          "Neighbor's Designated Router (DR) router ID.";
      }

      leaf dr-ip-addr {
        type inet:ip-address;
        config false;
        description
          "Neighbor's Designated Router (DR) IP address.";
      }

      leaf bdr-router-id {
        type rt-types:router-id;
        config false;
        description
          "Neighbor's Backup Designated Router (BDR) router ID.";
      }

      leaf bdr-ip-addr {
        type inet:ip-address;
        config false;
        description
          "Neighbor's Backup Designated Router (BDR) IP Address.";
      }

      leaf state {
        type nbr-state-type;
        config false;
        description "OSPF neighbor state.";
      }

      leaf dead-timer {
        type uint32;
        units "seconds";
        config false;
        description
          "This timer tracks the remaining time before
                   the neighbor is declared dead.";
      }

      container statistics {
        config false;
        description
          "Per neighbor statistics";
        uses neighbor-stat;
      }  // container statistics
    }  // grouping neighbor-state

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

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

      leaf hello-timer {
        type uint32;
        units "seconds";
        config false;
        description
          "This timer tracks the remaining time before
                   the next hello packet is sent.";
      }

      leaf wait-timer {
        type uint32;
        units "seconds";
        config false;
        description
          "This timer tracks the remaining time before
                   the interface exits the Waiting state.";
      }

      leaf dr-router-id {
        type rt-types:router-id;
        config false;
        description
          "Designated Router (DR) router ID.";
      }

      leaf dr-ip-addr {
        type inet:ip-address;
        config false;
        description
          "Designated Router (DR) IP address.";
      }

      leaf bdr-router-id {
        type rt-types:router-id;
        config false;
        description
          "Backup Designated Router (BDR) router ID.";
      }

      leaf bdr-ip-addr {
        type inet:ip-address;
        config false;
        description
          "Backup Designated Router (BDR) IP Address.";
      }

      container statistics {
        config false;
        description
          "Per interface statistics";
        uses interface-stat;
      }  // container statistics

      container neighbors {
        config false;
        description
          "All neighbors for the interface.";
        list neighbor {
          key "neighbor-router-id";
          description
            "List of OSPF neighbors.";
          leaf neighbor-router-id {
            type rt-types:router-id;
            description
              "Neighbor router ID.";
          }

          uses neighbor-state;
        }  // list neighbor
      }  // container neighbors

      container database {
        config false;
        description
          "Link scope LSA database.";
        list link-scope-lsa-type {
          key "lsa-type";
          description
            "List OSPF link scope LSA databases.";
          leaf lsa-type {
            type uint16;
            description
              "OSPF link scope LSA type.";
          }

          container link-scope-lsas {
            description
              "All link scope LSAs of this LSA type.";
            list link-scope-lsa {
              key "lsa-id adv-router";
              description
                "List of OSPF link scope LSAs";
              uses lsa-key;

              uses lsa {
                refine 
                refine 
              }
            }  // list link-scope-lsa
          }  // container link-scope-lsas
        }  // list link-scope-lsa-type
      }  // container database
    }  // grouping interface-common-state

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

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

    grouping virtual-link-config {
      description
        "OSPF virtual link configuration state.";
      uses interface-common-config;
    }  // grouping virtual-link-config

    grouping virtual-link-state {
      description
        "OSPF virtual link operational state.";
      leaf cost {
        type uint16 {
          range "1..65535";
        }
        config false;
        description
          "Virtual link interface cost.";
      }

      uses interface-common-state;
    }  // grouping virtual-link-state

    grouping sham-link-config {
      description
        "OSPF sham link configuration state.";
      uses interface-common-config;

      uses interface-physical-link-config;
    }  // grouping sham-link-config

    grouping sham-link-state {
      description
        "OSPF sham link operational state.";
      uses interface-common-state;
    }  // grouping sham-link-state

    grouping af-area-config {
      description
        "OSPF address-family specific area config state.";
      container ranges {
        description
          "Container for summary ranges";
        list range {
          key "prefix";
          description
            "Summarize routes matching address/mask
           (Area Border Routers (ABRs) 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
              "Advertised cost of summary route.";
          }
        }  // list range
      }  // container ranges
    }  // grouping af-area-config

    grouping area-common-config {
      description
        "OSPF area common configuration state.";
      leaf summary {
        when
          "../area-type = 'ospf:stub' or "
            + "../area-type = 'ospf:nssa'" {
          description
            "Summary advertisement into the stub/NSSA area.";
        }
        type boolean;
        description
          "Enable/Disable summary advertisement into the stub or
         NSSA area.";
      }

      leaf default-cost {
        when
          "../area-type = 'ospf:stub' or "
            + "../area-type = 'ospf:nssa'" {
          description
            "Cost for LSA default route advertised into the
             stub or NSSA area.";
        }
        type uint32 {
          range "1..16777215";
        }
        description
          "Set the summary default route cost for a
         stub or NSSA area.";
      }
    }  // grouping area-common-config

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

      uses area-common-config;

      uses af-area-config {
        when
          "../../../operation-mode = "
            + "'ospf:ships-in-the-night'" {
          description
            "Ships in the night configuration.";
        }
      }
    }  // grouping area-config

    grouping area-state {
      description
        "OSPF area operational state.";
      container statistics {
        config false;
        description "Per area statistics";
        uses area-stat;
      }  // container statistics

      container database {
        config false;
        description
          "Area scope LSA database.";
        list area-scope-lsa-type {
          key "lsa-type";
          description
            "List OSPF area scope LSA databases.";
          leaf lsa-type {
            type uint16;
            description
              "OSPF area scope LSA type.";
          }

          container area-scope-lsas {
            description
              "All area scope LSAs of an area scope
             LSA type.";
            list area-scope-lsa {
              key "lsa-id adv-router";
              description
                "List of OSPF area scope LSAs";
              uses lsa-key;

              uses lsa {
                refine 
                refine 
              }
            }  // list area-scope-lsa
          }  // container area-scope-lsas
        }  // list area-scope-lsa-type
      }  // container database
    }  // grouping area-state

    grouping local-rib {
      description "Local-rib grouping.";
      container local-rib {
        config false;
        description "Local-rib.";
        list route {
          key "prefix";
          description "Routes";
          leaf prefix {
            type inet:ip-prefix;
            description
              "Destination prefix.";
          }

          container next-hops {
            description
              "All next hops for the route.";
            list next-hop {
              key "next-hop";
              description
                "List of next hop for the route";
              leaf outgoing-interface {
                type if:interface-ref;
                description
                  "Name of the outgoing interface.";
              }

              leaf next-hop {
                type inet:ip-address;
                description
                  "Nexthop address.";
              }
            }  // list next-hop
          }  // container next-hops

          leaf metric {
            type uint32;
            description
              "Metric for this route.";
          }

          leaf route-type {
            type route-type;
            description
              "Route type for this route.";
          }

          leaf route-tag {
            type uint32;
            description
              "Route tag for this route.";
          }
        }  // list route
      }  // container local-rib
    }  // grouping local-rib

    grouping ietf-spf-delay-config {
      description
        "Grouping for IETF SPF delay configuration.";
      leaf initial-delay {
        type uint16;
        units "msec";
        description
          "Delay used while in QUIET state.";
      }

      leaf short-delay {
        type uint16;
        units "msec";
        description
          "Delay used while in SHORT_WAIT state.";
      }

      leaf long-delay {
        type uint16;
        units "msec";
        description
          "Delay used while in LONG_WAIT state.";
      }

      leaf hold-down {
        type uint16;
        units "msec";
        description
          "Timer used to consider an IGP stability period.";
      }

      leaf time-to-learn {
        type uint16;
        units "msec";
        description
          "Duration used to learn all the IGP events
         related to a single component failure.";
      }
    }  // grouping ietf-spf-delay-config

    grouping ietf-spf-delay-state {
      description
        "Grouping for IETF SPF delay operational states.";
      leaf current-state {
        type enumeration {
          enum "QUIET" {
            value 0;
            description "QUIET state";
          }
          enum "SHORT_WAIT" {
            value 1;
            description "SHORT_WAIT state";
          }
          enum "LONG_WAIT" {
            value 2;
            description "LONG_WAIT state";
          }
        }
        config false;
        description
          "Current state of the algorithm.";
      }

      leaf remaining-time-to-learn {
        type uint16;
        units "seconds";
        config false;
        description
          "Remaining time until time-to-learn timer fires.";
      }

      leaf remaining-hold-down {
        type uint16;
        units "seconds";
        config false;
        description
          "Remaining time until hold-down timer fires.";
      }

      leaf last-event-received {
        type yang:timestamp;
        config false;
        description
          "Time of last IGP event received";
      }

      leaf next-spf-time {
        type yang:timestamp;
        config false;
        description
          "Time when next SPF has been scheduled.";
      }

      leaf last-spf-time {
        type yang:timestamp;
        config false;
        description
          "Time of last SPF computation.";
      }
    }  // grouping ietf-spf-delay-state

    grouping node-tag-config {
      description
        "OSPF node tag config state.";
      container node-tags {
        if-feature node-tag;
        description
          "Container for node tags.";
        list node-tag {
          key "tag";
          description "List of tags.";
          leaf tag {
            type uint32;
            description "Node tag value.";
          }
        }  // list node-tag
      }  // container node-tags
    }  // grouping node-tag-config

    grouping instance-config {
      description
        "OSPF instance config state.";
      leaf explicit-router-id {
        if-feature explicit-router-id;
        type rt-types:router-id;
        description
          "Defined in RFC 2328. A 32-bit number
         that uniquely identifies the router.";
      }

      container preference {
        description
          "Route preference config state.";
        choice scope {
          description
            "Options for expressing preference
           as single or multiple values.";
          leaf all {
            type uint8;
            description
              "Preference for intra-area, inter-area and
               external routes.";
          }

          case multi-values {
            choice granularity {
              description
                "Options for expressing preference
               for intra-area and inter-area routes.";
              case detail {
                leaf intra-area {
                  type uint8;
                  description
                    "Preference for intra-area routes.";
                }

                leaf inter-area {
                  type uint8;
                  description
                    "Preference for inter-area routes.";
                }
              }  // case detail
              leaf internal {
                type uint8;
                description
                  "Preference for both intra-area and
                   inter-area routes.";
              }
            }  // choice granularity

            leaf external {
              type uint8;
              description
                "Preference for external routes.";
            }
          }  // case multi-values
        }  // choice scope
      }  // container preference

      container nsr {
        if-feature nsr;
        description
          "Non-Stop Routing (NSR) config state.";
        leaf enable {
          type boolean;
          description "Enable/Disable NSR.";
        }
      }  // container nsr

      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
           for OSPFv2 and RFC 5187 for OSPFv3.";
        }

        leaf helper-enable {
          type boolean;
          description
            "Enable graceful restart helper support for restarting
           routers (RFC 3623 Section 3).";
        }

        leaf restart-interval {
          type uint16 {
            range "1..1800";
          }
          units "seconds";
          default "120";
          description
            "Interval in seconds to attempt graceful restart prior
           to failing (RFC 3623 Section B.1)";
        }

        leaf helper-strict-lsa-checking {
          type boolean;
          description
            "Terminate graceful restart when an LSA topology change
           is detected (RFC 3623 Section B.2).";
        }
      }  // container graceful-restart

      leaf enable {
        if-feature admin-control;
        type boolean;
        default 'true';
        description
          "Enable/Disable the protocol.";
      }

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

        leaf reference-bandwidth {
          when "../enable = 'true'" {
            description
              "Only when auto cost is enabled";
          }
          type uint32 {
            range "1..4294967";
          }
          units "Mbits";
          description
            "Configure reference bandwidth used to automatically
           determine interface cost (Mbits). The cost is the
           reference bandwidth divided by the interface speed
           with 1 being the minimum cost.";
        }
      }  // container auto-cost

      container spf-control {
        description
          "SPF calculation control.";
        leaf paths {
          if-feature max-ecmp;
          type uint16 {
            range "1..32";
          }
          description
            "Maximum number of Equal-Cost Multi-Path (ECMP) paths.";
        }

        container ietf-spf-delay {
          if-feature ietf-spf-delay;
          description
            "IETF spf delay algorithm configuration.";
          uses ietf-spf-delay-config;
        }  // container ietf-spf-delay
      }  // container spf-control

      container database-control {
        description
          "Database maintenance control.";
        leaf max-lsa {
          if-feature max-lsa;
          type uint32 {
            range "1..4294967294";
          }
          description
            "Maximum number of LSAs OSPF the router will accept.";
        }
      }  // container database-control

      container stub-router {
        if-feature stub-router;
        description
          "Set maximum metric configuration";
        choice trigger {
          description
            "Specific triggers which will enable stub
           router state.";
          container always {
            presence
              "Enables unconditional stub router support";
            description
              "Unconditional stub router state (advertise
             transit links with max metric";
          }  // container always
        }  // choice trigger
      }  // container stub-router

      container mpls {
        description
          "OSPF MPLS config state.";
        container te-rid {
          if-feature te-rid;
          description
            "Stable OSPF Router IP Address used for Traffic
           Engineering (TE)";
          leaf ipv4-router-id {
            type inet:ipv4-address;
            description
              "Explicitly configure the TE IPv4 router ID.";
          }

          leaf ipv6-router-id {
            type inet:ipv6-address;
            description
              "Explicitly configure the TE IPv6 router ID.";
          }
        }  // container te-rid

        container ldp {
          description
            "OSPF MPLS LDP config state.";
          leaf igp-sync {
            if-feature ldp-igp-sync;
            type boolean;
            description
              "Enable LDP IGP synchronization.";
          }
        }  // container ldp
      }  // container mpls

      uses instance-fast-reroute-config;

      uses node-tag-config;
    }  // grouping instance-config

    grouping instance-state {
      description
        "OSPF instance operational state.";
      leaf router-id {
        type rt-types:router-id;
        config false;
        description
          "Defined in RFC 2328. A 32-bit number
         that uniquely identifies the router.";
      }

      uses local-rib;

      container statistics {
        config false;
        description
          "Per instance statistics";
        uses instance-stat;
      }  // container statistics

      container ietf-spf-delay {
        if-feature ietf-spf-delay;
        config false;
        description
          "IETF SPF delay operational states.";
        uses ietf-spf-delay-config;

        uses ietf-spf-delay-state;
      }  // container ietf-spf-delay

      container database {
        config false;
        description "AS scope LSA database.";
        list as-scope-lsa-type {
          key "lsa-type";
          description
            "List OSPF AS scope LSA databases.";
          leaf lsa-type {
            type uint16;
            description
              "OSPF AS scope LSA type.";
          }

          container as-scope-lsas {
            description
              "All AS scope of LSA of this LSA type.";
            list as-scope-lsa {
              key "lsa-id adv-router";
              description
                "List of OSPF area scope LSAs";
              uses lsa-key;

              uses lsa {
                refine 
                refine 
              }
            }  // list as-scope-lsa
          }  // container as-scope-lsas
        }  // list as-scope-lsa-type
      }  // container database

      uses spf-log;

      uses lsa-log;
    }  // grouping instance-state

    grouping ospf-config {
      description
        "OSPF top configuration state.";
      leaf operation-mode {
        type identityref {
          base operation-mode;
        }
        default 'ships-in-the-night';
        description "OSPF operation mode.";
      }
    }  // grouping ospf-config

    grouping ospf-state {
      description
        "OSPF top operational state.";
    }  // grouping ospf-state

    grouping multi-topology-area-common-config {
      description
        "OSPF multi-topology area common configuration state.";
      leaf summary {
        when
          "../../../../../areas/area[area-id=current()/../area-id]/"
            + "area-type = 'ospf:stub' or "
            + "../../../../../areas/area[area-id=current()/../area-id]/"
            + "area-type = 'ospf:nssa'" {
          description
            "Summary advertisement into the stub/NSSA area.";
        }
        type boolean;
        description
          "Enable/Disable summary advertisement into the
         topology in the stub or NSSA area.";
      }

      leaf default-cost {
        when
          "../../../../../areas/area[area-id=current()/../area-id]/"
            + "area-type = 'ospf:stub' or "
            + "../../../../../areas/area[area-id=current()/../area-id]/"
            + "area-type = 'ospf:nssa'" {
          description
            "Cost for LSA default route advertised into the
           topology into the stub or NSSA area.";
        }
        type uint32 {
          range "1..16777215";
        }
        description
          "Set the summary default route cost for a
         stub or NSSA area.";
      }
    }  // grouping multi-topology-area-common-config

    grouping multi-topology-area-config {
      description
        "OSPF multi-topology area configuration state.";
      uses multi-topology-area-common-config;

      uses af-area-config {
        when
          "../../../../../operation-mode = "
            + "'ospf:ships-in-the-night'" {
          description
            "Ships in the night configuration.";
        }
      }
    }  // grouping multi-topology-area-config

    grouping multi-topology-area-state {
      description
        "OSPF multi-topology area operational state.";
    }  // grouping multi-topology-area-state

    grouping multi-topology-config {
      description
        "OSPF multi-topology configuration state.";
    }  // grouping multi-topology-config

    grouping multi-topology-state {
      description
        "OSPF multi-topology operational state.";
      uses local-rib;
    }  // grouping multi-topology-state

    grouping multi-topology-interface-config {
      description
        "OSPF multi-topology configuration state.";
      leaf cost {
        type uint32;
        description
          "Interface cost for this topology.";
      }
    }  // grouping multi-topology-interface-config

    grouping multi-topology-interface-state {
      description
        "OSPF multi-topology operational state.";
    }  // grouping multi-topology-interface-state

    grouping ospfv3-interface-config {
      description
        "OSPFv3 interface specific configuration state.";
      leaf instance-id {
        type uint8 {
          range "0 .. 31";
        }
        description "OSPFv3 instance ID.";
      }
    }  // grouping ospfv3-interface-config

    grouping ospfv3-interface-state {
      description
        "OSPFv3 interface specific operational state.";
      leaf interface-id {
        type uint16;
        config false;
        description "OSPFv3 interface ID.";
      }
    }  // grouping ospfv3-interface-state

    grouping lsa-identifiers {
      description
        "The parameters that uniquely identify an LSA.";
      leaf area-id {
        type area-id-type;
        description "Area ID";
      }

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

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

      leaf lsa-id {
        type yang:dotted-quad;
        description "LSA ID.";
      }

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

      leaf seq-num {
        type uint32;
        description "LSA sequence number.";
      }
    }  // grouping lsa-identifiers

    grouping spf-log {
      description "Grouping for SPF log.";
      container spf-log {
        config false;
        description
          "This container lists the SPF log.";
        list event {
          key "id";
          description
            "List of SPF logs.
           It is used as a wrapping buffer.";
          leaf id {
            type uint32;
            description
              "This leaf defines the event identifier.
             This is a purely internal value.";
          }

          leaf spf-type {
            type enumeration {
              enum "full" {
                value 0;
                description
                  "Computation done is a Full SPF.";
              }
              enum "intra" {
                value 1;
                description
                  "Computation done is only for intra-area routes.";
              }
              enum "inter" {
                value 2;
                description
                  "Computation done is only for inter-area
                 summary routes.";
              }
              enum "external" {
                value 3;
                description
                  "Computation done is only for AS external routes.";
              }
            }
            description
              "The SPF computation type.";
          }

          leaf schedule-timestamp {
            type yang:timestamp;
            description
              "This leaf describes the timestamp
             when the computation was scheduled.";
          }

          leaf start-timestamp {
            type yang:timestamp;
            description
              "This leaf describes the timestamp
             when the computation was started.";
          }

          leaf end-timestamp {
            type yang:timestamp;
            description
              "This leaf describes the timestamp
             when the computation was completed.";
          }

          list trigger-lsa {
            description
              "The list of LSAs that triggered the computation.";
            uses lsa-identifiers;
          }  // list trigger-lsa
        }  // list event
      }  // container spf-log
    }  // grouping spf-log

    grouping lsa-log {
      description "Grouping for LSA log.";
      container lsa-log {
        config false;
        description
          "This conatiner lists the LSA log.
         Local LSA modifications are also included
         in the list.";
        list event {
          key "id";
          description
            "List of LSA logs.
           It is used as a wrapping buffer.";
          leaf id {
            type uint32;
            description
              "This leaf defines the event identifier.
             This is a purely internal value.";
          }

          container lsa {
            description
              "This container describes the logged LSA.";
            uses lsa-identifiers;
          }  // container lsa

          leaf received-timestamp {
            type yang:timestamp;
            description
              "This leaf describes the timestamp
             when the LSA was received.  In case of
             local LSA update, the timestamp refers
             to the local LSA update time.";
          }

          leaf reason {
            type identityref {
              base lsa-log-reason;
            }
            description
              "This leaf describes the reason
             that resulted in this LSA log.";
          }
        }  // list event
      }  // container lsa-log
    }  // grouping lsa-log

    augment /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol {
      when
        "rt:type = 'ospf:ospfv2' or rt:type = 'ospf:ospfv3'" {
        description
          "This augmentation is only valid for a routing protocol
         instance of OSPF (type 'ospfv2' or 'ospfv3').";
      }
      description "OSPF augmentation.";
      container ospf {
        description "OSPF.";
        uses ospf-config;

        uses ospf-state;

        list instance {
          key "af";
          description
            "An OSPF routing protocol instance.";
          leaf af {
            type iana-rt-types:address-family;
            description
              "Address-family of the instance.";
          }

          uses instance-config;

          uses instance-state;

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

              uses area-config;

              uses area-state;

              container virtual-links {
                when
                  "../area-id = '0.0.0.0' and "
                    + "../area-type = 'ospf:normal'" {
                  description
                    "Virtual links must be in backbone area.";
                }
                description
                  "All virtual links.";
                list virtual-link {
                  key "transit-area-id router-id";
                  description
                    "OSPF virtual link";
                  leaf transit-area-id {
                    type leafref {
                      path
                        "../../../../area/area-id";
                    }
                    must
                      "../../../../area[area-id=current()]/"
                        + "area-id != '0.0.0.0' and "
                        + "../../../../area[area-id=current()]/"
                        + "area-type = 'ospf:normal'" {
                      error-message
                        "Virtual link transit area must "
                          + "be non-zero.";
                      description
                        "Virtual-link trasit area must be
                       non-zero area.";
                    }
                    description
                      "Virtual link tranist area ID.";
                  }

                  leaf router-id {
                    type rt-types:router-id;
                    description
                      "Virtual Link remote endpoint router ID.";
                  }

                  uses virtual-link-config;

                  uses virtual-link-state;
                }  // list virtual-link
              }  // container virtual-links

              container sham-links {
                if-feature pe-ce-protocol;
                description
                  "All sham links.";
                list sham-link {
                  key "local-id remote-id";
                  description
                    "OSPF sham link";
                  leaf local-id {
                    type inet:ip-address;
                    description
                      "Address of the local Sham Link endpoint.";
                  }

                  leaf remote-id {
                    type inet:ip-address;
                    description
                      "Address of the remote Sham Link endpoint.";
                  }

                  uses sham-link-config;

                  uses sham-link-state;
                }  // list sham-link
              }  // container sham-links

              container interfaces {
                description
                  "All interfaces.";
                list interface {
                  key "name";
                  description
                    "List of OSPF interfaces.";
                  leaf name {
                    type if:interface-ref;
                    description
                      "Interface name.";
                  }

                  uses interface-config;

                  uses interface-state;
                }  // list interface
              }  // container interfaces
            }  // list area
          }  // container areas
        }  // list instance
      }  // container ospf
    }

    augment /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/ospf:ospf/ospf:instance {
      when
        "../../rt:type = 'ospf:ospfv2' or
          ../../rt:type = 'ospf:ospfv3'" {
        description
          "This augmentation is only valid for OSPF
        (type 'ospfv2' or 'ospfv3').";
      }
      if-feature multi-topology;
      description
        "OSPF multi-topology instance configuration
       state augmentation.";
      container topologies {
        description "All topologies.";
        list topology {
          key "name";
          description "OSPF topology.";
          leaf name {
            type leafref {
              path
                "../../../../../../../rt:ribs/rt:rib/rt:name";
            }
            description "RIB";
          }

          uses multi-topology-config;

          uses multi-topology-state;

          container areas {
            description
              "All areas in the topology.";
            list area {
              key "area-id";
              description
                "List of OSPF areas";
              leaf area-id {
                type area-id-type;
                description "Area ID.";
              }

              uses multi-topology-area-config;

              uses multi-topology-area-state;
            }  // list area
          }  // container areas
        }  // list topology
      }  // container topologies
    }

    augment /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/ospf:ospf/ospf:instance/ospf:areas/ospf:area/ospf:interfaces/ospf:interface {
      when
        "../../../../../../rt:type = 'ospf:ospfv2'" {
        description
          "This augmentation is only valid for OSPFv2.";
      }
      if-feature ospf:multi-topology;
      description
        "OSPF multi-topology interface configuration state
       augmentation.";
      container topologies {
        description
          "All topologies for the interface.";
        list topology {
          key "name";
          description
            "OSPF interface topology.";
          leaf name {
            type leafref {
              path
                "../../../../../../../../../../../"
                  + "rt:ribs/rt:rib/rt:name";
            }
            description
              "One of the topologies enabled on this interface.";
          }

          uses multi-topology-interface-config;

          uses multi-topology-interface-state;
        }  // list topology
      }  // container topologies
    }

    augment /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/ospf:ospf/ospf:instance/ospf:areas/ospf:area/ospf:interfaces/ospf:interface {
      when
        "../../../../../../rt:type = 'ospf:ospfv3'" {
        description
          "This augmentation is only valid for OSPFv3.";
      }
      description
        "OSPFv3 interface specific configuration state
       augmentation.";
      uses ospfv3-interface-config;

      uses ospfv3-interface-state;
    }

    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 route-type;
        description "OSPF route type";
      }
    }  // grouping route-content

    augment /rt:routing/rt:ribs/rt:rib/rt:routes/rt:route {
      when
        "rt:source-protocol = 'ospf:ospfv2' or "
          + "rt:source-protocol = 'ospf:ospfv3'" {
        description
          "This augmentation is only valid for a routes whose
         source protocol is OSPF.";
      }
      description
        "OSPF-specific route attributes.";
      uses route-content;
    }

    rpc clear-neighbor {
      description
        "This RPC request clears a particular
       set of OSPF neighbors. If the operation
       fails for OSPF internal reason, then
       error-tag and error-app-tag should be set
       to a meaningful value.";
      input {
        leaf routing-protocol-name {
          type leafref {
            path "/rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/rt:name";
          }
          mandatory true;
          description
            "Name of the OSPF protocol instance which information
           is being queried.

           If the OSPF instance with name equal to the
           value of this parameter doesn't exist, then this
           operation SHALL fail with error-tag 'data-missing'
           and error-app-tag
           'routing-protocol-instance-not-found'.";
        }

        leaf interface {
          type if:interface-ref;
          description
            "Name of the OSPF interface.

             If the OSPF interface with name equal to the
             value of this parameter doesn't exist, then this
             operation SHALL fail with error-tag 'data-missing'
             and error-app-tag
             'ospf-interface-not-found'.";
        }
      }
    }  // rpc clear-neighbor

    rpc clear-database {
      description
        "This RPC request clears a particular
       OSPF database. If the operation
       fails for OSPF internal reason, then
       error-tag and error-app-tag should be set
       to a meaningful value.";
      input {
        leaf routing-protocol-name {
          type leafref {
            path "/rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/rt:name";
          }
          mandatory true;
          description
            "Name of the OSPF protocol instance whose
           information is being queried.

           If the OSPF instance with name equal to the
           value of this parameter doesn't exist, then this
           operation SHALL fail with error-tag 'data-missing'
           and error-app-tag
           'routing-protocol-instance-not-found'.";
        }
      }
    }  // rpc clear-database

    grouping notification-instance-hdr {
      description
        "This group describes common instance specific
      data for notifications.";
      leaf routing-protocol-name {
        type leafref {
          path
            "/rt:routing/rt:control-plane-protocols/"
              + "rt:control-plane-protocol/rt:name";
        }
        must
          "/rt:routing/rt:control-plane-protocols/"
            + "rt:control-plane-protocol[rt:name=current()]/"
            + "rt:type = 'ospf:ospfv2' or "
            + "/rt:routing/rt:control-plane-protocols/"
            + "rt:control-plane-protocol[rt:name=current()]/"
            + "rt:type = 'ospf:ospfv3'";
        description
          "OSPF routing protocol instance name.";
      }

      leaf af {
        type leafref {
          path
            "/rt:routing/"
              + "rt:control-plane-protocols/rt:control-plane-protocol"
              + "[rt:name=current()/../routing-protocol-name]/"
              + "ospf:ospf/ospf:instance/af";
        }
        description
          "Address family of the OSPF instance.";
      }
    }  // grouping notification-instance-hdr

    grouping notification-interface {
      description
        "This grouping provides the interface information
       for the notifications.";
      choice if-link-type-selection {
        description "Options for link type.";
        container interface {
          description "Normal interface.";
          leaf interface {
            type if:interface-ref;
            description "Interface.";
          }
        }  // container interface
        container virtual-link {
          description "virtual-link.";
          leaf transit-area-id {
            type area-id-type;
            description "Area ID.";
          }

          leaf neighbor-router-id {
            type rt-types:router-id;
            description
              "Neighbor Router ID.";
          }
        }  // container virtual-link
        container sham-link {
          description "sham-link.";
          leaf area-id {
            type area-id-type;
            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
      }  // choice if-link-type-selection
    }  // grouping notification-interface

    grouping notification-neighbor {
      description
        "This grouping provides the neighbor information
       for the notifications.";
      leaf neighbor-router-id {
        type rt-types:router-id;
        description "Neighbor Router ID.";
      }

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

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

      uses notification-interface;

      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;

      uses notification-interface;

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

      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;

      uses notification-interface;

      uses notification-neighbor;

      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 a neighbor restart
       helper status change is detected.";
      uses notification-instance-hdr;

      uses notification-interface;

      uses notification-neighbor;

      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 if-rx-bad-packet {
      description
        "This notification is sent when an OSPF packet that
       cannot be parsed is received on an OSPF interface.";
      uses notification-instance-hdr;

      uses notification-interface;

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

      leaf packet-type {
        type packet-type;
        description "OSPF packet type.";
      }
    }  // notification if-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 role in translating OSPF NSSA LSAs
       to OSPF AS-External LSAs.";
      uses notification-instance-hdr;

      leaf area-id {
        type area-id-type;
        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
  }  // module ietf-ospf

Summary

  
  
Organization IETF OSPF - OSPF Working Group
  
Module ietf-ospf
Version 2017-10-30
File ietf-ospf@2017-10-30.yang
  
Prefix ospf
Namespace urn:ietf:params:xml:ns:yang:ietf-ospf
Reference
RFC XXXX
  
Cooked /cookedmodules/ietf-ospf/2017-10-30
YANG /src/ietf-ospf@2017-10-30.yang
XSD /xsd/ietf-ospf@2017-10-30.xsd
  
Abstract This YANG module defines the generic configuration and operational state for the OSPF protocol common to all vendor implementati...
  
Contact
WG Web:   <http://datatracker.ietf.org/group/ospf/>
WG List:  <mailto:ospf@ietf.org>

Editor:   Derek Yeung
	  <mailto:derek@arrcus.com>
Author:   Acee Lindem
	  <mailto:acee@cisco.com>
Author:   Yingzhen Qu
	  <mailto:yingzhen.qu@huawei.com>
Author:   Jeffrey Zhang
	  <mailto:zzhang@juniper.net>
Author:   Ing-Wher Chen
	  <mailto:ing-wher_chen@jabil.com>
Author:   Dean Bogdanovic
	  <mailto:ivandean@gmail.com>
Author:   Kiran Agrahara Sreenivasa
	  <mailto:kkoushik@cisco.com>

Description

 
This YANG module defines the generic configuration and
operational state for the OSPF protocol common to all
vendor implementations. It is intended that the module
will be extended by vendors to define vendor-specific
OSPF configuration parameters and policies,
for example route maps or route policies.

Copyright (c) 2017 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).

 This version of this YANG module is part of RFC XXXX;
 see the RFC itself for full legal notices.

Typedefs

Typedef Base type Abstract
area-id-type string Area ID type.
checksum16-type string 16-bit checksum in hex-string format 0xXXXX.
if-state-type enumeration OSPF interface state type.
nbr-state-type enumeration OSPF neighbor state type.
nssa-translator-state-type enumeration OSPF NSSA translator state type.
packet-type enumeration OSPF packet type.
restart-exit-reason-type enumeration Describes the outcome of the last attempt at a graceful restart, either by itself or acting as a helper.
restart-helper-status-type enumeration Restart helper status type.
restart-status-type enumeration OSPF graceful restart status type.
route-type enumeration OSPF route type.
uint24 uint32 24-bit unsigned integer.

Groupings

Grouping Objects Abstract
af-area-config ranges OSPF address-family specific area config state.
area-common-config summary default-cost OSPF area common configuration state.
area-config area-type summary default-costranges OSPF area configuration state.
area-stat spf-runs-count abr-count asbr-count ar-nssa-translator-event-count area-scope-lsa-count area-scope-lsa-cksum-sum database Per-area statistics.
area-state statistics database OSPF area operational state.
ietf-spf-delay-config initial-delay short-delay long-delay hold-down time-to-learn Grouping for IETF SPF delay configuration.
ietf-spf-delay-state current-state remaining-time-to-learn remaining-hold-down last-event-received next-spf-time last-spf-time Grouping for IETF SPF delay operational states.
instance-config explicit-router-id preference nsr graceful-restart enable auto-cost spf-control database-control stub-router mpls fast-reroutenode-tags OSPF instance config state.
instance-fast-reroute-config fast-reroute This group defines global configuration of IP-FRR.
instance-stat originate-new-lsa-count rx-new-lsas-count as-scope-lsa-count as-scope-lsa-chksum-sum database Per-instance statistics
instance-state router-id local-ribstatistics ietf-spf-delay database spf-loglsa-log OSPF instance operational state.
interface-common-config hello-interval dead-interval retransmit-interval transmit-delay lls ttl-security enable authentication Common configuration for all types of interfaces, including virtual links and sham links.
interface-common-state state hello-timer wait-timer dr-router-id dr-ip-addr bdr-router-id bdr-ip-addr statistics neighbors database OSPF interface common operational state.
interface-config interface-type passive demand-circuit priority multi-areas static-neighbors node-flag bfd fast-reroutehello-interval dead-interval retransmit-interval transmit-delay lls ttl-security enable authenticationcost mtu-ignore prefix-suppression Configuration for real interfaces.
interface-fast-reroute-config fast-reroute This group defines interface configuration of IP-FRR.
interface-physical-link-config cost mtu-ignore prefix-suppression Interface cost configuration that only applies to physical interfaces and sham links.
interface-stat if-event-count link-scope-lsa-count link-scope-lsa-cksum-sum database Per-interface statistics
interface-state state hello-timer wait-timer dr-router-id dr-ip-addr bdr-router-id bdr-ip-addr statistics neighbors database OSPF interface operational state.
local-rib local-rib Local-rib grouping.
lsa decoded-completed raw-dataversion OSPF LSA.
lsa-common decoded-completed raw-data Common field for OSPF LSA represenation.
lsa-header age type adv-router seq-num checksum length Common LSA for OSPFv2 and OSPFv3
lsa-identifiers area-id link-id type lsa-id adv-router seq-num The parameters that uniquely identify an LSA.
lsa-key lsa-id adv-router OSPF LSA key.
lsa-log lsa-log Grouping for LSA log.
multi-topology-area-common-config summary default-cost OSPF multi-topology area common configuration state.
multi-topology-area-config summary default-costranges OSPF multi-topology area configuration state.
multi-topology-area-state OSPF multi-topology area operational state.
multi-topology-config OSPF multi-topology configuration state.
multi-topology-interface-config cost OSPF multi-topology configuration state.
multi-topology-interface-state OSPF multi-topology operational state.
multi-topology-state local-rib OSPF multi-topology operational state.
neighbor-stat nbr-event-count nbr-retrans-qlen Per-neighbor statistics.
neighbor-state address dr-router-id dr-ip-addr bdr-router-id bdr-ip-addr state dead-timer statistics OSPF neighbor operational state.
node-tag-config node-tags OSPF node tag config state.
node-tag-tlv node-tag OSPF Node Admin Tag TLV grouping.
notification-instance-hdr routing-protocol-name af This group describes common instance specific data for notifications.
notification-interface if-link-type-selection This grouping provides the interface information for the notifications.
notification-neighbor neighbor-router-id neighbor-ip-addr This grouping provides the neighbor information for the notifications.
ospf-config operation-mode OSPF top configuration state.
ospf-state OSPF top operational state.
ospfv2-lsa header body OSPFv2 LSA.
ospfv2-lsa-body router network summary external opaque OSPFv2 LSA body.
ospfv2-router-link link-id link-data type OSPFv2 router link.
ospfv3-interface-config instance-id OSPFv3 interface specific configuration state.
ospfv3-interface-state interface-id OSPFv3 interface specific operational state.
ospfv3-lsa header body Decoded OSPFv3 LSA.
ospfv3-lsa-body router network inter-area-prefix inter-area-router as-external nssa link intra-area-prefix router-information OSPFv3 LSA body.
ospfv3-lsa-external metric flags referenced-ls-type prefix prefix-optionsforwarding-address external-route-tag referenced-link-state-id AS-External and NSSA LSA.
ospfv3-lsa-options options OSPFv3 LSA options
ospfv3-lsa-prefix prefix prefix-options OSPFv3 LSA prefix.
route-content metric tag route-type This grouping defines OSPF-specific route attributes.
sham-link-config hello-interval dead-interval retransmit-interval transmit-delay lls ttl-security enable authenticationcost mtu-ignore prefix-suppression OSPF sham link configuration state.
sham-link-state state hello-timer wait-timer dr-router-id dr-ip-addr bdr-router-id bdr-ip-addr statistics neighbors database OSPF sham link operational state.
spf-log spf-log Grouping for SPF log.
tlv type length value TLV
unknown-tlvs unknown-tlvs Unknown TLVs grouping - Used for unknown TLVs or unknown sub-TLVs.
virtual-link-config hello-interval dead-interval retransmit-interval transmit-delay lls ttl-security enable authentication OSPF virtual link configuration state.
virtual-link-state cost state hello-timer wait-timer dr-router-id dr-ip-addr bdr-router-id bdr-ip-addr statistics neighbors database OSPF virtual link operational state.

RPC Methods

RPC Abstract
clear-database This RPC request clears a particular OSPF database. If the operation fails for OSPF internal reason, then error-tag and error-app-tag should be set to a meaningful value.
clear-neighbor This RPC request clears a particular set of OSPF neighbors. If the operation fails for OSPF internal reason, then error-tag and error-app-tag should be set to a meaningful value.

Notifications

Notification Abstract
if-config-error This notification is sent when interface config error is detected.
if-rx-bad-packet This notification is sent when an OSPF packet that cannot be parsed is received on an OSPF interface.
if-state-change This notification is sent when an interface state change is detected.
lsdb-approaching-overflow 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.
lsdb-overflow This notification is sent when the number of LSAs in the router's link state database has exceeded ext-lsdb-limit.
nbr-restart-helper-status-change This notification is sent when a neighbor restart helper status change is detected.
nbr-state-change This notification is sent when neighbor state change is detected.
nssa-translator-status-change This notification is sent when there is a change in the router's role in translating OSPF NSSA LSAs to OSPF AS-External LSAs.
restart-status-change This notification is sent when the graceful restart state for the router has changed.