Internet                                                        D. Yeung
Internet-Draft                                                     Y. Qu                                                    Arrcus
Intended status: Informational                             Cisco Systems                                     Y. Qu
Expires: January 8, May 4, 2017                                       Cisco Systems
                                                                J. Zhang
                                                        Juniper Networks
                                                           D. Bogdanovic

                                                           K. Sreenivasa
                                                                 I. Chen
                                                     Kuatro Technologies
                                                               A. Lindem
                                                           Cisco Systems
                                                            July 7,
                                                        October 31, 2016

                   Yang Data Model for OSPF Protocol
                        draft-ietf-ospf-yang-05
                        draft-ietf-ospf-yang-06

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 January 8, May 4, 2017.

Copyright Notice

   Copyright (c) 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  12
   3.  OSPF Segment Routing BFD Yang Module  . . . . . . . . . . . . . . . . . . . .  14  15
   4.  OSPF BFD Yang Module  . . . . . . . . . . . . . . . . . . . .  22 . .  15
   5.  OSPF BFD Yang Module  . . . . . . . . . . . . . . . . . . . . . .  22  91
   6.  OSPF Segment Routing Yang Module  . . . . . . . . .  Security Considerations . . . . .  95
   7.  OSPF BFD Yang Module . . . . . . . . . . . . . .  94
   7.  Acknowledgements  . . . . . . 110
   8.  Security Considerations . . . . . . . . . . . . . . . .  94
   8.  References  . . . 113
   9.  Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 113
   10.  94
     8.1.  Normative References  . . . . . . . . . . . . . . . . . . . . . . . . . 113
     10.1.  Normative  94
     8.2.  Informative References  . . . . . . . . . . . . . . . . . . 113
     10.2.  Informative References . .  96
   Appendix A.  Contributors' Addreses . . . . . . . . . . . . . . . 115  97
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . . 115  97

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.ietf-rtgwg-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  These includes demand circuit [RFC1793],
   traffic engineering [RFC3630], multiple address family [RFC5838],
   graceful restart [RFC3623] [RFC5187], NSSA [RFC3101], and sham link
   [RFC4577]. OSPF(v3) as
   a PE-CE Protocol [RFC4577], [RFC6565].  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 the 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. protocols.  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 router-id?                 yang:dotted-quad
    +--rw control-plane-protocols
     +--rw control-plane-protocol* [type 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 the 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
   include leaves that 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. areas in the OSPF instance.

   module: ospf
    +--rw ospf
        .
        .
     +--rw instance* [af]
        +--rw af                  identityref
        +--rw all-areas-inherit {area-inheritance}?
        |  +--rw area
        |  +--rw interface
        +--rw explicit-router-id? yang:dotted-quad {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}?

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 virtual-links
     |    |  +--rw virtual-link* [router-id]
     |    |     +--rw transit-area-id      -> ../../../area-id
     |    |     +--rw router-id            yang:dotted-quad
     |    |     +--rw hello-interval?      uint16
     |    |     +--rw dead-interval?       uint16       uint32
     |    |     +--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
     |    |                  +--:(replay-protection-only)
     |    |                                 {replay-protection-only}?
     |    |                     +--rw replay-protection-only?   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
     |    |                  +--:(replay-protection-only)
     |    |                                 {replay-protection-only}?
     |    |                     +--rw replay-protection-only?   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 name                   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? candidate-disable?   boolean
      |         |     +--rw enabled? enable?              boolean
      |         |     +--rw remote-lfa {remote-lfa}?
      |         |        +--rw enabled? enable?   boolean
      |         +--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
      |         |            +--:(replay-protection-only)
      |         |                           {replay-protection-only}?
      |         |               +--rw replay-protection-only?   empty
      |         +--rw cost?                uint16
      |         +--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?        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?        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?        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?        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?        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?        string
      |  +--ro routing-protocol-type?   -> ...
      |  +--ro routing-protocol-name?   -> ...
      |  +--ro af?                      -> ...
      |  +--ro ext-lsdb-limit?          uint32
      +---n lsdb-overflow
      |  +--ro routing-instance?        string
      |  +--ro routing-protocol-type?   -> ...
      |  +--ro routing-protocol-name?   -> ...
      |  +--ro af?                      -> ...
      |  +--ro ext-lsdb-limit?          uint32
      +---n nssa-translator-status-change
      |  +--ro routing-instance?        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?        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, BFD Yang Module

   Additionally, this document also defines a
   model for module that can be used to
   configure and monitor the OSPF segment routing 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 SR BFD YANG augments the base OSPF module requires and is defined
   as a separate module.  Hence, an implementation that does not support for
   BFD can still use the OSPF base segment routing
   module [I-D.ietf-spring-sr-yang], which defines model without having to import the global segment
   routing configuration independent of any specific routing protocol
   configuration.
   BFD module [I-D.ietf-bfd-yang].

   module: ietf-ospf-sr
   augment /rt:routing/rt:control-plane-protocols
           /rt:control-plane-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 ietf-ospf-bfd
   augment /rt:routing/rt:control-plane-protocols
           /rt:control-plane-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 bfd
         +--rw advertise-protection?      enumeration enable?                    boolean
   augment /rt:routing/rt:control-plane-protocols
           /rt:control-plane-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:control-plane-protocols
           /rt:control-plane-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:control-plane-protocols /rt:routing-state/rt:control-plane-protocols
           /rt:control-plane-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:control-plane-protocols
           /rt:control-plane-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:control-plane-protocols
           /rt:control-plane-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:control-plane-protocols
           /rt:control-plane-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:control-plane-protocols
           /rt:control-plane-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
      | bfd
         +--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:control-plane-protocols
           /rt:control-plane-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:control-plane-protocols
           /rt:control-plane-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:control-plane-protocols
           /rt:control-plane-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:control-plane-protocols
           /rt:control-plane-protocol/ospf:ospf/ospf:instance
           /ospf:areas/ospf:area/ospf:interfaces/ospf:interface:
      +--rw bfd
         +--rw enabled?                    boolean
   augment /rt:routing-state/rt:control-plane-protocols
           /rt:control-plane-protocol/ospf:ospf/ospf:instance
           /ospf:areas/ospf:area/ospf:interfaces/ospf:interface:
      +--ro bfd
         +--ro enabled?                    boolean

5.  OSPF Yang Module

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

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

  revision 2015-10-19 {
    description
      "* Remove the abstract identity ospf.

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

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

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

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

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

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

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

  feature multi-area-adj {
    description
      "OSPF multi-area adjacency support as in RFC 5185.";
  }
  feature explicit-router-id {
    description
      "Set Router-ID per instance explicitly.";
  }

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

  feature mtu-ignore enable?                    boolean

4.  OSPF Yang Module

<CODE BEGINS> file "ietf-ospf@2016-10-31.yang"
module ietf-ospf {
    description
      "Disable OSPF Database Description packet MTU
       mismatch checking.";
  }

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

  prefix ospf;

  import ietf-inet-types {
    description
      "OSPF link-local signaling (LLS) as in RFC 5613.";
    prefix "inet";
  }

  feature prefix-suppression

  import ietf-yang-types {
    description
      "OSPF
    prefix suppression support as in RFC 6860."; "yang";
  }

  feature ttl-security

  import ietf-interfaces {
    description
      "OSPF TTL security check.";
    prefix "if";
  }

  feature nsr
  import ietf-routing {
    description
      "Non-Stop-Routing (NSR).";
    prefix "rt";
  }

  feature graceful-restart

  import ietf-key-chain {
    description
      "Graceful OSPF Restart as defined in RFC 3623 and
       RFC 5187.";
    prefix "key-chain";
  }

  feature admin-control {

  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:derek@arrcus.com>
      Author:   Derek Yeung
                <mailto:derek@arrcus.com>
      Author:   Yingzhen Qu
                <mailto:yiqu@cisco.com>
      Author:   Jeffrey Zhang
                <mailto:zzhang@juniper.net>
      Author:   Ing-Wher Chen
                <mailto:ichen@kuatrotech.com>
      Author:   Dean Bogdanovic
                <mailto:ivandean@gmail.com>
      Author:   Kiran Agrahara Sreenivasa
                <mailto:kkoushik@cisco.com>";

  description
      "Administrative control of
    "This YANG module defines the generic configuration and
     operational state for the protocol state.";
  }

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

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

  feature max-lsa {
    description
      "Setting maximum number of LSAs all
     vendor implementations. It is intended that the OSPF instance module
     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 be extended by vendors to define vendor-specific
     OSPF configuration parameters and policies,
     for OSPFv3 authentication.";
  }

  feature fast-reroute {
   description
     "Support of example route maps or route policies.

     Terms and Acronyms
     OSPF (ospf): Open Shortest Path First

     IP Fast Reroute (IP-FRR).";
  }

  feature node-flag (ip): Internet Protocol

     IPv4 (ipv4):Internet Protocol Version 4

     IPv6 (ipv6): Internet Protocol Version 6

     MTU (mtu) Maximum Transmission Unit
    ";

  revision 2016-10-31 {
    description
     "Support of
      "* Update authors information.
       * Rename candidate-disabled to candidiate-enable
         and set the default value to TRUE.
       * Rename node flag.";
  }
  feature lfa {
   description
     "Support of Loop Free Alternates (LFAs).";
  }

  feature remote-lfa {
   description
     "Support identifiers that end with
         'enabled' to 'enable'.
       * Set the default value of Remote Loop Free Alternates (R-LFA).";
  }

  feature stub-router {
    description
      "Support
         ospf/instance/areas/area/interfaces/interface/
         fast-reroute/lfa/enable (previously named 'enabled')
         to FALSE.
       * Set the default value 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 tlv {
    description
      "TLV";
    leaf type {
         ospf/instance/areas/area/interfaces/interface/
         fast-reroute/remote-lfa/enable (previously named 'enabled')
         to FALSE.
       * Rename
         ospf/instance/areas/area/interfaces/interface/
         static-neighbors/neighbor/address to 'identifier'
         with type uint16;
      description "TLV type.";
    }
    leaf length { inet:ip-address
       * Add 'dead-timer' to
         ospf-state/instance/areas/area/interfaces/interface/
         neighbors/neighbor.
       * Remove 'mtu-ignore' and 'prefix-suppression' from
         virtual-link configuration.
       * Adjust range specifications from 'transmit-delay',
         'dead-interval', and 'retransmit-interval' in
         ospf/instance/areas/area/interfaces/interface.
       * Change the type uint16;
      description "TLV length.";
    }
    leaf value { of
         ospf/instance/areas/area/interface/interface/dead-interval
         to uint32 to match RFC2328 Appendix A.3.2.
       * Change hello-timer and wait-timer unit to seconds.
       * Update hello-timer, dead-timer and wait-timer descriptions.
       * Add IEEE bandwidth type yang:hex-string;
      description "TLV value.";
    }
  }

  grouping unknown-tlvs {
    description
      "Unknown TLVs grouping - Used for unknown TLVs or
       unknown sub-TLVs.";
    container unknown-tlvs {
      description "All unknown TLVs.";
      list unknown-tlv {
        description "Unknown TLV.";
        uses tlv;
      }
    } and update all TE bandwidth fields to use it.
       * Add Nt-bit to OSPFv2 router LSA.
       * Remove L-bit from OSPFv2 router LSA.
      ";
    reference
      "RFC XXXX: A YANG Data Model for OSPF.";
  }

  grouping ospfv2-router-link

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

  revision 2016-03-20 {
    description "Link ID.";
      "* 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.";
  }
    leaf link-data {
      type union

  revision 2015-10-19 {
        type inet:ipv4-address;
        type uint32;
      }
    description "Link data.";
      "* 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.";

  }
    leaf type

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

  grouping ospfv2-lsa-body {
    description "OSPFv2 LSA body.";
    container router {
      when "../../header/type = 1"

  revision 2015-07-06 {
    description
          "Only applies
      "* 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 Router LSAs.";
      }
      description
        "Router LSA.";
      leaf flags {
        type bits { rib.
       * Add ability to set single admin distance.
       * Make unreserved bandwidth into list.
       * Add F and T bit V {
            description
              "When set, the to OSPFv3 external LSA.
       * Remove key statement inside LSA body.
       * Add stub router is an endpoint support.
       * Fix usage of one or af-area-config.
       * Add statistics to operation data.
       * Add local rib.
       * Use dotted-quad for all router-id fields.
       * Support more virtual links."; 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.";
  }
          bit E

  revision 2015-03-09 {
    description
              "When set, the router is an AS Boundary Router
               (ASBR).";
      "Initial revision.";
    reference
      "RFC XXXX: A YANG Data Model for OSPF.";

  }
          bit B

  identity ospfv2 {
    base "rt:routing-protocol";
    description
              "When set, the router is an Area Border
               Router (ABR).";
          }
        }
        description "Flags."; "OSPFv2";
  }
      leaf num-of-links

  identity ospfv3 {
        type uint16;
    base "rt:routing-protocol";
    description "Number of links."; "OSPFv3";
  }
      container links

  identity operation-mode {
    description "All router Links.";
        list link
      "OSPF operation mode.";
  }

  identity ships-in-the-night {
    base operation-mode;
    description "Router LSA link.";
          uses ospfv2-router-link;
          container topologies
      "Ships-in-the-night operation mode in which
      each OSPF instance carries only one address family";
  }

  identity area-type {
    description "All topologies "Base identity for the link.";
            list topology OSPF area type.";
  }

  identity normal {
    base area-type;
    description
                "Topology specific information.";
              leaf mt-id "OSPF normal area.";
  }

  identity stub {
                type uint8;
    base area-type;
    description
                  "The MT-ID for the topology enabled on
                   the link."; "OSPF stub area.";
  }
              leaf metric

  identity nssa {
                type uint16;
    base area-type;
    description "Metric for the topology.";
              }
            } "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.";
  }
    container network

  typedef route-type {
      when "../../header/type = 2"
    type enumeration {
      enum intra-area {
        description
          "Only applies to Network LSAs."; "OSPF intra-area route.";
      }
      enum inter-area {
        description
        "Network LSA.";
      leaf network-mask "OSPF inter-area route.";
      }
      enum external-1 {
        type inet:ipv4-address;
        description
          "The IP address mask for the network."; "OSPF type 1 external route.";
      }
      container attached-routers
      enum external-2 {
        description "All attached routers.";
        leaf-list attached-router "OSPF type 2 external route.";
      }
      enum nssa-1 {
        description "OSPF type yang:dotted-quad; 1 NSSA route.";
      }
      enum nssa-2 {
        description
            "List of the routers attached to the network."; "OSPF type 2 NSSA route.";
      }
    }
    description "OSPF route type.";
  }
    container summary

  typedef if-state-type {
      when "../../header/type = 3 or "
         + "../../header/type = 4"
    type enumeration {
      enum Down {
        value "1";
        description
          "Interface down state.";
      }
      enum Loopback {
        value "2";
        description
          "Only applies to Summary LSAs.";
          "Interface loopback state.";
      }
      description
        "Summary LSA.";
      leaf network-mask
      enum Waiting {
        type inet:ipv4-address;
        value "3";
        description
          "The IP address mask for the network";
          "Interface waiting state.";
      }
      container topologies
      enum Point-to-Point {
        value "4";
        description "All topologies for the summary LSA.";
        list topology
          "Interface point-to-point state.";
      }
      enum DR {
        value "5";
        description
            "Topology specific information.";
          leaf mt-id
          "Interface Designated Router (DR) state.";
      }
      enum BDR {
            type uint8;
        value "6";
        description
              "The MT-ID for the topology enabled for
               the summary.";
          "Interface Backup Designated Router (BDR) state.";
      }
          leaf metric
      enum DR-Other {
            type uint24;
        value "7";
        description "Metric for the topology.";
          }
          "Interface Other Designated Router state.";
      }
    }
    description
      "OSPF interface state type.";
  }
    container external

  typedef nbr-state-type {
      when "../../header/type = 5 or "
         + "../../header/type = 7"
    type enumeration {
      enum Down {
        value "1";
        description
          "Only applies to AS-external LSAs and NSSA LSAs.";
          "Neighbor down state.";
      }
      description
        "External LSA.";
      leaf network-mask
      enum Attempt {
        type inet:ipv4-address;
        value "2";
        description
          "The IP address mask for the network";
          "Neighbor attempt state.";
      }
      container topologies
      enum Init {
        value "3";
        description "All topologies for the external.";
        list topology
          "Neighbor init state.";
      }
      enum 2-Way {
        value "4";
        description
            "Topology specific information.";
          leaf mt-id
          "Neighbor 2-Way state.";

      }
      enum ExStart {
            type uint8;
        value "5";
        description
              "The MT-ID for the topology enabled for the
               external or NSSA prefix.";
          "Neighbor exchange start state.";
      }
          leaf flags
      enum Exchange {
            type bits
        value "6";
        description
          "Neighbor exchange state.";
      }
      enum Loading {
              bit E
        value "7";
        description
          "Neighbor loading state.";
      }
      enum Full {
        value "8";
        description
                  "When set, the metric specified is a Type 2
                   external metric.";
          "Neighbor full state.";
      }
    }
    description "Flags.";
      "OSPF neighbor state type.";
  }
          leaf metric

  typedef restart-helper-status-type {
    type uint24;
            description "Metric for the topology.";
          }
          leaf forwarding-address enumeration {
            type inet:ipv4-address;
      enum Not-Helping {
        value "1";
        description
              "Forwarding address.";
          "Restart helper status not helping.";
      }
          leaf external-route-tag
      enum Helping {
            type uint32;
        value "2";
        description
              "Route tag for the topology.";
          }
        }
          "Restart helper status helping.";
      }
    }
    container opaque {
      when "../../header/type = 9 or "
         + "../../header/type = 10 or "
         + "../../header/type = 11" {
    description
          "Only applies to Opaque LSAs.";
      "Restart helper status type.";
  }
      description
        "Opaque LSA.";

      uses unknown-tlvs;

      container router-address-tlv {
        description
          "Router address TLV.";
        leaf router-address

  typedef restart-exit-reason-type {
    type inet:ipv4-address;
          description
            "Router address.";
        }
      }

      container link-tlvs enumeration {
        description "All link TLVs in the LSA.";
        container link-tlv
      enum None {
        value "1";
        description "Link TLV.";
          leaf link-type
          "Not attempted.";
      }
      enum InProgress {
            type uint8;
            mandatory true;
        value "2";
        description "Link type.";
          "Restart in progress.";
      }
          leaf link-id {
            type union
      enum Completed {
              type inet:ipv4-address;
              type yang:dotted-quad;
            }
            mandatory true;
        value "3";
        description "Link ID.";
          "Successfully completed.";
      }
          container local-if-ipv4-addrs
      enum TimedOut {
        value "4";
        description "All local interface IPv4 addresses.";
            leaf-list local-if-ipv4-addr
          "Timed out.";
      }
      enum TopologyChanged {
              type inet:ipv4-address;
        value "5";
        description
                "List of local interface IPv4 addresses.";
          "Aborted due to topology change.";
      }
    }
          container remote-if-ipv4-addrs {
    description "All remote interface IPv4 addresses.";
            leaf-list remote-if-ipv4-addr
      "Describes the outcome of the last attempt at a
      graceful restart, either by itself or acting
      as a helper.";
  }
  typedef packet-type {
    type inet:ipv4-address; enumeration {
      enum Hello {
        value "1";
        description
                "List of remote interface IPv4 addresses.";
            }
          "OSPF hello packet.";
      }
          leaf te-metric
      enum Database-Descripton {
            type uint32;
        value "2";
        description "TE metric.";
          "OSPF database description packet.";
      }
          leaf max-bandwidth {
            type decimal64
      enum Link-State-Request {
              fraction-digits 2;
            }
        value "3";
        description "Maximum bandwidth.";
          "OSPF link state request packet.";
      }
          leaf max-reservable-bandwidth {
            type decimal64
      enum Link-State-Update {
              fraction-digits 2;
            }
        value "4";
        description "Maximum reservable bandwidth.";
          "OSPF link state update packet.";
      }
          container unreserved-bandwidths
      enum Link-State-Ack {
        value "5";
        description "All unreserved bandwidths.";
            list unreserved-bandwidth {
              leaf priority {
                type uint8 {
                  range "0 .. 7";
          "OSPF link state acknowlegement packet.";
      }
    }
    description "Priority from 0 to 7.";
      "OSPF packet type.";
  }
              leaf unreserved-bandwidth

  typedef nssa-translator-state-type {
    type decimal64 enumeration {
                  fraction-digits 2;
                }
      enum Enabled {
        value "1";
        description "Unreserved bandwidth.";
          "NSSA translator enabled state.";
      }
      enum Elected {
        description
                "List of unreserved bandwidths for different
                 priorities.";
            }
          "NSSA translator elected state.";
      }
          leaf admin-group
      enum Disabled {
            type uint32;
        value "3";
        description
              "Administrative group/Resource Class/Color.";
          }
          uses unknown-tlvs;
          "NSSA translator disabled state.";
      }
    }

      container extended-prefix-tlvs {
        description "All extended prefix TLVs in the LSA.";
        list extended-prefix-tlv {
    description "Extended prefix TLV.";
          leaf route-type
      "OSPF NSSA translator state type.";
  }

  typedef restart-status-type {
    type enumeration {
      enum unspecified Not-Restarting {
        value "0"; "1";
        description "Unspecified.";
          "Router is not restarting.";
      }
      enum intra-area Planned-Restart {
                value "1";
        description "OSPF intra-area route.";
          "Router is going through planned restart.";
      }
      enum inter-area Unplanned-Restart {
        value "3";
        description
          "Router is going through unplanned restart.";

      }
    }
    description
      "OSPF inter-area route."; graceful restart status type.";
  }

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

  typedef ieee-bandwidth {
    type string {
      pattern
        '0[xX](0((\.0?)?[pP](\+)?0?|(\.0?))|'
      + '1(\.([\da-fA-F]{0,5}[02468aAcCeE]?)?)?[pP](\+)?(12[0-7]|'
      + '1[01]\d|0?\d?\d)?)|0[xX][\da-fA-F]{1,8}';
    }
    description
      "Bandwidth in IEEE 754 floating point 32-bit binary format:
       (-1)**(S) * 2**(Exponent-127) * (1 + Fraction),
       where Exponent uses 8 bits, and Fraction uses 23 bits.
       The units are bytes per second.
       The encoding format is the external hexadecimal-significand
       character sequences specified in IEEE 754 and C99,
       restricted to be normalized, non-negative, and non-fraction:
       0x1.hhhhhhp{+}d or 0X1.HHHHHHP{+}D
       where 'h' and 'H' are hexadecimal digits, 'd' and 'D' are
       integers in the range of [0..127].
       When six hexadecimal digits are used for 'hhhhhh' or 'HHHHHH',
       the least significant digit must be an even number.
       'x' and 'X' indicate hexadecimal; 'p' and 'P' indicate power
       of two.
       Some examples are: 0x0p0, 0x1p10, and 0x1.abcde2p+20";
    reference
      "IEEE Std 754-2008: IEEE Standard for Floating-Point
       Arithmetic.";
  }
              enum external

  feature multi-topology {
                value "5";
    description "OSPF External route.";
      "Support Multiple-Topolgy Routing (MTR).";
  }
              enum nssa

  feature multi-area-adj {
                value "7";
    description
      "OSPF NSSA external route.";
              }
            }
            description "Route type."; multi-area adjacency support as in RFC 5185.";
  }
          leaf flags {
            type bits {
              bit A
  feature explicit-router-id {
    description
                  "Attach flag.";
      "Set Router-ID per instance explicitly.";
  }
              bit N

  feature demand-circuit {
    description
                  "Node flag.";
              }
            }
            description "Flags.";
      "OSPF demand circuit support as in RFC 1793.";
  }
          leaf prefix

  feature mtu-ignore {
            type inet:ip-prefix;
    description "Address prefix.";
          }
          uses unknown-tlvs;
        }
      "Disable OSPF Database Description packet MTU
       mismatch checking.";
  }

      container extended-link-tlvs

  feature lls {
    description "All extended link TLVs
      "OSPF link-local signaling (LLS) as in the LSA.";
        list extended-link-tlv {
          description "Extended link TLV.";
          uses ospfv2-router-link;
          uses unknown-tlvs;
        }
      }
    } RFC 5613.";
  }
  grouping ospfv3-lsa-options {
    description "OSPFv3 LSA options";
    leaf options {
      type bits {
        bit AF

  feature prefix-suppression {
    description
            "When set, the router supprts OSPFv3 AFs
      "OSPF prefix suppression support as in RFC5838. ";
        }
        bit DC {
          description
            "When set, the router supports demand circuits.";
        }
        bit R {
          description
            "When set, the originator is an active router."; RFC 6860.";
  }
        bit N

  feature ttl-security {
    description
            "If set, the router is attached to an NSSA";
      "OSPF TTL security check.";
  }
        bit E

  feature nsr {
    description
            "This bit describes the way AS-external LSAs
             are flooded";
      "Non-Stop-Routing (NSR).";
  }
        bit V6

  feature graceful-restart {
    description
            "If clear, the router/link should be excluded
             from IPv6 routing calculaton";
        }
      }
      mandatory true;
      description "OSPFv3 LSA options.";
    }
      "Graceful OSPF Restart as defined in RFC 3623 and
       RFC 5187.";
  }

  grouping ospfv3-lsa-prefix

  feature admin-control {
    description
      "OSPFv3 LSA prefix.";

    leaf prefix
      "Administrative control of the protocol state.";

  }

  feature auto-cost {
      type inet:ip-prefix;
    description
        "Prefix.";
      "Calculate OSPF interface cost according to
       reference bandwidth.";
  }
    leaf prefix-options {
      type bits {
        bit NU

  feature max-ecmp {
    description
            "When set, the prefix should be excluded
             from IPv6 unicast calculations.";
      "Setting maximum number of ECMP paths.";
  }
        bit LA

  feature max-lsa {
    description
            "When set, the prefix is actually an IPv6 interface
             address
      "Setting maximum number of LSAs the Advertising Router."; OSPF instance
       will accept.";
  }
        bit P

  feature te-rid {
    description
            "When set, the NSSA area prefix should be
             translated to an AS External LSA and readvertised
             by the translating NSSA Border Router.";
      "TE Router-ID.";
  }
        bit DN

  feature ldp-igp-sync {
    description
            "When set, the inter-area-prefix LSA or
             AS-external LSA prefix has been advertised as an
             L3VPN prefix.";
        }
      "LDP IGP synchronization.";
  }
      mandatory true;

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

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

  grouping ospfv3-lsa-external

  feature fast-reroute {
   description
      "AS-External and NSSA LSA.";
    leaf metric
     "Support of IP Fast Reroute (IP-FRR).";
  }

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

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

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

  feature stub-router {
    description
            "When set, the metric specified is a Type 2
             external metric.";
      "Support of RFC 6987 OSPF Stub Router Advertisement.";
  }
        bit F

  feature instance-inheritance {
    description
            "When set, a Forwarding Address is included
             in the LSA.";
      "Support instance inheritance";
  }
        bit T

  feature area-inheritance {
    description
            "When set, an External Route Tag is included
             in the LSA.";
      "Support area inheritance";
  }

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

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

  grouping tlv {
    description
      "TLV";
    leaf referenced-ls-type type {
      type uint16;
      description "Referenced Link State "TLV type.";
    }
    leaf length {
      type uint16;
      description "TLV length.";
    }
    leaf value {
      type yang:hex-string;
      description "TLV value.";
    }
  }

  grouping unknown-tlvs {
    description
      "Unknown TLVs grouping - Used for unknown TLVs or
       unknown sub-TLVs.";
    container unknown-tlvs {
      description "All unknown TLVs.";
      list unknown-tlv {
        description "Unknown TLV.";
        uses ospfv3-lsa-prefix; tlv;
      }
    }
  }

  grouping ospfv2-router-link {
    description "OSPFv2 router link.";
    leaf forwarding-address link-id {
      type inet:ipv6-address; union {
        type inet:ipv4-address;
        type yang:dotted-quad;
      }
      description
        "Forwarding address."; "Link ID.";
    }
    leaf external-route-tag link-data {
      type union {
        type inet:ipv4-address;
        type uint32;
      }
      description
        "Route tag."; "Link data.";
    }
    leaf referenced-link-state-id type {
      type uint32; uint8;
      description
        "Referenced Link State ID."; "Link type.";
    }
  }

  grouping ospfv3-lsa-body ospfv2-lsa-body {
    description "OSPFv3 "OSPFv2 LSA body.";
    container router {
      when "../../header/type = 8193" 1" { // 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
              "When set, the router is an NSSA border router
               that is unconditionally translating NSSA LSAs
               into AS-external LSAs.";
          }
        }
        mandatory true;
        description "Router LSA flags."; "Flags.";
      }
      leaf num-of-links {
        type uint16;
        description "Number of links.";
      }

      uses ospfv3-lsa-options;
      container links {
        description "All router link."; Links.";
        list link {
          description "Router LSA link.";
          leaf interface-id {
            type uint32;
            description "Interface ID.";
          }
          leaf neighbor-interface-id
          uses ospfv2-router-link;
          container topologies {
            type uint32;
            description "Neighbor Interface ID.";
          }
          leaf neighbor-router-id "All topologies for the link.";
            list topology {
            type yang:dotted-quad;
              description "Neighbor Router ID.";
          }
                "Topology specific information.";
              leaf type mt-id {
                type uint8;
                description "Link type.";
                  "The MT-ID for the topology enabled on
                   the link.";
              }
              leaf metric {
                type uint16;
                description "Metric."; "Metric for the topology.";
              }
            }
          }
        }
      }
    }
    container network {
      when "../../header/type = 8194" 2" { // 0x2002
        description
          "Only applies to Network LSA."; LSAs.";
      }
      description
        "Network LSA.";

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

      uses ospfv3-lsa-external;

      description "AS-External LSA.";
    }
    container nssa external {
      when "../../header/type = 8199" 5 or "
         + "../../header/type = 7" { // 0x2007
        description
          "Only applies to AS-external LSAs and NSSA LSAs.";
      }
      uses ospfv3-lsa-external;
      description "NSSA
        "External LSA.";
      leaf network-mask {
        type inet:ipv4-address;
        description
          "The IP address mask for the network";
      }
      container link topologies {
      when "../../header/type = 8"
        description "All topologies for the external.";
        list topology { // 0x0008
          description
          "Only applies to Link LSAs.";
      }
            "Topology specific information.";
          leaf rtr-priority mt-id {
            type uint8;
            description "Router Priority
              "The MT-ID for the interface."; topology enabled for the
               external or NSSA prefix.";
          }
      uses ospfv3-lsa-options;
          leaf link-local-interface-address flags {
            type inet:ipv6-address; bits {
              bit E {
                description
          "The originating router's link-local
           interface address for
                  "When set, the link."; metric specified is a Type 2
                   external metric.";
              }
            }
            description "Flags.";
          }
          leaf num-of-prefixes metric {
            type uint32; uint24;
            description "Number of prefixes."; "Metric for the topology.";

          }

      container prefixes
          leaf forwarding-address {
            type inet:ipv4-address;
            description "All prefixes for the link.";
        list prefix
              "Forwarding address.";
          }
          leaf external-route-tag {
            type uint32;
            description
            "List of prefixes associated with
              "Route tag for the link.";

          uses ospfv3-lsa-prefix; topology.";
          }
        }
      }
      description "Link LSA.";
    }
    container intra-area-prefix opaque {
      when "../../header/type = 8201" 9 or "
         + "../../header/type = 10 or "
         + "../../header/type = 11" { // 0x2009
        description
          "Only applies to Intra-Area-Prefix LSA."; Opaque LSAs.";
      }
      description "Intra-Area-Prefix
        "Opaque LSA.";

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

      uses unknown-tlvs;

      container router-address-tlv {
        type uint32;
        description
          "Referenced Link State ID.";
      }
          "Router address TLV.";
        leaf referenced-adv-router router-address {
          type inet:ipv4-address;
          description
          "Referenced Advertising Router.";
            "Router address.";
        }

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

      container prefixes link-tlvs {
        description "All prefixes in this LSA.";
        list prefix {
          description "List of prefixes link TLVs in this the LSA.";
          uses ospfv3-lsa-prefix;
          leaf metric {
            type uint24;
            description "Prefix Metric.";
          }
        }
      }
    }
  }

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

  grouping ospfv2-lsa
          leaf te-metric {
            type uint32;
            description
        "OSPFv2 LSA.";
    container header "TE metric.";
          }
          leaf max-bandwidth {
      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)" ieee-bandwidth;
            description "Maximum bandwidth.";
          }
          leaf max-reservable-bandwidth {
        description
          "Opaque
            type and ID only apply to Opaque LSAs."; ieee-bandwidth;
            description "Maximum reservable bandwidth.";
          }
          container unreserved-bandwidths {
            description
        "Decoded OSPFv2 LSA header data."; "All unreserved bandwidths.";
            list unreserved-bandwidth {
              leaf option priority {
                type bits uint8 {
          bit MT
                  range "0 .. 7";
                }
                description "Priority from 0 to 7.";
              }
              leaf unreserved-bandwidth {
                type ieee-bandwidth;
                description
              "When set, the router supports multi-topology as in RFC 4915."; "Unreserved bandwidth.";
              }
          bit DC
              description
                "List of unreserved bandwidths for different
                 priorities.";
            }
          }
          leaf admin-group {
            type uint32;
            description
              "When set, the router supports demand circuits.";
              "Administrative group/Resource Class/Color.";
          }
          bit P
          uses unknown-tlvs;
        }
      }

      container extended-prefix-tlvs {
        description
              "Only used "All extended prefix TLVs in type-7 LSA. When set, an NSSA
               border router should translate the type-7 LSA
               to a type-5 LSA.";
          }
          bit MC
        list extended-prefix-tlv {
          description
              "When set, the router supports MOSPF.";
          }
          bit E "Extended prefix TLV.";
          leaf route-type {
            description
              "This bit describes the way AS-external LSAs
               are flooded.";
          }
          bit L
            type enumeration {
              enum unspecified {
                value "0";
                description
              "L-bit is set in Hello and DD packets to indicate that
               the packet contains an LLS data block as in RFC 5613."; "Unspecified.";
              }
          bit O
              enum intra-area {
                value "1";
                description
              "When set, the router is opaque-capable as in RFC 5250."; "OSPF intra-area route.";
              }
          bit DN
              enum inter-area {
                value "3";
                description
              "When a type 3, 5 or 7 LSA is sent from a PE to a CE, the DN
              bit must be set. See RFC 4576.";
          } "OSPF inter-area route.";
              }
        mandatory true;
              enum external {
                value "5";
                description "LSA options."; "OSPF External route.";
              }
      leaf lsa-id
              enum nssa {
        type inet:ipv4-address;
        mandatory true;
                value "7";
                description "LSA ID."; "OSPF NSSA external route.";
              }
            }

      leaf opaque-type {
        type uint8;
            description "Opaque "Route type.";
          }
          leaf opaque-id flags {
            type uint24; bits {
              bit A {
                description "Opaque ID.";
      }

      uses lsa-header;
                  "Attach flag.";
              }
    container body
              bit N {
                description
        "Decoded OSPFv2 LSA body data.";
      uses ospfv2-lsa-body;
                  "Node flag.";
              }
            }

  grouping ospfv3-lsa {
            description
        "Decoded OSPFv3 LSA.";
    container header {
      description
        "Decoded OSPFv3 LSA header data."; "Flags.";
          }
          leaf lsa-id prefix {
            type uint32;
        mandatory true; inet:ip-prefix;
            description "LSA ID."; "Address prefix.";
          }
          uses lsa-header; unknown-tlvs;
        }
      }

      container body extended-link-tlvs {
        description
        "Decoded OSPF LSA body data."; "All extended link TLVs in the LSA.";
        list extended-link-tlv {
          description "Extended link TLV.";
          uses ospfv3-lsa-body; ospfv2-router-link;
          uses unknown-tlvs;
        }
      }
    }
  }

  grouping lsa-common ospfv3-lsa-options {
    description
        "Common field for OSPF "OSPFv3 LSA represenation."; options";
    leaf decoded-completed options {
      type boolean;
      description
        "The OSPF LSA body is fully decoded.";
    }
    leaf raw-data bits {
        bit AF {
      type yang:hex-string;
          description
        "The complete LSA in network byte
         order hexadecimal
            "When set, the router supprts OSPFv3 AFs as received or originated.";
    } in RFC5838. ";
        }

  grouping lsa
        bit DC {
          description
        "OSPF LSA.";
    uses lsa-common;
    choice version
            "When set, the router supports demand circuits.";
        }
        bit R {
          description
        "OSPFv2 or OSPFv3 LSA body.";
      container ospfv2
            "When set, the originator is an active router.";
        }
        bit N {
          description "OSPFv2 LSA";
        uses ospfv2-lsa;
            "If set, the router is attached to an NSSA";
        }
      container ospfv3
        bit E {
          description "OSPFv3 LSA";
        uses ospfv3-lsa;
      }
    }
            "This bit describes the way AS-external LSAs
             are flooded";
        }

  grouping lsa-key
        bit V6 {
          description
      "OSPF LSA key.";
    leaf lsa-id {
      type union {
        type inet:ipv4-address;
        type uint32;
            "If clear, the router/link should be excluded
             from IPv6 routing calculaton";
        }
      description
        "LSA ID.";
      }
    leaf adv-router {
      type inet:ipv4-address;
      mandatory true;
      description
        "Advertising router."; "OSPFv3 LSA options.";
    }
  }

  grouping instance-stat ospfv3-lsa-prefix {
    description "Per-instance statistics";
      "OSPFv3 LSA prefix.";

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

  grouping area-stat ospfv3-lsa-external {
    description "Per-area statistics.";
      "AS-External and NSSA LSA.";
    leaf spf-runs-count metric {
      type yang:counter32; uint24;
      description
        "The number of times the intra-area SPF has run."; "Metric";
    }

    leaf abr-count flags {
      type yang:gauge32; bits {
        bit E {
          description
        "The total number of Area Border Routers (ABRs)
         reachable within this area.";
            "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
            "When set, an External Route Tag is included
             in the LSA.";
        }
      }
      description "Flags.";
    }

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

    uses ospfv3-lsa-prefix;

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

    leaf area-scope-lsa-count external-route-tag {
      type yang:gauge32; uint32;
      description
        "The number of area scope LSAs in the area.";
        "Route tag.";
    }
    leaf area-scope-lsa-cksum-sum referenced-link-state-id {
      type int32; uint32;
      description "The sum of the area scope LSAs checksums.";
        "Referenced Link State ID.";
    }
    container database
  }

  grouping ospfv3-lsa-body {
    description "Container for area scope "OSPFv3 LSA type statistics.";
      list area-scope-lsa-type body.";
    container router {
        description "List of area scope LSA statistics";
        leaf lsa-type
      when "../../header/type = 8193" {
          type uint16; // 0x2001
        description "Area scope LSA type.";
          "Only applies to Router LSAs.";
      }
        leaf lsa-count {
          type yang:gauge32;
      description "The number of LSAs of the LSA type.";
        } "Router LSA.";
      leaf lsa-cksum-sum flags {
        type int32; bits {
          bit V {
            description
            "The sum of
              "When set, the LSA checksums router is an endpoint of the LSA type.";
        }
      }
    } one or
               more virtual links.";
          }

  grouping interface-stat
          bit E {
            description "Per-interface statistics";
    leaf if-event-count
              "When set, the router is an AS Boundary Router
               (ASBR).";
          }
          bit B {
      type yang:counter32;
            description
        "The number of times this interface has changed its
         state or
              "When set, the router is an error has occurred."; Area Border
               Router (ABR).";
          }
    leaf link-scope-lsa-count
          bit Nt {
      type yang:gauge32;
            description "The number of link scope
              "When set, the router is an NSSA border router
               that is unconditionally translating NSSA LSAs
               into AS-external LSAs.";
          }
    leaf link-scope-lsa-cksum-sum {
      type uint32;
        }
        mandatory true;
        description "The sum of link scope "Router LSA checksums."; flags.";
      }

      uses ospfv3-lsa-options;
      container database links {
        description "Container for link scope LSA type statistics."; "All router link.";
        list link-scope-lsa-type link {
          description "List of link scope "Router LSA statistics"; link.";
          leaf lsa-type interface-id {
            type uint16; uint32;
            description "Link scope LSA type."; "Interface ID.";
          }
          leaf lsa-count neighbor-interface-id {
            type yang:gauge32; uint32;
            description "The number of LSAs of the LSA type."; "Neighbor Interface ID.";
          }
          leaf lsa-cksum-sum neighbor-router-id {
            type int32; yang:dotted-quad;
            description
            "The sum of the LSA checksums of the LSA type.";
        }
      }
    } "Neighbor Router ID.";
          }

  grouping neighbor-stat {
    description "Per-neighbor statistics.";
          leaf nbr-event-count type {
            type yang:counter32; uint8;
            description
        "The number of times this neighbor has changed
         state or an error has occurred."; "Link type.";
          }
          leaf nbr-retrans-qlen metric {
            type yang:gauge32; uint16;
              description
        "The current length of the retransmission queue."; "Metric.";
          }
        }

  grouping instance-fast-reroute-config
      }
    }
    container network {
      when "../../header/type = 8194" { // 0x2002
        description
      "This group defines global configuration of IP-FRR.";
          "Only applies to Network LSA.";
      }
      description "Network LSA.";

      uses ospfv3-lsa-options;

      container fast-reroute attached-routers {
      if-feature fast-reroute;
        description
        "This container may be augmented with global
         parameters for IP-FRR.";
      container lfa "All attached routers.";
        leaf-list attached-router {
        if-feature lfa;
          type yang:dotted-quad;
          description
          "This container may be augmented with
           global parameters for LFA. Container creation
           has no effect on LFA activation.";
            "List of the routers attached to the network.";
        }
      }
    }

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

      uses ospfv3-lsa-external;

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

      description
        "IP Fast-reroute configuration.";
    } "NSSA LSA.";
    }
  grouping interface-cost-config
    container link {
      when "../../header/type = 8" { // 0x0008
        description
      "Interface cost configuration that only
          "Only applies to
       physical interfaces and sham links."; Link LSAs.";
      }
      leaf cost rtr-priority {
        type uint16 {
        range "1..65535";
      }
      description
        "Interface cost.";
    }
  }

  grouping interface-common-config { uint8;
        description
      "Common configuration "Router Priority for all types of interfaces,
       including virtual links and sham links."; the interface.";
      }
      uses ospfv3-lsa-options;

      leaf hello-interval link-local-interface-address {
        type uint16 {
        range "1..65535";
      }
      units seconds; inet:ipv6-address;
        description
        "Interval between hello packets in seconds.";
          "The originating router's link-local
           interface address for the link.";
      }

      leaf dead-interval num-of-prefixes {
        type uint16 {
        range "1..65535"; uint32;
        description "Number of prefixes.";
      }
      units seconds;
      must "../dead-interval > ../hello-interval"

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

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

      leaf transmit-delay referenced-ls-type {
        type uint16 {
        range "1..65535";
      }
      units seconds; uint16;
        description
        "Estimated time needed to transmit "Referenced Link State Update
         packets on the interface in seconds."; type.";
      }
      leaf mtu-ignore referenced-link-state-id {
      if-feature mtu-ignore;
        type boolean; uint32;
        description
        "Enable/Disable bypassing the MTU mismatch check in
         Database Description packets.";
          "Referenced Link State ID.";
      }
      leaf lls referenced-adv-router {
      if-feature lls;
        type boolean; inet:ipv4-address;
        description
        "Enable/Disable link-local signaling (LLS) support.";
          "Referenced Advertising Router.";
      }

      leaf prefix-suppression num-of-prefixes {
      if-feature prefix-suppression;
        type boolean; uint16;
        description
        "Suppress advertisement "Number of the prefixes associated
         with the interface."; prefixes.";
      }
      container ttl-security prefixes {
      if-feature ttl-security;
        description "TTL security check."; "All prefixes in this LSA.";
        list prefix {
          description "List of prefixes in this LSA.";
          uses ospfv3-lsa-prefix;
          leaf enable metric {
            type boolean; uint24;
            description
          "Enable/Disable TTL security check."; "Prefix Metric.";
          }
        }
      }
    }
  }

  grouping lsa-header {
    description
        "Common LSA for OSPFv2 and OSPFv3";
    leaf hops age {
      type uint8 uint16;
      mandatory true;
      description "LSA age.";
    }
    leaf type {
          range "1..254";
      type uint16;
      mandatory true;
      description "LSA type.";
    }
    leaf adv-router {
      type yang:dotted-quad;
      mandatory true;
      description
          "Maximum number of hops that an OSPF packet may
           have traversed before reception."; "LSA advertising router.";
    }
    leaf seq-num {
      type uint32;
      mandatory true;
      description "LSA sequence number.";
    }
    leaf enable checksum {
      if-feature admin-control;
      type boolean;
      default checksum16-type;
      mandatory true;
      description
        "Enable/disable protocol on the interface."; "LSA checksum.";
    }

    container authentication
    leaf length {
      type uint16;
      mandatory true;
      description "Authentication configuration.";
      choice auth-type-selection "LSA length.";
    }
  }

  grouping ospfv2-lsa {
    description
          "Options for expressing authentication setting.";
        case auth-ipsec
        "OSPFv2 LSA.";
    container header {
          when "../../../../../../../rt:type
      must "(type = 'ospf:ospfv3'" 9 or type = 10 or type = 11) and "
         + "opaque-id and opaque-type "
         + "or (type != 9 and type != 10 and type != 11) "
         + "and not(opaque-id) and "
         + "not(opaque-type)" {
        description "Applied
          "Opaque type and ID only apply to OSPFv3 only."; Opaque LSAs.";
      }
          if-feature ospfv3-authentication-ipsec;
          leaf sa {
              type string;
      description
                "Security Association name.";
          }
        }
        case auth-trailer-key-chain {
        "Decoded OSPFv2 LSA header data.";
      leaf key-chain option {
        type key-chain:key-chain-ref;
             description
              "key-chain name.";
            }
          }
        case auth-trailer-key bits {
          leaf key
          bit MT {
            type string;
            description
              "Key string
              "When set, the router supports multi-topology as in ASCII format."; RFC 4915.";
          }
          container crypto-algorithm
          bit DC {
            uses key-chain:crypto-algorithm-types;
            description
              "Cryptographic algorithm associated with key.";

          }
        }
      }
    }
              "When set, the router supports demand circuits.";
          } // interface-common-config

  grouping interface-config
          bit P {
            description "Configuration for real interfaces.";

    leaf network-type {
      type enumeration {
        enum "broadcast"
              "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 {
            description
            "Specify OSPF broadcast multi-access network.";
              "When set, the router supports MOSPF.";
          }
        enum "non-broadcast"
          bit E {
            description
            "Specify OSPF Non-Broadcast Multi-Access
             (NBMA) network.";
              "This bit describes the way AS-external LSAs
               are flooded.";
          }
        enum "point-to-multipoint"
          bit O {
            description
            "Specify OSPF point-to-multipoint network.";
              "When set, the router is opaque-capable as in RFC 5250.";
          }
        enum "point-to-point"
          bit DN {
            description
            "Specify OSPF point-to-point network.";
              "When a type 3, 5 or 7 LSA is sent from a PE to a CE, the DN
              bit must be set. See RFC 4576.";
          }
        }
        mandatory true;
        description
        "Network type."; "LSA options.";
      }
      leaf passive lsa-id {
        type boolean;
      description
        "Enable/Disable passive interface - a passive interface's
         prefix will be advertised but no neighbor adjacencies
         will be formed on the interface."; inet:ipv4-address;
        mandatory true;
        description "LSA ID.";
      }

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

      leaf priority opaque-id {
        type uint8; uint24;
        description
        "Configure OSPF router priority."; "Opaque ID.";
      }

      uses lsa-header;
    }
    container multi-areas body {
      if-feature multi-area-adj;
      description "Container for multi-area config.";
      list multi-area
        "Decoded OSPFv2 LSA body data.";
      uses ospfv2-lsa-body;
    }
  }

  grouping ospfv3-lsa {
        key multi-area-id;
    description
          "Configure OSPF multi-area adjacency.";
        leaf multi-area-id
        "Decoded OSPFv3 LSA.";
    container header {
          type area-id-type;
      description
            "Multi-area adjacency area ID.";
        }
        "Decoded OSPFv3 LSA header data.";
      leaf cost lsa-id {
        type uint16; uint32;
        mandatory true;
        description
            "Interface cost for multi-area adjacency.";
        } "LSA ID.";

      }
      uses lsa-header;
    }
    container static-neighbors body {
      description "Statically configured neighbors.";

      list neighbor
        "Decoded OSPF LSA body data.";
      uses ospfv3-lsa-body;
    }
  }
  grouping lsa-common {
        key "address";
    description
          "Specify a static
        "Common field for OSPF neighbor."; LSA represenation.";
    leaf address decoded-completed {
      type inet:ip-address; boolean;
      description "Neighbor IP address.";
        "The OSPF LSA body is fully decoded.";
    }
    leaf cost raw-data {
      type uint16 {
            range "1..65535";
          } yang:hex-string;
      description "Neighbor cost.";
        "The complete LSA in network byte
         order hexadecimal as received or originated.";
    }
        leaf poll-interval {
          type uint16 {
            range "1..65535";
  }
          units seconds;

  grouping lsa {
    description "Neighbor poll interval in seconds.";
        }
        leaf priority
        "OSPF LSA.";
    uses lsa-common;
    choice version {
          type uint8
      description
        "OSPFv2 or OSPFv3 LSA body.";
      container ospfv2 {
            range "1..255";
          }
        description "Neighbor priority for DR election.";
        }
      } "OSPFv2 LSA";
        uses ospfv2-lsa;
      }

    leaf node-flag
      container ospfv3 {
      if-feature node-flag;
      type boolean;
      default false;
        description
        "Set prefix as a node representative prefix.";
    }
    uses interface-fast-reroute-config;
    uses interface-common-config; "OSPFv3 LSA";
        uses interface-cost-config; ospfv3-lsa;
      }
    }
  } // grouping interface-config

  grouping neighbor-operation lsa-key {
    description
      "OSPF neighbor operation data."; LSA key.";
    leaf address lsa-id {
      type inet:ip-address; union {
        type inet:ipv4-address;
        type uint32;
      }
      description
        "Neighbor address.";
        "LSA ID.";
    }
    leaf dr-router-id adv-router {
      type yang:dotted-quad; inet:ipv4-address;
      description "Neighbor's Designated Router (DR) router ID.";
        "Advertising router.";
    }
  }

  grouping instance-stat {
    description "Per-instance statistics";
    leaf dr-ip-addr originate-new-lsa-count {
      type inet:ip-address; yang:counter32;
      description "Neighbor's Designated Router (DR) IP address."; "The number of new LSAs originated.";
    }
    leaf bdr-router-id rx-new-lsas-count {
      type yang:dotted-quad; yang:counter32;
      description
        "Neighbor's Backup Designated Router (BDR) router ID."; "The number of LSAs received.";
    }
    leaf bdr-ip-addr as-scope-lsa-count {
      type inet:ip-address; yang:gauge32;
      description
        "Neighbor's Backup Designated Router (BDR) IP Address."; "The number of AS Scope LSAs.";
    }
    leaf state as-scope-lsa-chksum-sum {
      type nbr-state-type; uint32;
      description
        "OSPF neighbor state.";
        "The sum of the LSA checksums for AS Scope LSAs.";
    }
    container statistics database {
      description "Per neighbor statistics";
      uses neighbor-stat;
    }
  }

  grouping interface-common-operation "Container for per AS-scope LSA statistics.";
      list as-scope-lsa-type {
        description
      "OSPF interface common operation state.";
    reference "RFC2328 Section 9"; "List of AS-scope LSA statistics";
        leaf state lsa-type {
          type if-state-type; uint16;
          description "Interface state."; "AS-scope LSA type.";
        }
        leaf hello-timer lsa-count {
          type uint32;
      units "milliseconds"; yang:gauge32;
          description "Hello timer."; "The number of LSAs of the LSA type.";
        }
        leaf wait-timer lsa-cksum-sum {
          type uint32;
      units "milliseconds"; int32;
          description "Wait timer.";
            "The sum of the LSA checksums of the LSA type.";

        }

    leaf dr-router-id
      }
    }
  }

  grouping area-stat {
      type yang:dotted-quad;
    description "Designated Router (DR) router ID.";
    } "Per-area statistics.";
    leaf dr-ip-addr spf-runs-count {
      type inet:ip-address; yang:counter32;
      description "Designated Router (DR) IP address.";
        "The number of times the intra-area SPF has run.";
    }
    leaf bdr-router-id abr-count {
      type yang:dotted-quad; yang:gauge32;
      description "Backup Designated Router (BDR) router ID.";
        "The total number of Area Border Routers (ABRs)
         reachable within this area.";
    }
    leaf bdr-ip-addr asbr-count {
      type inet:ip-address;
      description "Backup Designated Router (BDR) IP Address.";
    }

    container statistics { yang:gauge32;
      description "Per interface statistics";
      uses interface-stat;
        "The total number of AS Border Routers (ASBRs).";
    }

    container neighbors {
      description "All neighbors for the interface.";
      list neighbor
    leaf ar-nssa-translator-event-count {
        key "neighbor-router-id";
      type yang:counter32;
      description
          "List
        "The number of OSPF neighbors."; NSSA translator-state changes.";
    }
    leaf neighbor-router-id area-scope-lsa-count {
      type yang:dotted-quad; yang:gauge32;
      description
            "Neighbor router ID.";
        }
        uses neighbor-operation;
      } // list
        "The number of OSPF neighbors
    } area scope LSAs in the area.";
    } // interface-common-operation

  grouping interface-operation
    leaf area-scope-lsa-cksum-sum {
      type int32;
      description
      "OSPF interface operation state.";
    reference "RFC2328 Section 9";

    uses interface-common-operation; "The sum of the area scope LSAs checksums.";
    }
    container database {
      description "Link "Container for area scope LSA database."; type statistics.";
      list link-scope-lsa-type area-scope-lsa-type {
        key "lsa-type";
        description "List OSPF link of area scope LSA databases."; statistics";
        leaf lsa-type {
          type uint16;
          description "OSPF link "Area scope LSA type.";
        }
        container link-scope-lsas
        leaf lsa-count {
          type yang:gauge32;
          description
            "All link scope "The number of LSAs of this the 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'"
        leaf lsa-cksum-sum {
          type int32;
          description "OSPFv3 LSA.";
                }
              }
            }
          }
        }
            "The sum of the LSA checksums of the LSA type.";
        } // list link-scope-lsas
      }
    }

  grouping virtual-link-config {
    description
      "OSPF virtual link configuration state.";

    uses interface-common-config;
  }

  grouping virtual-link-operation interface-stat {
    description
      "OSPF virtual link operation state."; "Per-interface statistics";
    leaf cost if-event-count {
      type uint16 {
        range "1..65535";
      } yang:counter32;
      description
        "Virtual link
        "The number of times this interface cost.";
    }
    uses interface-common-operation; has changed its
         state or an error has occurred.";
    }

  grouping sham-link-config
    leaf link-scope-lsa-count {
      type yang:gauge32;
      description
      "OSPF sham "The number of link configuration state.";

    uses interface-common-config;
    uses interface-cost-config; scope LSAs.";
    }

  grouping sham-link-operation
    leaf link-scope-lsa-cksum-sum {
      type uint32;
      description
      "OSPF sham "The sum of link operation state.";

    uses interface-common-operation;
  }

  grouping af-area-config {
    description
      "OSPF address-family specific area config state."; scope LSA checksums.";
    }
    container ranges database {
      description "Container for summary ranges"; link scope LSA type statistics.";
      list range link-scope-lsa-type {
        key "prefix";
        description
          "Summarize routes matching address/mask
           (Area Border Routers (ABRs) only)"; "List of link scope LSA statistics";
        leaf prefix lsa-type {
          type inet:ip-prefix; uint16;
          description
            "IPv4 or IPv6 prefix"; "Link scope LSA type.";
        }
        leaf advertise lsa-count {
          type boolean; yang:gauge32;
          description
            "Advertise or hide."; "The number of LSAs of the LSA type.";
        }
        leaf cost lsa-cksum-sum {
          type uint24 {
            range "0..16777214";
          } int32;
          description
            "Advertised cost
            "The sum of summary route."; the LSA checksums of the LSA type.";
        }
      }
    }
  }

  grouping area-common-config neighbor-stat {
    description
      "OSPF area common configuration state."; "Per-neighbor statistics.";
    leaf summary {
      when "../area-type = 'ospf:stub' or "
         + "../area-type = 'ospf:nssa'" nbr-event-count {
        description
          "Summary advertisement into the stub/NSSA area.";
      }
      type boolean; yang:counter32;
      description
        "Enable/Disable summary advertisement into the stub
        "The number of times this neighbor has changed
         state or
         NSSA area."; an error has occurred.";
    }
    leaf default-cost {
      when "../area-type = 'ospf:stub' or "
         + "../area-type = 'ospf:nssa'" nbr-retrans-qlen {
          description
            "Cost for LSA default route advertised into the
             stub or NSSA area.";
      }
      type uint32 {
        range "1..16777215";
      } yang:gauge32;
      description
        "Set
        "The current length of the summary default route cost for a
         stub or NSSA area."; retransmission queue.";
    }
  }

  grouping area-config instance-fast-reroute-config {
    description
      "OSPF area
      "This group defines global configuration state."; of IP-FRR.";
    container all-interfaces-inherit fast-reroute {
      if-feature interface-inheritance; fast-reroute;
      description
        "Inheritance for all interfaces";
        "This container interface {
        description
          "Interface config to may be inherited by all
           interfaces in the area.";
      }
    }
    leaf area-type {
      type identityref {
        base area-type;
      }
      default normal;
      description
        "Area type.";
    }

    uses area-common-config;

    uses af-area-config {
      when "../../operation-mode = "
         + "'ospf:ships-in-the-night'" augmented with global
         parameters for IP-FRR.";
      container lfa {
        description
          "Ships in the night configuration.";
        if-feature lfa;
        description
          "This container may be augmented with
           global parameters for LFA. Container creation
           has no effect on LFA activation.";
      }
    }
  }

  grouping area-operation interface-fast-reroute-config {
    description
      "OSPF area operation state.";
      "This group defines interface configuration of IP-FRR.";
    container statistics fast-reroute {
      description "Per area statistics";
      uses area-stat;
    }
      if-feature fast-reroute;
      container database lfa {
      description "Area scope LSA database.";
      list area-scope-lsa-type
        if-feature lfa;
        leaf candidate-enable {
        key "lsa-type";
          type boolean;
          default true;
          description "List OSPF area scope LSA databases.";
            "Enable the interface to be used as backup.";
        }
        leaf lsa-type enable {
          type uint16; boolean;
          default false;
          description "OSPF area scope LSA type.";
            "Activates LFA - Per-prefix LFA computation
             is assumed.";
        }
        container area-scope-lsas {
          description
            "All area scope LSAs of an area scope
             LSA type.";
          list area-scope-lsa {
            key "lsa-id adv-router";
            description "List of OSPF area scope LSAs";
            uses lsa-key;
            uses lsa {
              refine "version/ospfv2/ospfv2" remote-lfa {
                must "../../../../../../../../../"
                   + "rt:type = 'ospf:ospfv2'"
          if-feature remote-lfa;
          leaf enable {
            type boolean;
            default false;
            description "OSPFv2 LSA.";
                }
            "Activates Remote LFA (R-LFA).";
          }
              refine "version/ospfv3/ospfv3" {
                must "../../../../../../../../../"
                   + "rt:type = 'ospf:ospfv3'" {
          description "OSPFv3 LSA.";
                }
              }
            }
          }
            "Remote LFA configuration.";
        }
        description
          "LFA configuration.";
      } // list area-scope-lsas
      description
        "IP Fast-reroute configuration.";
    }
  }

  grouping local-rib {
    description "Local-rib grouping.";
    container local-rib {
      description "Local-rib.";
      list route interface-physical-link-config {
        key "prefix";
    description "Routes";
      "Interface cost configuration that only applies to
       physical interfaces and sham links.";
    leaf prefix cost {
      type inet:ip-prefix;
          description "Destination prefix.";
        }
        container next-hops uint16 {
        range "1..65535";
      }
      description "All next hops for the route.";
          list next-hop
        "Interface cost.";
    }
    leaf mtu-ignore {
            key "next-hop";
      if-feature mtu-ignore;
      type boolean;
      description "List of next hop for
        "Enable/Disable bypassing the route"; MTU mismatch check in
         Database Description packets.";
    }
    leaf outgoing-interface prefix-suppression {
      if-feature prefix-suppression;
      type if:interface-ref; boolean;
      description
                "Name
        "Suppress advertisement of the outgoing prefixes associated
         with the interface.";
    }

  }

  grouping interface-common-config {
    description
      "Common configuration for all types of interfaces,
       including virtual links and sham links.";

    leaf next-hop hello-interval {
      type inet:ip-address;
             description "Nexthop address.";
            } uint16 {
        range "1..65535";
      }
      units seconds;
      description
        "Interval between hello packets in seconds.";
    }

    leaf metric dead-interval {
      type uint32; uint32 {
        range "1..2147483647";
      }
      units seconds;
      must "../dead-interval > ../hello-interval" {
        error-message "The dead interval must be "
                    + "larger than the hello interval";
        description "Metric for this route.";
          "The value MUST be greater than 'hello-internval'.";
      }
      description
        "Interval after which a neighbor is
         declared down in seconds.";
    }

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

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

  grouping instance-config

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

    container all-areas-inherit ttl-security {
      if-feature area-inheritance; ttl-security;
      description
        "Inheritance for all areas.";
      container area "TTL security check.";
      leaf enable {
        type boolean;
        description
          "Area config to be inherited by all areas.";
          "Enable/Disable TTL security check.";
      }
      container interface
      leaf hops {
        type uint8 {
          range "1..254";
        }
        description
          "Interface config to be inherited by all interfaces
           in all areas.";
          "Maximum number of hops that an OSPF packet may
           have traversed before reception.";
      }
    }
    leaf explicit-router-id enable {
      if-feature explicit-router-id; admin-control;
      type yang:dotted-quad;
      description
        "Defined in RFC 2328. A 32-bit number
         that uniquely identifies boolean;
      default true;
      description
        "Enable/disable protocol on the router."; interface.";
    }

    container admin-distance authentication {
      description "Admin distance config state."; "Authentication configuration.";
      choice scope auth-type-selection {
        description
          "Options for expressing admin distance
           as single or multiple values."; authentication setting.";
        case single-value auth-ipsec {
          when "../../../../../../../rt:type = 'ospf:ospfv3'" {
            description "Applied to OSPFv3 only.";
          }
          if-feature ospfv3-authentication-ipsec;
          leaf all sa {
              type uint8; string;
              description
              "Admin distance for intra-area, inter-area and
               external routes.";
                "Security Association name.";
          }
        }
        case multi-values auth-trailer-key-chain {
          choice granularity
          leaf key-chain {
            type key-chain:key-chain-ref;
             description
              "Options for expressing admin distance
               for intra-area and inter-area routes.";
              "key-chain name.";
            }
          }
        case detail auth-trailer-key {
          leaf intra-area key {
            type uint8; string;
            description
                  "Admin distance for intra-area routes.";
              "Key string in ASCII format.";
          }
              leaf inter-area
          container crypto-algorithm {
                type uint8;
            uses key-chain:crypto-algorithm-types;
            description
                  "Admin distance for inter-area routes.";
              "Cryptographic algorithm associated with key.";
          }
        }
            case coarse
      }
    }
  } // interface-common-config

  grouping interface-config {
    description "Configuration for real interfaces.";

    leaf internal network-type {
      type uint8; enumeration {
        enum "broadcast" {
          description
                  "Admin distance for both intra-area and
                   inter-area routes.";
            "Specify OSPF broadcast multi-access network.";
        }
        enum "non-broadcast" {
          description
            "Specify OSPF Non-Broadcast Multi-Access
             (NBMA) network.";
        }
        enum "point-to-multipoint" {
          description
            "Specify OSPF point-to-multipoint network.";
        }
        enum "point-to-point" {
          description
            "Specify OSPF point-to-point network.";

        }
      }
      description
        "Network type.";
    }

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

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

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

    container nsr multi-areas {
      if-feature nsr; multi-area-adj;
      description
        "Non-Stop Routing (NSR) config state."; "Container for multi-area config.";
      list multi-area {
        key multi-area-id;
        description
          "Configure OSPF multi-area adjacency.";
        leaf multi-area-id {
          type area-id-type;
          description
            "Multi-area adjacency area ID.";
        }
        leaf enable cost {
          type boolean; uint16;
          description
          "Enable/Disable NSR.";
            "Interface cost for multi-area adjacency.";
        }
      }
    }

    container graceful-restart static-neighbors {
      if-feature graceful-restart;
      description
        "Graceful restart config state."; "Statically configured neighbors.";

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

        leaf enable identifier {
          type boolean; inet:ip-address;
          description
          "Enable/Disable graceful restart as defined in RFC 3623
           for OSPFv2 and RFC 5187 for OSPFv3."; "Neighbor IPv4 address or router ID.";
        }

        leaf helper-enable cost {
          type boolean; uint16 {
            range "1..65535";
          }
          description
          "Enable graceful restart helper support for restarting
           routers (RFC 3623 Section 3)."; "Neighbor cost.";
        }
        leaf restart-interval poll-interval {
          type uint16 {
            range "1..1800";  // Range is defined in RFC 3623. "1..65535";
          }
          units seconds;
        default "120";  // Default is defined in RFC 3623.
          description
          "Interval "Neighbor poll interval in seconds to attempt graceful restart prior
           to failing (RFC 3623 Section B.1)"; seconds.";
        }
        leaf helper-strict-lsa-checking priority {
          type boolean; uint8 {
            range "1..255";
          }
          description
          "Terminate graceful restart when an LSA topology change
           is detected (RFC 3623 Section B.2)."; "Neighbor priority for DR election.";
        }
      }
    }

    leaf enable node-flag {
      if-feature admin-control; node-flag;
      type boolean;
      default true; false;
      description
        "Enable/Disable the protocol.";
        "Set prefix as a node representative prefix.";
    }

    container auto-cost
    uses interface-fast-reroute-config;
    uses interface-common-config;
    uses interface-physical-link-config;
  } // grouping interface-config

  grouping neighbor-operation {
      if-feature auto-cost;
    description
        "Interface Auto-cost configuration state.";
      "OSPF neighbor operation data.";

    leaf enable address {
      type boolean; inet:ip-address;
      description
          "Enable/Disable interface auto-cost.";
        "Neighbor address.";
    }
    leaf reference-bandwidth {
        when "../enable = 'true'" dr-router-id {
          description "Only when auto cost is enabled";
        }
      type uint32 {
          range "1..4294967";
        }
        units Mbits; yang:dotted-quad;
      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.";
      } "Neighbor's Designated Router (DR) router ID.";
    }

    container spf-control {

    leaf paths dr-ip-addr {
        if-feature max-ecmp;
      type uint16 {
          range "1..32";
        }
        description
          "Maximum number of Equal-Cost Multi-Path (ECMP) paths.";
      } inet:ip-address;
      description "SPF calculation control."; "Neighbor's Designated Router (DR) IP address.";
    }

    container database-control {

    leaf max-lsa bdr-router-id {
        if-feature max-lsa;
      type uint32 {
          range "1..4294967294";
        } yang:dotted-quad;
      description
          "Maximum number of LSAs OSPF the
        "Neighbor's Backup Designated Router (BDR) router will accept."; ID.";
    }

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

    container stub-router
    leaf state {
      if-feature stub-router;
      type nbr-state-type;
      description "Set maximum metric configuration";

      choice trigger
        "OSPF neighbor state.";
    }
    leaf dead-timer {
      type uint32;
      units "seconds";
      description
          "Specific triggers which will enable stub
           router state."; "This timer tracks the remaining time before
                   the neighbor is declared dead.";
    }
    container always statistics {
          presence
            "Enables unconditional stub router support";
      description
            "Unconditional stub router state (advertise
             transit links with max metric";
        } "Per neighbor statistics";
      uses neighbor-stat;
    }
  }

    container mpls

  grouping interface-common-operation {
    description
      "OSPF MPLS config state.";
      container te-rid {
        if-feature te-rid;
        description
          "Stable OSPF Router IP Address used for Traffic
           Engineering (TE)";
        choice source {
          description
            "Different options for specifying TE router ID.";
          case interface { common operation state.";

    reference "RFC2328 Section 9";

    leaf interface state {
      type if:interface-ref; if-state-type;
      description
                "Use the interface's IPv4 address as TE
                 router ID.";
            } "Interface state.";
    }
          case explicit {

    leaf router-id hello-timer {
      type inet:ipv4-address; uint32;
      units "seconds";
      description
                "Explicitly configure "This timer tracks the TE router ID.";
            }
          }
        } remaining time before
                   the next hello packet is sent.";
    }
      container ldp

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

    leaf igp-sync dr-router-id {
          if-feature ldp-igp-sync;
      type boolean; yang:dotted-quad;
      description
            "Enable LDP IGP synchronization."; "Designated Router (DR) router ID.";
    }

    leaf autoconfig dr-ip-addr {
          if-feature ldp-igp-autoconfig;
      type boolean; inet:ip-address;
      description
            "Enable LDP IGP interface auto-configuration.";
        }
      }
    }
    uses instance-fast-reroute-config; "Designated Router (DR) IP address.";
    }

  grouping instance-operation

    leaf bdr-router-id {
      type yang:dotted-quad;
      description
      "OSPF Address Family operation state."; "Backup Designated Router (BDR) router ID.";
    }

    leaf router-id bdr-ip-addr {
      type yang:dotted-quad; inet:ip-address;
      description
        "Defined in RFC 2328. A 32-bit number
         that uniquely identifies the router."; "Backup Designated Router (BDR) IP Address.";
    }

    uses local-rib;

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

    container database neighbors {
      description "AS scope LSA database."; "All neighbors for the interface.";
      list as-scope-lsa-type neighbor {
        key "lsa-type"; "neighbor-router-id";
        description
          "List of OSPF AS scope LSA databases."; neighbors.";
        leaf lsa-type neighbor-router-id {
          type uint16; yang:dotted-quad;
          description "OSPF AS scope LSA type.";
            "Neighbor router ID.";
        }
        container as-scope-lsas {
          description "All AS scope of LSA of this LSA type.";
          list as-scope-lsa {
            key "lsa-id adv-router";
            description "List of OSPF area scope LSAs";
            uses lsa-key;
        uses lsa {
              refine "version/ospfv2/ospfv2" {
                must "../../../../../../../rt:type = "
                   + "'ospf:ospfv2'" {
                  description "OSPFv2 LSA.";
                }
              }
              refine "version/ospfv3/ospfv3" {
                must "../../../../../../../rt:type = "
                   + "'ospf:ospfv3'" {
                  description "OSPFv3 LSA.";
                }
              }
            }
          }
        } neighbor-operation;
      } // list as-scope-lsas of OSPF neighbors
    }
  } // interface-common-operation

  grouping ospf-config interface-operation {
    description
      "OSPF top configuration interface operation state.";
    reference "RFC2328 Section 9";

    uses interface-common-operation;

    container all-instances-inherit {
      if-feature instance-inheritance;
      description
        "Inheritance support to all instances.";
      container area database {
      description
          "Area config to be inherited by all areas
           in all instances.";
      }
      container interface "Link scope LSA database.";
      list link-scope-lsa-type {
        key "lsa-type";
        description
          "Interface config to be inherited by all
           interfaces in all instances.";
      }
    }
          "List OSPF link scope LSA databases.";
        leaf operation-mode lsa-type {
          type identityref {
        base operation-mode;
      }
      default ospf:ships-in-the-night; uint16;
          description "OSPF operation mode.";
    }
  }

  grouping ospf-operation link scope LSA type.";
        }
        container link-scope-lsas {
          description
      "OSPF top operation state.";
  }

  grouping multi-topology-area-config
            "All link scope LSAs of this LSA type.";
          list link-scope-lsa {
            key "lsa-id adv-router";
            description
      "OSPF multi-topology area configuration state."; "List of OSPF link scope LSAs";
            uses area-common-config; lsa-key;
            uses af-area-config lsa {
      when "../../../../operation-mode = "
              refine "version/ospfv2/ospfv2" {
                must "../../../../../../../../../../../"
                   + "'ospf:ships-in-the-night'" "rt:type = 'ospf:ospfv2'" {
                  description
          "Ships in the night configuration.";
      } "OSPFv2 LSA.";
                }
              }

  grouping multi-topology-area-operation
              refine "version/ospfv3/ospfv3" {
    description
      "OSPF multi-topology area operation state.";
  }

  grouping multi-topology-config
                must "../../../../../../../../../../../"
                   + "rt:type = 'ospf:ospfv3'" {

                  description
      "OSPF multi-topology configuration state."; "OSPFv3 LSA.";
                }
              }
            }
          }
        }
      } // list link-scope-lsas
    }
  }

  grouping multi-topology-operation virtual-link-config {
    description
      "OSPF multi-topology operation virtual link configuration state.";

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

  grouping multi-topology-interface-config virtual-link-operation {
    description
      "OSPF multi-topology configuration virtual link operation state.";

    leaf cost {
      type uint32; uint16 {
        range "1..65535";
      }
      description
         "Interface cost for this topology.";
        "Virtual link interface cost.";
    }
    uses interface-common-operation;
  }

  grouping multi-topology-interface-operation sham-link-config {
    description
      "OSPF multi-topology operation state.";
  }

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

    leaf instance-id {
      type uint8 {
        range "0 .. 31";
      }
      description
        "OSPFv3 instance ID.";
    }

    uses interface-common-config;
    uses interface-physical-link-config;
  }

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

    leaf interface-id {
      type uint16;
      description
        "OSPFv3 interface ID.";
    }

    uses interface-common-operation;
  }

  augment "/rt:routing/rt:control-plane-protocols/"
        + "rt:control-plane-protocol" {
     when "rt:type = 'ospf:ospfv2' or rt:type = 'ospf:ospfv3'"

  grouping af-area-config {
    description
        "This augmentation is only valid for a routing protocol
         instance of OSPF (type 'ospfv2' or 'ospfv3').";
    }
    description
      "OSPF augmentation.";

    container ospf {
      description
        "OSPF.";

      uses ospf-config;
      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-config; address-family specific area config state.";

    container areas ranges {
      description "All areas."; "Container for summary ranges";

      list area range {
        key "area-id"; "prefix";
        description
              "List of OSPF areas";
          "Summarize routes matching address/mask
           (Area Border Routers (ABRs) only)";
        leaf area-id prefix {
          type area-id-type; inet:ip-prefix;
          description
                "Area ID.";
            "IPv4 or IPv6 prefix";
        }

            uses area-config;

            container virtual-links {
              when "../area-id = '0' and "
                 + "../area-type = 'ospf:normal'"
        leaf advertise {
          type boolean;
          description
                  "Virutal links must be in backbone area.";
            "Advertise or hide.";
        }
              description "All virtual links.";
              list virtual-link {
                key "transit-area-id router-id";
                description
                  "OSPF virtual link";
        leaf transit-area-id cost {
          type leafref {
                    path "../../../area-id";
                  }
                  must ".!='0.0.0.0'" uint24 {
                    error-message "Virtual link transit area must "
                                + "be non-zero.";
                    description
                      "Virtual-link trasit area must be non-zero area.";
            range "0..16777214";
          }
          description
                    "Virtual link tranist area ID.";
            "Advertised cost of summary route.";
        }
                leaf router-id {
                  type yang:dotted-quad;
                  description
                    "Virtual Link remote endpoint router ID.";
      }

                uses virtual-link-config;
    }
  }
            container sham-links {
              description "All sham links.";
              list sham-link

  grouping area-common-config {
                key "local-id remote-id";
    description
      "OSPF sham link"; area common configuration state.";

    leaf local-id summary {
      when "../area-type = 'ospf:stub' or "
         + "../area-type = 'ospf:nssa'" {
        description
          "Summary advertisement into the stub/NSSA area.";
      }
      type inet:ip-address; boolean;
      description
                    "Address of
        "Enable/Disable summary advertisement into the local Sham Link endpoint."; stub or
         NSSA area.";
    }
    leaf remote-id default-cost {
      when "../area-type = 'ospf:stub' or "
         + "../area-type = 'ospf:nssa'" {
                  type inet:ip-address;
          description
                    "Address of
            "Cost for LSA default route advertised into the remote Sham Link endpoint.";
             stub or NSSA area.";
      }
                uses sham-link-config;
      type uint32 {
        range "1..16777215";
      }
      description
        "Set the summary default route cost for a
         stub or NSSA area.";
    }
            container interfaces
  }

  grouping area-config {
    description "All interfaces.";
              list interface
      "OSPF area configuration state.";

    container all-interfaces-inherit {
                key "name";
      if-feature interface-inheritance;
      description
                  "List of OSPF interfaces.";
                leaf name
        "Inheritance for all interfaces";
      container interface {
                  type if:interface-ref;
        description
          "Interface name.";
                }
                uses interface-config;
              } // list of config to be inherited by all
           interfaces in the area.";
      }
    } // list of areas

        }
      } // list of instance

    leaf area-type {
      type identityref {
        base area-type;
      } // container ospf
      default normal;
      description
        "Area type.";
    }

  augment "/rt:routing/rt:control-plane-protocols/"
        + "rt:control-plane-protocol/ospf:ospf/ospf:instance"

    uses area-common-config;

    uses af-area-config {
      when "../../rt:type = 'ospf:ospfv2' or
          ../../rt:type "../../../operation-mode = 'ospf:ospfv3'" "
         + "'ospf:ships-in-the-night'" {
        description
        "This augmentation is only valid for OSPF
        (type 'ospfv2' or 'ospfv3').";
          "Ships in the night configuration.";
      }
    if-feature multi-topology;
    }
  }
  grouping area-operation {
    description
      "OSPF multi-topology instance configuration
       state augmentation."; area operation state.";

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

    container database {
      description "Area scope LSA database.";
      list topology area-scope-lsa-type {
        // Topology must be in the same routing-instance
        //  and of same AF as the container.
        key "name"; "lsa-type";
        description "OSPF topology."; "List OSPF area scope LSA databases.";
        leaf name lsa-type {
          type leafref {
            path "../../../../../../../rt:ribs/rt:rib/rt:name";
          } uint16;
          description "RIB"; "OSPF area scope LSA type.";
        }

        uses multi-topology-config;
        container areas area-scope-lsas {
          description
            "All areas in the topology.";
          list area scope LSAs of an area scope
             LSA type.";
          list area-scope-lsa {
            key "area-id"; "lsa-id adv-router";
            description "List of OSPF areas";
            leaf area-id area scope LSAs";
            uses lsa-key;
            uses lsa {
              refine "version/ospfv2/ospfv2" {
                must "../../../../../../../../../"
                   + "rt:type = 'ospf:ospfv2'" {
              type area-id-type;
                  description
                "Area ID."; "OSPFv2 LSA.";
                }
            uses multi-topology-area-config;
              }
              refine "version/ospfv3/ospfv3" {
                must "../../../../../../../../../"
                   + "rt:type = 'ospf:ospfv3'" {
                  description "OSPFv3 LSA.";
                }
              }
            }
          }
        }

  augment "/rt:routing/rt:control-plane-protocols/"
        + "rt:control-plane-protocol/ospf:ospf/ospf:instance/"
        + "ospf:areas/ospf:area/ospf:interfaces/ospf:interface"
      } // list area-scope-lsas
    }
  }

  grouping local-rib {
    description "Local-rib grouping.";
    container local-rib {
      description "Local-rib.";
      list route {
    when "../../../../../../rt:type = 'ospf:ospfv2'"
        key "prefix";
        description "Routes";
        leaf prefix {
          type inet:ip-prefix;
          description
        "This augmentation is only valid for OSPFv2."; "Destination prefix.";
        }
    if-feature ospf:multi-topology;
    description
      "OSPF multi-topology interface configuration state
       augmentation.";
        container topologies next-hops {
          description "All topologies next hops for the interface."; route.";
          list topology next-hop {
            key "name"; "next-hop";
            description "OSPF interface topology."; "List of next hop for the route";
            leaf name outgoing-interface {
              type leafref {
            path "../../../../../../../../../../../"
               + "rt:ribs/rt:rib/rt:name";
          } if:interface-ref;
              description
            "One
                "Name of the topologies enabled on this outgoing interface.";
            }

        uses multi-topology-interface-config;
            leaf next-hop {
             type inet:ip-address;
             description "Nexthop address.";
            }
          }
        }

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

  augment "/rt:routing-state/"
        + "rt:control-plane-protocols/rt:control-plane-protocol" {

    when "rt:type = 'ospf:ospfv2' or "
       + "rt:type = 'ospf:ospfv3'"
        leaf route-tag {
          type uint32;
          description
        "This augmentation is only valid "Route tag for a routing protocol
         instance of type 'ospfv2' or 'ospfv3'."; this route.";
        }
      }
    }
  }

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

    container ospf all-areas-inherit {
      if-feature area-inheritance;
      description "OSPF";

      uses ospf-config;
      uses ospf-operation;

      list instance
        "Inheritance for all areas.";
      container area {
        key "af";
        description
          "An OSPF routing protocol instance.";
          "Area config to be inherited by all areas.";
      }
      container interface {
        description
          "Interface config to be inherited by all interfaces
           in all areas.";
      }
    }

    leaf af explicit-router-id {
      if-feature explicit-router-id;
      type identityref {
            base rt:address-family;
          } yang:dotted-quad;
      description
            "Address-family of
        "Defined in RFC 2328. A 32-bit number
         that uniquely identifies the instance."; router.";
    }

        uses instance-config;
        uses instance-operation;

    container areas admin-distance {
      description "All areas";
          list area "Admin distance config state.";
      choice scope {
            key "area-id";
        description "List of OSPF areas";
          "Options for expressing admin distance
           as single or multiple values.";
        case single-value {
          leaf area-id all {
            type area-id-type; uint8;
            description "Area ID.";
              "Admin distance for intra-area, inter-area and
               external routes.";
          }

            uses area-config;
            uses area-operation;

            container virtual-links
        }
        case multi-values {
              description "All virtual links.";
              list virtual-link
          choice granularity {
            description
                  "OSPF virtual link";
              "Options for expressing admin distance
               for intra-area and inter-area routes.";
            case detail {
              leaf transit-area-id intra-area {
                type leafref {
                    path "../../../area-id";
                  } uint8;
                description
                    "Virutal link transit area ID.";
                  "Admin distance for intra-area routes.";
              }
              leaf router-id inter-area {
                type yang:dotted-quad; uint8;
                description
                    "Virtual link router ID.";
                }

                uses virtual-link-config;
                uses virtual-link-operation;
                  "Admin distance for inter-area routes.";
              }
            }
            container sham-links {
              description "All sham links.";
              list sham-link
            case coarse {
                description
                  "OSPF sham link";
              leaf local-id internal {
                type inet:ip-address; uint8;
                description
                    "Address of the local Sham Link endpoint.";
                  "Admin distance for both intra-area and
                   inter-area routes.";
              }
            }
          }
          leaf remote-id external {
            type inet:ip-address; uint8;
            description
                    "Address of the remote Sham Link endpoint.";
              "Admin distance for external routes.";
          }
        }
                uses sham-link-config;
                uses sham-link-operation;
      }
    }

    container interfaces {
              description "All interfaces in the area.";
              list interface nsr {
                key "name";
      if-feature nsr;
      description
                  "List of OSPF interfaces.";
        "Non-Stop Routing (NSR) config state.";
      leaf name enable {
                  // Should it refer to config state leaf?
        type if:interface-ref; boolean;
        description "Interface name.";
                }
                uses interface-config;
                uses interface-operation;
              } // list of OSPF interfaces
            }
          } // list of OSPF areas
        }
          "Enable/Disable NSR.";
      } // list of instances
    } //

    container ospf
  }

  augment "/rt:routing-state/"
        + "rt:control-plane-protocols/rt:control-plane-protocol/"
        + "ospf:ospf/ospf:instance" graceful-restart {
    when "../../rt:type = 'ospf:ospfv2'"
      if-feature graceful-restart;
      description
        "Graceful restart config state.";
      leaf enable {
        type boolean;
        description
          "Enable/Disable graceful restart as defined in RFC 3623
           for OSPFv2 and RFC 5187 for OSPFv3.";
      }
      leaf helper-enable {
        type boolean;
        description
        "This augmentation is only valid
          "Enable graceful restart helper support for OSPFv2."; restarting
           routers (RFC 3623 Section 3).";
      }
    if-feature multi-topology;
    description
      "OSPF multi-topology instance operation state
       augmentation.";
    container topologies
      leaf restart-interval {
      description "All topologies.";
      list topology
        type uint16 {
          range "1..1800";  // Topology must be Range is defined in the same routing-instance RFC 3623.
        }
        units seconds;
        default "120";  // and of same AF as the container.
        key "name"; Default is defined in RFC 3623.
        description "OSPF topology.";
          "Interval in seconds to attempt graceful restart prior
           to failing (RFC 3623 Section B.1)";
      }
      leaf name helper-strict-lsa-checking {
        type leafref {
            path "../../../../../../../"
               + "rt:ribs/rt:rib/rt:name";
          } boolean;
        description "RIB";
          "Terminate graceful restart when an LSA topology change
           is detected (RFC 3623 Section B.2).";
      }

        uses multi-topology-config;
        uses multi-topology-operation;

        container areas
    }

    leaf enable {
      if-feature admin-control;
      type boolean;
      default true;
      description "All areas in
        "Enable/Disable the topology.";
          list area protocol.";
    }

    container auto-cost {
            key "area-id";
      if-feature auto-cost;
      description
              "List of OSPF areas";
        "Interface Auto-cost configuration state.";
      leaf area-id enable {
        type area-id-type; boolean;
        description
                "Area ID.";
            }
            uses multi-topology-area-config;
            uses multi-topology-area-operation;
          }
        }
      }
    }
          "Enable/Disable interface auto-cost.";
      }

  augment "/rt:routing-state/"
        + "rt:control-plane-protocols/rt:control-plane-protocol/"
        + "ospf:ospf/ospf:instance/ospf:areas/ospf:area/"
        + "ospf:interfaces/ospf:interface"
      leaf reference-bandwidth {
        when "../../../../../../rt:type "../enable = 'ospf:ospfv2'" 'true'" {
          description
        "This augmentation "Only when auto cost is only valid for OSPFv2."; enabled";
        }
    if-feature ospf:multi-topology;
    description
      "OSPF multi-topology interface operation state
       augmentation.";
    container topologies
        type uint32 {
          range "1..4294967";
        }
        units Mbits;
        description "All topologies.";
      list topology
          "Configure reference bandwidth used to automatically
           determine interface cost (Mbits). The cost is the
           reference bandwidth divided by the interface speed
           with 1 being the minimum cost.";

      }
    }

    container spf-control {
        key "name";
        description "OSPF interface topology.";
      leaf name paths {
        if-feature max-ecmp;
        type leafref uint16 {
            path "../../../../../../../../../../../"
               + "rt:ribs/rt:rib/rt:name";
          range "1..32";
        }
        description
            "One
          "Maximum number of the topologies enabled on this interface.";
        }
        uses multi-topology-interface-config;
        uses multi-topology-interface-operation;
      } Equal-Cost Multi-Path (ECMP) paths.";
      }
      description "SPF calculation control.";
    }

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

    container database-control {
    when "../../../../../../rt:type = 'ospf:ospfv3'"
      leaf max-lsa {
        if-feature max-lsa;
        type uint32 {
          range "1..4294967294";
        }
        description
        "This augmentation is only valid for OSPFv3.";
          "Maximum number of LSAs OSPF the router will accept.";
      }
      description
      "OSPFv3 interface specific operation state
       augmentation.";
    uses ospfv3-interface-config;
    uses ospfv3-interface-operation; "Database maintenance control.";
    }

  grouping route-content

    container stub-router {
      if-feature stub-router;
      description
      "This grouping defines OSPF-specific route attributes.";
    leaf "Set maximum metric configuration";

      choice trigger {
      type uint32;
        description "OSPF route metric.";
    }
    leaf tag
          "Specific triggers which will enable stub
           router state.";
        container always {
      type uint32;
      default "0";
          presence
            "Enables unconditional stub router support";
          description "OSPF route tag.";
            "Unconditional stub router state (advertise
             transit links with max metric";
        }
    leaf route-type {
      type route-type;
      description "OSPF route type";
      }
    }

  augment "/rt:routing-state/"
        + "rt:ribs/rt:rib/rt:routes/rt:route"

    container mpls {
    when "rt:source-protocol = 'ospf:ospfv2' or "
       + "rt:source-protocol = 'ospf:ospfv3'"
      description
        "OSPF MPLS config state.";

      container te-rid {
        if-feature te-rid;
        description
        "This augmentation is only valid
          "Stable OSPF Router IP Address used for a routes whose Traffic
           Engineering (TE)";
        choice source protocol is OSPF.";
    }
    description
      "OSPF-specific route attributes.";
    uses route-content;
  }

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

    /*
     * TBD:
     * Need to define a way to reference routing-instance.
     */ specifying TE router ID.";
          case interface {
            leaf routing-instance interface {
              type string; if:interface-ref;
              description
        "Describe
                "Use the routing instance."; interface's IPv4 address as TE
                 router ID.";
            }
          }
          case explicit {
            leaf routing-protocol-type router-id {
              type leafref {
        path "/rt:routing/rt:control-plane-protocols/"
           + "rt:control-plane-protocol/rt:type";
      }
      must ". = 'ospf:ospfv2' or . = 'ospf:ospfv3'" { inet:ipv4-address;
              description "Only applies to
                "Explicitly configure the OSPF routing protocol."; TE router ID.";
            }
          }
        }
      }
      container ldp {
        description
          "OSPF routing protocol type (OSPFv2 or OSPFv3).";
    } MPLS LDP config state.";
        leaf routing-protocol-name igp-sync {
          if-feature ldp-igp-sync;
          type leafref {
        path "/rt:routing/"
           + "rt:control-plane-protocols/rt:control-plane-protocol"
           + "[rt:type=current()/../routing-protocol-type]/"
           + "rt:name";
      } boolean;
          description
       "OSPF routing protocol instance name.";
            "Enable LDP IGP synchronization.";
        }
        leaf af autoconfig {
          if-feature ldp-igp-autoconfig;
          type leafref {
        path "/rt:routing/"
           + "rt:control-plane-protocols/rt:control-plane-protocol"
           + "[rt:name=current()/../routing-protocol-name]"
           + "[rt:type=current()/../routing-protocol-type]/"
           + "ospf:ospf/ospf:instance/af";
      } boolean;
          description
        "Address family of the OSPF instance.";
            "Enable LDP IGP interface auto-configuration.";
        }
      }
    }
    uses instance-fast-reroute-config;
  }

  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 instance-operation {
    description "Normal interface.";
      "OSPF Address Family operation state.";

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

    uses local-rib;

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

    container virtual-link database {
      description "virtual-link.";
        leaf transit-area-id "AS scope LSA database.";
      list as-scope-lsa-type {
          type area-id-type;
        key "lsa-type";
        description "Area ID.";
        } "List OSPF AS scope LSA databases.";
        leaf neighbor-router-id lsa-type {
          type yang:dotted-quad; uint16;
          description "Neighbor Router ID.";
        } "OSPF AS scope LSA type.";
        }
        container sham-link as-scope-lsas {
          description "sham-link.";
        leaf area-id "All AS scope of LSA of this LSA type.";
          list as-scope-lsa {
          type area-id-type;
            key "lsa-id adv-router";
            description "Area ID.";
        }
        leaf local-ip-addr "List of OSPF area scope LSAs";
            uses lsa-key;
            uses lsa {
              refine "version/ospfv2/ospfv2" {
                must "../../../../../../../rt:type = "
                   + "'ospf:ospfv2'" {
          type inet:ip-address;
                  description "Sham link local address."; "OSPFv2 LSA.";
                }
        leaf remote-ip-addr
              }
              refine "version/ospfv3/ospfv3" {
                must "../../../../../../../rt:type = "
                   + "'ospf:ospfv3'" {
          type inet:ip-address;
                  description "Sham link remote address."; "OSPFv3 LSA.";
                }
              }
            }
          }
        }
      } // list as-scope-lsas
    }
  }
  grouping notification-neighbor ospf-config {
    description
      "This grouping provides the neighbor information
       for the notifications.";

    leaf neighbor-router-id
      "OSPF top configuration state.";

    container all-instances-inherit {
      type yang:dotted-quad;
      if-feature instance-inheritance;
      description "Neighbor Router ID.";
    }
    leaf neighbor-ip-addr
        "Inheritance support to all instances.";
      container area {
      type yang:dotted-quad;
        description "Neighbor address.";
    }
          "Area config to be inherited by all areas
           in all instances.";
      }

  notification if-state-change {
    uses notification-instance-hdr;
    uses notification-interface;

    leaf state
      container interface {
      type if-state-type;
        description
          "Interface state."; config to be inherited by all
           interfaces in all instances.";
      }
    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 operation-mode {
      type yang:dotted-quad;
      description "Source address.";
    }

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

    leaf error {
      type enumeration {
        enum "badVersion" {
          description "Bad version.";
  }
        enum "areaMismatch"

  grouping ospf-operation {
    description "Area mistmatch.";
      "OSPF top operation state.";
  }
        enum "unknownNbmaNbr"

  grouping multi-topology-area-common-config {
    description "Unknown NBMA neighbor.";
        }
        enum "unknownVirtualNbr"
      "OSPF multi-topology area common configuration state.";
    leaf summary {
          description "Unknown virtual link neighbor.";
        }
        enum "authTypeMismatch"
      when "../../../../../areas/area[area-id=current()/../area-id]/"
         + "area-type = 'ospf:stub' or "
         + "../../../../../areas/area[area-id=current()/../area-id]/"
         + "area-type = 'ospf:nssa'" {
        description "Auth type mismatch.";
          "Summary advertisement into the stub/NSSA area.";
      }
        enum "authFailure" {
      type boolean;
      description "Auth failure.";
        "Enable/Disable summary advertisement into the
         topology in the stub or NSSA area.";
    }
        enum "netMaskMismatch"
    leaf default-cost {
          description "Network mask mismatch.";
        }
        enum "helloIntervalMismatch"
      when "../../../../../areas/area[area-id=current()/../area-id]/"
         + "area-type = 'ospf:stub' or "
         + "../../../../../areas/area[area-id=current()/../area-id]/"
         + "area-type = 'ospf:nssa'" {
        description "Hello interval mismatch.";
          "Cost for LSA default route advertised into the
           topology into the stub or NSSA area.";
      }
        enum "deadIntervalMismatch"
      type uint32 {
          description "Dead interval mismatch.";
        range "1..16777215";
      }
        enum "optionMismatch" {
      description "Option mismatch.";
        "Set the summary default route cost for a
         stub or NSSA area.";
    }
        enum "mtuMismatch" {
          description "MTU mismatch.";
  }
        enum "duplicateRouterId"

  grouping multi-topology-area-config {
    description "Duplicate router ID.";
        }
        enum "noError"
      "OSPF multi-topology area configuration state.";

    uses multi-topology-area-common-config;

    uses af-area-config {
      when "../../../../../operation-mode = "
         + "'ospf:ships-in-the-night'" {
        description "No error.";
        }
          "Ships in the night configuration.";
      }
      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

  grouping multi-topology-area-operation {
      type nbr-state-type;
    description "Neighbor
      "OSPF multi-topology area operation state.";
  }

  grouping multi-topology-config {
    description
      "This notification is sent when neighbor
       state change is detected.";
      "OSPF multi-topology configuration state.";
  }
  notification nbr-restart-helper-status-change

  grouping multi-topology-operation {
    description
      "OSPF multi-topology operation state.";

    uses notification-instance-hdr;
    uses notification-interface;
    uses notification-neighbor;

    leaf status local-rib;
  }

  grouping multi-topology-interface-config {
      type restart-helper-status-type;
    description "Restart helper status.";
    }
      "OSPF multi-topology configuration state.";

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

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

  grouping multi-topology-interface-operation {
    description
      "This notification is sent when a neighbor restart
       helper status change is detected.";
      "OSPF multi-topology operation state.";
  }

  notification if-rx-bad-packet

  grouping ospfv3-interface-config {
    uses notification-instance-hdr;
    uses notification-interface;
    description
      "OSPFv3 interface specific configuration state.";

    leaf packet-source instance-id {
      type yang:dotted-quad; uint8 {
        range "0 .. 31";
      }
      description "Source address.";
        "OSPFv3 instance ID.";
    }
  }

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

    leaf packet-type interface-id {
      type packet-type; uint16;
      description "OSPF packet type.";
        "OSPFv3 interface ID.";
    }
  }

  augment "/rt:routing/rt:control-plane-protocols/"
        + "rt:control-plane-protocol" {
     when "rt:type = 'ospf:ospfv2' or rt:type = 'ospf:ospfv3'" {
      description
        "This notification is sent when an OSPF packet that
       cannot be parsed augmentation is received on an only valid for a routing protocol
         instance of OSPF interface."; (type 'ospfv2' or 'ospfv3').";
    }
  notification lsdb-approaching-overflow
    description "OSPF augmentation.";

    container ospf {
      description
        "OSPF.";

      uses notification-instance-hdr; ospf-config;

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

        leaf ext-lsdb-limit af {
          type uint32; identityref {
            base rt:address-family;
          }
          description
        "The maximum number
            "Address-family of non-default AS-external LSAs
         entries that can be stored in the link state database."; instance.";
        }

        uses instance-config;

        container areas {
          description
      "This notification is sent when the number "All areas.";
          list area {
            key "area-id";
            description
              "List of LSAs OSPF areas";
            leaf area-id {
              type area-id-type;
              description
                "Area ID.";
            }

            uses area-config;

            container virtual-links {
              when "../area-id = '0' and "
                 + "../area-type = 'ospf:normal'" {
                description
                  "Virutal links must be in the router's link state database has exceeded
       ninety percent of the ext-lsdb-limit."; backbone area.";
                }

  notification lsdb-overflow
              description "All virtual links.";
              list virtual-link {
    uses notification-instance-hdr;
                key "transit-area-id router-id";
                description
                  "OSPF virtual link";
                leaf ext-lsdb-limit transit-area-id {
                  type uint32; leafref {
                    path "../../../area-id";
                  }
                  must ".!='0.0.0.0'" {
                    error-message "Virtual link transit area must "
                                + "be non-zero.";
                    description
        "The maximum number of non-default AS-external LSAs
         entries that can
                      "Virtual-link trasit area must be stored in the link state database."; non-zero area.";
                  }
                  description
      "This notification is sent when the number of LSAs
       in the router's
                    "Virtual link state database has exceeded
       ext-lsdb-limit."; tranist area ID.";
                }

  notification nssa-translator-status-change {
    uses notification-instance-hdr;
                leaf area-id router-id {
                  type area-id-type; yang:dotted-quad;
                  description "Area
                    "Virtual Link remote endpoint router ID.";
                }

                uses virtual-link-config;
              }
            }
            container sham-links {
              if-feature pe-ce-protocol;
              description "All sham links.";
              list sham-link {
                key "local-id remote-id";
                description
                  "OSPF sham link";
                leaf status local-id {
                  type nssa-translator-state-type;
      description
        "NSSA translator status.";
    } inet:ip-address;
                  description
      "This notification is sent when there is a change
       in
                    "Address of the router's role in translating OSPF NSSA LSAs
       to OSPF AS-External LSAs."; local Sham Link endpoint.";
                }

  notification restart-status-change {
    uses notification-instance-hdr;
                leaf status remote-id {
                  type restart-status-type; inet:ip-address;
                  description
        "Restart status.";
                    "Address of the remote Sham Link endpoint.";
                }

    leaf restart-interval
                uses sham-link-config;
              }
            }
            container interfaces {
      type uint16
              description "All interfaces.";
              list interface {
        range "1..1800";
      }
      units seconds;
      default "120";
                key "name";
                description
        "Restart interval.";
    }
                  "List of OSPF interfaces.";
                leaf exit-reason name {
                  type restart-exit-reason-type;
      description
        "Restart exit reason.";
    } if:interface-ref;
                  description
      "This notification is sent when the graceful restart
       state for the router has changed.";
                    "Interface name.";
                }
                uses interface-config;
              }
<CODE ENDS>

6.  OSPF Segment Routing Yang Module

   <CODE BEGINS> file "ietf-ospf-sr@2016-07-07.yang"
   module ietf-ospf-sr {
     namespace "urn:ietf:params:xml:ns:yang:ietf-ospf-sr";

     prefix ospf-sr;

     import ietf-inet-types {
       prefix "inet"; // list of interfaces
            }
     import ietf-yang-types {
       prefix "yang";
          }

     import ietf-routing {
       prefix "rt"; // list of areas
        }
     import ietf-segment-routing {
       prefix "sr";
      }
     import ietf-ospf {
       prefix "ospf"; // list of instance
    }

     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>"; // container ospf
  }

  augment "/rt:routing/rt:control-plane-protocols/"
        + "rt:control-plane-protocol/ospf:ospf/ospf:instance" {
    when "../../rt:type = 'ospf:ospfv2' or
          ../../rt:type = 'ospf:ospfv3'" {
      description
        "This YANG module defines the generic configuration
        and operational state for OSPF Segment Routing, which is
        common across all of the vendor implementations. It augmentation is
        intended that the module will be extended by vendors to
        define vendor-specific only valid for OSPF Segment Routing
        (type 'ospfv2' or 'ospfv3').";
    }
    if-feature multi-topology;
    description
      "OSPF multi-topology instance configuration
       state augmentation.";
    container topologies {
      description "All topologies.";
      list topology {
        // Topology must be in the same routing-instance
        //  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-07-07 of same AF as the container.
        key "name";
        description "OSPF topology.";
        leaf name {
          type leafref {
            path "../../../../../../../rt:ribs/rt:rib/rt:name";
          }
          description
         "* Change routing-protocol to control-plane-protocol.";
       reference
         "RFC XXXX: A YANG Data Model for OSPF Segment Routing."; "RIB";
        }

     revision 2016-03-20

        uses multi-topology-config;

        container areas {
          description
         "* Remove routing-instance.";
       reference
         "RFC XXXX: A YANG Data Model for OSPF Segment Routing.";
     }

     revision 2015-10-19 "All areas in the topology.";
          list area {
            key "area-id";
            description
         "* Add per-protocol SRGB support.
          * Editorial changes.";
       reference
         "RFC XXXX: A YANG Data Model for
              "List of OSPF Segment Routing."; areas";
            leaf area-id {
              type area-id-type;
              description
                "Area ID.";
            }

     revision 2015-09-02
            uses multi-topology-area-config;
          }
        }
      }
    }
  }

  augment "/rt:routing/rt:control-plane-protocols/"
        + "rt:control-plane-protocol/ospf:ospf/ospf:instance/"
        + "ospf:areas/ospf:area/ospf:interfaces/ospf:interface" {
    when "../../../../../../rt:type = 'ospf:ospfv2'" {
      description
         "* Author list update.
          * Editorial changes.";
       reference
         "RFC XXXX: A YANG Data Model
        "This augmentation is only valid for OSPF Segment Routing."; OSPFv2.";
    }

     revision 2015-07-06
    if-feature ospf:multi-topology;
    description
      "OSPF multi-topology interface configuration state
       augmentation.";
    container topologies {
      description
         "Initial revision.";
       reference
         "RFC XXXX: A YANG Data Model "All topologies for OSPF Segment Routing.";
     }

     feature ti-lfa the interface.";
      list topology {
        key "name";
        description
         "Topology-Independent Loop-Free Alternate (TI-LFA)
          computation using segment routing."; "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;
      }
    }
  }

     /* Configuration */

  augment "/rt:routing/rt:control-plane-protocols" "/rt:routing/rt:control-plane-protocols/"
        + "/rt:control-plane-protocol/ospf:ospf/ospf:instance" "rt:control-plane-protocol/ospf:ospf/ospf:instance/"
        + "ospf:areas/ospf:area/ospf:interfaces/ospf:interface" {
    when "../../rt:type = 'ospf:ospfv2' or "
          + "../../rt:type "../../../../../../rt:type = 'ospf:ospfv3'" {
      description
        "This augments the OSPF routing protocol when used."; augmentation is only valid for OSPFv3.";
    }
    description
         "This augments the OSPF protocol
      "OSPFv3 interface specific configuration
          with segment routing.";
       uses sr:controlplane-cfg;
       container protocol-srgb {
         if-feature sr:protocol-srgb; state
       augmentation.";
    uses sr:srgb-cfg;
         description
           "Per-protocol SRGB.";
       } ospfv3-interface-config;
  }

  augment "/rt:routing/rt:control-plane-protocols/"
           + "rt:control-plane-protocol/ospf:ospf/ospf:instance/" "/rt:routing-state/"
        + "ospf:areas/ospf:area/ospf:interfaces/ospf:interface" "rt:control-plane-protocols/rt:control-plane-protocol" {
    when "../../../../../../rt:type "rt:type = 'ospf:ospfv2' or "
       + "../../../../../../rt:type "rt:type = 'ospf:ospfv3'"  {
      description
        "This augments the augmentation is only valid for a routing protocol
         instance of type 'ospfv2' or 'ospfv3'.";
    }
    description
         "OSPF operational state.";
    container ospf {
      description "OSPF";

      uses ospf-config;
      uses ospf-operation;

      list instance {
        key "af";
        description
          "An OSPF interface configuration
            when used."; routing protocol instance.";

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

        uses instance-config;
        uses instance-operation;

        container areas {
          description "All areas";
          list area {
            key "area-id";
            description "List of OSPF protocol interface
          configuration with segment routing."; areas";
            leaf area-id {
              type area-id-type;
              description "Area ID.";
            }

            uses sr:igp-interface-cfg; area-config;
            uses area-operation;

            container virtual-links {
              description "All virtual links.";
              list virtual-link {
                description
                  "OSPF virtual link";
                leaf transit-area-id {
                  type leafref {
                    path "../../../area-id";
                  }
     augment "/rt:routing/rt:control-plane-protocols/"
           + "rt:control-plane-protocol/ospf:ospf/ospf:instance/"
           + "ospf:areas/ospf:area/ospf:interfaces/ospf:interface/"
           + "ospf:fast-reroute"
                  description
                    "Virutal link transit area ID.";
                }
                leaf router-id {
                  type yang:dotted-quad;
                  description
                    "Virtual link router ID.";
                }

                uses virtual-link-config;
                uses virtual-link-operation;
              }
            }
            container sham-links {
              description "All sham links.";
              list sham-link {
       when "../../../../../../../rt:type = 'ospf:ospfv2' or "
          + "../../../../../../../rt:type = 'ospf:ospfv3'"
                description
                  "OSPF sham link";
                leaf local-id {
                  type inet:ip-address;
                  description
           "This augments
                    "Address of the OSPF routing protocol when used."; local Sham Link endpoint.";
                }
       description
         "This augments the OSPF protocol IP-FRR with TI-LFA.";

       container ti-lfa {
         if-feature ti-lfa;
                leaf enable remote-id {
                  type boolean; inet:ip-address;
                  description
            "Enables TI-LFA computation.";
                    "Address of the remote Sham Link endpoint.";
                }
         description
           "Topology Independent Loop Free Alternate
            (TI-LFA) support.";
                uses sham-link-config;
                uses sham-link-operation;
              }

            }

     /* Operational states */

     augment "/rt:routing-state/"
           + "rt:control-plane-protocols/rt:control-plane-protocol/"
           + "ospf:ospf/ospf:instance" {
       when "../../rt:type = 'ospf:ospfv2' or "
          + "../../rt:type = 'ospf:ospfv3'"

            container interfaces {
              description
           "This augments "All interfaces in the OSPF routing protocol when used.";
       } area.";
              list interface {
                key "name";
                description
        "This augments the
                  "List of OSPF protocol operational interfaces.";
                leaf name {
                  // Should it refer to config state
         with segment routing."; leaf?
                  type if:interface-ref;
                  description "Interface name.";
                }

                uses sr:controlplane-cfg;
       container protocol-srgb {
         if-feature sr:protocol-srgb; interface-config;
                uses sr:srgb-cfg;
         description
           "Per-protocol SRGB."; interface-operation;
              } // list of OSPF interfaces
            }
          } // list of OSPF areas
        }
      } // list of instances
    } // container ospf
  }

  augment "/rt:routing-state/"
        + "rt:control-plane-protocols/rt:control-plane-protocol/"
        + "ospf:ospf/ospf:instance/ospf:areas/ospf:area/"
           + "ospf:interfaces/ospf:interface" "ospf:ospf/ospf:instance" {
    when "../../../../../../rt:type = 'ospf:ospfv2' or "
          + "../../../../../../rt:type "../../rt:type = 'ospf:ospfv3'" 'ospf:ospfv2'" {
      description
        "This augments the OSPF routing protocol when used."; augmentation is only valid for OSPFv2.";
    }
    if-feature multi-topology;
    description
        "This augments the OSPF protocol interface
         operational
      "OSPF multi-topology instance operation state with segment routing.";

       uses sr:igp-interface-cfg;
     }

     /* Database */

     grouping sid-sub-tlv {
       description "SID/Label sub-TLV grouping.";
       augmentation.";
    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 topologies {
      description "Prefix Segment ID (SID) sub-TLVs.";
       container perfix-sid-sub-tlvs{
         description "Prefix SID sub-TLV."; "All topologies.";
      list prefix-sid-sub-tlv topology {
        // Topology must be in the same routing-instance
        // and of same AF as the container.
        key "name";
        description "Prefix SID sub-TLV."; "OSPF topology.";
        leaf flags name {
          type bits {
               bit NP {
                 description
                   "No-PHP flag.";
               }
               bit M leafref {
                 description
                   "Mapping server flag.";
            path "../../../../../../../"
               + "rt:ribs/rt:rib/rt:name";
          }
               bit E {
          description
                   "Explicit-NULL flag."; "RIB";

        }
               bit V

        uses multi-topology-config;
        uses multi-topology-operation;

        container areas {
          description
                   "Value/Index flag.";
               }
               bit L "All areas in the topology.";
          list area {
            key "area-id";
            description
                   "Local flag.";
               }
             }
             description "Segment Identifier (SID) Flags.";
           }
              "List of OSPF areas";
            leaf mt-id area-id {
              type uint8; area-id-type;
              description "Multi-topology
                "Area ID.";
            }
           leaf algorithm {
             type uint8;
             description
               "The algorithm associated with the prefix-SID.";
            uses multi-topology-area-config;
            uses multi-topology-area-operation;
          }
           leaf sid {
             type uint32;
             description "An index or label.";
        }
      }
    }
  }

     grouping sid-binding-sub-tlvs

  augment "/rt:routing-state/"
        + "rt:control-plane-protocols/rt:control-plane-protocol/"
        + "ospf:ospf/ospf:instance/ospf:areas/ospf:area/"
        + "ospf:interfaces/ospf:interface" {
    when "../../../../../../rt:type = 'ospf:ospfv2'" {
      description "SID/Label binding sub-TLV grouping.";
        "This augmentation is only valid for OSPFv2.";
    }
    if-feature ospf:multi-topology;
    description
      "OSPF multi-topology interface operation state
       augmentation.";
    container sid-binding-sub-tlvs topologies {
      description "SID binding sub-TLVs."; "All topologies.";
      list sid-binding-sub-tlv topology {
        key "name";
        description "SID binding sub-TLV."; "OSPF interface topology.";
        leaf flags name {
          type bits {
               bit M leafref {
            path "../../../../../../../../../../../"
               + "rt:ribs/rt:rib/rt:name";
          }
          description
                   "Mirroring context flag.";
            "One of the topologies enabled on this interface.";

        }
        uses multi-topology-interface-config;
        uses multi-topology-interface-operation;
      }
             description "Flags.";
    }
           leaf mt-id {
             type uint8;
             description "Multi-topology ID.";
  }
           leaf weight

  augment "/rt:routing-state/"
        + "rt:control-plane-protocols/rt:control-plane-protocol/"
        + "ospf:ospf/ospf:instance/ospf:areas/ospf:area/"
        + "ospf:interfaces/ospf:interface" {
    when "../../../../../../rt:type = 'ospf:ospfv3'" {
             type uint8;
      description "Weight
        "This augmentation is only valid for load-balancing purposes."; OSPFv3.";
    }
    description
      "OSPFv3 interface specific operation state
       augmentation.";
    uses sid-sub-tlv;

           container ero-metric-sub-tlv ospfv3-interface-config;
    uses ospfv3-interface-operation;
  }

  grouping route-content {
    description
               "The cost of an Explicit Route Object (ERO) path.";
      "This grouping defines OSPF-specific route attributes.";
    leaf metric {
      type uint32;
      description "The aggregate IGP or TE path cost.";
             } "OSPF route metric.";
    }

           container ipv4-ero-sub-tlv
    leaf tag {
      type uint32;
      default "0";
      description
               "The IPv4 ERO sub-TLV describes a path segment
                using IPv4 address."; "OSPF route tag.";
    }
    leaf flags route-type {
      type bits route-type;
      description "OSPF route type";
    }
  }

  augment "/rt:routing-state/"
        + "rt:ribs/rt:rib/rt:routes/rt:route" {
                 bit L
    when "rt:source-protocol = 'ospf:ospfv2' or "
       + "rt:source-protocol = 'ospf:ospfv3'" {
      description
                     "If set, then the segment path
        "This augmentation is designated as
                      'loose'. Otherwise, the path only valid for a routes whose
         source protocol is 'strict'.";
                 }
               }
               description "ERO Flags."; OSPF.";
    }
             leaf ipv4-address {
               type inet:ipv4-address;
    description "The address of the explicit
      "OSPF-specific route hop.";
             } attributes.";
    uses route-content;
  }
           container unnumbered-ero-sub-tlv

  grouping notification-instance-hdr {
    description "The unnumbered interface ID ERO sub-TLV
     "This group describes common instance specific
      data for notifications.";

    /*
     * TBD:
     * Need to define a path segment that includes an
                          unnumbered interface."; way to reference routing-instance.
     */
    leaf flags routing-instance {
      type bits {
                 bit L { string;
      description
                     "If set, then
        "Describe the segment path is designated as
                      'loose'. Otherwise as 'strict'.";
                 }
               }
               description "ERO Flags."; routing instance.";
    }

    leaf router-id routing-protocol-type {
      type yang:dotted-quad;
               description "Router-id of the next-hop."; leafref {
        path "/rt:routing/rt:control-plane-protocols/"
           + "rt:control-plane-protocol/rt:type";
      }
             leaf interface-id
      must ". = 'ospf:ospfv2' or . = 'ospf:ospfv3'" {
               type uint32;
        description
                 "The identifier assigned "Only applies to the link by the
                  router specified by the router-id.";
             } OSPF routing protocol.";
      }
           container ipv4-backup-ero-sub-tlv {
      description
               "The IPv4 backup ERO sub-TLV describes a path
                segment using IPv4 address.";
       "OSPF routing protocol type (OSPFv2 or OSPFv3).";
    }

    leaf flags routing-protocol-name {
      type bits {
                 bit L leafref {
                   description
                     "If set, then the segment
        path is designated as
                      'loose'. Otherwise as 'strict'.";
                 } "/rt:routing/"
           + "rt:control-plane-protocols/rt:control-plane-protocol"
           + "[rt:type=current()/../routing-protocol-type]/"
           + "rt:name";
      }
      description "Flags.";
       "OSPF routing protocol instance name.";
    }

    leaf ipv4-address af {
      type inet:ipv4-address; leafref {
        path "/rt:routing/"
           + "rt:control-plane-protocols/rt:control-plane-protocol"
           + "[rt:name=current()/../routing-protocol-name]"
           + "[rt:type=current()/../routing-protocol-type]/"
           + "ospf:ospf/ospf:instance/af";
      }
      description "The address
        "Address family of the explicit route hop."; OSPF instance.";
    }
  }
           container unnumbered-backup-ero-sub-tlv

  grouping notification-interface {
    description
               "The unnumbered
      "This grouping provides the interface ID backup ERO sub-TLV
                describes a path segment that includes an
                unnumbered information
       for the notifications.";

    choice if-link-type-selection {
      description
        "Options for link type.";
      container interface {
        description "Normal interface.";
        leaf flags interface {
          type bits {
                 bit L { if:interface-ref;
          description
                     "If set, then the segment path is designated as
                      'loose'. Otherwise, the path is 'strict'."; "Interface.";
        }
      }
      container virtual-link {
        description "Flags.";
             } "virtual-link.";
        leaf router-id transit-area-id {
          type yang:dotted-quad; area-id-type;
          description "Router-id of the next-hop."; "Area ID.";
        }
        leaf interface-id neighbor-router-id {
          type uint32; yang:dotted-quad;
          description
                 "The identifier assigned to the link by the
                 router specified by the router-id.";
             }
           }
         } "Neighbor 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 sham-link {    //type=2?
        description "The range of prefixes."; "sham-link.";
        leaf range-size area-id {
          type uint16; area-id-type;
          description "The number of prefixes covered by the
                          advertisement."; "Area ID.";
        }
        leaf flags local-ip-addr {
          type bits {
               bit IA {
                 description
                   "Inter-Area flag.";
               }
             } inet:ip-address;
          description "Flags."; "Sham link local address.";
        }
        leaf prefix remote-ip-addr {
          type inet:ip-prefix; inet:ip-address;
          description "Address prefix."; "Sham link remote address.";
        }
           uses prefix-sid-sub-tlvs;
           uses sid-binding-sub-tlvs;
           uses ospf:unknown-tlvs;

      }
    }
  }

  grouping sr-algorithm-tlv notification-neighbor {
    description "SR algorithm TLV grouping.";
       container sr-algorithm-tlv
      "This grouping provides the neighbor information
       for the notifications.";

    leaf neighbor-router-id {
      type yang:dotted-quad;
      description "All SR algorithm TLVs.";
         leaf-list sr-algorithm "Neighbor Router ID.";
    }

    leaf neighbor-ip-addr {
      type uint8; yang:dotted-quad;
      description
             "The Segment Routing (SR) algorithms that the router is
              currently using.";
         } "Neighbor address.";
    }
  }

     grouping sid-range-tlvs {
       description "SID Range TLV grouping.";
       container sid-range-tlvs {
         description "List of SID range TLVs.";
         list sid-range-tlv

  notification if-state-change {
           description "SID range TLV.";
    uses notification-instance-hdr;
    uses notification-interface;

    leaf range-size state {
      type ospf:uint24; if-state-type;
      description "The SID range.";
           }
           uses sid-sub-tlv;
         }
       } "Interface state.";
    }
     augment "/rt:routing-state/"
           + "rt:control-plane-protocols/rt:control-plane-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 notification is only valid for OSPFv2."; sent when an interface
      state change is detected.";
  }
       description
         "SR specific TLVs for OSPFv2 extended prefix TLV
          in type 9 opaque LSA.";

  notification if-config-error {
    uses prefix-sid-sub-tlvs; notification-instance-hdr;
    uses sid-binding-sub-tlvs; notification-interface;

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

     augment "/rt:routing-state/"
           + "rt:control-plane-protocols/rt:control-plane-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"

    leaf packet-type {
       when "../../../../../../../../../../../../../../../"
          + "rt:type = 'ospf:ospfv2'"
      type packet-type;
      description "OSPF packet type.";
    }

    leaf error {
      type enumeration {
        enum "badVersion" {
          description "Bad version.";
        }
        enum "areaMismatch" {
          description
           "This augmentation is only valid for OSPFv2."; "Area mistmatch.";
        }
        enum "unknownNbmaNbr" {
          description
         "SR specific TLVs for OSPFv2 extended prefix TLV
          in type 10 opaque LSA.";
       uses prefix-sid-sub-tlvs;
       uses sid-binding-sub-tlvs; "Unknown NBMA neighbor.";
        }

     augment "/rt:routing-state/"
           + "rt:control-plane-protocols/rt:control-plane-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'"
        enum "unknownVirtualNbr" {
          description
           "This augmentation is only valid for OSPFv2."; "Unknown virtual link neighbor.";
        }
        enum "authTypeMismatch" {
          description
         "SR specific TLVs for OSPFv2 extended prefix TLV
          in "Auth type 11 opaque LSA.";
       uses prefix-sid-sub-tlvs;
       uses sid-binding-sub-tlvs; mismatch.";
        }

     augment "/rt:routing-state/"
           + "rt:control-plane-protocols/rt:control-plane-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'"
        enum "authFailure" {
          description
           "This augmentation is only valid for OSPFv2."; "Auth failure.";
        }
       description
         "SR specific TLVs for OSPFv2 extended link TLV
          in type 10 opaque LSA.";

       container adj-sid-sub-tlvs
        enum "netMaskMismatch" {
          description "Adjacency SID optional sub-TLVs.";
         list adj-sid-sub-tlv "Network mask mismatch.";
        }
        enum "helloIntervalMismatch" {
          description "List of Adjacency SID sub-TLVs.";
           leaf flags "Hello interval mismatch.";
        }
        enum "deadIntervalMismatch" {
             type bits
          description "Dead interval mismatch.";
        }
        enum "optionMismatch" {
               bit B
          description "Option mismatch.";
        }
        enum "mtuMismatch" {
          description
                   "Backup flag."; "MTU mismatch.";
        }
               bit V
        enum "duplicateRouterId" {
          description
                   "Value/Index flag."; "Duplicate router ID.";
        }
               bit L
        enum "noError" {
          description
                   "Local/Global flag."; "No error.";
        }
               bit S
      }
      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
                   "Set flag."; "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 "Flags.";
        "Remaining time in current OSPF graceful restart
         interval, if the router is acting as a restart
         helper for the neighbor.";
    }

    leaf mt-id exit-reason {
      type uint8; restart-exit-reason-type;
      description "Multi-topology ID.";
        "Restart helper exit reason.";
    }
           leaf weight {
             type uint8;
    description "Weight used for load-balancing.";
      "This notification is sent when a neighbor restart
       helper status change is detected.";
  }

  notification if-rx-bad-packet {
    uses notification-instance-hdr;
    uses notification-interface;
    leaf sid packet-source {
      type uint32; yang:dotted-quad;
      description "Segment Identifier (SID) index/label.";
           }
         } "Source address.";
    }

       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 packet-type {
      type bits {
               bit B { packet-type;
      description
                   "Backup flag."; "OSPF packet type.";
    }
               bit V {

    description
                   "Value/Index flag.";
      "This notification is sent when an OSPF packet that
       cannot be parsed is received on an OSPF interface.";
  }
               bit L

  notification lsdb-approaching-overflow {
                 description
                   "Local/Global flag.";
               }
               bit S
    uses notification-instance-hdr;

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

    description "Flags.";
      "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 mt-id ext-lsdb-limit {
      type uint8; uint32;
      description "Multi-topology ID.";
        "The maximum number of non-default AS-external LSAs
         entries that can be stored in the link state database.";
    }
           leaf weight {
             type uint8;

    description "Weight used for load-balancing.";
      "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 neighbor-router-id area-id {
      type yang:dotted-quad; area-id-type;
      description "Neighbor router "Area ID.";
    }

    leaf sid status {
      type uint32; nssa-translator-state-type;
      description "Segment Identifier (SID) index/label.";
           }
         }
        "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.";
  }

     augment "/rt:routing-state/"
           + "rt:control-plane-protocols/rt:control-plane-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"

  notification restart-status-change {
       when "../../../../../../../../../../../../../../../"
          + "rt:type = 'ospf:ospfv2'"
    uses notification-instance-hdr;

    leaf status {
         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; restart-status-type;
      description
        "Restart status.";
    }

     augment "/rt:routing-state/"
           + "rt:control-plane-protocols/rt:control-plane-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"

    leaf restart-interval {
       when "../../../../../../../../../../../../../"
          + "rt:type = 'ospf:ospfv2'"
      type uint16 {
         description
           "This augmentation is only valid for OSPFv2.";
        range "1..1800";
      }
      units seconds;
      default "120";
      description
         "SR specific TLVs for OSPFv2 type 10 opaque LSA.";

       uses extended-prefix-range-tlvs;
       uses sr-algorithm-tlv;
       uses sid-range-tlvs;
        "Restart interval.";
    }

     augment "/rt:routing-state/"
           + "rt:control-plane-protocols/rt:control-plane-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'"

    leaf exit-reason {
      type restart-exit-reason-type;
      description
           "This augmentation is only valid for OSPFv2.";
        "Restart exit reason.";
    }

    description
         "SR specific TLVs
      "This notification is sent when the graceful restart
       state for OSPFv2 type 11 opaque LSA.";

       uses extended-prefix-range-tlvs;
       uses sr-algorithm-tlv;
       uses sid-range-tlvs; the router has changed.";
  }

}
<CODE ENDS>

