Internet                                                        D. Yeung
Internet-Draft                                                     Y. Qu
Intended status: Informational                             Cisco Systems
Expires: April 21, September 22, 2016                                     J. Zhang
                                                        Juniper Networks
                                                           D. Bogdanovic

                                                           K. Sreenivasa
                                                           Cisco Systems
                                                        October 19, 2015
                                                          March 21, 2016

                   Yang Data Model for OSPF Protocol
                        draft-ietf-ospf-yang-03
                        draft-ietf-ospf-yang-04

Abstract

   This document defines a YANG data model that can be used to configure
   and manage OSPF.

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at http://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on April 21, September 22, 2016.

Copyright Notice

   Copyright (c) 2015 2016 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Table of Contents

   1.  Overview  . . . . . . . . . . . . . . . . . . . . . . . . . .   2
     1.1.  Requirements Language . . . . . . . . . . . . . . . . . .   3
   2.  Design of Data Model  . . . . . . . . . . . . . . . . . . . .   3
     2.1.  Overview  . . . . . . . . . . . . . . . . . . . . . . . .   3
     2.2.  OSPFv2 and OSPFv3 . . . . . . . . . . . . . . . . . . . .   5
     2.3.  Optional Features . . . . . . . . . . . . . . . . . . . .   5
     2.4.  Inheritance . . . . . . . . . . . . . . . . . . . . . . .   5
     2.5.  OSPF Router Configuration . . . . . . . . . . . . . . . .   6
     2.6.  OSPF Instance Configuration . . . . . . . . . . . . . . .   6
     2.7.  OSPF Area Configuration . . . . . . . . . . . . . . . . .   7
     2.8.  OSPF Interface Configuration  . . . . . . . . . . . . . .  10
     2.9.  OSPF notification . . . . . . . . . . . . . . . . . . . .  11
   3.  OSPF Segment Routing  . . . . . . . . . . . . . . . . . . . .  14
   4.  OSPF BFD Yang Module  . . . . . . . . . . . . . . . . . . . .  21
   5.  OSPF Yang Module  . . . . . . . . . . . . . . . . . . . . . .  22
   6.  OSPF Segment Routing Yang Module  . . . . . . . . . . . . . .  89  93
   7.  OSPF BFD Yang Module  . . . . . . . . . . . . . . . . . . . . 103 107
   8.  Security Considerations . . . . . . . . . . . . . . . . . . . 106 110
   9.  Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . 106 110
   10. References  . . . . . . . . . . . . . . . . . . . . . . . . . 106 111
     10.1.  Normative References . . . . . . . . . . . . . . . . . . 106 111
     10.2.  Informative References . . . . . . . . . . . . . . . . . 108 112
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . . 108 113

1.  Overview

   YANG [RFC6020] is a data definition language used to define the
   contents of a conceptual data store that allows networked devices to
   be managed using NETCONF [RFC6241].  YANG is proving relevant beyond
   its initial confines, as bindings to other interfaces (e.g., ReST)
   and encodings other than XML (e.g., JSON) are being defined.
   Furthermore, YANG data models can be used as the basis for
   implementation of other interfaces, such as CLI and programmatic
   APIs.

   This document defines a YANG data model that can be used to configure
   and manage OSPF and it is an augmentation to the core routing data
   model.  A core routing data model is defined in
   [I-D.ietf-netmod-routing-cfg], and it provides the basis for the
   development of data models for routing protocols.  The interface data
   model is defined in [RFC7223] and is used for referencing interfaces
   from the routing protocol.  The key-chain data model used for OSPF
   authentication is defined in [I-D.acee-rtg-yang-key-chain] and
   provides both a reference to configured key-chains and an enumeration
   of cryptographic algorithms.

   Both OSPFv2 [RFC2328] and OSPFv3 [RFC5340] are supported.  In
   addition to the core OSPF protocol, features described in other OSPF
   RFCs are also supported.  They includes demand circuit [RFC1793],
   traffic engineering [RFC3630], multiple address family [RFC5838],
   graceful restart [RFC3623] [RFC5187], NSSA [RFC3101], and sham link
   [RFC4577].  These non-core features are made optional in the OSPF
   data model.

1.1.  Requirements Language

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in [RFC2119].

2.  Design of Data Model

   Although the basis of OSPF configuration elements like routers,
   areas, and interfaces remains the same, the detailed configuration
   model varies among router vendors.  Differences are observed in terms
   of how the protocol engine is tied to routing domain, how multiple
   protocol engines are be instantiated, and configuration inheritance,
   among others.

   The goal of this document is to define a data model that provides a
   common user interface to the OSPFv2 and OSPFv3 protocol.  There is
   very little information that is designated as "mandatory", providing
   freedom for vendors to adapt this data model to their respective
   product implementations.

2.1.  Overview

   The OSPF YANG module defined in this document has all the common
   building blocks for the OSPF protocol.

   The OSPF YANG module augments the routing/routing-instance/routing-
   protocols/routing-protocol path defined in the ietf-routing module.

   module: ospf
   +--rw routing
    +--rw routing-instance [name]
     +--rw routing-protocols
     +--rw routing-protocol [name]
       +--rw ospf
             .
             .
          +--rw all-instances-inherit {instance-inheritance}?
          |   .
          |   .
          +--rw instance* [routing-instance af]
                .
                .
            +--rw areas
            |  +--rw area* [area-id]
            |     .
            |     .
            |     +--rw all-interfaces-inherit {interface-inheritance}?
            |     .
            |     .
            |     +--rw virtual-links
            |     |  +--rw virtual-link* [router-id]
            |     |     .
            |     |     .
            |     +--rw sham-links
            |     |  +--rw sham-link* [local-id remote-id]
            |     |     .
            |     |     .
            |     +--rw interfaces
            |     |  +--rw interface* [interface]
            |     |     .
            |     |     .
            |     .
            |     .
            +--rw topologies
               +--rw topology* [name]

   The ospf module is intended to match to the vendor specific OSPF
   configuration construct that is identified by a local identifier
   'name'.  The field 'version' allows support for OSPFv2 and OSPFv3.

   The ospf container includes one or more OSPF protocol engines, each
   enclosed in a separate instance entity.  Each instance includes
   information for the routing domain based on the [routing-instance af]
   specification.  There is no default routing domain assumed by the
   data model.  For example, to enable OSPF on a vendor's default IPv4
   routing domain, an explicit instance entity with a specification like

   ["default" "ipv4-unicast"] is required.  The instance also contains
   OSPF router level configuration

   The instance/area and instance/area/interface containers respectively
   define the OSPF configuration for OSPF areas and interfaces.

   The instance/topology container defines the OSPF configuration for
   OSPF topologies when the multi-topology feature is supported.

2.2.  OSPFv2 and OSPFv3

   The data model defined herein supports both OSPFv2 and OSPFv3.

   The field 'version' is used to indicate the OSPF version and is
   mandatory.  Based on the configured version, the data model varies to
   accommodate the differences between OSPFv2 and OSPFv3.

2.3.  Optional Features

   Optional features are beyond the basic OSPF configuration and it is
   the responsibility of each vendor to decide whether to support a
   given feature on a particular device.

   This model defines a number of features, such as NSR, max-LSA, etc.
   It is expected that vendors will support additional features through
   vendor specific augmentations.

2.4.  Inheritance

   This data model supports configuration inheritance at different
   levels including instance-level, area-level, and interface-level
   inheritance.

   The all-instances-inherit, all-areas-inherit, and all-interfaces-
   inherit containers are defined to provide a consistent way to
   configure inheritable configuration parameters.  For example,
   parameters defined in the all-instances-inherit container apply to
   all OSPF instances.  However, a particular instance configuration can
   override this inheritance.

   Inheritance is defined as an optional feature, and vendors are
   permitted to augment the inheritance containers with their own vendor
   specific parameters.

2.5.  OSPF Router Configuration

   The ospf container is the top level container in this data model.  It
   contains shared information among the OSPF instances configured
   within the container.

       module: ospf
          +--rw ospf
             +--rw all-instances-inherit {instance-inheritance}?
             |  +--rw area
             |  +--rw interface
             +--rw operation-mode?          identityref
             +--rw instance* [af]
                .
                .

2.6.  OSPF Instance Configuration

   The instance container represents an OSPF protocol engine and
   contains the router level configuration.  The routing domain for each
   instance is dictated through the specification of [routing-instance
   af].

   The all-areas-inherit container contains area configuration that may
   be inherited by configured OSPF areas.

   module: ospf
    +--rw ospf
        .
        .
     +--rw instance* [af]
        +--rw af                  identityref
        +--rw router-id? all-areas-inherit {area-inheritance}?
        |  +--rw area
        |  +--rw interface
        +--rw explicit-router-id? yang:dotted-quad {router-id}? {explicit-router-id}?
        +--rw admin-distance
        |  +--rw (scope)?
        |     +--:(single-value)
        |     |  +--rw all?          uint8
        |     +--:(multi-values)
        |        +--rw (granularity)?
        |        |  +--:(detail)
        |        |  |  +--rw intra-area?   uint8
        |        |  |  +--rw inter-area?   uint8
        |        |  +--:(coarse)
        |        |     +--rw internal?     uint8
        |        +--rw external?     uint8
        +--rw nsr {nsr}?
        |  +--rw enable?   boolean
        +--rw graceful-restart {graceful-restart}?
        |  +--rw enable?                       boolean
        |  +--rw helper-enable?                boolean
        |  +--rw restart-interval?             uint16
        |  +--rw helper-strict-lsa-checking?   boolean
        +--rw enable?              boolean {admin-control}?
        +--rw auto-cost {auto-cost}?
        |  +--rw enable?                boolean
        |  +--rw reference-bandwidth?   uint32
        +--rw spf-control
        |  +--rw paths?   uint16 {max-ecmp}?
        +--rw database-control
        |  +--rw max-lsa?   uint32 {max-lsa}?
        +--rw stub-router {stub-router}?
        |  +--rw (trigger)?
        |     +--:(always)
        |        +--rw always!
        +--rw mpls
        |  +--rw te-rid {te-rid}?
        |  |  +--rw (source)?
        |  |     +--:(interface)
        |  |     |  +--rw interface?   if:interface-ref
        |  |     +--:(explicit)
        |  |        +--rw router-id?   inet:ipv4-address
        |  +--rw ldp
        |     +--rw igp-sync?     boolean {ldp-igp-sync}?
        |     +--rw autoconfig?   boolean {ldp-igp-autoconfig}?
        +--rw fast-reroute {fast-reroute}?
        |  +--rw lfa {lfa}?
            +--rw all-areas-inherit {area-inheritance}?
            |  +--rw area
            |  +--rw interface

2.7.  OSPF Area Configuration

   The area container contains OSPF area configuration and the list of
   interface containers representing all the OSPF interfaces in the
   area.

   The all-interfaces-inherit contains interface configuration that may
   be inherited by all OSPF area interfaces.

   module: ospf
   +--rw ospf
      .
      .
    +--rw instance* [routing-instance af]
       .
       .

     +--rw areas
     |  +--rw area* [area-id]
     |    +--rw area-id                   area-id-type
     |    +--rw all-interfaces-inherit {interface-inheritance}?
     |    |  +--rw interface
     |    +--rw area-type?                identityref
     |    +--rw summary?                  boolean
     |    +--rw default-cost?             uint32
     |    +--rw ranges
     |    |  +--rw range* [prefix]
     |    |     +--rw prefix       inet:ip-prefix
     |    |     +--rw advertise?   boolean
     |    |     +--rw cost?        uint24
     |    +--rw all-interfaces-inherit {interface-inheritance}?
     |    |  +--rw interface
     |    +--rw virtual-links
     |    |  +--rw virtual-link* [router-id]
     |    |     +--rw router-id            yang:dotted-quad
     |    |     +--rw cost?                uint16
     |    |     +--rw hello-interval?      uint16
     |    |     +--rw dead-interval?       uint16
     |    |     +--rw retransmit-interval? uint16
     |    |     +--rw transmit-delay?      uint16
     |    |     +--rw mtu-ignore?          boolean {mtu-ignore}?
     |    |     +--rw lls?                 boolean {lls}?
     |    |     +--rw prefix-suppression?  boolean {prefix-suppression}?
     |    |     +--rw ttl-security {ttl-security}?
     |    |     |  +--rw enable?   boolean
     |    |     |  +--rw hops?     uint8
     |    |     +--rw enable?                boolean {admin-control}?
     |    |     +--rw authentication
     |    |        +--rw (auth-type-selection)?
     |    |           +--:(auth-ipsec) {ospfv3-authentication-ipsec}?
     |    |           |  +--rw sa?                 string
     |    |           +--:(auth-trailer-key-chain)
     |    |           |  +--rw key-chain?        key-chain:key-chain-ref
     |    |           +--:(auth-trailer-key)
     |    |              +--rw key?              string
     |    |              +--rw crypto-algorithm
     |    |               +--rw (algorithm)?
     |    |                  +--:(hmac-sha-1-12) {crypto-hmac-sha-1-12}?
     |    |                  |  +--rw hmac-sha1-12?   empty
     |    |                  +--:(md5)
     |    |                  |  +--rw md5?            empty
     |    |                  +--:(sha-1)
     |    |                  |  +--rw sha-1?          empty
     |    |                  +--:(hmac-sha-1)
     |    |                  |  +--rw hmac-sha-1?     empty
     |    |                  +--:(hmac-sha-256)
     |    |                  |  +--rw hmac-sha-256?   empty
     |    |                  +--:(hmac-sha-384)
     |    |                  |  +--rw hmac-sha-384?   empty
     |    |                  +--:(hmac-sha-512)
     |    |                  |  +--rw hmac-sha-512?   empty
     |    |                  +--:(clear-text) {clear-text}?
     |    |                     +--rw clear-text?     empty
     |    +--rw sham-link
     |    |  +--rw sham-link* [local-id remote-id]
     |    |     +--rw local-id             inet:ip-address
     |    |     +--rw remote-id            inet:ip-address
     |    |     +--rw cost?                uint16
     |    |     +--rw hello-interval?      uint16
     |    |     +--rw dead-interval?       uint16
     |    |     +--rw retransmit-interval? uint16
     |    |     +--rw transmit-delay?      uint16
     |    |     +--rw mtu-ignore?          boolean {mtu-ignore}?
     |    |     +--rw lls?                 boolean {lls}?
     |    |     +--rw prefix-suppression?  boolean {prefix-suppression}?
     |    |     +--rw bfd?                 boolean {bfd}?
     |    |     +--rw ttl-security {ttl-security}?
     |    |     |  +--rw enable?   boolean
     |    |     |  +--rw hops?     uint8
     |    |     +--rw enable?                boolean {admin-control}?
     |    |     +--rw authentication
     |    |        +--rw (auth-type-selection)?
     |    |           +--:(auth-ipsec) {ospfv3-authentication-ipsec}?
     |    |           |  +--rw sa?                 string
     |    |           +--:(auth-trailer-key-chain)
     |    |           |  +--rw key-chain?        key-chain:key-chain-ref
     |    |           +--:(auth-trailer-key)
     |    |              +--rw key?              string
     |    |              +--rw crypto-algorithm
     |    |               +--rw (algorithm)?
     |    |                  +--:(hmac-sha-1-12) {crypto-hmac-sha-1-12}?
     |    |                  |  +--rw hmac-sha1-12?   empty
     |    |                  +--:(md5)
     |    |                  |  +--rw md5?            empty
     |    |                  +--:(sha-1)
     |    |                  |  +--rw sha-1?          empty
     |    |                  +--:(hmac-sha-1)
     |    |                  |  +--rw hmac-sha-1?     empty
     |    |                  +--:(hmac-sha-256)
     |    |                  |  +--rw hmac-sha-256?   empty
     |    |                  +--:(hmac-sha-384)
     |    |                  |  +--rw hmac-sha-384?   empty
     |    |                  +--:(hmac-sha-512)
     |    |                  |  +--rw hmac-sha-512?   empty
     |    |                  +--:(clear-text) {clear-text}?
     |    |                     +--rw clear-text?     empty

2.8.  OSPF Interface Configuration

   The interface container contains OSPF interface configuration.

   module: ospf
   +--rw ospf
       .
       .
    +--rw instance* [routing-instance af]
       .
       .
     +--rw areas
      |  +--rw area* [area-id]
            .
            .
      |     +--rw interfaces
      |      +--rw interface* [interface]
      |         +--rw interface              if:interface-ref
      |         +--rw network-type?          enumeration
      |         +--rw passive?               boolean
      |         +--rw demand-circuit?        boolean {demand-circuit}?
      |         +--rw multi-areas
      |         |  +--rw multi-area* [multi-area-id] {multi-area-adj}?
      |         |     +--rw multi-area-id    area-id-type
      |         |     +--rw cost?            uint16
      |         +--rw static-neighbors
      |         |  +--rw neighbor* [address]
      |         |     +--rw address          inet:ip-address
      |         |     +--rw cost?            uint16
      |         |     +--rw poll-interval?   uint16
      |         |     +--rw priority?        uint8
      |         +--rw node-flag?             boolean {node-flag}?
      |         +--rw fast-reroute {fast-reroute}?
      |         |  +--rw lfa {lfa}?
      |         |     +--rw candidate-disabled?   boolean
      |         |     +--rw enabled?              boolean
      |         |     +--rw remote-lfa {remote-lfa}?
      |         |        +--rw enabled?   boolean
      |         +--rw cost?                uint16
      |         +--rw hello-interval?      uint16
      |         +--rw dead-interval?       uint16
      |         +--rw retransmit-interval? uint16
      |         +--rw transmit-delay?      uint16
      |         +--rw mtu-ignore?          boolean {mtu-ignore}?
      |         +--rw lls?                 boolean {lls}?
      |         +--rw prefix-suppression?  boolean {prefix-suppression}?
      |         +--rw ttl-security {ttl-security}?
      |         |  +--rw enable?   boolean
      |         |  +--rw hops?     uint8
      |         +--rw enable?                boolean {admin-control}?
      |         +--rw authentication
      |         |  +--rw (auth-type-selection)?
      |         |   +--:(auth-ipsec) {ospfv3-authentication-ipsec}?
      |         |   |  +--rw sa?                 string
      |         |   +--:(auth-trailer-key-chain)
      |         |   |  +--rw key-chain?        key-chain:key-chain-ref
      |         |   +--:(auth-trailer-key)
      |         |      +--rw key?              string
      |         |      +--rw crypto-algorithm
      |         |         +--rw (algorithm)?
      |         |            +--:(hmac-sha-1-12) {crypto-hmac-sha-1-12}?
      |         |            |  +--rw hmac-sha1-12?   empty
      |         |            +--:(md5)
      |         |            |  +--rw md5?            empty
      |         |            +--:(sha-1)
      |         |            |  +--rw sha-1?          empty
      |         |            +--:(hmac-sha-1)
      |         |            |  +--rw hmac-sha-1?     empty
      |         |            +--:(hmac-sha-256)
      |         |            |  +--rw hmac-sha-256?   empty
      |         |            +--:(hmac-sha-384)
      |         |            |  +--rw hmac-sha-384?   empty
      |         |            +--:(hmac-sha-512)
      |         |            |  +--rw hmac-sha-512?   empty
      |         |            +--:(clear-text) {clear-text}?
      |         |               +--rw clear-text?     empty
      |         +--rw topologies
      |         |  +--rw topology* [name]
      |         |     +--rw name    leafref
      |         |     +--rw cost?   uint32
      |         +--rw instance-id?         uint8

2.9.  OSPF notification

   This YANG model defines a list of notifications that inform YANG
   clients of important events detected during protocol operation.  The
   defined notifications cover the common set of traps from the OSPFv2
   MIB [RFC4750] and OSPFv3 MIB [RFC5643].

   module: ospf
   notifications:
      +---n if-state-change
      |  +--ro routing-instance?        rt:routing-instance-ref        string
      |  +--ro routing-protocol-type?   -> ...

      |  +--ro routing-protocol-name?   -> ...
      |  +--ro af?                      -> ...
      |  +--ro (if-link-type-selection)?
      |  |  +--:(interface)
      |  |  |  +--ro interface
      |  |  |     +--ro interface?   if:interface-ref
      |  |  +--:(virtual-link)
      |  |  |  +--ro virtual-link
      |  |  |     +--ro area-id?              area-id-type
      |  |  |     +--ro neighbor-router-id?   yang:dotted-quad
      |  |  +--:(sham-link)
      |  |     +--ro sham-link
      |  |        +--ro area-id?          area-id-type
      |  |        +--ro local-ip-addr?    inet:ip-address
      |  |        +--ro remote-ip-addr?   inet:ip-address
      |  +--ro state?                   if-state-type
      +---n if-config-error
      |  +--ro routing-instance?        rt:routing-instance-ref        string
      |  +--ro routing-protocol-type?   -> ...
      |  +--ro routing-protocol-name?   -> ...
      |  +--ro af?                      -> ...
      |  +--ro (if-link-type-selection)?
      |  |  +--:(interface)
      |  |  |  +--ro interface
      |  |  |     +--ro interface?   if:interface-ref
      |  |  +--:(virtual-link)
      |  |  |  +--ro virtual-link
      |  |  |     +--ro area-id?              area-id-type
      |  |  |     +--ro neighbor-router-id?   yang:dotted-quad
      |  |  +--:(sham-link)
      |  |     +--ro sham-link
      |  |        +--ro area-id?          area-id-type
      |  |        +--ro local-ip-addr?    inet:ip-address
      |  |        +--ro remote-ip-addr?   inet:ip-address
      |  +--ro packet-source?           yang:dotted-quad
      |  +--ro packet-type?             packet-type
      |  +--ro error?                   enumeration
      +---n nbr-state-change
      |  +--ro routing-instance?        rt:routing-instance-ref        string
      |  +--ro routing-protocol-type?   -> ...
      |  +--ro routing-protocol-name?   -> ...
      |  +--ro af?                      -> ...
      |  +--ro (if-link-type-selection)?
      |  |  +--:(interface)
      |  |  |  +--ro interface
      |  |  |     +--ro interface?   if:interface-ref
      |  |  +--:(virtual-link)
      |  |  |  +--ro virtual-link
      |  |  |     +--ro area-id?              area-id-type
      |  |  |     +--ro neighbor-router-id?   yang:dotted-quad
      |  |  +--:(sham-link)
      |  |     +--ro sham-link
      |  |        +--ro area-id?          area-id-type
      |  |        +--ro local-ip-addr?    inet:ip-address
      |  |        +--ro remote-ip-addr?   inet:ip-address
      |  +--ro neighbor-router-id?      yang:dotted-quad
      |  +--ro neighbor-ip-addr?        yang:dotted-quad
      |  +--ro state?                   nbr-state-type
      +---n nbr-restart-helper-status-change
      |  +--ro routing-instance?        rt:routing-instance-ref        string
      |  +--ro routing-protocol-type?   -> ...
      |  +--ro routing-protocol-name?   -> ...
      |  +--ro af?                      -> ...
      |  +--ro (if-link-type-selection)?
      |  |  +--:(interface)
      |  |  |  +--ro interface
      |  |  |     +--ro interface?   if:interface-ref
      |  |  +--:(virtual-link)
      |  |  |  +--ro virtual-link
      |  |  |     +--ro area-id?              area-id-type
      |  |  |     +--ro neighbor-router-id?   yang:dotted-quad
      |  |  +--:(sham-link)
      |  |     +--ro sham-link
      |  |        +--ro area-id?          area-id-type
      |  |        +--ro local-ip-addr?    inet:ip-address
      |  |        +--ro remote-ip-addr?   inet:ip-address
      |  +--ro neighbor-router-id?      yang:dotted-quad
      |  +--ro neighbor-ip-addr?        yang:dotted-quad
      |  +--ro status?                  restart-helper-status-type
      |  +--ro age?                     uint32
      |  +--ro exit-reason?             restart-exit-reason-type
      +---n rx-bad-packet
      |  +--ro routing-instance?        rt:routing-instance-ref        string
      |  +--ro routing-protocol-type?   -> ...
      |  +--ro routing-protocol-name?   -> ...
      |  +--ro af?                      -> ...
      |  +--ro (if-link-type-selection)?
      |  |  +--:(interface)
      |  |  |  +--ro interface
      |  |  |     +--ro interface?   if:interface-ref
      |  |  +--:(virtual-link)
      |  |  |  +--ro virtual-link
      |  |  |     +--ro area-id?              area-id-type
      |  |  |     +--ro neighbor-router-id?   yang:dotted-quad
      |  |  +--:(sham-link)
      |  |     +--ro sham-link
      |  |        +--ro area-id?          area-id-type
      |  |        +--ro local-ip-addr?    inet:ip-address
      |  |        +--ro remote-ip-addr?   inet:ip-address
      |  +--ro packet-source?           yang:dotted-quad
      |  +--ro packet-type?             packet-type
      +---n lsdb-approaching-overflow
      |  +--ro routing-instance?        rt:routing-instance-ref        string
      |  +--ro routing-protocol-type?   -> ...
      |  +--ro routing-protocol-name?   -> ...
      |  +--ro af?                      -> ...
      |  +--ro ext-lsdb-limit?          uint32
      +---n lsdb-overflow
      |  +--ro routing-instance?        rt:routing-instance-ref        string
      |  +--ro routing-protocol-type?   -> ...
      |  +--ro routing-protocol-name?   -> ...
      |  +--ro af?                      -> ...
      |  +--ro ext-lsdb-limit?          uint32
      +---n nssa-translator-status-change
      |  +--ro routing-instance?        rt:routing-instance-ref        string
      |  +--ro routing-protocol-type?   -> ...
      |  +--ro routing-protocol-name?   -> ...
      |  +--ro af?                      -> ...
      |  +--ro area-id?                 area-id-type
      |  +--ro status?                  nssa-translator-state-type
      +---n restart-status-change
         +--ro routing-instance?        rt:routing-instance-ref        string
         +--ro routing-protocol-type?   -> ...
         +--ro routing-protocol-name?   -> ...
         +--ro af?                      -> ...
         +--ro status?                  restart-status-type
         +--ro restart-interval?        uint16
         +--ro exit-reason?             restart-exit-reason-type

3.  OSPF Segment Routing

   In addition to the OSPF base YANG model, this document also defines a
   model for the OSPF segment routing feature.

   The OSPF SR YANG module requires support for the base segment routing
   module [I-D.ietf-spring-sr-yang], which defines the global segment
   routing configuration independent of any specific routing protocol
   configuration.

   module: ietf-ospf-sr
   augment /rt:routing/rt:routing-instance/rt:routing-protocols /rt:routing/rt:routing-protocols
           /rt:routing-protocol/ospf:ospf/ospf:instance:
      +--rw segment-routing
      |  +--rw enabled?    boolean
      |  +--rw bindings
      |     +--rw advertise
      |     |  +--rw policies*   string
      |     +--rw receive?     boolean
      +--rw protocol-srgb {sr:protocol-srgb}?
         +--rw srgb* [lower-bound upper-bound]
            +--rw lower-bound    uint32
            +--rw upper-bound    uint32
   augment /rt:routing/rt:routing-instance/rt:routing-protocols /rt:routing/rt:routing-protocols
           /rt:routing-protocol/ospf:ospf/ospf:instance
           /ospf:areas/ospf:area/ospf:interfaces/ospf:interface:
      +--rw segment-routing
         +--rw adjacency-sid
            +--rw advertise-adj-group-sid* [group-id]
            |  +--rw group-id    uint32
            +--rw advertise-protection?      enumeration
   augment /rt:routing/rt:routing-instance/rt:routing-protocols /rt:routing/rt:routing-protocols
           /rt:routing-protocol/ospf:ospf/ospf:instance/ospf:areas
           /ospf:area/ospf:interfaces/ospf:interface/ospf:fast-reroute:
      +--rw ti-lfa {ti-lfa}?
         +--rw enable?   boolean
   augment /rt:routing-state/rt:routing-instance/rt:routing-protocols /rt:routing-state/rt:routing-protocols
           /rt:routing-protocol/ospf:ospf/ospf:instance:
      +--ro segment-routing
      |  +--ro enabled?    boolean
      |  +--ro bindings
      |     +--ro advertise
      |     |  +--ro policies*   string
      |     +--ro receive?     boolean
      +--ro protocol-srgb {sr:protocol-srgb}?
         +--ro srgb* [lower-bound upper-bound]
            +--ro lower-bound    uint32
            +--ro upper-bound    uint32
   augment /rt:routing-state/rt:routing-instance/rt:routing-protocols /rt:routing-state/rt:routing-protocols
           /rt:routing-protocol/ospf:ospf/ospf:instance
           /ospf:areas/ospf:area/ospf:interfaces/ospf:interface:
      +--ro segment-routing
         +--ro adjacency-sid
            +--ro advertise-adj-group-sid* [group-id]
            |  +--ro group-id    uint32
            +--ro advertise-protection?      enumeration
   augment /rt:routing-state/rt:routing-instance/rt:routing-protocols /rt:routing-state/rt:routing-protocols
           /rt:routing-protocol/ospf:ospf/ospf:instance/ospf:areas
           /ospf:area/ospf:interfaces/ospf:interface/ospf:database
           /ospf:link-scope-lsa-type/ospf:link-scope-lsas
           /ospf:link-scope-lsa/ospf:version/ospf:ospfv2
           /ospf:ospfv2/ospf:body/ospf:opaque
           /ospf:extended-prefix-tlvs/ospf:extended-prefix-tlv:

      +--ro perfix-sid-sub-tlvs
      |  +--ro prefix-sid-sub-tlv*
      |     +--ro flags?       bits
      |     +--ro mt-id?       uint8
      |     +--ro algorithm?   uint8
      |     +--ro sid?         uint32
      +--ro sid-binding-sub-tlvs
         +--ro sid-binding-sub-tlv*
            +--ro flags?                           bits
            +--ro mt-id?                           uint8
            +--ro weight?                          uint8
            +--ro sid-sub-tlv
            |  +--ro sid?   uint32
            +--ro ero-metric-sub-tlv
            |  +--ro metric?   uint32
            +--ro ipv4-ero-sub-tlv
            |  +--ro flags?          bits
            |  +--ro ipv4-address?   inet:ipv4-address
            +--ro unnumbered-ero-sub-tlv
            |  +--ro flags?          bits
            |  +--ro router-id?      yang:dotted-quad
            |  +--ro interface-id?   uint32
            +--ro ipv4-backup-ero-sub-tlv
            |  +--ro flags?          bits
            |  +--ro ipv4-address?   inet:ipv4-address
            +--ro unnumbered-backup-ero-sub-tlv
               +--ro flags?          bits
               +--ro router-id?      yang:dotted-quad
               +--ro interface-id?   uint32
   augment /rt:routing-state/rt:routing-instance/rt:routing-protocols /rt:routing-state/rt:routing-protocols
           /rt:routing-protocol/ospf:ospf/ospf:instance
           /ospf:areas/ospf:area/ospf:database
           /ospf:area-scope-lsa-type/ospf:area-scope-lsas
           /ospf:area-scope-lsa/ospf:version/ospf:ospfv2
           /ospf:ospfv2/ospf:body/ospf:opaque
           /ospf:extended-prefix-tlvs/ospf:extended-prefix-tlv:
      +--ro perfix-sid-sub-tlvs
      |  +--ro prefix-sid-sub-tlv*
      |     +--ro flags?       bits
      |     +--ro mt-id?       uint8
      |     +--ro algorithm?   uint8
      |     +--ro sid?         uint32
      +--ro sid-binding-sub-tlvs
         +--ro sid-binding-sub-tlv*
            +--ro flags?                           bits
            +--ro mt-id?                           uint8
            +--ro weight?                          uint8
            +--ro sid-sub-tlv
            |  +--ro sid?   uint32
            +--ro ero-metric-sub-tlv
            |  +--ro metric?   uint32
            +--ro ipv4-ero-sub-tlv
            |  +--ro flags?          bits
            |  +--ro ipv4-address?   inet:ipv4-address
            +--ro unnumbered-ero-sub-tlv
            |  +--ro flags?          bits
            |  +--ro router-id?      yang:dotted-quad
            |  +--ro interface-id?   uint32
            +--ro ipv4-backup-ero-sub-tlv
            |  +--ro flags?          bits
            |  +--ro ipv4-address?   inet:ipv4-address
            +--ro unnumbered-backup-ero-sub-tlv
               +--ro flags?          bits
               +--ro router-id?      yang:dotted-quad
               +--ro interface-id?   uint32
   augment /rt:routing-state/rt:routing-instance/rt:routing-protocols /rt:routing-state/rt:routing-protocols
           /rt:routing-protocol/ospf:ospf/ospf:instance
           /ospf:database/ospf:as-scope-lsa-type/ospf:as-scope-lsas
           /ospf:as-scope-lsa/ospf:version/ospf:ospfv2
           /ospf:ospfv2/ospf:body/ospf:opaque
           /ospf:extended-prefix-tlvs/ospf:extended-prefix-tlv:
      +--ro perfix-sid-sub-tlvs
      |  +--ro prefix-sid-sub-tlv*
      |     +--ro flags?       bits
      |     +--ro mt-id?       uint8
      |     +--ro algorithm?   uint8
      |     +--ro sid?         uint32
      +--ro sid-binding-sub-tlvs
         +--ro sid-binding-sub-tlv*
            +--ro flags?                           bits
            +--ro mt-id?                           uint8
            +--ro weight?                          uint8
            +--ro sid-sub-tlv
            |  +--ro sid?   uint32
            +--ro ero-metric-sub-tlv
            |  +--ro metric?   uint32
            +--ro ipv4-ero-sub-tlv
            |  +--ro flags?          bits
            |  +--ro ipv4-address?   inet:ipv4-address
            +--ro unnumbered-ero-sub-tlv
            |  +--ro flags?          bits
            |  +--ro router-id?      yang:dotted-quad
            |  +--ro interface-id?   uint32
            +--ro ipv4-backup-ero-sub-tlv
            |  +--ro flags?          bits
            |  +--ro ipv4-address?   inet:ipv4-address
            +--ro unnumbered-backup-ero-sub-tlv
               +--ro flags?          bits
               +--ro router-id?      yang:dotted-quad
               +--ro interface-id?   uint32
   augment /rt:routing-state/rt:routing-instance/rt:routing-protocols /rt:routing-state/rt:routing-protocols
           /rt:routing-protocol/ospf:ospf/ospf:instance
           /ospf:areas/ospf:area/ospf:database
           /ospf:area-scope-lsa-type/ospf:area-scope-lsas
           /ospf:area-scope-lsa/ospf:version/ospf:ospfv2
           /ospf:ospfv2/ospf:body/ospf:opaque
           /ospf:extended-link-tlvs/ospf:extended-link-tlv:
      +--ro adj-sid-sub-tlvs
      |  +--ro adj-sid-sub-tlv*
      |     +--ro flags?    bits
      |     +--ro mt-id?    uint8
      |     +--ro weight?   uint8
      |     +--ro sid?      uint32
      +--ro lan-adj-sid-sub-tlvs
         +--ro lan-adj-sid-sub-tlv*
            +--ro flags?                bits
            +--ro mt-id?                uint8
            +--ro weight?               uint8
            +--ro neighbor-router-id?   yang:dotted-quad
            +--ro sid?                  uint32
   augment /rt:routing-state/rt:routing-instance/rt:routing-protocols /rt:routing-state/rt:routing-protocols
           /rt:routing-protocol/ospf:ospf/ospf:instance/ospf:areas
           /ospf:area/ospf:interfaces/ospf:interface
           /ospf:database/ospf:link-scope-lsa-type/ospf:link-scope-lsas
           /ospf:link-scope-lsa/ospf:version/ospf:ospfv2
           /ospf:ospfv2/ospf:body/ospf:opaque:
      +--ro extended-prefix-range-tlvs
      |  +--ro extended-prefix-range-tlv*
      |     +--ro range-size?             uint16
      |     +--ro flags?                  bits
      |     +--ro prefix?                 inet:ip-prefix
      |     +--ro perfix-sid-sub-tlvs
      |     |  +--ro prefix-sid-sub-tlv*
      |     |     +--ro flags?       bits
      |     |     +--ro mt-id?       uint8
      |     |     +--ro algorithm?   uint8
      |     |     +--ro sid?         uint32
      |     +--ro sid-binding-sub-tlvs
      |     |  +--ro sid-binding-sub-tlv*
      |     |     +--ro flags?                           bits
      |     |     +--ro mt-id?                           uint8
      |     |     +--ro weight?                          uint8
      |     |     +--ro sid-sub-tlv
      |     |     |  +--ro sid?   uint32
      |     |     +--ro ero-metric-sub-tlv
      |     |     |  +--ro metric?   uint32
      |     |     +--ro ipv4-ero-sub-tlv
      |     |     |  +--ro flags?          bits
      |     |     |  +--ro ipv4-address?   inet:ipv4-address
      |     |     +--ro unnumbered-ero-sub-tlv
      |     |     |  +--ro flags?          bits
      |     |     |  +--ro router-id?      yang:dotted-quad
      |     |     |  +--ro interface-id?   uint32
      |     |     +--ro ipv4-backup-ero-sub-tlv
      |     |     |  +--ro flags?          bits
      |     |     |  +--ro ipv4-address?   inet:ipv4-address
      |     |     +--ro unnumbered-backup-ero-sub-tlv
      |     |        +--ro flags?          bits
      |     |        +--ro router-id?      yang:dotted-quad
      |     |        +--ro interface-id?   uint32
      |     +--ro unknown-tlvs
      |        +--ro unknown-tlv*
      |           +--ro type?     uint16
      |           +--ro length?   uint16
      |           +--ro value?    yang:hex-string
      +--ro sr-algorithm-tlv
      |  +--ro sr-algorithm*   uint8
      +--ro sid-range-tlvs
         +--ro sid-range-tlv*
            +--ro range-size?    ospf:uint24
            +--ro sid-sub-tlv
               +--ro sid?   uint32
   augment /rt:routing-state/rt:routing-instance/rt:routing-protocols /rt:routing-state/rt:routing-protocols
           /rt:routing-protocol/ospf:ospf/ospf:instance/ospf:areas
           /ospf:area/ospf:database/ospf:area-scope-lsa-type
           /ospf:area-scope-lsas/ospf:area-scope-lsa
           /ospf:version/ospf:ospfv2/ospf:ospfv2/ospf:body/ospf:opaque:
      +--ro extended-prefix-range-tlvs
      |  +--ro extended-prefix-range-tlv*
      |     +--ro range-size?             uint16
      |     +--ro flags?                  bits
      |     +--ro prefix?                 inet:ip-prefix
      |     +--ro perfix-sid-sub-tlvs
      |     |  +--ro prefix-sid-sub-tlv*
      |     |     +--ro flags?       bits
      |     |     +--ro mt-id?       uint8
      |     |     +--ro algorithm?   uint8
      |     |     +--ro sid?         uint32
      |     +--ro sid-binding-sub-tlvs
      |     |  +--ro sid-binding-sub-tlv*
      |     |     +--ro flags?                           bits
      |     |     +--ro mt-id?                           uint8
      |     |     +--ro weight?                          uint8
      |     |     +--ro sid-sub-tlv
      |     |     |  +--ro sid?   uint32
      |     |     +--ro ero-metric-sub-tlv
      |     |     |  +--ro metric?   uint32
      |     |     +--ro ipv4-ero-sub-tlv
      |     |     |  +--ro flags?          bits
      |     |     |  +--ro ipv4-address?   inet:ipv4-address
      |     |     +--ro unnumbered-ero-sub-tlv
      |     |     |  +--ro flags?          bits
      |     |     |  +--ro router-id?      yang:dotted-quad
      |     |     |  +--ro interface-id?   uint32
      |     |     +--ro ipv4-backup-ero-sub-tlv
      |     |     |  +--ro flags?          bits
      |     |     |  +--ro ipv4-address?   inet:ipv4-address
      |     |     +--ro unnumbered-backup-ero-sub-tlv
      |     |        +--ro flags?          bits
      |     |        +--ro router-id?      yang:dotted-quad
      |     |        +--ro interface-id?   uint32
      |     +--ro unknown-tlvs
      |        +--ro unknown-tlv*
      |           +--ro type?     uint16
      |           +--ro length?   uint16
      |           +--ro value?    yang:hex-string
      +--ro sr-algorithm-tlv
      |  +--ro sr-algorithm*   uint8
      +--ro sid-range-tlvs
         +--ro sid-range-tlv*
            +--ro range-size?    ospf:uint24
            +--ro sid-sub-tlv
               +--ro sid?   uint32
   augment /rt:routing-state/rt:routing-instance/rt:routing-protocols /rt:routing-state/rt:routing-protocols
           /rt:routing-protocol/ospf:ospf/ospf:instance/ospf:database
           /ospf:as-scope-lsa-type/ospf:as-scope-lsas/ospf:as-scope-lsa
           /ospf:version/ospf:ospfv2/ospf:ospfv2/ospf:body/ospf:opaque:
      +--ro extended-prefix-range-tlvs
      |  +--ro extended-prefix-range-tlv*
      |     +--ro range-size?             uint16
      |     +--ro flags?                  bits
      |     +--ro prefix?                 inet:ip-prefix
      |     +--ro perfix-sid-sub-tlvs
      |     |  +--ro prefix-sid-sub-tlv*
      |     |     +--ro flags?       bits
      |     |     +--ro mt-id?       uint8
      |     |     +--ro algorithm?   uint8
      |     |     +--ro sid?         uint32
      |     +--ro sid-binding-sub-tlvs
      |     |  +--ro sid-binding-sub-tlv*
      |     |     +--ro flags?                           bits
      |     |     +--ro mt-id?                           uint8
      |     |     +--ro weight?                          uint8
      |     |     +--ro sid-sub-tlv
      |     |     |  +--ro sid?   uint32
      |     |     +--ro ero-metric-sub-tlv
      |     |     |  +--ro metric?   uint32
      |     |     +--ro ipv4-ero-sub-tlv
      |     |     |  +--ro flags?          bits
      |     |     |  +--ro ipv4-address?   inet:ipv4-address
      |     |     +--ro unnumbered-ero-sub-tlv
      |     |     |  +--ro flags?          bits
      |     |     |  +--ro router-id?      yang:dotted-quad
      |     |     |  +--ro interface-id?   uint32
      |     |     +--ro ipv4-backup-ero-sub-tlv
      |     |     |  +--ro flags?          bits
      |     |     |  +--ro ipv4-address?   inet:ipv4-address
      |     |     +--ro unnumbered-backup-ero-sub-tlv
      |     |        +--ro flags?          bits
      |     |        +--ro router-id?      yang:dotted-quad
      |     |        +--ro interface-id?   uint32
      |     +--ro unknown-tlvs
      |        +--ro unknown-tlv*
      |           +--ro type?     uint16
      |           +--ro length?   uint16
      |           +--ro value?    yang:hex-string
      +--ro sr-algorithm-tlv
      |  +--ro sr-algorithm*   uint8
      +--ro sid-range-tlvs
         +--ro sid-range-tlv*
            +--ro range-size?    ospf:uint24
            +--ro sid-sub-tlv
               +--ro sid?   uint32