7.

5.  OSPF BFD Yang Module

   <CODE BEGINS> file "ietf-ospf-bfd@2016-07-07.yang" "ietf-ospf-bfd@2016-10-31.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-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>
                   <mailto:derek@arrcus.com>
         Author:   Derek Yeung
                   <mailto:myeung@cisco.com>
                   <mailto:derek@arrcus.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>
                   <mailto:ichen@kuatrotech.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 2016-10-31 {
       description
         "* Update authors information.
          * Rename bfd/enabled to bfd/enable";
       reference
         "RFC XXXX: A YANG Data Model for OSPF BFD.";
     }

     revision 2016-07-07 {
       description
         "* Change routing-protocol to control-plane-protocol.";
       reference
         "RFC XXXX: A YANG Data Model for OSPF BFD.";
     }

     revision 2016-03-20 {
       description
         "* 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.";
     }

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

     }

     /* Configuration */

     augment "/rt:routing/rt:control-plane-protocols/"
           + "rt:control-plane-protocol/ospf:ospf/ospf:instance/"
           + "ospf:areas/ospf:area/ospf:interfaces/ospf:interface" {
       when "../../../../../../rt:type = 'ospf:ospfv2' 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 enable {
           type boolean;
           default false;
           description
             "True if BFD is enabled for the OSPF interface.";
         }
       }
     }

     /* Operational states */

     augment "/rt:routing-state/"
           + "rt:control-plane-protocols/rt:control-plane-protocol/"
           + "ospf:ospf/ospf:instance/ospf:areas/ospf:area/"
           + "ospf:interfaces/ospf:interface" {
       when "../../../../../../rt:type = 'ospf:ospfv2' 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 enable {
           type boolean;
           description
             "True if BFD is enabled for the OSPF interface.";

         }
       }
     }
   }
   <CODE ENDS>