4.  OSPF BFD Yang Module

   Additionally this document defines a module that can be used to
   configure and monitor the OSPF BFD feature.

   Bidirectional Forwarding Detection (BFD) [RFC5880] is a network
   protocol that is used for liveness detection of arbitrary paths
   between systems.  A YANG data model is defined in [I-D.ietf-bfd-yang]
   that supports BFD configuration and management.

   As a client of BFD, the OSPF protocol uses the services provided by
   BFD.  The OSPF BFD YANG augments the base OSPF module and is defined
   as a separate module.  So any implementation that does not support
   BFD can still use the OSPF base model without having to import the
   BFD module [I-D.ietf-bfd-yang].

   module: ietf-ospf-bfd
   augment /rt:routing/rt:routing-instance/rt:routing-protocols /rt:routing/rt:routing-protocols
           /rt:routing-protocol/ospf:ospf/ospf:instance
           /ospf:areas/ospf:area/ospf:interfaces/ospf:interface:
      +--rw bfd
         +--rw enabled?                    boolean
         +--rw local-multiplier?           multiplier
         +--rw (interval-config-type)?
            +--:(tx-rx-intervals)
            |  +--rw desired-min-tx-interval     uint32
            |  +--rw required-min-rx-interval    uint32
            +--:(single-interval)
               +--rw min-interval                uint32
   augment /rt:routing-state/rt:routing-instance/rt:routing-protocols /rt:routing-state/rt:routing-protocols
           /rt:routing-protocol/ospf:ospf/ospf:instance
           /ospf:areas/ospf:area/ospf:interfaces/ospf:interface:
      +--ro bfd
         +--ro enabled?                    boolean
         +--ro local-multiplier?           multiplier
         +--ro (interval-config-type)?
            +--:(tx-rx-intervals)
            |  +--ro desired-min-tx-interval     uint32
            |  +--ro required-min-rx-interval    uint32
            +--:(single-interval)
               +--ro min-interval                uint32

5.  OSPF Yang Module

   <CODE BEGINS> file "ietf-ospf@2015-10-19.yang" "ietf-ospf@2016-03-20.yang"
   module ietf-ospf {
     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 {
       prefix "rt";
     }

     import ietf-key-chain ietf-routing-key-chain {
       prefix "key-chain";
     }

     organization
       "Cisco Systems
        170 West Tasman Drive
        San Jose, CA 95134-1706
        USA";

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

         WG Chair: Acee Lindem
                   <mailto:acee@cisco.com>

         WG Chair: Abhay Roy
                   <mailto:akr@cisco.com>

         Editor:   Derek Yeung
                   <mailto:myeung@cisco.com>
         Author:   Derek Yeung
                   <mailto:myeung@cisco.com>
         Author:   Yingzhen Qu
                   <mailto:yiqu@cisco.com>
         Author:   Jeffrey Zhang
                   <mailto:zzhang@juniper.net>
         Author:   Ing-Wher Chen
                   <mailto:ing-wher.chen@ericsson.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.

        Terms and Acronyms

        OSPF (ospf): Open Shortest Path First

        IP (ip): Internet Protocol

        IPv4 (ipv4):Internet Protocol Version 4

        IPv6 (ipv6): Internet Protocol Version 6

        MTU (mtu) Maximum Transmission Unit
       ";

     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.";
     }

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

     identity ospfv3 {
       base "rt:routing-protocol";
       description "OSPFv3";
     }

     identity operation-mode {
       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 {
       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.";
     }

     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 {
           description "OSPF intra-area route.";
         }
         enum inter-area {
           description "OSPF inter-area route.";
         }
         enum external-1 {
           description "OSPF type 1 external route.";
         }
         enum external-2 {
           description "OSPF type 2 external route.";
         }
         enum nssa-1 {
           description "OSPF type 1 NSSA route.";
         }
         enum nssa-2 {
           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 {
           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 {
           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.";
     }

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

     feature multi-area-adj {
       description
         "OSPF multi-area adjacency support as in RFC 5185.";
     }
     feature router-id explicit-router-id {
       description
         "Set Router-ID per instance."; 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 ldp-igp-autoconfig {
       description
         "LDP IGP auto-config.";
     }

     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 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 instance-inheritance {
       description
         "Support instance inheritance";
     }

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

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

     grouping instance-stat tlv {
       description "Per-instance statistics";
         "TLV";
       leaf originate-new-lsa-count type {
         type yang:counter32; uint16;
         description "The number of new LSAs originated."; "TLV type.";
       }
       leaf rx-new-lsas-count length {
         type yang:counter32; uint16;
         description "The number of LSAs received."; "TLV length.";
       }
       leaf as-scope-lsa-count value {
         type yang:gauge32; yang:hex-string;
         description "The number of AS Scope LSAs."; "TLV value.";
       }
       leaf as-scope-lsa-chksum-sum
     }

     grouping unknown-tlvs {
         type uint32;
       description
           "The sum of the LSA checksums
         "Unknown TLVs grouping - Used for AS Scope LSAs.";
       } unknown TLVs or
          unknown sub-TLVs.";
       container database unknown-tlvs {
         description "Container for per AS-scope LSA statistics."; "All unknown TLVs.";
         list as-scope-lsa-type unknown-tlv {
           description "List of AS-scope LSA statistics"; "Unknown TLV.";
           uses tlv;
         }
       }
     }

     grouping ospfv2-router-link {
       description "OSPFv2 router link.";
       leaf lsa-type link-id {
         type uint16;
             description "AS-scope LSA type."; union {
           type inet:ipv4-address;
           type yang:dotted-quad;
         }
         description "Link ID.";
       }
       leaf lsa-count link-data {
         type yang:gauge32; union {
           type inet:ipv4-address;
           type uint32;
         }
         description "The number of LSAs of the LSA type."; "Link data.";
       }
       leaf lsa-cksum-sum type {
         type int32; uint8;
         description
               "The sum of the LSA checksums of the LSA "Link type.";
       }
     }
       }
     }

     grouping area-stat ospfv2-lsa-body {
       description "Per-area statistics.";
       leaf spf-runs-count "OSPFv2 LSA body.";
       container router {
         when "../../header/type = 1" {
         type yang:counter32;
           description
           "The number of times the intra-area SPF has run.";
             "Only applies to Router LSAs.";
         }
         description
           "Router LSA.";
         leaf abr-count flags {
           type yang:gauge32; bits {
             bit V {
               description
           "The total number
                 "When set, the router is an endpoint of Area Border Routers (ABRs)
            reachable within this area."; one or
                  more virtual links.";
             }
       leaf asbr-count
             bit E {
         type yang:gauge32;
               description
           "The total number of
                 "When set, the router is an AS Border Routers (ASBRs)."; Boundary Router
                  (ASBR).";
             }
       leaf ar-nssa-translator-event-count
             bit B {
         type yang:counter32;
               description
           "The number of NSSA translator-state changes.";
                 "When set, the router is an Area Border
                  Router (ABR).";
             }
           }
       leaf area-scope-lsa-count {
         type yang:gauge32;
           description
           "The number of area scope LSAs in the area."; "Flags.";
         }
         leaf area-scope-lsa-cksum-sum num-of-links {
           type int32; uint16;
           description "The sum "Number of the area scope LSAs checksums."; links.";
         }
         container database links {
           description "Container for area scope LSA type statistics."; "All router Links.";
           list area-scope-lsa-type link {
             description "List of area scope "Router LSA statistics";
           leaf lsa-type link.";
             uses ospfv2-router-link;
             container topologies {
             type uint16;
               description "Area scope LSA type.";
           } "All topologies for the link.";
               list topology {
                 description
                   "Topology specific information.";
                 leaf lsa-count mt-id {
                   type yang:gauge32; uint8;
                   description
                     "The number of LSAs of MT-ID for the LSA type."; topology enabled on
                      the link.";
                 }
                 leaf lsa-cksum-sum metric {
                   type int32; uint16;
                   description
               "The sum of the LSA checksums of "Metric for the LSA type."; topology.";
                 }
               }
             }
           }

     grouping interface-stat
         }
       }
       container network {
         when "../../header/type = 2" {
           description "Per-interface statistics";
             "Only applies to Network LSAs.";
         }
         description
           "Network LSA.";
         leaf if-event-count network-mask {
           type yang:counter32; inet:ipv4-address;
           description
             "The number of times this interface has changed its
            state or an error has occurred."; IP address mask for the network.";
         }
       leaf link-scope-lsa-count
         container attached-routers {
           description "All attached routers.";
           leaf-list attached-router {
             type yang:gauge32; yang:dotted-quad;
             description "The number
               "List of link scope the routers attached to the network.";
           }
         }
       }
       container summary {
         when "../../header/type = 3 or "
            + "../../header/type = 4" {
           description
             "Only applies to Summary LSAs.";
         }
         description
           "Summary LSA.";
         leaf link-scope-lsa-cksum-sum network-mask {
           type uint32; inet:ipv4-address;
           description
             "The sum of link scope LSA checksums."; IP address mask for the network";
         }
         container database topologies {
           description "Container "All topologies for link scope LSA type statistics."; the summary LSA.";
           list link-scope-lsa-type {
           description "List of link scope LSA statistics";
           leaf lsa-type topology {
             type uint16;
             description "Link scope LSA type.";
           }
               "Topology specific information.";
             leaf lsa-count mt-id {
               type yang:gauge32; uint8;
               description
                 "The number of LSAs of MT-ID for the LSA type."; topology enabled for
                  the summary.";
             }
             leaf lsa-cksum-sum metric {
               type int32; uint24;
               description
               "The sum of the LSA checksums of "Metric for the LSA type."; topology.";
             }
           }
         }
       }
     grouping neighbor-stat
       container external {
       description "Per-neighbor statistics.";
       leaf nbr-event-count
         when "../../header/type = 5 or "
            + "../../header/type = 7" {
         type yang:counter32;
           description
           "The number of times this neighbor has changed
            state or an error has occurred.";
             "Only applies to AS-external LSAs and NSSA LSAs.";
         }
         description
           "External LSA.";
         leaf nbr-retrans-qlen network-mask {
           type yang:gauge32; inet:ipv4-address;
           description
             "The current length of IP address mask for the retransmission queue.";
       } network";
         }

     grouping instance-fast-reroute-config
         container topologies {
           description
         "This group defines global configuration of IP-FRR.";
       container fast-reroute "All topologies for the external.";
           list topology {
         if-feature fast-reroute;
             description
           "This container may be augmented with global
            parameters for IP-FRR.";
         container lfa
               "Topology specific information.";
             leaf mt-id {
           if-feature lfa;
               type uint8;
               description
             "This container may be augmented with
              global parameters
                 "The MT-ID for LFA. Container creation
              has no effect on LFA activation.";
         }
       } the topology enabled for the
                  external or NSSA prefix.";
             }

     grouping interface-fast-reroute-config
             leaf flags {
       description
         "This group defines interface configuration of IP-FRR.";
       container fast-reroute
               type bits {
         if-feature fast-reroute;
         container lfa
                 bit E {
           if-feature lfa;
                   description
                     "When set, the metric specified is a Type 2
                      external metric.";
                 }
               }
               description "Flags.";
             }
             leaf candidate-disabled metric {
               type boolean; uint24;
               description
               "Prevent "Metric for the interface to be used as backup."; topology.";
             }
             leaf enabled forwarding-address {
               type boolean; inet:ipv4-address;
               description
               "Activates LFA - Per-prefix LFA computation
                is assumed.";
                 "Forwarding address.";
             }
           container remote-lfa {
             if-feature remote-lfa;
             leaf enabled external-route-tag {
               type boolean; uint32;
               description
               "Activates Remote LFA (R-LFA).";
                 "Route tag for the topology.";
             }
           }
             description
               "Remote LFA configuration.";
         }
       }
       container opaque {
         when "../../header/type = 9 or "
            + "../../header/type = 10 or "
            + "../../header/type = 11" {
           description
             "LFA configuration.";
             "Only applies to Opaque LSAs.";
         }
         description
           "IP Fast-reroute configuration.";
           "Opaque LSA.";

         uses unknown-tlvs;

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

     grouping interface-common-config

         container link-tlvs {
           description
         "Common configuration for all types of interfaces,
          including virtual links and sham links."; "All link TLVs in the LSA.";
           container link-tlv {
             description "Link TLV.";
             leaf cost link-type {
               type uint16 {
           range "1..65535";
         } uint8;
               mandatory true;
               description
           "Interface cost."; "Link type.";
             }
             leaf hello-interval link-id {
               type uint16 union {
           range "1..65535";
                 type inet:ipv4-address;
                 type yang:dotted-quad;
               }
         units seconds;
               mandatory true;
               description
           "Interval between hello packets in seconds."; "Link ID.";
             }

       leaf dead-interval {
         type uint16
             container local-if-ipv4-addrs {
           range "1..65535";
         }
         units seconds;
         must "../dead-interval > ../hello-interval"
               description "All local interface IPv4 addresses.";
               leaf-list local-if-ipv4-addr {
           error-message "The dead interval must be "
                       + "larger than the hello interval";
                 type inet:ipv4-address;
                 description
             "The value MUST be greater than 'hello-internval'.";
                   "List of local interface IPv4 addresses.";
               }
         description
           "Interval after which a neighbor is
            declared down in seconds.";
             }

       leaf retransmit-interval {
         type uint16
             container remote-if-ipv4-addrs {
           range "1..65535";
         }
         units seconds;
               description
           "Interval between retransmitting unacknowledged Link
            State Advertisements (LSAs) in seconds.";
       }

       leaf transmit-delay "All remote interface IPv4 addresses.";
               leaf-list remote-if-ipv4-addr {
                 type uint16 {
           range "1..65535";
         }
         units seconds; inet:ipv4-address;
                 description
           "Estimated time needed to transmit Link State Update
            packets on the
                   "List of remote interface in seconds."; IPv4 addresses.";
               }
             }
             leaf mtu-ignore te-metric {
         if-feature mtu-ignore;
               type boolean; uint32;
               description
           "Enable/Disable bypassing the MTU mismatch check in
            Database Description packets."; "TE metric.";

             }
             leaf lls max-bandwidth {
         if-feature lls;
               type boolean; decimal64 {
                 fraction-digits 2;
               }
               description
           "Enable/Disable link-local signaling (LLS) support."; "Maximum bandwidth.";
             }
             leaf prefix-suppression max-reservable-bandwidth {
         if-feature prefix-suppression;
               type boolean; decimal64 {
                 fraction-digits 2;
               }
               description
           "Suppress advertisement of the prefixes associated
            with the interface."; "Maximum reservable bandwidth.";
             }
             container ttl-security unreserved-bandwidths {
         if-feature ttl-security;
               description "TTL security check.";
         leaf enable "All unreserved bandwidths.";
               list unreserved-bandwidth {
           type boolean;
           description
             "Enable/Disable TTL security check.";
         }
                 leaf hops priority {
                   type uint8 {
                     range "1..254"; "0 .. 7";
                   }
                   description
             "Maximum number of hops that an OSPF packet may
              have traversed before reception.";
         } "Priority from 0 to 7.";
                 }
                 leaf enable unreserved-bandwidth {
         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'" decimal64 {
                     fraction-digits 2;
                   }
                   description "Applied to OSPFv3 only."; "Unreserved bandwidth.";
                 }
             if-feature ospfv3-authentication-ipsec;
             leaf sa {
                 type string;
                 description
                   "Security Association name.";
                   "List of unreserved bandwidths for different
                    priorities.";
               }
             }
           case auth-trailer-key-chain {
             leaf key-chain admin-group {
               type key-chain:key-chain-ref; uint32;
               description
                 "key-chain name.";
                 "Administrative group/Resource Class/Color.";
             }
             uses unknown-tlvs;
           }
           case auth-trailer-key {
             leaf key {
               type string;
               description
                 "Key string in ASCII format.";
         }

         container crypto-algorithm extended-prefix-tlvs {
               uses key-chain:crypto-algorithm-types;
           description
                 "Cryptographic algorithm associated with key.";
             }
           }
         }
       }
     } // interface-common-config

     grouping interface-config "All extended prefix TLVs in the LSA.";
           list extended-prefix-tlv {
             description "Configuration for real interfaces."; "Extended prefix TLV.";
             leaf network-type route-type {
               type enumeration {
                 enum "broadcast" unspecified {
                   value "0";
                   description
               "Specify OSPF broadcast multi-access network."; "Unspecified.";
                 }
                 enum "non-broadcast" intra-area {
                   value "1";
                   description
               "Specify OSPF Non-Broadcast Multi-Access
                (NBMA) network."; "OSPF intra-area route.";
                 }
                 enum "point-to-multipoint" inter-area {
                   value "3";
                   description
               "Specify OSPF point-to-multipoint network."; "OSPF inter-area route.";
                 }
                 enum "point-to-point" external {
                   value "5";
                   description
               "Specify OSPF point-to-point network."; "OSPF External route.";
                 }
                 enum nssa {
                   value "7";
                   description "OSPF NSSA external route.";
                 }
               }
               description
           "Network "Route type.";
             }
             leaf passive flags {
               type boolean; bits {
                 bit A {
                   description
           "Enable/Disable passive interface - a passive interface's
            prefix will be advertised but no neighbor adjacencies
            will be formed on the interface.";
                     "Attach flag.";
                 }
                 bit N {
                   description
                     "Node flag.";
                 }
               }
               description "Flags.";
             }
             leaf demand-circuit prefix {
         if-feature demand-circuit;
               type boolean; inet:ip-prefix;
               description
           "Enable/Disable demand circuit."; "Address prefix.";
             }
             uses unknown-tlvs;
           }
         }

         container multi-areas extended-link-tlvs {
           description "Container for multi-area config."; "All extended link TLVs in the LSA.";
           list multi-area extended-link-tlv {
           if-feature multi-area-adj;
           key multi-area-id;
             description
             "Configure OSPF multi-area adjacency.";
           leaf multi-area-id {
             type area-id-type;
             description
               "Multi-area adjacency area ID."; "Extended link TLV.";
             uses ospfv2-router-link;
             uses unknown-tlvs;
           }
           leaf cost {
             type uint16;
             description
               "Interface cost for multi-area adjacency.";
         }
       }
     }

       container static-neighbors {
         description "Statically configured neighbors.";

         list neighbor

     grouping ospfv3-lsa-options {
           key "address";
       description
             "Specify a static OSPF neighbor."; "OSPFv3 LSA options";
       leaf address options {
         type inet:ip-address;
             description "Neighbor IP address.";
           }
           leaf cost bits {
             type uint16
           bit DC {
               range "1..65535";
             }
             description "Neighbor cost.";
               "When set, the router supports demand circuits.";
           }
           leaf poll-interval {
             type uint16
           bit R {
               range "1..65535";
             }
             units seconds;
             description "Neighbor poll interval in seconds.";
               "When set, the originator is an active router.";
           }
           leaf priority {
             type uint8
           bit N {
               range "1..255";
             }
             description "Neighbor priority for DR election.";
           }
               "If set, the router is attached to an NSSA";
           }
           bit E {
             description
               "This bit describes the way AS-external LSAs
                are flooded";
           }

       leaf node-flag
           bit V6 {
         if-feature node-flag;
         type boolean;
         default false;
             description
           "Set prefix as a segment
               "If clear, the router/link should be excluded
                from IPv6 routing (SR) node
            representative prefix."; calculaton";
           }
         }
         mandatory true;
         description "OSPFv3 LSA options.";
       }
       uses interface-fast-reroute-config;
       uses interface-common-config;
     } // grouping interface-config

     grouping tlv ospfv3-lsa-prefix {
       description
         "TLV";
         "OSPFv3 LSA prefix.";

       leaf type prefix {
         type uint16; inet:ip-prefix;
         description "TLV type.";
           "Prefix.";
       }
       leaf length prefix-options {
         type uint16; bits {
           bit NU {
             description "TLV length.";
               "When set, the prefix should be excluded
                from IPv6 unicast calculations.";
           }
       leaf value
           bit LA {
         type yang:hex-string;
             description "TLV value.";
       }
               "When set, the prefix is actually an IPv6 interface
                address of the Advertising Router.";
           }

     grouping unknown-tlvs
           bit P {
             description
         "Unknown TLVs grouping - Used for unknown TLVs or
          unknown sub-TLVs.";
       container unknown-tlvs {
         description "All unknown TLVs.";
         list unknown-tlv
               "When set, the NSSA area prefix should be
                translated to an AS External LSA and readvertised
                by the translating NSSA Border Router.";
           }
           bit DN {
             description "Unknown TLV.";
           uses tlv;
               "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 ospfv2-router-link ospfv3-lsa-external {
       description "OSPFv2 router link.";
         "AS-External and NSSA LSA.";
       leaf link-id metric {
         type union uint24;
         description "Metric";
       }

       leaf flags {
         type inet:ipv4-address;
           type yang:dotted-quad; bits {
           bit E {
             description
               "When set, the metric specified is a Type 2
                external metric.";
           }
           bit F {
             description
               "When set, a Forwarding Address is included
                in the LSA.";
           }
           bit T {
             description "Link ID.";
               "When set, an External Route Tag is included
                in the LSA.";
           }
         }
         description "Flags.";
       }

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

       uses ospfv3-lsa-prefix;

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

       leaf external-route-tag {
         type uint32;
         }
         description "Link data.";
           "Route tag.";
       }
       leaf type referenced-link-state-id {
         type uint8; uint32;
         description "Link type.";
           "Referenced Link State ID.";
       }
     }

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

         uses ospfv3-lsa-options;

         container links {
           description "All router Links."; link.";
           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 interface-id {
               type uint8; uint32;
               description
                     "The MT-ID for the topology enabled on
                      the link."; "Interface ID.";
             }
             leaf metric neighbor-interface-id {
               type uint16; uint32;
               description "Metric for the topology."; "Neighbor Interface ID.";
             }
             leaf neighbor-router-id {
               type yang:dotted-quad;
               description "Neighbor Router ID.";
             }
             leaf type {
               type uint8;
               description "Link type.";
             }
             leaf metric {
               type uint16;
                 description "Metric.";
             }
           }
         }
       }
       container network {
         when "../../header/type = 2" 8194" { // 0x2002
           description
             "Only applies to Network LSAs."; LSA.";
         }
         description "Network LSA.";
         leaf network-mask {
           type inet:ipv4-address;
           description
             "The IP address mask for the network.";
         }

         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 summary inter-area-prefix {
         when "../../header/type = 3 or "
            + "../../header/type = 4" 8195" { // 0x2003
           description
             "Only applies to Summary Inter-Area-Prefix LSAs.";
         }
         description
           "Summary LSA.";
         leaf network-mask metric {
           type inet:ipv4-address; uint24;
           description
             "The IP address mask for the network"; "Metric";
         }
         container topologies {
         uses ospfv3-lsa-prefix;
         description "All topologies for the summary "Inter-Area-Prefix LSA.";
           list topology
       }
       container inter-area-router {
         when "../../header/type = 8196" { // 0x2004
           description
               "Topology specific information.";
             "Only applies to Inter-Area-Router LSAs.";
         }
         uses ospfv3-lsa-options;
         leaf mt-id metric {
           type uint8; uint24;
           description
                 "The MT-ID for the topology enabled for
                  the summary."; "Metric.";
         }
         leaf metric destination-router-id {
           type uint24; yang:dotted-quad;
           description "Metric for
             "The Router ID of the topology.";
             }

           } router being described by the LSA.";
         }
         description "Inter-Area-Router LSA.";
       }
       container external as-external {
         when "../../header/type = 5 or "
            + 16389" { // 0x4005
           description
             "Only applies to AS-external LSAs.";
         }

         uses ospfv3-lsa-external;

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

         description
           "External "NSSA LSA.";
       }
       container link {
         when "../../header/type = 8" { // 0x0008
           description
             "Only applies to Link LSAs.";
         }
         leaf network-mask rtr-priority {
           type inet:ipv4-address; uint8;
           description "Router Priority for the interface.";
         }
         uses ospfv3-lsa-options;

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

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

         container topologies prefixes {
           description "All topologies prefixes for the external."; link.";
           list topology prefix {
             description
               "Topology specific information.";
             leaf mt-id {
               type uint8;
               description
                 "The MT-ID for the topology enabled for
               "List of prefixes associated with the
                  external or NSSA prefix."; link.";
             uses ospfv3-lsa-prefix;
           }
             leaf flags {
               type bits
         }
         description "Link LSA.";
       }
       container intra-area-prefix {
                 bit E
         when "../../header/type = 8201" { // 0x2009
           description
                     "When set, the metric specified is a Type 2
                      external metric.";
                 }
             "Only applies to Intra-Area-Prefix LSA.";
         }
         description "Flags."; "Intra-Area-Prefix LSA.";

         leaf referenced-ls-type {
           type uint16;
           description "Referenced Link State type.";
         }
         leaf metric referenced-link-state-id {
           type uint24; uint32;
           description "Metric for the topology.";
             "Referenced Link State ID.";
         }
         leaf forwarding-address referenced-adv-router {
           type inet:ipv4-address;
           description
                 "Forwarding address.";
             "Referenced Advertising Router.";
         }

         leaf external-route-tag num-of-prefixes {
           type uint32; uint16;
           description
                 "Route tag for the topology.";
             }
           }
         } "Number of prefixes.";
         }
         container opaque {
         when "../../header/type = 9 or "
            + "../../header/type = 10 or "
            + "../../header/type = 11" prefixes {
           description
             "Only applies to Opaque LSAs.";
         }
         description
           "Opaque "All prefixes in this LSA.";

         uses unknown-tlvs;

         container router-address-tlv
           list prefix {
             description
             "Router address TLV."; "List of prefixes in this LSA.";
             uses ospfv3-lsa-prefix;
             leaf router-address metric {
               type inet:ipv4-address; uint24;
               description
               "Router address."; "Prefix Metric.";
             }
           }

         container link-tlvs
         }
       }
     }
     grouping lsa-header {
       description "All link TLVs in the LSA.";
           container link-tlv
           "Common LSA for OSPFv2 and OSPFv3";
       leaf age {
         type uint16;
         mandatory true;
         description "Link TLV."; "LSA age.";
       }
       leaf link-type type {
         type uint8; uint16;
         mandatory true;
         description "Link "LSA type.";
       }
       leaf link-id {
               type union adv-router {
         type inet:ipv4-address;
                 type yang:dotted-quad;
               }
         mandatory true;
         description "Link ID."; "LSA advertising router.";
       }
             container local-if-ipv4-addrs
       leaf seq-num {
         type uint32;
         mandatory true;
         description "All local interface IPv4 addresses.";
               leaf-list local-if-ipv4-addr "LSA sequence number.";
       }
       leaf checksum {
         type inet:ipv4-address; uint16;
         mandatory true;
         description
                   "List of local interface IPv4 addresses.";
               } "LSA checksum.";
       }
             container remote-if-ipv4-addrs
       leaf length {
         type uint16;
         mandatory true;
         description "All remote interface IPv4 addresses.";
               leaf-list remote-if-ipv4-addr {
                 type inet:ipv4-address;
                 description
                   "List of remote interface IPv4 addresses."; "LSA length.";
       }
     }
             leaf te-metric

     grouping ospfv2-lsa {
               type uint32;
       description "TE metric.";
             }
             leaf max-bandwidth
           "OSPFv2 LSA.";
       container header {
         must "(type = 9 or type decimal64 = 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)" {
                 fraction-digits 2;
               }
           description "Maximum bandwidth.";
             "Opaque type and ID only apply to Opaque LSAs.";
         }
         description
           "Decoded OSPFv2 LSA header data.";
         leaf max-reservable-bandwidth option {
           type decimal64 bits {
             bit DC {
                 fraction-digits 2;
               }
               description "Maximum reservable bandwidth.";
                 "When set, the router supports demand circuits.";
             }
             container unreserved-bandwidths
             bit P {
               description "All unreserved bandwidths.";
               list unreserved-bandwidth {
                 leaf priority
                 "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 {
                   type uint8
               description
                 "When set, the router supports MOSPF.";
             }
             bit E {
                     range "0 .. 7";
               description
                 "This bit describes the way AS-external LSAs
                  are flooded";
             }
           }
           mandatory true;
           description "Priority from 0 to 7."; "LSA options.";
         }
         leaf unreserved-bandwidth lsa-id {
           type decimal64 {
                     fraction-digits 2;
                   } inet:ipv4-address;
           mandatory true;
           description "Unreserved bandwidth."; "LSA ID.";
         }

         leaf opaque-type {
           type uint8;
           description
                   "List of unreserved bandwidths for different
                    priorities.";
               } "Opaque type.";
         }

         leaf admin-group opaque-id {
           type uint32; uint24;
           description
                 "Administrative group/Resource Class/Color."; "Opaque ID.";
         }

         uses unknown-tlvs;
           } lsa-header;
       }
       container extended-prefix-tlvs body {
         description "All extended prefix TLVs in the
           "Decoded OSPFv2 LSA body data.";
         uses ospfv2-lsa-body;

       }
     }

     grouping ospfv3-lsa {
       description
           "Decoded OSPFv3 LSA.";
           list extended-prefix-tlv
       container header {
         description "Extended prefix TLV.";
           "Decoded OSPFv3 LSA header data.";
         leaf route-type lsa-id {
           type enumeration {
                 enum unspecified {
                   value "0"; uint32;
           mandatory true;
           description "Unspecified."; "LSA ID.";
         }
                 enum intra-area {
                   value "1";
                   description "OSPF intra-area route.";
         uses lsa-header;
       }
                 enum inter-area
       container body {
                   value "3";
         description "OSPF inter-area route.";
           "Decoded OSPF LSA body data.";
         uses ospfv3-lsa-body;
       }
                 enum external {
                   value "5";
                   description "OSPF External route.";
     }
                 enum nssa
     grouping lsa-common {
                   value "7";
                   description "OSPF NSSA external route.";
                 }
               }
       description "Route type.";
             }
           "Common field for OSPF LSA represenation.";
       leaf flags decoded-completed {
         type bits {
                 bit A {
                   description
                     "Attach flag.";
                 }
                 bit N {
                   description
                     "Node flag.";

                 }
               } boolean;
         description "Flags.";
           "The OSPF LSA body is fully decoded.";
       }
       leaf prefix raw-data {
         type inet:ip-prefix; yang:hex-string;
         description "Address prefix.";
             }
             uses unknown-tlvs;
           "The complete LSA in network byte
            order hexadecimal as received or originated.";
       }
     }

         container extended-link-tlvs

     grouping lsa {
       description "All extended link TLVs in the
           "OSPF LSA.";
           list extended-link-tlv
       uses lsa-common;
       choice version {
         description "Extended link TLV.";
             uses ospfv2-router-link;
           "OSPFv2 or OSPFv3 LSA body.";
         container ospfv2 {
           description "OSPFv2 LSA";
           uses unknown-tlvs; ospfv2-lsa;

         }
         container ospfv3 {
           description "OSPFv3 LSA";
           uses ospfv3-lsa;
         }
       }
     }

     grouping ospfv3-lsa-options lsa-key {
       description "OSPFv3
         "OSPF LSA options"; key.";
       leaf options lsa-id {
         type bits {
           bit DC union {
           type inet:ipv4-address;
           type uint32;
         }
         description
               "When set, the router supports demand circuits.";
           "LSA ID.";
       }
           bit R
       leaf adv-router {
         type inet:ipv4-address;
         description
               "When set, the originator is an active
           "Advertising router.";
       }
           bit N
     }

     grouping instance-stat {
       description
               "If set, the router is attached to an NSSA";
           }
           bit E "Per-instance statistics";
       leaf originate-new-lsa-count {
         type yang:counter32;
         description
               "This bit describes the way AS-external "The number of new LSAs
                are flooded"; originated.";
       }
           bit V6
       leaf rx-new-lsas-count {
         type yang:counter32;
         description
               "If clear, the router/link should be excluded
                from IPv6 routing calculaton";

           }
         }
         mandatory true;
         description "OSPFv3 LSA options.";
       } "The number of LSAs received.";
       }

     grouping ospfv3-lsa-prefix {
       description
         "OSPFv3 LSA prefix.";
       leaf prefix as-scope-lsa-count {
         type inet:ip-prefix; yang:gauge32;
         description
           "Prefix."; "The number of AS Scope LSAs.";
       }
       leaf prefix-options as-scope-lsa-chksum-sum {
         type bits {
           bit NU { uint32;
         description
               "When set,
           "The sum of the prefix should be excluded
                from IPv6 unicast calculations."; LSA checksums for AS Scope LSAs.";
       }
           bit LA
       container database {
         description
               "When set, the prefix is actually an IPv6 interface
                address "Container for per AS-scope LSA statistics.";
         list as-scope-lsa-type {
           description "List of the Advertising Router."; AS-scope LSA statistics";
           leaf lsa-type {
             type uint16;
             description "AS-scope LSA type.";
           }
           bit P
           leaf lsa-count {
             type yang:gauge32;
             description
               "When set, "The number of LSAs of the NSSA area prefix should be
                translated to an AS External LSA and readvertised
                by the translating NSSA Border Router."; type.";
           }
           bit DN
           leaf lsa-cksum-sum {
             type int32;
             description
               "When set,
               "The sum of the inter-area-prefix LSA or
                AS-external checksums of the LSA prefix has been advertised as an
                L3VPN prefix."; type.";
           }
         }
         mandatory true;
         description "Prefix options.";
       }
     }

     grouping ospfv3-lsa-external area-stat {
       description
         "AS-External and NSSA LSA."; "Per-area statistics.";
       leaf metric spf-runs-count {
         type uint24; yang:counter32;
         description "Metric";
           "The number of times the intra-area SPF has run.";
       }
       leaf flags abr-count {
         type bits {
           bit E { yang:gauge32;
         description
               "When set, the metric specified is a Type 2
                external metric.";
           "The total number of Area Border Routers (ABRs)
            reachable within this area.";
       }
           bit F
       leaf asbr-count {
         type yang:gauge32;
         description
               "When set, a Forwarding Address is included
                in the LSA.";
           "The total number of AS Border Routers (ASBRs).";
       }
           bit T
       leaf ar-nssa-translator-event-count {
         type yang:counter32;
         description
               "When set, an External Route Tag is included
                in the LSA.";
           }
         }
         description "Flags.";
           "The number of NSSA translator-state changes.";
       }
       leaf referenced-ls-type area-scope-lsa-count {
         type uint16; yang:gauge32;
         description "Referenced Link State type.";
           "The number of area scope LSAs in the area.";
       }

       uses ospfv3-lsa-prefix;
       leaf forwarding-address area-scope-lsa-cksum-sum {
         type inet:ipv6-address; int32;
         description
           "Forwarding address."; "The sum of the area scope LSAs checksums.";
       }

       leaf external-route-tag
       container database {
         type uint32;
         description
           "Route tag.";
       }
       leaf referenced-link-state-id { "Container for area scope LSA type uint32;
         description
           "Referenced Link State ID.";
       }
     }

     grouping ospfv3-lsa-body statistics.";
         list area-scope-lsa-type {
           description "OSPFv3 "List of area scope LSA body.";
       container router {
         when "../../header/type = 8193" statistics";
           leaf lsa-type { // 0x2001
             type uint16;
             description
             "Only applies to Router LSAs."; "Area scope LSA type.";
           }
         description "Router LSA.";
           leaf flags lsa-count {
             type bits {
             bit V { yang:gauge32;
             description
                 "When set, the router is an endpoint "The number of LSAs of one or
                  more virtual links.";
             }
             bit E {
               description
                 "When set, the router is an AS Boundary Router
                  (ASBR)."; LSA type.";
           }
             bit B
           leaf lsa-cksum-sum {
             type int32;
             description
                 "When set,
               "The sum of the router is an Area Border
                  Router (ABR).";
             }
             bit Nt {
               description
                 "When set, LSA checksums of the router is an NSSA border router
                  that is unconditionally translating NSSA LSAs
                  into AS-external LSAs."; LSA type.";
           }
         }
           mandatory true;
           description "Router LSA flags.";
       }

         uses ospfv3-lsa-options;

         container links
     }

     grouping interface-stat {
       description "All router link.";
           list link "Per-interface statistics";
       leaf if-event-count {
         type yang:counter32;
         description "Router LSA link.";
           "The number of times this interface has changed its
            state or an error has occurred.";
       }
       leaf interface-id link-scope-lsa-count {
         type uint32; yang:gauge32;
         description "Interface ID."; "The number of link scope LSAs.";
       }
       leaf neighbor-interface-id link-scope-lsa-cksum-sum {
         type uint32;
         description "Neighbor Interface ID."; "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 neighbor-router-id lsa-type {
             type yang:dotted-quad; uint16;
             description "Neighbor Router ID."; "Link scope LSA type.";
           }
           leaf type lsa-count {
             type uint8; yang:gauge32;
             description "Link "The number of LSAs of the LSA type.";
           }
           leaf metric lsa-cksum-sum {
             type uint16; int32;
             description "Metric.";
               "The sum of the LSA checksums of the LSA type.";
           }
         }
       }
     }
       container network {
         when "../../header/type = 8194"

     grouping neighbor-stat { // 0x2002
           description
             "Only applies to Network LSA.";
         }
       description "Network LSA.";

         uses ospfv3-lsa-options;

         container attached-routers "Per-neighbor statistics.";
       leaf nbr-event-count {
         type yang:counter32;
         description "All attached routers.";
           leaf-list attached-router
           "The number of times this neighbor has changed
            state or an error has occurred.";
       }
       leaf nbr-retrans-qlen {
         type yang:dotted-quad; yang:gauge32;
         description
               "List
           "The current length of the routers attached to the network.";
           } retransmission queue.";
       }
     }
       container inter-area-prefix

     grouping instance-fast-reroute-config {
         when "../../header/type = 8195"
       description
         "This group defines global configuration of IP-FRR.";
       container fast-reroute { // 0x2003
         if-feature fast-reroute;
         description
             "Only applies to Inter-Area-Prefix LSAs.";
         }
         leaf metric
           "This container may be augmented with global
            parameters for IP-FRR.";
         container lfa {
           type uint24;
           if-feature lfa;
           description "Metric";
             "This container may be augmented with
              global parameters for LFA. Container creation
              has no effect on LFA activation.";
         }
         uses ospfv3-lsa-prefix;
         description "Inter-Area-Prefix LSA.";
       }
     }

     grouping interface-fast-reroute-config {
       description
         "This group defines interface configuration of IP-FRR.";

       container inter-area-router fast-reroute {
         when "../../header/type = 8196"
         if-feature fast-reroute;
         container lfa { // 0x2004
           description
             "Only applies to Inter-Area-Router LSAs.";
         }
         uses ospfv3-lsa-options;
           if-feature lfa;
           leaf metric candidate-disabled {
             type uint24; boolean;
             description "Metric.";
               "Prevent the interface to be used as backup.";
           }
           leaf destination-router-id enabled {
             type yang:dotted-quad; boolean;
             description
             "The Router ID of the router being described by the LSA.";
         }
         description "Inter-Area-Router LSA.";
               "Activates LFA - Per-prefix LFA computation
                is assumed.";
           }
           container as-external remote-lfa {
         when "../../header/type = 16389"
             if-feature remote-lfa;
             leaf enabled { // 0x4005
               type boolean;
               description
             "Only applies to AS-external LSAs.";
               "Activates Remote LFA (R-LFA).";
             }

         uses ospfv3-lsa-external;
             description "AS-External LSA.";
               "Remote LFA configuration.";
           }
       container nssa {
         when "../../header/type = 8199" { // 0x2007
           description
             "Only applies to NSSA LSAs.";
             "LFA configuration.";
         }
         uses ospfv3-lsa-external;
         description "NSSA LSA.";
           "IP Fast-reroute configuration.";
       }
       container link {
         when "../../header/type = 8"
     }

     grouping interface-common-config { // 0x0008
       description
             "Only applies to Link LSAs.";
         }
         "Common configuration for all types of interfaces,
          including virtual links and sham links.";

       leaf rtr-priority cost {
         type uint8; uint16 {
           range "1..65535";
         }
         description "Router Priority for the interface.";
           "Interface cost.";
       }
         uses ospfv3-lsa-options;
       leaf link-local-interface-address hello-interval {
         type inet:ipv6-address; uint16 {
           range "1..65535";

         }
         units seconds;
         description
             "The originating router's link-local
              interface address for the link.";
           "Interval between hello packets in seconds.";
       }

       leaf num-of-prefixes dead-interval {
         type uint32;
           description "Number of prefixes."; uint16 {
           range "1..65535";
         }

         container prefixes
         units seconds;
         must "../dead-interval > ../hello-interval" {
           description "All prefixes for
           error-message "The dead interval must be "
                       + "larger than the link.";
           list prefix { hello interval";
           description
               "List of prefixes associated with the link.";
             uses ospfv3-lsa-prefix;
           }
             "The value MUST be greater than 'hello-internval'.";
         }
         description "Link LSA.";
           "Interval after which a neighbor is
            declared down in seconds.";
       }
       container intra-area-prefix

       leaf retransmit-interval {
         when "../../header/type = 8201"
         type uint16 { // 0x2009
           description
             "Only applies to Intra-Area-Prefix LSA.";
           range "1..65535";
         }
         units seconds;
         description "Intra-Area-Prefix LSA.";
           "Interval between retransmitting unacknowledged Link
            State Advertisements (LSAs) in seconds.";
       }

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

       leaf referenced-link-state-id mtu-ignore {
         if-feature mtu-ignore;
         type uint32; boolean;
         description
             "Referenced Link State ID.";
           "Enable/Disable bypassing the MTU mismatch check in
            Database Description packets.";

       }

       leaf referenced-adv-router lls {
         if-feature lls;
         type inet:ipv4-address; boolean;
         description
             "Referenced Advertising Router.";
           "Enable/Disable link-local signaling (LLS) support.";
       }

       leaf num-of-prefixes prefix-suppression {
         if-feature prefix-suppression;
         type uint16; boolean;
         description "Number
           "Suppress advertisement of prefixes."; the prefixes associated
            with the interface.";
       }

       container prefixes {
           description "All prefixes in this LSA.";
           list prefix ttl-security {
         if-feature ttl-security;
         description "List of prefixes in this LSA.";
             uses ospfv3-lsa-prefix; "TTL security check.";
         leaf metric enable {
           type uint24; boolean;
           description "Prefix Metric.";
             }
             "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.";
         }
       }

     grouping lsa-header {
       description
           "Common LSA for OSPFv2 and OSPFv3";
       leaf age enable {
         if-feature admin-control;
         type uint16;
         mandatory boolean;
         default true;
         description "LSA age.";
           "Enable/disable protocol on the interface.";
       }
       leaf type

       container authentication {
         type uint16;
         mandatory true;
         description "LSA type."; "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 adv-router sa {
                 type yang:dotted-quad;
         mandatory true; string;
                 description "LSA advertising router.";
                   "Security Association name.";
             }
           }
           case auth-trailer-key-chain {
             leaf seq-num key-chain {
               type uint32;
         mandatory true; key-chain:key-chain-ref;
                description "LSA sequence number.";
                 "key-chain name.";
               }
             }
           case auth-trailer-key {
             leaf checksum key {
               type uint16;
         mandatory true; string;
               description "LSA checksum.";
                 "Key string in ASCII format.";
             }
       leaf length
             container crypto-algorithm {
         type uint16;
         mandatory true;
               uses key-chain:crypto-algorithm-types;
               description "LSA length.";
                 "Cryptographic algorithm associated with key.";
             }
           }
         }
       }
     } // interface-common-config

     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)" interface-config {
       description
             "Opaque type and ID only apply to Opaque LSAs.";
         }
         description
           "Decoded OSPFv2 LSA header data."; "Configuration for real interfaces.";

       leaf option network-type {
         type bits enumeration {
             bit DC
           enum "broadcast" {
             description
                 "When set, the router supports demand circuits.";
               "Specify OSPF broadcast multi-access network.";
           }
             bit P
           enum "non-broadcast" {
             description
                 "Only used in type-7 LSA. When set, an NSSA
                  border router should translate the type-7 LSA
                  to a type-5 LSA.";
               "Specify OSPF Non-Broadcast Multi-Access
                (NBMA) network.";
           }
             bit MC
           enum "point-to-multipoint" {
             description
                 "When set, the router supports MOSPF.";
               "Specify OSPF point-to-multipoint network.";
           }
             bit E
           enum "point-to-point" {
             description
                 "This bit describes the way AS-external LSAs
                  are flooded";
               "Specify OSPF point-to-point network.";
           }
         }
           mandatory true;
         description "LSA options.";
           "Network type.";
       }

       leaf lsa-id passive {
         type inet:ipv4-address;
           mandatory true; boolean;
         description "LSA ID.";
           "Enable/Disable passive interface - a passive interface's
            prefix will be advertised but no neighbor adjacencies
            will be formed on the interface.";
       }

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

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

         uses lsa-header;
       }
       container body
           leaf cost {
             type uint16;
             description
           "Decoded OSPFv2 LSA body data.";
         uses ospfv2-lsa-body;
               "Interface cost for multi-area adjacency.";
           }
         }
       }

     grouping ospfv3-lsa {
       description
           "Decoded OSPFv3 LSA.";

       container header static-neighbors {
         description
           "Decoded OSPFv3 LSA header data."; "Statically configured neighbors.";

         list neighbor {
           key "address";
           description
             "Specify a static OSPF neighbor.";

           leaf lsa-id address {
             type uint32;
           mandatory true; inet:ip-address;
             description "LSA ID.";
         }
         uses lsa-header; "Neighbor IP address.";
           }
       container body

           leaf cost {
         description
           "Decoded OSPF LSA body data.";
         uses ospfv3-lsa-body;
             type uint16 {
               range "1..65535";
             }
             description "Neighbor cost.";
           }
     grouping lsa-common
           leaf poll-interval {
             type uint16 {
               range "1..65535";
             }
             units seconds;
             description
           "Common field for OSPF LSA represenation."; "Neighbor poll interval in seconds.";
           }
           leaf decoded-completed priority {
             type boolean; uint8 {
               range "1..255";
             }
             description
           "The OSPF LSA body is fully decoded."; "Neighbor priority for DR election.";
           }
         }
       }

       leaf raw-data node-flag {
         if-feature node-flag;
         type yang:hex-string; boolean;
         default false;
         description
           "The complete LSA in network byte
            order hexadecimal
           "Set prefix as received or originated."; a segment routing (SR) node
            representative prefix.";
       }
       uses interface-fast-reroute-config;
       uses interface-common-config;
     } // grouping lsa interface-config

     grouping neighbor-operation {
       description
         "OSPF LSA.";
       uses lsa-common;
       choice version {
         description
           "OSPFv2 or OSPFv3 LSA body.";
         container ospfv2 neighbor operation data.";

       leaf address {
         type inet:ip-address;
         description "OSPFv2 LSA";
           uses ospfv2-lsa;
           "Neighbor address.";
       }
         container ospfv3
       leaf dr-router-id {
         type yang:dotted-quad;
         description "OSPFv3 LSA";
           uses ospfv3-lsa;
         }
       } "Neighbor's Designated Router (DR) router ID.";
       }

     grouping lsa-key {
       description
         "OSPF LSA key.";

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

       leaf bdr-router-id {
         type inet:ipv4-address;
           type uint32;
         } yang:dotted-quad;
         description
           "LSA
           "Neighbor's Backup Designated Router (BDR) router ID.";
       }

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

     grouping af-area-config
       leaf state {
         type nbr-state-type;
         description
           "OSPF address-family specific area config neighbor state.";
       }
       container ranges statistics {
         description "Container for summary ranges";
         list range "Per neighbor statistics";
         uses neighbor-stat;
       }
     }

     grouping interface-common-operation {
           key "prefix";
       description
             "Summarize routes matching address/mask
              (Area Border Routers (ABRs) only)";
           leaf prefix
         "OSPF interface common operation state.";
       reference "RFC2328 Section 9";

       leaf state {
         type inet:ip-prefix; if-state-type;
         description
               "IPv4 or IPv6 prefix"; "Interface state.";
       }
       leaf advertise hello-timer {
         type boolean; uint32;
         units "milliseconds";
         description
               "Advertise or hide."; "Hello timer.";
       }

       leaf cost wait-timer {
         type uint24 {
               range "0..16777214";
             } uint32;
         units "milliseconds";
         description
               "Advertised cost of summary route.";
           }
         }
       } "Wait timer.";
       }

     grouping area-config {
       description
         "OSPF area configuration state.";

       leaf area-type dr-router-id {
         type identityref {
           base area-type;
         }
         default normal; yang:dotted-quad;
         description
           "Area type."; "Designated Router (DR) router ID.";
       }

       leaf summary {
         when "../area-type = 'ospf:stub' or "
            + "../area-type = 'ospf:nssa'" dr-ip-addr {
           description
             "Summary advertisement into the stub/NSSA area.";
         }
         type boolean; inet:ip-address;
         description
           "Enable/Disable summary advertisement into the stub or
            NSSA area."; "Designated Router (DR) IP address.";
       }

       leaf default-cost bdr-router-id {
         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";
         } yang:dotted-quad;
         description
           "Set the summary default route cost for a
            stub or NSSA area.";
       } "Backup Designated Router (BDR) router ID.";
       }

     grouping local-rib

       leaf bdr-ip-addr {
         type inet:ipv4-address;
         description "Local-rib grouping."; "Backup Designated Router (BDR) IP Address.";
       }

       container local-rib {
         description "Local-rib.";
         list route {
           key "prefix";
           description "Routes";
           leaf prefix statistics {
             type inet:ip-prefix;
         description "Destination prefix."; "Per interface statistics";
         uses interface-stat;
       }

       container next-hops neighbors {
         description "All next hops neighbors for the route."; interface.";
         list next-hop neighbor {
           key "next-hop"; "neighbor-router-id";
           description
             "List of next hop for the route"; OSPF neighbors.";
           leaf outgoing-interface neighbor-router-id {
             type if:interface-ref; yang:dotted-quad;
             description
                   "Name of the outgoing interface.";
               "Neighbor router ID.";
           }
               leaf next-hop {
                type inet:ip-address;
                description "Nexthop address.";
           uses neighbor-operation;
         } // list of OSPF neighbors
       }
     }
           leaf metric // interface-common-operation

     grouping interface-operation {
             type uint32;
       description "Metric for this route.";
           }
         "OSPF interface operation state.";
       reference "RFC2328 Section 9";

       uses interface-common-operation;

       container database {
         description "Link scope LSA database.";
         list link-scope-lsa-type {
           key "lsa-type";
           description
             "List OSPF link scope LSA databases.";
           leaf route-type lsa-type {
             type route-type; uint16;
             description "Route type for this route."; "OSPF link scope LSA type.";
           }
           leaf route-tag
           container link-scope-lsas {
             type uint32;
             description "Route tag for
               "All link scope LSAs of this route."; LSA type.";
             list link-scope-lsa {
               key "lsa-id adv-router";
               description "List of OSPF link scope LSAs";
               uses lsa-key;
               uses lsa {
                 refine "version/ospfv2/ospfv2" {
                   must "../../../../../../../../../../../"
                      + "rt:type = 'ospf:ospfv2'" {
                     description "OSPFv2 LSA.";
                   }
                 }
                 refine "version/ospfv3/ospfv3" {
                   must "../../../../../../../../../../../"
                      + "rt:type = 'ospf:ospfv3'" {
                     description "OSPFv3 LSA.";
                   }
                 }
               }
             }
           }
         } // list link-scope-lsas
       }
     }
     grouping instance-config virtual-link-config {
       description
         "OSPF instance config virtual link configuration state.";
       leaf router-id {
         if-feature router-id;
         type yang:dotted-quad;
         description
           "Defined in RFC 2328. A 32-bit number
            that uniquely identifies the router.";

       uses interface-common-config;
     }

       container admin-distance

     grouping virtual-link-operation {
       description "Admin distance config
         "OSPF virtual link operation state.";
         choice scope

       uses interface-common-operation;
     }

     grouping sham-link-config {
       description
             "Options for expressing admin distance
              as single or multiple values.";
           case single-value {
             leaf all
         "OSPF sham link configuration state.";

       uses interface-common-config;
     }

     grouping sham-link-operation {
               type uint8;
       description
                 "Admin distance for intra-area, inter-area and
                  external routes.";
             }
         "OSPF sham link operation state.";

       uses interface-common-operation;
     }
           case multi-values

     grouping af-area-config {
             choice granularity
       description
         "OSPF address-family specific area config state.";

       container ranges {
         description
                 "Options for expressing admin distance "Container for intra-area and inter-area routes.";
               case detail summary ranges";

         list range {
           key "prefix";
           description
             "Summarize routes matching address/mask
              (Area Border Routers (ABRs) only)";
           leaf intra-area prefix {
             type uint8; inet:ip-prefix;
             description
                     "Admin distance for intra-area routes.";
               "IPv4 or IPv6 prefix";
           }
           leaf inter-area advertise {
             type uint8; boolean;
             description
                     "Admin distance for inter-area routes.";
                 }
               "Advertise or hide.";
           }
               case coarse {
           leaf internal cost {
             type uint8;
                   description
                     "Admin distance for both intra-area and
                      inter-area routes.";
                 }
               }
             }
             leaf external uint24 {
               type uint8;
               range "0..16777214";
             }
             description
                 "Admin distance for external routes.";
               "Advertised cost of summary route.";
           }
         }
       }
     }

       container nsr

     grouping area-common-config {
         if-feature nsr;
       description
           "Non-Stop Routing (NSR) config
         "OSPF area common configuration state.";

       leaf enable summary {
         when "../area-type = 'ospf:stub' or "
            + "../area-type = 'ospf:nssa'" {
           description
             "Summary advertisement into the stub/NSSA area.";
         }
         type boolean;
         description
           "Enable/Disable NSR."; 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-config {
       description
         "OSPF area configuration state.";

       container graceful-restart all-interfaces-inherit {
         if-feature graceful-restart; interface-inheritance;
         description
           "Graceful restart config state.";
         leaf enable
           "Inheritance for all interfaces";
         container interface {
           type boolean;
           description
             "Enable/Disable graceful restart as defined
             "Interface config to be inherited by all
              interfaces in RFC 3623."; the area.";
         }
       }

       leaf helper-enable area-type {
         type boolean; identityref {
           base area-type;
         }
         default normal;
         description
             "Enable graceful restart helper support for restarting
              routers (RFC 3623 Section B.2).";
           "Area type.";
       }
         leaf restart-interval

       uses area-common-config;

       uses af-area-config {
           type uint16
         when "../../operation-mode = "
            + "'ospf:ships-in-the-night'" {
             range "1..1800";  // Range is defined
           description
             "Ships in RFC 3623. the night configuration.";
         }
           units seconds;
           default "120";  // Default is defined in RFC 3623.
       }
     }

     grouping area-operation {
       description
             "Interval in seconds to attempt graceful restart prior
              to failing (RFC 3623 Section B.1)";
         "OSPF area operation state.";

       container statistics {
         description "Per area statistics";
         uses area-stat;
       }

       container database {
         description "Area scope LSA database.";
         list area-scope-lsa-type {
           key "lsa-type";
           description "List OSPF area scope LSA databases.";
           leaf helper-strict-lsa-checking lsa-type {
             type boolean; uint16;
             description
             "Terminate graceful restart when "OSPF area scope LSA type.";

           }
           container area-scope-lsas {
             description
               "All area scope LSAs of an area scope
                LSA topology change
              is detected (RFC 3623 Section B.2)."; type.";
             list area-scope-lsa {
               key "lsa-id adv-router";
               description "List of OSPF area scope LSAs";
               uses lsa-key;
               uses lsa {
                 refine "version/ospfv2/ospfv2" {
                   must "../../../../../../../../../"
                      + "rt:type = 'ospf:ospfv2'" {
                     description "OSPFv2 LSA.";
                   }
                 }
                 refine "version/ospfv3/ospfv3" {
                   must "../../../../../../../../../"
                      + "rt:type = 'ospf:ospfv3'" {
                     description "OSPFv3 LSA.";
                   }
                 }
               }
             }
           }
         } // list area-scope-lsas
       }
     }

     grouping local-rib {
       description "Local-rib grouping.";
       container local-rib {
         description "Local-rib.";
         list route {
           key "prefix";
           description "Routes";
           leaf enable prefix {
         if-feature admin-control;
             type boolean;
         default true; inet:ip-prefix;
             description
           "Enable/Disable the protocol."; "Destination prefix.";
           }
           container auto-cost next-hops {
         if-feature auto-cost;
             description
           "Interface Auto-cost configuration state."; "All next hops for the route.";
             list next-hop {
               key "next-hop";
               description "List of next hop for the route";
               leaf enable outgoing-interface {
                 type boolean; if:interface-ref;
                 description
             "Enable/Disable interface auto-cost.";
                   "Name of the outgoing interface.";
               }
               leaf reference-bandwidth {
           when "../enable = 'true'" next-hop {
             description "Only when auto cost is enabled";
           }
                type uint32 {
             range "1..4294967";
           }
           units Mbits; inet:ip-address;
                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."; "Nexthop address.";
               }
             }
           }

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

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

     grouping instance-config {
       description
         "OSPF instance config state.";

       container stub-router all-areas-inherit {
         if-feature stub-router; area-inheritance;
         description "Set maximum metric configuration";

         choice trigger
           "Inheritance for all areas.";
         container area {
           description
             "Specific triggers which will enable stub
              router state.";
             "Area config to be inherited by all areas.";
         }
         container always interface {
             presence
               "Enables unconditional stub router support";
           description
               "Unconditional stub router state (advertise
                transit links with max metric";
             "Interface config to be inherited by all interfaces
              in all areas.";
         }
       }

       leaf explicit-router-id {
         if-feature explicit-router-id;
         type yang:dotted-quad;
         description
           "Defined in RFC 2328. A 32-bit number
            that uniquely identifies the router.";
       }

       container mpls admin-distance {
         description
           "OSPF MPLS "Admin distance config state.";
         container te-rid
         choice scope {
           if-feature te-rid;
           description
             "Stable OSPF Router IP Address used
             "Options for expressing admin distance
              as single or multiple values.";
           case single-value {
             leaf all {
               type uint8;
               description
                 "Admin distance for Traffic
              Engineering (TE)"; intra-area, inter-area and
                  external routes.";
             }
           }
           case multi-values {
             choice source granularity {
               description
               "Different options
                 "Options for specifying TE router ID."; expressing admin distance
                  for intra-area and inter-area routes.";
               case interface detail {
                 leaf interface intra-area {
                   type if:interface-ref; uint8;
                   description
                   "Use the interface's IPv4 address as TE
                    router ID.";
               }
                     "Admin distance for intra-area routes.";
                 }
             case explicit {
                 leaf router-id inter-area {
                   type inet:ipv4-address; uint8;
                   description
                   "Explicitly configure the TE router ID.";
               }
             }
                     "Admin distance for inter-area routes.";
                 }
               }
         container ldp
               case coarse {
           description
             "OSPF MPLS LDP config state.";
                 leaf igp-sync internal {
             if-feature ldp-igp-sync;
                   type boolean; uint8;
                   description
               "Enable LDP IGP synchronization.";
                     "Admin distance for both intra-area and
                      inter-area routes.";
                 }
               }
             }
             leaf autoconfig external {
             if-feature ldp-igp-autoconfig;
               type boolean; uint8;
               description
               "Enable LDP IGP interface auto-configuration.";
                 "Admin distance for external routes.";
             }

           }
         }
       uses instance-fast-reroute-config;
       }

     grouping interface-operation

       container nsr {
         if-feature nsr;
         description
         "OSPF interface operation
           "Non-Stop Routing (NSR) config state.";
       reference "RFC2328 Section 9";
       uses interface-config;
         leaf state enable {
           type if-state-type; boolean;
           description "Interface state.";
             "Enable/Disable NSR.";
         }

       leaf hello-timer
       }

       container graceful-restart {
         type uint32;
         units "milliseconds";
         if-feature graceful-restart;
         description "Hello timer.";
       }
           "Graceful restart config state.";
         leaf wait-timer enable {
           type uint32;
         units "milliseconds"; boolean;
           description "Wait timer.";
             "Enable/Disable graceful restart as defined in RFC 3623
              for OSPFv2 and RFC 5187 for OSPFv3.";
         }
         leaf dr helper-enable {
           type inet:ipv4-address; boolean;
           description "Designated Router (DR) IP address.";
             "Enable graceful restart helper support for restarting
              routers (RFC 3623 Section 3).";
         }
         leaf bdr restart-interval {
           type inet:ipv4-address;
         description "Backup Designated Router (BDR) IP Address.";
       }

       container statistics uint16 {
         description "Per interface statistics";
         uses interface-stat;
       }
     }
             range "1..1800";  // interface-operation

     grouping neighbor-operation {
       description
         "OSPF neighbor operation data.";

       leaf address {
         type inet:ip-address;
         description
           "Neighbor address."; Range is defined in RFC 3623.
           }
       leaf dr {
         type yang:dotted-quad;
           units seconds;
           default "120";  // Default is defined in RFC 3623.
           description
           "Designated Router.";
             "Interval in seconds to attempt graceful restart prior
              to failing (RFC 3623 Section B.1)";
         }
         leaf bdr helper-strict-lsa-checking {
           type yang:dotted-quad; boolean;
           description
           "Backup Designated Router.";
             "Terminate graceful restart when an LSA topology change
              is detected (RFC 3623 Section B.2).";
         }
       }
       leaf state enable {
         if-feature admin-control;
         type nbr-state-type; boolean;
         default true;
         description
           "OSPF neighbor state.";
           "Enable/Disable the protocol.";
       }

       container statistics {
         description "Per neighbor statistics";
         uses neighbor-stat;
       }
     }

     grouping instance-operation auto-cost {
         if-feature auto-cost;
         description
         "OSPF Address Family operation
           "Interface Auto-cost configuration state.";
         leaf router-id enable {
           type yang:dotted-quad;
         description
           "Defined in RFC 2328. A 32-bit number
            that uniquely identifies the router.";
       }

       uses local-rib;

       container statistics { boolean;
           description "Per instance statistics";
         uses instance-stat;
       }
             "Enable/Disable interface auto-cost.";
         }

     augment "/rt:routing/rt:routing-instance/rt:routing-protocols/"
           + "rt:routing-protocol"
         leaf reference-bandwidth {
           when "rt:type = 'ospf:ospfv2' or rt:type "../enable = 'ospf:ospfv3'" 'true'" {
             description
           "This augmentation "Only when auto cost is only valid for a routing protocol
            instance of OSPF (type 'ospfv2' or 'ospfv3')."; enabled";
           }
       description "OSPF augmentation.";

       container ospf {
         description
           "OSPF.";
         container all-instances-inherit {
           if-feature instance-inheritance;
           description
             "Inheritance support to all instances.";
           container area
           type uint32 {
             description
               "Area config to be inherited by all areas
                in all instances.";
             range "1..4294967";
           }
           container interface {
           units Mbits;
           description
               "Interface config
             "Configure reference bandwidth used to be inherited automatically
              determine interface cost (Mbits). The cost is the
              reference bandwidth divided by all
                interfaces in all instances."; the interface speed
              with 1 being the minimum cost.";
         }
       }

       container spf-control {
         leaf operation-mode paths {
           if-feature max-ecmp;
           type identityref uint16 {
             base operation-mode;
             range "1..32";
           }
           default ospf:ships-in-the-night;
           description
             "OSPF operation mode.";
             "Maximum number of Equal-Cost Multi-Path (ECMP) paths.";
         }

         list instance {
           key "af";
         description
             "An OSPF routing protocol instance."; "SPF calculation control.";
       }

       container database-control {
         leaf af max-lsa {
           if-feature max-lsa;
           type identityref uint32 {
               base rt:address-family;
             range "1..4294967294";
           }
           description
               "Address-family
             "Maximum number of LSAs OSPF the instance."; router will accept.";
         }
         description "Database maintenance control.";
       }

           uses instance-config;

       container all-areas-inherit stub-router {
         if-feature area-inheritance; stub-router;
         description
               "Inheritance for all areas.";
             container area "Set maximum metric configuration";

         choice trigger {
           description
                 "Area config to be inherited by all areas.";

             }
             "Specific triggers which will enable stub
              router state.";
           container interface always {
             presence
               "Enables unconditional stub router support";
             description
                 "Interface config to be inherited by all interfaces
                  in all areas.";
               "Unconditional stub router state (advertise
                transit links with max metric";
           }
         }
       }

       container areas mpls {
         description "All areas.";
             list area
           "OSPF MPLS config state.";
         container te-rid {
               key "area-id";
           if-feature te-rid;
           description
                 "List of
             "Stable OSPF areas";
               leaf area-id Router IP Address used for Traffic
              Engineering (TE)";
           choice source {
                 type area-id-type;
             description
                   "Area
               "Different options for specifying TE router ID.";
               }

               uses area-config;
               uses af-area-config
             case interface {
                 when "../../operation-mode = "
                    + "'ospf:ships-in-the-night'"
               leaf interface {
                 type if:interface-ref;
                 description
                     "Ships in
                   "Use the night configuration."; interface's IPv4 address as TE
                    router ID.";
               }
             }
               container all-interfaces-inherit
             case explicit {
                 if-feature interface-inheritance;
                 description
                   "Inheritance for all interfaces";
                 container interface
               leaf router-id {
                 type inet:ipv4-address;
                 description
                     "Interface config to be inherited by all
                      interfaces in
                   "Explicitly configure the area."; TE router ID.";
               }
             }
           }
         }
         container virtual-links ldp {
           description "All virtual links.";
                 list virtual-link {
                   when "../../area-id != '0' and "
                      + "../../area-type = 'ospf:normal'"
             "OSPF MPLS LDP config state.";
           leaf igp-sync {
             if-feature ldp-igp-sync;
             type boolean;
             description
                       "Transit area must be a non-backbone
                        normal area.";
               "Enable LDP IGP synchronization.";
           }
           leaf autoconfig {
             if-feature ldp-igp-autoconfig;
             type boolean;
             description
               "Enable LDP IGP interface auto-configuration.";
           }
                   key "router-id";
         }
       }
       uses instance-fast-reroute-config;
     }

     grouping instance-operation {
       description
         "OSPF virtual link"; Address Family operation state.";

       leaf router-id {
         type yang:dotted-quad;
         description
                       "Virtual Link remote endpoint router ID.";
           "Defined in RFC 2328. A 32-bit number
            that uniquely identifies the router.";
       }

       uses interface-common-config;
                 } local-rib;

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

       container sham-links database {
         description "All sham links."; "AS scope LSA database.";
         list sham-link as-scope-lsa-type {
           key "local-id remote-id";
                   description
                     "OSPF sham link";
                   leaf local-id {
                     type inet:ip-address; "lsa-type";
           description
                       "Address of the local Sham Link endpoint.";
                   } "List OSPF AS scope LSA databases.";
           leaf remote-id lsa-type {
             type inet:ip-address; uint16;
             description
                       "Address of the remote Sham Link endpoint.";
                   }
                   uses interface-common-config;
                 } "OSPF AS scope LSA type.";
           }
           container interfaces as-scope-lsas {
             description "All interfaces."; AS scope of LSA of this LSA type.";
             list interface as-scope-lsa {
               key "interface"; "lsa-id adv-router";
               description "List of OSPF interfaces.";
                   leaf interface area scope LSAs";
               uses lsa-key;
               uses lsa {
                 refine "version/ospfv2/ospfv2" {
                   must "../../../../../../../rt:type = "
                      + "'ospf:ospfv2'" {
                     type if:interface-ref;
                     description
                       "Interface."; "OSPFv2 LSA.";
                   }
                 }
                 refine "version/ospfv3/ospfv3" {
                   must "../../../../../../../rt:type = "
                      + "'ospf:ospfv3'" {
                     description "OSPFv3 LSA.";
                   }
                   uses interface-config;
                 } // list of interfaces
               }
             } // list of areas
           }
         } // list of instance as-scope-lsas
       } // container ospf
     }
     augment "/rt:routing/rt:routing-instance/rt:routing-protocols/"
           + "rt:routing-protocol/ospf:ospf/ospf:instance" {
       when "../../rt:type = 'ospf:ospfv2' or
             ../../rt:type = 'ospf:ospfv3'"

     grouping ospf-config {
       description
           "This augmentation is only valid for OSPF
           (type 'ospfv2' or 'ospfv3').";
       }
       if-feature multi-topology;
       description
         "OSPF multi-topology routing-protocol augmentation."; top configuration state.";

       container topologies {
         description "All topologies.";
         list topology {
           // Topology must be in the same routing-instance
           //  and of same AF as the container.
           key "name";
           description "OSPF topology.";
           leaf name {
             type leafref {
               path "../../../../../../../rt:ribs/rt:rib/rt:name";
             } all-instances-inherit {
         if-feature instance-inheritance;
         description "RIB";
           }
           "Inheritance support to all instances.";
         container areas area {
           description "All
             "Area config to be inherited by all areas
              in the topology.";
             list area all instances.";
         }
         container interface {
               key "area-id";
           description
                 "List of OSPF areas";
             "Interface config to be inherited by all
              interfaces in all instances.";
         }
       }

       leaf area-id operation-mode {
         type area-id-type; identityref {
           base operation-mode;
         }
         default ospf:ships-in-the-night;
         description
                   "Area ID.";
           "OSPF operation mode.";
       }
     }

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

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

       uses area-config; 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-operation {
       description
         "OSPF multi-topology area operation state.";
     }
         }

       }
     }
     augment "/rt:routing/rt:routing-instance/rt:routing-protocols/"
           + "rt:routing-protocol/ospf:ospf/ospf:instance/"
           + "ospf:areas/ospf:area/ospf:interfaces/ospf:interface"

     grouping multi-topology-config {
       when "../../../../../../rt:type = 'ospf:ospfv2'"
       description
         "OSPF multi-topology configuration state.";
     }

     grouping multi-topology-operation {
       description
           "This augmentation is only valid for OSPFv2.";
         "OSPF multi-topology operation state.";

       uses local-rib;
     }
       if-feature ospf:multi-topology;

     grouping multi-topology-interface-config {
       description
         "OSPF multi-topology interface augmentation.";
       container topologies configuration state.";

       leaf cost {
          type uint32;
          description "All topologies
            "Interface cost for the interface.";
         list topology this topology.";
       }
     }

     grouping multi-topology-interface-operation {
           key "name";
       description
         "OSPF multi-topology operation state.";
     }

     grouping ospfv3-interface-config {
       description
         "OSPFv3 interface topology."; specific configuration state.";

       leaf name instance-id {
         type leafref uint8 {
               path "../../../../../../../../../../../"
                  + "rt:ribs/rt:rib/rt:name";
           range "0 .. 31";
         }
         description
               "One of the topologies enabled on this interface.";
           "OSPFv3 instance ID.";
       }
     }

     grouping ospfv3-interface-operation {
       description
         "OSPFv3 interface specific operation state.";

       leaf cost interface-id {
         type uint32; uint16;
         description
                "Interface cost for this topology.";
           }
         }
           "OSPFv3 interface ID.";
       }
     }

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

       container ospf {
         description "OSPF";

         leaf operation-mode {
           type identityref {
             base operation-mode;
           }
           description
             "OSPF operation mode.";
         }
           "OSPF.";

         uses ospf-config;

         list instance {
           key "af";
           description
             "An OSPF routing protocol instance.";

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

           uses instance-operation; instance-config;

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

               container statistics {
                 description "Per area statistics";
                 uses area-stat;
                 description
                   "Area ID.";
               }

               uses area-config;

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

                   uses interface-operation; virtual-link-config;
                 }
               }
               container sham-links {
                 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 interface-operation; sham-link-config;
                 }
               }
               container interfaces {
                 description "All interfaces in the area."; interfaces.";
                 list interface {
                   key "interface";
                   description
                     "List of OSPF interfaces.";
                   leaf interface {
                     // Should it refer to config state leaf?
                     type if:interface-ref;
                     description
                       "Interface.";
                   }
                   uses interface-operation; interface-config;
                 } // list of interfaces
               }
             } // list of areas
           }
         } // list of instance

       } // container neighbors ospf
     }

     augment "/rt:routing/rt:routing-protocols/"
           + "rt:routing-protocol/ospf:ospf/ospf:instance" {
       when "../../rt:type = 'ospf:ospfv2' or
             ../../rt:type = 'ospf:ospfv3'" {
         description "All neighbors
           "This augmentation is only valid for the interface."; OSPF
           (type 'ospfv2' or 'ospfv3').";
       }
       if-feature multi-topology;
       description
         "OSPF multi-topology instance configuration
          state augmentation.";
       container topologies {
         description "All topologies.";
         list neighbor topology {
           // Topology must be in the same routing-instance
           //  and of same AF as the container.
           key "neighbor-router-id"; "name";
           description
                         "List of OSPF neighbors."; "OSPF topology.";
           leaf neighbor-router-id name {
             type yang:dotted-quad; leafref {
               path "../../../../../../../rt:ribs/rt:rib/rt:name";
             }
             description
                           "Neighbor router ID."; "RIB";
           }

           uses neighbor-operation;
                     } // list of OSPF neighbors
                   } multi-topology-config;

           container database areas {
             description "Link scope LSA database."; "All areas in the topology.";
             list link-scope-lsa-type area {
               key "lsa-type"; "area-id";
               description
                 "List of OSPF link scope LSA databases."; areas";
               leaf lsa-type area-id {
                 type uint16; area-id-type;
                 description "OSPF link scope LSA type.";
                   "Area ID.";
               }
               uses multi-topology-area-config;
             }
           }
         }
       }
     }
     augment "/rt:routing/rt:routing-protocols/"
           + "rt:routing-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 link-scope-lsas topologies {
         description "All link scope LSAs of this LSA type."; topologies for the interface.";
         list link-scope-lsa topology {
           key "name";
           description "OSPF interface topology.";
           leaf name {
             type leafref {
                           key "lsa-id adv-router";
               path "../../../../../../../../../../../"
                  + "rt:ribs/rt:rib/rt:name";
             }
             description "List
               "One of OSPF link scope LSAs";
                           uses lsa-key; the topologies enabled on this interface.";
           }

           uses lsa {
                             refine "version/ospfv2/ospfv2" {
                               must "../../../../../../../../../../../" multi-topology-interface-config;
         }
       }
     }

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

     augment "/rt:routing-state/"
           + "rt:routing-protocols/rt:routing-protocol" {
                               must "../../../../../../../../../../../"
       when "rt:type = 'ospf:ospfv2' or "
          + "rt:type = 'ospf:ospfv3'"  {
         description "OSPFv3 LSA.";
                               }
                             }
                           }
                         }
                       }
                     } // list link-scope-lsas
                   }
                 } // list
           "This augmentation is only valid for a routing protocol
            instance of OSPF interfaces type 'ospfv2' or 'ospfv3'.";
       }
       description
            "OSPF operational state.";
       container database ospf {
         description "Area scope LSA database."; "OSPF";

         uses ospf-config;
         uses ospf-operation;

         list area-scope-lsa-type instance {
           key "lsa-type"; "af";
           description "List
             "An OSPF area scope LSA databases."; routing protocol instance.";

           leaf lsa-type af {
             type uint16; identityref {
               base rt:address-family;
             }
             description "OSPF area scope LSA type.";
               "Address-family of the instance.";
           }

           uses instance-config;
           uses instance-operation;

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

               uses lsa-key; area-config;
               uses lsa {
                         refine "version/ospfv2/ospfv2" {
                           must "../../../../../../../../../"
                              + "rt:type = 'ospf:ospfv2'" area-operation;

               container virtual-links {
                 description "OSPFv2 LSA.";
                           }
                         }
                         refine "version/ospfv3/ospfv3" "All virtual links.";
                 list virtual-link {
                           must "../../../../../../../../../"
                              + "rt:type = 'ospf:ospfv3'"
                   description
                     "OSPF virtual link";
                   leaf router-id {
                     type yang:dotted-quad;
                     description "OSPFv3 LSA.";
                           }
                         }
                       }
                     }
                   }
                 } // list area-scope-lsas
                       "Virtual link router ID.";
                   }

                   uses virtual-link-config;
                   uses virtual-link-operation;
                 } // list of OSPF areas
               }
               container database sham-links {
                 description "AS scope LSA database."; "All sham links.";
                 list as-scope-lsa-type sham-link {
                   description
                     "OSPF sham link";
                   leaf local-id {
               key "lsa-type";
                     type inet:ip-address;
                     description "List OSPF AS scope LSA databases.";
                       "Address of the local Sham Link endpoint.";
                   }
                   leaf lsa-type remote-id {
                     type uint16; inet:ip-address;
                     description "OSPF AS scope LSA type.";
                       "Address of the remote Sham Link endpoint.";
                   }
                   uses sham-link-config;
                   uses sham-link-operation;
                 }
               }

               container as-scope-lsas interfaces {
                 description "All AS scope of LSA of this LSA type."; interfaces in the area.";
                 list as-scope-lsa interface {
                   key "lsa-id adv-router"; "interface";
                   description
                     "List of OSPF area scope LSAs";
                   uses lsa-key;
                   uses lsa {
                     refine "version/ospfv2/ospfv2" {
                       must "../../../../../../../rt:type = "
                          + "'ospf:ospfv2'" {
                         description "OSPFv2 LSA.";
                       }
                     }
                     refine "version/ospfv3/ospfv3" {
                       must "../../../../../../../rt:type = "
                          + "'ospf:ospfv3'" interfaces.";
                   leaf interface {
                     // Should it refer to config state leaf?
                     type if:interface-ref;
                     description "OSPFv3 LSA.";
                       }
                     } "Interface.";
                   }

                   uses interface-config;
                   uses interface-operation;
                 } // list of OSPF interfaces
               }
             } // list as-scope-lsas of OSPF areas
           }
         } // list of instances
       } // container ospf
     }
     augment "/rt:routing-state/rt:routing-instance/" "/rt:routing-state/"
           + "rt:routing-protocols/rt:routing-protocol/"
           + "ospf:ospf/ospf:instance" {
       when "../../rt:type = 'ospf:ospfv2'" {
         description
           "This augmentation is only valid for OSPFv2.";
       }
       if-feature multi-topology;
       description
         "OSPF multi-topology routing-protocol instance operation state
          augmentation.";
       container topologies {
         description "All topologies.";
         list topology {
           // Topology must be in the same routing-instance
           // and of same AF as the container.
           key "name";
           description "OSPF topology.";
           leaf name {
             type leafref {
               path "../../../../../../../"
                  + "rt:ribs/rt:rib/rt:name";
             }
             description "RIB";
           }

           uses local-rib; multi-topology-config;
           uses multi-topology-operation;

           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-operation;
             }
           }
         }
       }
     }
     augment "/rt:routing-state/rt:routing-instance/" "/rt:routing-state/"
           + "rt:routing-protocols/rt:routing-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 operation state
          augmentation.";
       container topologies {
         description "All topologies.";
         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-operation;
         }
       }
     }

     augment "/rt:routing-state/"
           + "rt:routing-protocols/rt:routing-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 operation state
          augmentation.";
       uses ospfv3-interface-config;
       uses ospfv3-interface-operation;
     }

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

     augment "/rt:routing-state/rt:routing-instance/" "/rt:routing-state/"
           + "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;
     }

     grouping notification-instance-hdr {
       description
        "This group describes common instance specific
         data for notifications.";

       /*
        * TBD:
        * Need to define a way to reference routing-instance.
        */
       leaf routing-instance {
         type rt:routing-instance-ref; string;
         description
           "Describe the routing instance.";
       }

       leaf routing-protocol-type {
         type leafref {
           path "/rt:routing/rt:routing-instance"
              + "[rt:name=current()/../routing-instance]/"
              + "rt:routing-protocols/rt:routing-protocol/" "/rt:routing/rt:routing-protocols/"
              + "rt:type"; "rt:routing-protocol/rt:type";

         }
         must ". = 'ospf:ospfv2' or . = 'ospf:ospfv3'" {
           description "Only applies to the OSPF routing protocol.";
         }
         description
          "OSPF routing protocol type (OSPFv2 or OSPFv3).";
       }

       leaf routing-protocol-name {
         type leafref {
           path "/rt:routing/rt:routing-instance"
              + "[rt:name=current()/../routing-instance]/" "/rt:routing/"
              + "rt:routing-protocols/rt:routing-protocol"
              + "[rt:type=current()/../routing-protocol-type]/"
              + "rt:name";
         }
         description
          "OSPF routing protocol instance name.";
       }

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

     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 virtual-link {
           description "virtual-link.";
           leaf area-id {
             type area-id-type;
             description "Area ID.";
           }
           leaf neighbor-router-id {
             type yang:dotted-quad;
             description "Neighbor Router ID.";
           }
         }
         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.";
           }
         }
       }
     }

     grouping notification-neighbor {
       description
         "This grouping provides the neighbor information
          for the notifications.";

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

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

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

     notification if-config-error {
       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" {
             description "Bad version.";
           }
           enum "areaMismatch" {
             description "Area mistmatch.";
           }
           enum "unknownNbmaNbr" {
             description "Unknown NBMA neighbor.";
           }
           enum "unknownVirtualNbr" {
             description "Unknown virtual link neighbor.";
           }
           enum "authTypeMismatch" {
             description "Auth type mismatch.";
           }
           enum "authFailure" {
             description "Auth failure.";
           }
           enum "netMaskMismatch" {
             description "Network mask mismatch.";
           }
           enum "helloIntervalMismatch" {
             description "Hello interval mismatch.";

           }
           enum "deadIntervalMismatch" {
             description "Dead interval mismatch.";
           }
           enum "optionMismatch" {
             description "Option mismatch.";
           }
           enum "mtuMismatch" {
             description "MTU mismatch.";
           }
           enum "duplicateRouterId" {
             description "Duplicate router ID.";
           }
           enum "noError" {
             description "No error.";
           }
         }
         description "Error code.";
       }
       description
         "This notification is sent when interface
          config error is detected.";
     }

     notification nbr-state-change {
       uses notification-instance-hdr;
       uses notification-interface;
       uses notification-neighbor;

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

       description
         "This notification is sent when neighbor
          state change is detected.";
     }

     notification nbr-restart-helper-status-change {
       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.";
       }
       description
         "This notification is sent when a neighbor restart
          helper status change is detected.";
     }

     notification rx-bad-packet {
       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.";
       }

       description
         "This notification is sent when an OSPF packet that
          cannot be parsed is received on an OSPF interface.";
     }
     notification lsdb-approaching-overflow {
       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.";
       }

       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.";
     }

     notification lsdb-overflow {
       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.";
       }

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

     notification nssa-translator-status-change {
       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.";
       }

       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.";
     }

     notification restart-status-change {
       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.";
       }

       description
         "This notification is sent when the graceful restart
          state for the router has changed.";
     }
   }
   <CODE ENDS>