8.

6.  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.

7.  Acknowledgements

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

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

10.

8.  References

10.1.

8.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>.

   [RFC6565]  Pillay-Esnault, P., Moyer, P., Doyle, J., Ertekin, E., and
              M. Lundberg, "OSPFv3 as a Provider Edge to Customer Edge
              (PE-CE) Routing Protocol", RFC 6565, DOI 10.17487/RFC6565,
              June 2012, <http://www.rfc-editor.org/info/rfc6565>.

   [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.

8.2.  Informative References

   [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-01 draft-ietf-bfd-yang-03 (work in
              progress), February July 2016.

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

   [I-D.ietf-rtgwg-yang-key-chain]
              Lindem, A., Qu, Y., Yeung, D., Chen, I., Zhang, Z., and Y.
              Yang, "Routing Key Chain YANG Data Model", draft-ietf-
              rtgwg-yang-key-chain-06 (work in progress), June 2016.

   [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-03
              rtgwg-yang-key-chain-10 (work in progress), July October 2016.

Appendix A.  Contributors' Addreses

   Dean Bogdanovic
   Volta Networks, Inc.

   EMail: dean@voltanet.io

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

   EMail: kkoushik@cisco.com

Authors' Addresses

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

   EMail: myeung@cisco.com derek@arrcus.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

   Ing-Wher Chen
   Kuatro Technologies

   EMail: ivandean@gmail.com

   Kiran Koushik Agrahara Sreenivasa ichen@kuatrotech.com
   Acee Lindem
   Cisco Systems
   12515 Research Blvd, Bldg 4
   Austin, TX  78681
   USA
   301 Midenhall Way
   Cary, NC 27513

   EMail: kkoushik@cisco.com acee@cisco.com