6.  OSPF Segment Routing Yang Module

   <CODE BEGINS> file "ietf-ospf-sr@2015-10-19.yang" "ietf-ospf-sr@2016-03-20.yang"
   module ietf-ospf-sr {
     namespace "urn:ietf:params:xml:ns:yang:ietf-ospf-sr";

     prefix ospf-sr;

     import ietf-inet-types {
       prefix "inet";
     }

     import ietf-yang-types {
       prefix "yang";
     }

     import ietf-routing {
       prefix "rt";
     }
     import ietf-segment-routing {
       prefix "sr";
     }
     import ietf-ospf {
       prefix "ospf";
     }

     organization
       "Cisco Systems
        170 West Tasman Drive
        San Jose, CA 95134-1706
        USA";

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

         WG Chair: Acee Lindem
                   <mailto:acee@cisco.com>

         WG Chair: Abhay Roy
                   <mailto:akr@cisco.com>

         Editor:   Derek Yeung
                   <mailto:myeung@cisco.com>
         Author:   Derek Yeung
                   <mailto:myeung@cisco.com>
         Author:   Yingzhen Qu
                   <mailto:yiqu@cisco.com>
         Author:   Acee Lindem
                   <mailto:acee@cisco.com>
         Author:   Jeffrey Zhang
                   <mailto:zzhang@juniper.net>
         Author:   Ing-Wher Chen
                   <mailto:ing-wher.chen@ericsson.com>
         Author:   Greg Hankins
                   <mailto:greg.hankins@alcatel-lucent.com>";

     description
       "This YANG module defines the generic configuration
        and operational state for OSPF Segment Routing, which is
        common across all of the vendor implementations. It is
        intended that the module will be extended by vendors to
        define vendor-specific OSPF Segment Routing configuration
        and operational parameters and policies.

        Terms and Acronyms

        OSPF (ospf): Open Shortest Path First

        IP (ip): Internet Protocol
        IPv4 (ipv4):Internet Protocol Version 4

        IPv6 (ipv6): Internet Protocol Version 6
       ";

     revision 2016-03-20 {
       description
         "* Remove routing-instance.";
       reference
         "RFC XXXX: A YANG Data Model for OSPF Segment Routing.";
     }

     revision 2015-10-19 {
       description
         "* Add per-protocol SRGB support.
          * Editorial changes.";
       reference
         "RFC XXXX: A YANG Data Model for OSPF Segment Routing.";
     }

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

     revision 2015-07-06 {
       description
         "Initial revision.";
       reference
         "RFC XXXX: A YANG Data Model for OSPF Segment Routing.";
     }

     feature ti-lfa {
       description
         "Topology-Independent Loop-Free Alternate (TI-LFA)
          computation using segment routing.";
     }

     /* Configuration */

     augment "/rt:routing/rt:routing-instance/rt:routing-protocols" "/rt:routing/rt:routing-protocols"
           + "/rt:routing-protocol/ospf:ospf/ospf:instance" {
       when "../../rt:type = 'ospf:ospfv2' or "
          + "../../rt:type = 'ospf:ospfv3'" {
         description
           "This augments the OSPF routing protocol when used.";
       }
       description
         "This augments the OSPF protocol configuration
          with segment routing.";
       uses sr:controlplane-cfg;
       container protocol-srgb {
         if-feature sr:protocol-srgb;
         uses sr:srgb-cfg;
         description
           "Per-protocol SRGB.";
       }
     }

     augment "/rt:routing/rt:routing-instance/rt:routing-protocols/" "/rt:routing/rt:routing-protocols/"
           + "rt:routing-protocol/ospf:ospf/ospf:instance/"
           + "ospf:areas/ospf:area/ospf:interfaces/ospf:interface" {
       when "../../../../../../rt:type = 'ospf:ospfv2' or "
          + "../../../../../../rt:type = 'ospf:ospfv3'" {
         description
           "This augments the OSPF interface configuration
            when used.";
       }
       description
         "This augments the OSPF protocol interface
          configuration with segment routing.";

       uses sr:igp-interface-cfg;
     }

     augment "/rt:routing/rt:routing-instance/rt:routing-protocols/" "/rt:routing/rt:routing-protocols/"
           + "rt:routing-protocol/ospf:ospf/ospf:instance/"
           + "ospf:areas/ospf:area/ospf:interfaces/ospf:interface/"
           + "ospf:fast-reroute" {
       when "../../../../../../../rt:type = 'ospf:ospfv2' or "
          + "../../../../../../../rt:type = 'ospf:ospfv3'" {
         description
           "This augments the OSPF routing protocol when used.";
       }
       description
         "This augments the OSPF protocol IP-FRR with TI-LFA.";

       container ti-lfa {
         if-feature ti-lfa;
         leaf enable {
           type boolean;
           description
            "Enables TI-LFA computation.";

         }
         description
           "Topology Independent Loop Free Alternate
            (TI-LFA) support.";
       }
     }

     /* Operational states */

     augment "/rt:routing-state/rt:routing-instance/" "/rt:routing-state/"
           + "rt:routing-protocols/rt:routing-protocol/"
           + "ospf:ospf/ospf:instance" {
       when "../../rt:type = 'ospf:ospfv2' or "
          + "../../rt:type = 'ospf:ospfv3'" {
         description
           "This augments the OSPF routing protocol when used.";
       }
       description
        "This augments the OSPF protocol operational state
         with segment routing.";

       uses sr:controlplane-cfg;
       container protocol-srgb {
         if-feature sr:protocol-srgb;
         uses sr:srgb-cfg;
         description
           "Per-protocol SRGB.";
       }
     }

     augment "/rt:routing-state/rt:routing-instance/" "/rt:routing-state/"
           + "rt:routing-protocols/rt:routing-protocol/"
           + "ospf:ospf/ospf:instance/ospf:areas/ospf:area/"
           + "ospf:interfaces/ospf:interface" {
       when "../../../../../../rt:type = 'ospf:ospfv2' or "
          + "../../../../../../rt:type = 'ospf:ospfv3'" {
         description
         "This augments the OSPF routing protocol when used.";
       }
       description
        "This augments the OSPF protocol interface
         operational state with segment routing.";

       uses sr:igp-interface-cfg;
     }

     /* Database */
     grouping sid-sub-tlv {
       description "SID/Label sub-TLV grouping.";
       container sid-sub-tlv {
         description
           "Used to advertise the SID/Label associated with a
            prefix or adjacency.";
         leaf sid {
           type uint32;
           description
             "Segment Identifier (SID) - A 20 bit label or
              32 bit SID.";
         }
       }
     }

     grouping prefix-sid-sub-tlvs {
       description "Prefix Segment ID (SID) sub-TLVs.";
       container perfix-sid-sub-tlvs{
         description "Prefix SID sub-TLV.";
         list prefix-sid-sub-tlv {
           description "Prefix SID sub-TLV.";
           leaf flags {
             type bits {
               bit NP {
                 description
                   "No-PHP flag.";
               }
               bit M {
                 description
                   "Mapping server flag.";
               }
               bit E {
                 description
                   "Explicit-NULL flag.";
               }
               bit V {
                 description
                   "Value/Index flag.";
               }
               bit L {
                 description
                   "Local flag.";
               }
             }
             description "Segment Identifier (SID) Flags.";
           }
           leaf mt-id {
             type uint8;
             description "Multi-topology ID.";
           }
           leaf algorithm {
             type uint8;
             description
               "The algorithm associated with the prefix-SID.";
           }
           leaf sid {
             type uint32;
             description "An index or label.";
           }
         }
       }
     }

     grouping sid-binding-sub-tlvs {
       description "SID/Label binding sub-TLV grouping.";
       container sid-binding-sub-tlvs {
         description "SID binding sub-TLVs.";
         list sid-binding-sub-tlv {
           description "SID binding sub-TLV.";
           leaf flags {
             type bits {
               bit M {
                 description
                   "Mirroring context flag.";
               }
             }
             description "Flags.";
           }
           leaf mt-id {
             type uint8;
             description "Multi-topology ID.";
           }
           leaf weight {
             type uint8;
             description "Weight for load-balancing purposes.";
           }

           uses sid-sub-tlv;

           container ero-metric-sub-tlv {
             description
               "The cost of an Explicit Route Object (ERO) path.";
             leaf metric {
               type uint32;
               description "The aggregate IGP or TE path cost.";
             }

           }

           container ipv4-ero-sub-tlv {
             description
               "The IPv4 ERO sub-TLV describes a path segment
                using IPv4 address.";
             leaf flags {
               type bits {
                 bit L {
                   description
                     "If set, then the segment path is designated as
                      'loose'. Otherwise, the path is 'strict'.";
                 }
               }
               description "ERO Flags.";
             }
             leaf ipv4-address {
               type inet:ipv4-address;
               description "The address of the explicit route hop.";
             }
           }
           container unnumbered-ero-sub-tlv {
             description "The unnumbered interface ID ERO sub-TLV
                          describes a path segment that includes an
                          unnumbered interface.";
             leaf flags {
               type bits {
                 bit L {
                   description
                     "If set, then the segment path is designated as
                      'loose'. Otherwise as 'strict'.";
                 }
               }
               description "ERO Flags.";
             }
             leaf router-id {
               type yang:dotted-quad;
               description "Router-id of the next-hop.";
             }
             leaf interface-id {
               type uint32;
               description
                 "The identifier assigned to the link by the
                  router specified by the router-id.";
             }
           }
           container ipv4-backup-ero-sub-tlv {
             description
               "The IPv4 backup ERO sub-TLV describes a path
                segment using IPv4 address.";
             leaf flags {
               type bits {
                 bit L {
                   description
                     "If set, then the segment path is designated as
                      'loose'. Otherwise as 'strict'.";
                 }
               }
               description "Flags.";
             }
             leaf ipv4-address {
               type inet:ipv4-address;
               description "The address of the explicit route hop.";
             }
           }
           container unnumbered-backup-ero-sub-tlv {
             description
               "The unnumbered interface ID backup ERO sub-TLV
                describes a path segment that includes an
                unnumbered interface.";
             leaf flags {
               type bits {
                 bit L {
                   description
                     "If set, then the segment path is designated as
                      'loose'. Otherwise, the path is 'strict'.";
                 }
               }
               description "Flags.";
             }
             leaf router-id {
               type yang:dotted-quad;
               description "Router-id of the next-hop.";
             }
             leaf interface-id {
               type uint32;
               description
                 "The identifier assigned to the link by the
                 router specified by the router-id.";
             }
           }
         }
       }
     }

     grouping extended-prefix-range-tlvs {
       description "Extended prefix range TLV grouping.";

       container extended-prefix-range-tlvs {
         description "The list of range of prefixes.";
         list extended-prefix-range-tlv {    //type=2?
           description "The range of prefixes.";
           leaf range-size {
             type uint16;
             description "The number of prefixes covered by the
                          advertisement.";
           }
           leaf flags {
             type bits {
               bit IA {
                 description
                   "Inter-Area flag.";
               }
             }
             description "Flags.";
           }
           leaf prefix {
             type inet:ip-prefix;
             description "Address prefix.";
           }
           uses prefix-sid-sub-tlvs;
           uses sid-binding-sub-tlvs;
           uses ospf:unknown-tlvs;
         }
       }
     }

     grouping sr-algorithm-tlv {
       description "SR algorithm TLV grouping.";
       container sr-algorithm-tlv {
         description "All SR algorithm TLVs.";
         leaf-list sr-algorithm {
           type uint8;
           description
             "The Segment Routing (SR) algorithms that the router is
              currently using.";
         }
       }
     }

     grouping sid-range-tlvs {
       description "SID Range TLV grouping.";
       container sid-range-tlvs {
         description "List of SID range TLVs.";
         list sid-range-tlv {
           description "SID range TLV.";
           leaf range-size {
             type ospf:uint24;
             description "The SID range.";
           }
           uses sid-sub-tlv;
         }
       }
     }
     augment "/rt:routing-state/rt:routing-instance/" "/rt:routing-state/"
           + "rt:routing-protocols/rt:routing-protocol/"
           + "ospf:ospf/ospf:instance/ospf:areas/ospf:area/"
           + "ospf:interfaces/ospf:interface/ospf:database/"
           + "ospf:link-scope-lsa-type/ospf:link-scope-lsas/"
           + "ospf:link-scope-lsa/ospf:version/ospf:ospfv2/"
           + "ospf:ospfv2/ospf:body/ospf:opaque/"
           + "ospf:extended-prefix-tlvs/ospf:extended-prefix-tlv" {
       when "../../../../../../../../../../../../../../../../../"
          + "rt:type = 'ospf:ospfv2'" {
         description
           "This augmentation is only valid for OSPFv2.";
       }
       description
         "SR specific TLVs for OSPFv2 extended prefix TLV
          in type 9 opaque LSA.";
       uses prefix-sid-sub-tlvs;
       uses sid-binding-sub-tlvs;
     }

     augment "/rt:routing-state/rt:routing-instance/" "/rt:routing-state/"
           + "rt:routing-protocols/rt:routing-protocol/"
           + "ospf:ospf/ospf:instance/ospf:areas/"
           + "ospf:area/ospf:database/"
           + "ospf:area-scope-lsa-type/ospf:area-scope-lsas/"
           + "ospf:area-scope-lsa/ospf:version/ospf:ospfv2/"
           + "ospf:ospfv2/ospf:body/ospf:opaque/"
           + "ospf:extended-prefix-tlvs/ospf:extended-prefix-tlv" {
       when "../../../../../../../../../../../../../../../"
          + "rt:type = 'ospf:ospfv2'" {
         description
           "This augmentation is only valid for OSPFv2.";
       }
       description
         "SR specific TLVs for OSPFv2 extended prefix TLV
          in type 10 opaque LSA.";
       uses prefix-sid-sub-tlvs;
       uses sid-binding-sub-tlvs;

     }

     augment "/rt:routing-state/rt:routing-instance/" "/rt:routing-state/"
           + "rt:routing-protocols/rt:routing-protocol/"
           + "ospf:ospf/ospf:instance/ospf:database/"
           + "ospf:as-scope-lsa-type/ospf:as-scope-lsas/"
           + "ospf:as-scope-lsa/ospf:version/ospf:ospfv2/"
           + "ospf:ospfv2/ospf:body/ospf:opaque/"
           + "ospf:extended-prefix-tlvs/ospf:extended-prefix-tlv" {
       when "../../../../../../../../../../../../../"
          + "rt:type = 'ospf:ospfv2'" {
         description
           "This augmentation is only valid for OSPFv2.";
       }
       description
         "SR specific TLVs for OSPFv2 extended prefix TLV
          in type 11 opaque LSA.";
       uses prefix-sid-sub-tlvs;
       uses sid-binding-sub-tlvs;
     }

     augment "/rt:routing-state/rt:routing-instance/" "/rt:routing-state/"
           + "rt:routing-protocols/rt:routing-protocol/"
           + "ospf:ospf/ospf:instance/ospf:areas/"
           + "ospf:area/ospf:database/"
           + "ospf:area-scope-lsa-type/ospf:area-scope-lsas/"
           + "ospf:area-scope-lsa/ospf:version/ospf:ospfv2/"
           + "ospf:ospfv2/ospf:body/ospf:opaque/"
           + "ospf:extended-link-tlvs/ospf:extended-link-tlv" {
       when "../../../../../../../../../../../../../../../"
          + "rt:type = 'ospf:ospfv2'" {
         description
           "This augmentation is only valid for OSPFv2.";
       }
       description
         "SR specific TLVs for OSPFv2 extended link TLV
          in type 10 opaque LSA.";

       container adj-sid-sub-tlvs {
         description "Adjacency SID optional sub-TLVs.";
         list adj-sid-sub-tlv {
           description "List of Adjacency SID sub-TLVs.";
           leaf flags {
             type bits {
               bit B {
                 description
                   "Backup flag.";
               }
               bit V {
                 description
                   "Value/Index flag.";
               }
               bit L {
                 description
                   "Local/Global flag.";
               }
               bit S {
                 description
                   "Set flag.";
               }
             }
             description "Flags.";
           }
           leaf mt-id {
             type uint8;
             description "Multi-topology ID.";
           }
           leaf weight {
             type uint8;
             description "Weight used for load-balancing.";
           }
           leaf sid {
             type uint32;
             description "Segment Identifier (SID) index/label.";
           }
         }
       }

       container lan-adj-sid-sub-tlvs {
         description "LAN Adjacency SID optional sub-TLVs.";
         list lan-adj-sid-sub-tlv {
           description "List of LAN adjacency SID sub-TLVs.";
           leaf flags {
             type bits {
               bit B {
                 description
                   "Backup flag.";
               }
               bit V {
                 description
                   "Value/Index flag.";
               }
               bit L {
                 description
                   "Local/Global flag.";
               }
               bit S {
                 description
                   "Set flag.";
               }
             }
             description "Flags.";
           }
           leaf mt-id {
             type uint8;
             description "Multi-topology ID.";
           }
           leaf weight {
             type uint8;
             description "Weight used for load-balancing.";
           }
           leaf neighbor-router-id {
             type yang:dotted-quad;
             description "Neighbor router ID.";
           }
           leaf sid {
             type uint32;
             description "Segment Identifier (SID) index/label.";
           }
         }
       }
     }

     augment "/rt:routing-state/rt:routing-instance/" "/rt:routing-state/"
           + "rt:routing-protocols/rt:routing-protocol/"
           + "ospf:ospf/ospf:instance/ospf:areas/ospf:area/"
           + "ospf:interfaces/ospf:interface/ospf:database/"
           + "ospf:link-scope-lsa-type/ospf:link-scope-lsas/"
           + "ospf:link-scope-lsa/ospf:version/ospf:ospfv2/"
           + "ospf:ospfv2/ospf:body/ospf:opaque" {
       when "../../../../../../../../../../../../../../../"
          + "rt:type = 'ospf:ospfv2'" {
         description
           "This augmentation is only valid for OSPFv2.";
       }

       description
         "SR specific TLVs for OSPFv2 type 9 opaque LSA.";

       uses extended-prefix-range-tlvs;
       uses sr-algorithm-tlv;
       uses sid-range-tlvs;
     }
     augment "/rt:routing-state/rt:routing-instance/" "/rt:routing-state/"
           + "rt:routing-protocols/rt:routing-protocol/"
           + "ospf:ospf/ospf:instance/ospf:areas/"
           + "ospf:area/ospf:database/"
           + "ospf:area-scope-lsa-type/ospf:area-scope-lsas/"
           + "ospf:area-scope-lsa/ospf:version/ospf:ospfv2/"
           + "ospf:ospfv2/ospf:body/ospf:opaque" {
       when "../../../../../../../../../../../../../"
          + "rt:type = 'ospf:ospfv2'" {
         description
           "This augmentation is only valid for OSPFv2.";
       }

       description
         "SR specific TLVs for OSPFv2 type 10 opaque LSA.";

       uses extended-prefix-range-tlvs;
       uses sr-algorithm-tlv;
       uses sid-range-tlvs;
     }

     augment "/rt:routing-state/rt:routing-instance/" "/rt:routing-state/"
           + "rt:routing-protocols/rt:routing-protocol/"
           + "ospf:ospf/ospf:instance/ospf:database/"
           + "ospf:as-scope-lsa-type/ospf:as-scope-lsas/"
           + "ospf:as-scope-lsa/ospf:version/ospf:ospfv2/"
           + "ospf:ospfv2/ospf:body/ospf:opaque" {
       when "../../../../../../../../../../../"
          + "rt:type = 'ospf:ospfv2'" {
         description
           "This augmentation is only valid for OSPFv2.";
       }
       description
         "SR specific TLVs for OSPFv2 type 11 opaque LSA.";

       uses extended-prefix-range-tlvs;
       uses sr-algorithm-tlv;
       uses sid-range-tlvs;
     }
   }
   <CODE ENDS>

7.  OSPF BFD Yang Module

   <CODE BEGINS> file "ietf-ospf-bfd@2015-10-19.yang" "ietf-ospf-bfd@2016-03-20.yang"
   module ietf-ospf-bfd {
     namespace "urn:ietf:params:xml:ns:yang:ietf-ospf-bfd";
     prefix ospf-bfd;

     import ietf-routing {
       prefix "rt";
     }
     import ietf-bfd {
       prefix "bfd";
     }
     import ietf-ospf {
       prefix "ospf";
     }

     organization
       "Cisco Systems
        170 West Tasman Drive
        San Jose, CA 95134-1706
        USA";

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

         WG Chair: Acee Lindem
                   <mailto:acee@cisco.com>

         WG Chair: Abhay Roy
                   <mailto:akr@cisco.com>

         Editor:   Derek Yeung
                   <mailto:myeung@cisco.com>
         Author:   Derek Yeung
                   <mailto:myeung@cisco.com>
         Author:   Yingzhen Qu
                   <mailto:yiqu@cisco.com>
         Author:   Acee Lindem
                   <mailto:acee@cisco.com>
         Author:   Jeffrey Zhang
                   <mailto:zzhang@juniper.net>
         Author:   Ing-Wher Chen
                   <mailto:ing-wher.chen@ericsson.com>
         Author:   Greg Hankins
                   <mailto:greg.hankins@alcatel-lucent.com>";

     description
       "This YANG module defines the generic configuration
        and operational state for OSPF BFD, which is common
        across all of the vendor implementations. It is
        intended that the module will be extended by vendors to
        define vendor-specific OSPF BFD configuration
        and operational parameters and policies.

        Terms and Acronyms

        OSPF (ospf): Open Shortest Path First

        IP (ip): Internet Protocol

        IPv4 (ipv4):Internet Protocol Version 4

        IPv6 (ipv6): Internet Protocol Version 6
       ";

     revision 2015-10-19 2016-03-20 {
       description
         "Initial revision.";
         "* Remove routing-instance.
          * Remove use of bfd-protocol-parms from ietf-bfd module.
          * Remove import of ietf-bfd module.";
       reference
         "RFC XXXX: A YANG Data Model for OSPF BFD.";
     }

     feature bfd-protocol-parms

     revision 2015-10-19 {
       description
         "OSPF BFD protocol specific parameters support.";
         "Initial revision.";
       reference
         "RFC XXXX: A YANG Data Model for OSPF BFD.";
     }

     /* Configuration */

     augment "/rt:routing/rt:routing-instance/rt:routing-protocols/" "/rt:routing/rt:routing-protocols/"
           + "rt:routing-protocol/ospf:ospf/ospf:instance/"
           + "ospf:areas/ospf:area/ospf:interfaces/ospf:interface" {
       when "../../../../../../rt:type = 'ospf:ospfv2' or "
          + "../../../../../../rt:type = 'ospf:ospfv3'" {
         description
         "This augments the OSPF routing protocol when used";
       }
       description
        "This augments OSPF protocol configuration
         with BFD.";

       container bfd {
         description "BFD configuration.";
         leaf enabled {
           type boolean;
           default false;
           description
             "True if BFD is enabled for the OSPF interface.";

         }
         uses bfd:bfd-grouping-base-cfg-parms {
           if-feature bfd-protocol-parms;
         }
       }
     }

     /* Operational states */

     augment "/rt:routing-state/rt:routing-instance/" "/rt:routing-state/"
           + "rt:routing-protocols/rt:routing-protocol/"
           + "ospf:ospf/ospf:instance/ospf:areas/ospf:area/"
           + "ospf:interfaces/ospf:interface" {
       when "../../../../../../rt:type = 'ospf:ospfv2' or "
          + "../../../../../../rt:type = 'ospf:ospfv3'" {
         description
         "This augments the OSPF routing protocol when used";
       }
       description
        "This augments OSPF protocol operation
         with BFD.";

       container bfd {
         description "BFD operation.";
         leaf enabled {
           type boolean;
           description
             "True if BFD is enabled for the OSPF interface.";
         }
         uses bfd:bfd-grouping-base-cfg-parms {
           if-feature bfd-protocol-parms;
         }
       }
     }
   }
   <CODE ENDS>

8.  Security Considerations

   The data model defined does not create any security implications.

   This draft does not change any underlying security issues inherent in
   [I-D.ietf-netmod-routing-cfg].

9.  Acknowledgements

   The authors wish to thank Acee Lindem, Yi Yang, Alexander Clemm,
   Gaurav Gupta, Ing-Wher Chen, Ladislav Lhotka, Stephane Litkowski,
   Greg Hankins and Hankins, Manish Gupta and Alan Davey for their thorough reviews
   and helpful comments.

   This document was produced using Marshall Rose's xml2rfc tool.

10.  References

10.1.  Normative References

   [RFC1793]  Moy, J., "Extending OSPF to Support Demand Circuits",
              RFC 1793, DOI 10.17487/RFC1793, April 1995,
              <http://www.rfc-editor.org/info/rfc1793>.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997,
              <http://www.rfc-editor.org/info/rfc2119>.

   [RFC2328]  Moy, J., "OSPF Version 2", STD 54, RFC 2328,
              DOI 10.17487/RFC2328, April 1998,
              <http://www.rfc-editor.org/info/rfc2328>.

   [RFC3101]  Murphy, P., "The OSPF Not-So-Stubby Area (NSSA) Option",
              RFC 3101, DOI 10.17487/RFC3101, January 2003,
              <http://www.rfc-editor.org/info/rfc3101>.

   [RFC3623]  Moy, J., Pillay-Esnault, P., and A. Lindem, "Graceful OSPF
              Restart", RFC 3623, DOI 10.17487/RFC3623, November 2003,
              <http://www.rfc-editor.org/info/rfc3623>.

   [RFC3630]  Katz, D., Kompella, K., and D. Yeung, "Traffic Engineering
              (TE) Extensions to OSPF Version 2", RFC 3630,
              DOI 10.17487/RFC3630, September 2003,
              <http://www.rfc-editor.org/info/rfc3630>.

   [RFC4577]  Rosen, E., Psenak, P., and P. Pillay-Esnault, "OSPF as the
              Provider/Customer Edge Protocol for BGP/MPLS IP Virtual
              Private Networks (VPNs)", RFC 4577, DOI 10.17487/RFC4577,
              June 2006, <http://www.rfc-editor.org/info/rfc4577>.

   [RFC4750]  Joyal, D., Ed., Galecki, P., Ed., Giacalone, S., Ed.,
              Coltun, R., and F. Baker, "OSPF Version 2 Management
              Information Base", RFC 4750, DOI 10.17487/RFC4750,
              December 2006, <http://www.rfc-editor.org/info/rfc4750>.

   [RFC5187]  Pillay-Esnault, P. and A. Lindem, "OSPFv3 Graceful
              Restart", RFC 5187, DOI 10.17487/RFC5187, June 2008,
              <http://www.rfc-editor.org/info/rfc5187>.

   [RFC5340]  Coltun, R., Ferguson, D., Moy, J., and A. Lindem, "OSPF
              for IPv6", RFC 5340, DOI 10.17487/RFC5340, July 2008,
              <http://www.rfc-editor.org/info/rfc5340>.

   [RFC5643]  Joyal, D., Ed. and V. Manral, Ed., "Management Information
              Base for OSPFv3", RFC 5643, DOI 10.17487/RFC5643, August
              2009, <http://www.rfc-editor.org/info/rfc5643>.

   [RFC5838]  Lindem, A., Ed., Mirtorabi, S., Roy, A., Barnes, M., and
              R. Aggarwal, "Support of Address Families in OSPFv3",
              RFC 5838, DOI 10.17487/RFC5838, April 2010,
              <http://www.rfc-editor.org/info/rfc5838>.

   [RFC5880]  Katz, D. and D. Ward, "Bidirectional Forwarding Detection
              (BFD)", RFC 5880, DOI 10.17487/RFC5880, June 2010,
              <http://www.rfc-editor.org/info/rfc5880>.

   [RFC6020]  Bjorklund, M., Ed., "YANG - A Data Modeling Language for
              the Network Configuration Protocol (NETCONF)", RFC 6020,
              DOI 10.17487/RFC6020, October 2010,
              <http://www.rfc-editor.org/info/rfc6020>.

   [RFC6241]  Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed.,
              and A. Bierman, Ed., "Network Configuration Protocol
              (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011,
              <http://www.rfc-editor.org/info/rfc6241>.

   [RFC7223]  Bjorklund, M., "A YANG Data Model for Interface
              Management", RFC 7223, DOI 10.17487/RFC7223, May 2014,
              <http://www.rfc-editor.org/info/rfc7223>.

10.2.  Informative References

   [I-D.acee-rtg-yang-key-chain]
              Lindem, A., Qu, Y., Yeung, D., Chen, H., Zhang, J., and Y.
              Yang, "Key Chain YANG Data Model", draft-acee-rtg-yang-
              key-chain-09 (work in progress), October 2015.

   [I-D.ietf-bfd-yang]
              Zheng, L., Rahman, R., Networks, J., Jethanandani, M., and
              G. Mirsky, "Yang Data Model for Bidirectional Forwarding
              Detection (BFD)", draft-ietf-bfd-yang-00 (work in
              progress), August 2015.

   [I-D.ietf-netmod-routing-cfg]
              Lhotka, L. and A. Lindem, "A YANG Data Model for Routing
              Management", draft-ietf-netmod-routing-cfg-20 (work in
              progress), October 2015.

   [I-D.ietf-spring-sr-yang]
              Litkowski, S., Qu, Y., Sarkar, P., and J. Tantsura, "YANG
              Data Model for Segment Routing", draft-ietf-spring-sr-
              yang-00 (work in progress), July 2015.

Authors' Addresses

   Derek Yeung
   Cisco Systems
   170 West Tasman Drive
   San Jose, CA  95134
   USA

   EMail: myeung@cisco.com

   Yingzhen Qu
   Cisco Systems
   170 West Tasman Drive
   San Jose, CA  95134
   USA

   EMail: yiqu@cisco.com

   Jeffrey Zhang
   Juniper Networks
   10 Technology Park Drive
   Westford, MA  01886
   USA

   EMail: zzhang@juniper.net

   Dean Bogdanovic

   EMail: ivandean@gmail.com

   Kiran Koushik Agrahara Sreenivasa
   Cisco Systems
   12515 Research Blvd, Bldg 4
   Austin, TX  78681
   USA

   EMail: kkoushik@cisco.com