module ietf-ospf {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-ospf";
prefix ospf;
import ietf-inet-types {
prefix "inet";
reference "RFC 6991 - Common YANG Data Types";
}
import ietf-yang-types {
prefix "yang";
reference "RFC 6991 - Common YANG Data Types";
}
import ietf-interfaces {
prefix "if";
reference "RFC 8343 - A YANG Data Model for Interface
Management (NDMA Version)";
}
import ietf-routing-types {
prefix "rt-types";
reference "RFC 8294 - Common YANG Data Types for the
Routing Area";
}
import iana-routing-types {
prefix "iana-rt-types";
reference "RFC 8294 - Common YANG Data Types for the
Routing Area";
}
import ietf-routing {
prefix "rt";
reference "RFC 8349 - A YANG Data Model for Routing
Management (NMDA Version)";
}
import ietf-key-chain {
prefix "key-chain";
reference "RFC 8177 - YANG Data Model for Key Chains";
}
import ietf-bfd-types {
prefix "bfd-types";
reference "RFC YYYY - YANG Data Model for Bidirectional
Forwarding Detection (BFD). Please replace YYYY with
published RFC number for draft-ietf-bfd-yang-17.";
}
organization
"IETF LSR - Link State Routing Working Group";
contact
"WG Web:
WG List:
Editor: Derek Yeung
Author: Acee Lindem
Author: Yingzhen Qu
Author: Jeffrey Zhang
Author: Ing-Wher Chen
Author: Dean Bogdanovic
Author: Kiran Agrahara Sreenivasa
tuple with the sequence number differentiating
LSA instances.";
container header {
must "(derived-from(type, "
+ "'ospfv2-opaque-lsa-type') and "
+ "opaque-id and opaque-type) or "
+ "(not(derived-from(type, "
+ "'ospfv2-opaque-lsa-type')) "
+ "and not(opaque-id) and not(opaque-type))" {
description
"Opaque type and ID only apply to Opaque LSAs.";
}
description
"Decoded OSPFv2 LSA header data.";
leaf option {
type bits {
bit MT {
description
"When set, the router supports multi-topology as
in RFC 4915.";
}
bit DC {
description
"When set, the router supports demand circuits.";
}
bit P {
description
"Only used in type-7 LSA. When set, an NSSA
border router should translate the type-7 LSA
to a type-5 LSA.";
}
bit MC {
description
"When set, the router supports MOSPF.";
}
bit E {
description
"This bit describes the way AS-external LSAs
are flooded.";
}
bit O {
description
"When set, the router is opaque-capable as in
RFC 5250.";
}
bit DN {
description
"When a type 3, 5 or 7 LSA is sent from a PE to a CE,
the DN bit must be set. See RFC 4576.";
}
}
mandatory true;
description "LSA options.";
}
leaf lsa-id {
type yang:dotted-quad;
mandatory true;
description "Link-State ID.";
}
leaf opaque-type {
type uint8;
description "Opaque type.";
}
leaf opaque-id {
type opaque-id;
description "Opaque ID.";
}
uses lsa-header;
}
container body {
description
"Decoded OSPFv2 LSA body data.";
uses ospfv2-lsa-body;
}
}
grouping ospfv3-lsa {
description
"Decoded OSPFv3 LSA.";
container header {
description
"Decoded OSPFv3 LSA header data.";
leaf lsa-id {
type uint32;
mandatory true;
description "OSPFv3 LSA ID.";
}
uses lsa-header;
}
container body {
description
"Decoded OSPF LSA body data.";
uses ospfv3-lsa-body;
}
}
grouping lsa-common {
description
"Common fields for OSPF LSA represenation.";
leaf decoded-completed {
type boolean;
description
"The OSPF LSA body is fully decoded.";
}
leaf raw-data {
type yang:hex-string;
description
"The complete LSA in network byte
order hexadecimal as received or originated.";
}
}
grouping lsa {
description
"OSPF LSA.";
uses lsa-common;
choice version {
description
"OSPFv2 or OSPFv3 LSA body.";
container ospfv2 {
description "OSPFv2 LSA";
uses ospfv2-lsa;
}
container ospfv3 {
description "OSPFv3 LSA";
uses ospfv3-lsa;
}
}
}
grouping lsa-key {
description
"OSPF LSA key.";
leaf lsa-id {
type union {
type yang:dotted-quad;
type uint32;
}
description
"Link-State ID.";
}
leaf adv-router {
type rt-types:router-id;
description
"Advertising router.";
}
}
grouping instance-stat {
description "Per-instance statistics";
leaf originate-new-lsa-count {
type yang:counter32;
description "The number of new LSAs originated.";
}
leaf rx-new-lsas-count {
type yang:counter32;
description "The number of LSAs received.";
}
leaf as-scope-lsa-count {
type yang:gauge32;
description "The number of AS-scope LSAs.";
}
leaf as-scope-lsa-chksum-sum {
type uint32;
description
"The sum of the LSA checksums for AS-scope LSAs.";
}
container database {
description "Container for per AS-scope LSA statistics.";
list as-scope-lsa-type {
description "List of AS-scope LSA statistics";
leaf lsa-type {
type uint16;
description "AS-Scope LSA type.";
}
leaf lsa-count {
type yang:gauge32;
description "The number of LSAs of the LSA type.";
}
leaf lsa-cksum-sum {
type uint32;
description
"The sum of the LSA checksums of the LSA type.";
}
}
}
uses instance-fast-reroute-state;
}
grouping area-stat {
description "Per-area statistics.";
leaf spf-runs-count {
type yang:counter32;
description
"The number of times the intra-area SPF has run.";
}
leaf abr-count {
type yang:gauge32;
description
"The total number of Area Border Routers (ABRs)
reachable within this area.";
}
leaf asbr-count {
type yang:gauge32;
description
"The total number of AS Boundary Routers (ASBRs).";
}
leaf ar-nssa-translator-event-count {
type yang:counter32;
description
"The number of NSSA translator-state changes.";
}
leaf area-scope-lsa-count {
type yang:gauge32;
description
"The number of area-scope LSAs in the area.";
}
leaf area-scope-lsa-cksum-sum {
type uint32;
description "The sum of the area-scope LSAs checksums.";
}
container database {
description "Container for area-scope LSA type statistics.";
list area-scope-lsa-type {
description "List of area-scope LSA statistics";
leaf lsa-type {
type uint16;
description "Area-scope LSA type.";
}
leaf lsa-count {
type yang:gauge32;
description "The number of LSAs of the LSA type.";
}
leaf lsa-cksum-sum {
type uint32;
description
"The sum of the LSA checksums of the LSA type.";
}
}
}
}
grouping interface-stat {
description "Per-interface statistics";
leaf if-event-count {
type yang:counter32;
description
"The number of times this interface has changed its
state or an error has occurred.";
}
leaf link-scope-lsa-count {
type yang:gauge32;
description "The number of link-scope LSAs.";
}
leaf link-scope-lsa-cksum-sum {
type uint32;
description "The sum of link-scope LSA checksums.";
}
container database {
description "Container for link-scope LSA type statistics.";
list link-scope-lsa-type {
description "List of link-scope LSA statistics";
leaf lsa-type {
type uint16;
description "Link scope LSA type.";
}
leaf lsa-count {
type yang:gauge32;
description "The number of LSAs of the LSA type.";
}
leaf lsa-cksum-sum {
type uint32;
description
"The sum of the LSA checksums of the LSA type.";
}
}
}
}
grouping neighbor-stat {
description "Per-neighbor statistics.";
leaf nbr-event-count {
type yang:counter32;
description
"The number of times this neighbor has changed
state or an error has occurred.";
}
leaf nbr-retrans-qlen {
type yang:gauge32;
description
"The current length of the retransmission queue.";
}
}
grouping instance-fast-reroute-config {
description
"This group defines global configuration of IP
Fast ReRoute (FRR).";
container fast-reroute {
if-feature fast-reroute;
description
"This container may be augmented with global
parameters for IP-FRR.";
container lfa {
if-feature lfa;
description
"This container may be augmented with
global parameters for Loop-Free Alternatives (LFA).
Container creation has no effect on LFA activation.";
}
}
}
grouping instance-fast-reroute-state {
description "IPFRR state data grouping";
container protected-routes {
if-feature fast-reroute;
config false;
description "Instance protection statistics";
list address-family-stats {
key "address-family prefix alternate";
description
"Per Address Family protected prefix information";
leaf address-family {
type iana-rt-types:address-family;
description
"Address-family";
}
leaf prefix {
type string;
description
"Protected prefix.";
}
leaf alternate {
type string;
description
"Alternate nexthop for the prefix.";
}
leaf alternate-type {
type enumeration {
enum equal-cost {
description
"ECMP alternate.";
}
enum lfa {
description
"LFA alternate.";
}
enum remote-lfa {
description
"Remote LFA alternate.";
}
enum tunnel {
description
"Tunnel based alternate
(like RSVP-TE or GRE).";
}
enum ti-lfa {
description
"TI-LFA alternate.";
}
enum mrt {
description
"MRT alternate.";
}
enum other {
description
"Unknown alternate type.";
}
}
description
"Type of alternate.";
}
leaf best {
type boolean;
description
"Indicates if the alternate is the preferred.";
}
leaf non-best-reason {
type string;
description
"Information field to describe why the alternate
is not best.";
}
leaf protection-available {
type bits {
bit node-protect {
position 0;
description
"Node protection available.";
}
bit link-protect {
position 1;
description
"Link protection available.";
}
bit srlg-protect {
position 2;
description
"SRLG protection available.";
}
bit downstream-protect {
position 3;
description
"Downstream protection available.";
}
bit other {
position 4;
description
"Other protection available.";
}
}
description "Protection provided by the alternate.";
}
leaf alternate-metric1 {
type uint32;
description
"Metric from Point of Local Repair (PLR) to
destination through the alternate path.";
}
leaf alternate-metric2 {
type uint32;
description
"Metric from PLR to the alternate node";
}
leaf alternate-metric3 {
type uint32;
description
"Metric from alternate node to the destination";
}
}
}
container unprotected-routes {
if-feature fast-reroute;
config false;
description "List of prefixes that are not protected";
list address-family-stats {
key "address-family prefix";
description
"Per Address Family (AF) unprotected prefix statistics.";
leaf address-family {
type iana-rt-types:address-family;
description "Address-family";
}
leaf prefix {
type string;
description "Unprotected prefix.";
}
}
}
list protection-statistics {
key frr-protection-method;
config false;
description "List protection method statistics";
leaf frr-protection-method {
type string;
description "Protection method used.";
}
list address-family-stats {
key address-family;
description "Per Address Family protection statistics.";
leaf address-family {
type iana-rt-types:address-family;
description "Address-family";
}
leaf total-routes {
type uint32;
description "Total prefixes.";
}
leaf unprotected-routes {
type uint32;
description
"Total prefixes that are not protected.";
}
leaf protected-routes {
type uint32;
description
"Total prefixes that are protected.";
}
leaf linkprotected-routes {
type uint32;
description
"Total prefixes that are link protected.";
}
leaf nodeprotected-routes {
type uint32;
description
"Total prefixes that are node protected.";
}
}
}
}
grouping interface-fast-reroute-config {
description
"This group defines interface configuration of IP-FRR.";
container fast-reroute {
if-feature fast-reroute;
container lfa {
if-feature lfa;
leaf candidate-enable {
type boolean;
default true;
description
"Enable the interface to be used as backup.";
}
leaf enable {
type boolean;
default false;
description
"Activates LFA - Per-prefix LFA computation
is assumed.";
}
container remote-lfa {
if-feature remote-lfa;
leaf enable {
type boolean;
default false;
description
"Activates Remote LFA (R-LFA).";
}
description
"Remote LFA configuration.";
}
description
"LFA configuration.";
}
description
"Interface IP Fast-reroute configuration.";
}
}
grouping interface-physical-link-config {
description
"Interface cost configuration that only applies to
physical interfaces (non-virtual) and sham links.";
leaf cost {
type uint16 {
range "1..65535";
}
description
"Interface cost.";
}
leaf mtu-ignore {
if-feature mtu-ignore;
type boolean;
description
"Enable/Disable bypassing the MTU mismatch check in
Database Description packets.";
}
leaf prefix-suppression {
if-feature prefix-suppression;
type boolean;
description
"Suppress advertisement of the prefixes associated
with the interface.";
}
leaf two-part-metric {
if-feature two-part-metric;
type boolean;
description
"Support advertisement and computation of the 2-part
metric.";
}
}
grouping interface-common-config {
description
"Common configuration for all types of interfaces,
including virtual links and sham links.";
leaf hello-interval {
type uint16 {
range "1..65535";
}
description
"Interval between hello packets (seconds). It must
be the same for all routers on the same network.
Different networks, implementations, and deployments
will use different hello-intervals. A sample value
for a LAN network would be 10 seconds.";
}
leaf dead-interval {
type uint32 {
range "1..2147483647";
}
units seconds;
must "../dead-interval > ../hello-interval" {
error-message "The dead interval must be "
+ "larger than the hello interval";
description
"The value MUST be greater than 'hello-internval'.";
}
description
"Interval after which a neighbor is declared down
(seconds) if hello packets are not received. It is
typically 3 or 4 times the hello-interval. A typical
value for LAN networks is 40 seconds.";
}
leaf retransmit-interval {
type uint16 {
range "1..3600";
}
units seconds;
description
"Interval between retransmitting unacknowledged Link
State Advertisements (LSAs) (seconds). This should
be well over the round-trip transmit delay for
any two routers on the network. A sample value
would be 5 seconds.";
}
leaf transmit-delay {
type uint16 {
range "1..3600";
}
units seconds;
description
"Estimated time needed to transmit Link State Update
(LSU) packets on the interface (seconds). LSAs have
their age incremented by this amount on advertised
on the interface. A sample value would be 1 second.";
}
leaf lls {
if-feature lls;
type boolean;
description
"Enable/Disable link-local signaling (LLS) support.";
}
container ttl-security {
if-feature ttl-security;
description "Time to Live (TTL) security check.";
leaf enable {
type boolean;
description
"Enable/Disable TTL security check.";
}
leaf hops {
type uint8 {
range "1..254";
}
description
"Maximum number of hops that an OSPF packet may
have traversed before reception.";
}
}
leaf enable {
if-feature admin-control;
type boolean;
default true;
description
"Enable/disable OSPF protocol on the interface.";
}
container authentication {
description "Authentication configuration.";
choice auth-type-selection {
description
"Options for OSPFv3 authentication configuration.";
case auth-ipsec {
when "derived-from-or-self(../../../../../../rt:type, "
+ "'ospf:ospfv3')" {
description "Applied to OSPFv3 only.";
}
if-feature ospfv3-authentication-ipsec;
leaf sa {
type string;
description
"Security Association (SA) name.";
}
}
case auth-trailer-key-chain {
if-feature key-chain;
leaf key-chain {
type key-chain:key-chain-ref;
description
"key-chain name.";
}
}
case auth-trailer-key {
leaf key {
type string;
description
"Key string in ASCII format.";
}
leaf crypto-algorithm {
type identityref {
base key-chain:crypto-algorithm;
}
description
"Cryptographic algorithm associated with key.";
}
}
}
}
}
grouping interface-config {
description "Configuration for real interfaces.";
leaf interface-type {
type enumeration {
enum "broadcast" {
description
"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.";
}
enum "hybrid" {
if-feature hybrid-interface;
description
"Specify OSPF hybrid broadcast/P2MP network.";
}
}
description
"Interface type.";
}
leaf passive {
type boolean;
description
"Enable/Disable passive interface - a passive interface's
prefix will be advertised but no neighbor adjacencies
will be formed on the interface.";
}
leaf demand-circuit {
if-feature demand-circuit;
type boolean;
description
"Enable/Disable demand circuit.";
}
leaf priority {
type uint8;
description
"Configure OSPF router priority. On multi-access network
this value is for Designated Router (DR) election. The
priority is ignored on other interface types. A value
of 0 indicates the router is not eligible to become
Designated Router or Backup Designated Router (BDR).";
}
container multi-areas {
if-feature multi-area-adj;
description "Container for multi-area config.";
list multi-area {
key multi-area-id;
description
"Configure OSPF multi-area adjacency.";
leaf multi-area-id {
type area-id-type;
description
"Multi-area adjacency area ID.";
}
leaf cost {
type uint16;
description
"Interface cost for multi-area adjacency.";
}
}
}
container static-neighbors {
description "Statically configured neighbors.";
list neighbor {
key "identifier";
description
"Specify a static OSPF neighbor.";
leaf identifier {
type inet:ip-address;
description
"Neighbor Router ID, IPv4 address, or IPv6 address.";
}
leaf cost {
type uint16 {
range "1..65535";
}
description
"Neighbor cost. Different implementations have different
default costs with some defaulting to a cost inversely
proportioal to the interface speed. Others will default
to 1 equating the cost to a hop count." ;
}
leaf poll-interval {
type uint16 {
range "1..65535";
}
units seconds;
description
"Neighbor poll interval (seconds) for sending OSPF
hello packets to discover the neighbor on NBMA
networks. This interval dictates the granularity for
discovery of new neighbors. A sample would be 2 minutes
for a legacy Packet Data Network (PDN) X.25 network.";
}
leaf priority {
type uint8 {
range "1..255";
}
description "Neighbor priority for DR election.";
}
}
}
leaf node-flag {
if-feature node-flag;
type boolean;
default false;
description
"Set prefix as identifying the advertising router.";
reference "RFC 7684 - OSPFv2 Prefix/Link Attribute
Advertisement";
}
container bfd {
if-feature bfd;
description "BFD Client Configuration.";
uses bfd-types:client-cfg-parms;
reference "draft-ietf-bfd-yang-xx.txt:
YANG Data Model for Bidirectional Forwarding
Detection (BFD)";
}
uses interface-fast-reroute-config;
uses interface-common-config;
uses interface-physical-link-config;
}
grouping neighbor-state {
description
"OSPF neighbor operational state.";
leaf address {
type inet:ip-address;
config false;
description
"Neighbor address.";
}
leaf dr-router-id {
type rt-types:router-id;
config false;
description "Neighbor's Designated Router (DR) Router ID.";
}
leaf dr-ip-addr {
type inet:ip-address;
config false;
description "Neighbor's Designated Router (DR) IP address.";
}
leaf bdr-router-id {
type rt-types:router-id;
config false;
description
"Neighbor's Backup Designated Router (BDR) Router ID.";
}
leaf bdr-ip-addr {
type inet:ip-address;
config false;
description
"Neighbor's Backup Designated Router (BDR) IP Address.";
}
leaf state {
type nbr-state-type;
config false;
description
"OSPF neighbor state.";
}
leaf cost {
type uint32;
config false;
description "Cost to reach neighbor for Point-to-Multipoint
and Hybrid networks";
}
leaf dead-timer {
type uint32;
units "seconds";
config false;
description "This timer tracks the remaining time before
the neighbor is declared dead.";
}
container statistics {
config false;
description "Per-neighbor statistics";
uses neighbor-stat;
}
}
grouping interface-common-state {
description
"OSPF interface common operational state.";
reference "RFC2328 Section 9";
leaf state {
type if-state-type;
config false;
description "Interface state.";
}
leaf hello-timer {
type uint32;
units "seconds";
config false;
description "This timer tracks the remaining time before
the next hello packet is sent on the
interface.";
}
leaf wait-timer {
type uint32;
units "seconds";
config false;
description "This timer tracks the remaining time before
the interface exits the Waiting state.";
}
leaf dr-router-id {
type rt-types:router-id;
config false;
description "Designated Router (DR) Router ID.";
}
leaf dr-ip-addr {
type inet:ip-address;
config false;
description "Designated Router (DR) IP address.";
}
leaf bdr-router-id {
type rt-types:router-id;
config false;
description "Backup Designated Router (BDR) Router ID.";
}
leaf bdr-ip-addr {
type inet:ip-address;
config false;
description "Backup Designated Router (BDR) IP Address.";
}
container statistics {
config false;
description "Per-interface statistics";
uses interface-stat;
}
container neighbors {
config false;
description "All neighbors for the interface.";
list neighbor {
key "neighbor-router-id";
description
"List of interface OSPF neighbors.";
leaf neighbor-router-id {
type rt-types:router-id;
description
"Neighbor Router ID.";
}
uses neighbor-state;
}
}
container database {
config false;
description "Link-scope Link State Database.";
list link-scope-lsa-type {
key "lsa-type";
description
"List OSPF link-scope LSAs.";
leaf lsa-type {
type uint16;
description "OSPF link-scope LSA type.";
}
container link-scope-lsas {
description
"All link-scope LSAs of this LSA type.";
list link-scope-lsa {
key "lsa-id adv-router";
description "List of OSPF link-scope LSAs";
uses lsa-key;
uses lsa {
refine "version/ospfv2/ospfv2" {
must "derived-from-or-self( "
+ "../../../../../../../../../../"
+ "rt:type, 'ospf:ospfv2')" {
description "OSPFv2 LSA.";
}
}
refine "version/ospfv3/ospfv3" {
must "derived-from-or-self( "
+ "../../../../../../../../../../"
+ "rt:type, 'ospf:ospfv3')" {
description "OSPFv3 LSA.";
}
}
}
}
}
}
}
}
grouping interface-state {
description
"OSPF interface operational state.";
reference "RFC2328 Section 9";
uses interface-common-state;
}
grouping virtual-link-config {
description
"OSPF virtual link configuration state.";
uses interface-common-config;
}
grouping virtual-link-state {
description
"OSPF virtual link operational state.";
leaf cost {
type uint16 {
range "1..65535";
}
config false;
description
"Virtual link interface cost.";
}
uses interface-common-state;
}
grouping sham-link-config {
description
"OSPF sham link configuration state.";
uses interface-common-config;
uses interface-physical-link-config;
}
grouping sham-link-state {
description
"OSPF sham link operational state.";
uses interface-common-state;
}
grouping address-family-area-config {
description
"OSPF address-family specific area config state.";
container ranges {
description "Container for summary ranges";
list range {
key "prefix";
description
"Summarize routes matching address/mask -
Applicable to Area Border Routers (ABRs) only.";
leaf prefix {
type inet:ip-prefix;
description
"IPv4 or IPv6 prefix";
}
leaf advertise {
type boolean;
description
"Advertise or hide.";
}
leaf cost {
type ospf-metric {
range "0..16777214";
}
description
"Advertised cost of summary route.";
}
}
}
}
grouping area-common-config {
description
"OSPF area common configuration state.";
leaf summary {
when "derived-from(../area-type,'ospf:stub-nssa-area')" {
description
"Summary advertisement into the stub/NSSA area.";
}
type boolean;
description
"Enable/Disable summary advertisement into the stub or
NSSA area.";
}
leaf default-cost {
when "derived-from(../area-type,'ospf:stub-nssa-area')" {
description
"Cost for LSA default route advertised into the
stub or NSSA area.";
}
type ospf-metric;
description
"Set the summary default route cost for a
stub or NSSA area.";
}
}
grouping area-config {
description
"OSPF area configuration state.";
leaf area-type {
type identityref {
base area-type;
}
default normal-area;
description
"Area type.";
}
uses area-common-config;
uses address-family-area-config;
}
grouping area-state {
description
"OSPF area operational state.";
container statistics {
config false;
description "Per-area statistics";
uses area-stat;
}
container database {
config false;
description "Area-scope Link State Database.";
list area-scope-lsa-type {
key "lsa-type";
description "List OSPF area-scope LSAs.";
leaf lsa-type {
type uint16;
description "OSPF area-scope LSA type.";
}
container area-scope-lsas {
description
"All area-scope LSAs of an area-scope
LSA type.";
list area-scope-lsa {
key "lsa-id adv-router";
description "List of OSPF area-scope LSAs";
uses lsa-key;
uses lsa {
refine "version/ospfv2/ospfv2" {
must "derived-from-or-self( "
+ "../../../../../../../../"
+ "rt:type, 'ospf:ospfv2')" {
description "OSPFv2 LSA.";
}
}
refine "version/ospfv3/ospfv3" {
must "derived-from-or-self( "
+ "../../../../../../../../"
+ "rt:type, 'ospf:ospfv3')" {
description "OSPFv3 LSA.";
}
}
}
}
}
}
}
}
grouping local-rib {
description "Local-rib - RIB for Routes computed by the local
OSPF routing instance.";
container local-rib {
config false;
description "Local-rib.";
list route {
key "prefix";
description "Routes";
leaf prefix {
type inet:ip-prefix;
description "Destination prefix.";
}
container next-hops {
description "Next hops for the route.";
list next-hop {
key "next-hop";
description "List of next hops for the route";
leaf outgoing-interface {
type if:interface-ref;
description
"Name of the outgoing interface.";
}
leaf next-hop {
type inet:ip-address;
description "Nexthop address.";
}
}
}
leaf metric {
type uint32;
description "Metric for this route.";
}
leaf route-type {
type route-type;
description "Route type for this route.";
}
leaf route-tag {
type uint32;
description "Route tag for this route.";
}
}
}
}
grouping ietf-spf-delay {
leaf initial-delay {
type rt-types:timer-value-milliseconds;
description
"Delay used while in QUIET state (milliseconds).";
}
leaf short-delay {
type rt-types:timer-value-milliseconds;
description
"Delay used while in SHORT_WAIT state (milliseconds).";
}
leaf long-delay {
type rt-types:timer-value-milliseconds;
description
"Delay used while in LONG_WAIT state (milliseconds).";
}
leaf hold-down {
type rt-types:timer-value-milliseconds;
description
"Timer used to consider an IGP stability period
(milliseconds).";
}
leaf time-to-learn {
type rt-types:timer-value-milliseconds;
description
"Duration used to learn all the IGP events
related to a single component failure (milliseconds).";
}
leaf current-state {
type enumeration {
enum "quiet" {
description "QUIET state";
}
enum "short-wait" {
description "SHORT_WAIT state";
}
enum "long-wait" {
description "LONG_WAIT state";
}
}
config false;
description
"Current SPF backoff algorithm state.";
}
leaf remaining-time-to-learn {
type rt-types:timer-value-seconds16;
config false;
description
"Remaining time until time-to-learn timer fires.";
}
leaf remaining-hold-down {
type rt-types:timer-value-seconds16;
config false;
description
"Remaining time until hold-down timer fires.";
}
leaf last-event-received {
type yang:timestamp;
config false;
description
"Time of last SPF triggering event.";
}
leaf next-spf-time {
type yang:timestamp;
config false;
description
"Time when next SPF has been scheduled.";
}
leaf last-spf-time {
type yang:timestamp;
config false;
description
"Time of last SPF computation.";
}
description
"Grouping for IETF SPF delay configuration and state";
}
grouping node-tag-config {
description
"OSPF node tag config state.";
container node-tags {
if-feature node-tag;
list node-tag {
key tag;
leaf tag {
type uint32;
description
"Node tag value.";
}
description
"List of tags.";
}
description
"Container for node admin tags.";
}
}
grouping instance-config {
description
"OSPF instance config state.";
leaf explicit-router-id {
if-feature explicit-router-id;
type rt-types:router-id;
description
"Defined in RFC 2328. A 32-bit number
that uniquely identifies the router.";
}
container preference {
description "Route preference config state.";
choice scope {
description
"Options for expressing preference
as single or multiple values.";
case single-value {
leaf all {
type uint8;
description
"Preference for intra-area, inter-area, and
external routes.";
}
}
case multi-values {
choice granularity {
description
"Options for expressing preference
for intra-area and inter-area routes.";
case detail {
leaf intra-area {
type uint8;
description
"Preference for intra-area routes.";
}
leaf inter-area {
type uint8;
description
"Preference for inter-area routes.";
}
}
case coarse {
leaf internal {
type uint8;
description
"Preference for both intra-area and
inter-area routes.";
}
}
}
leaf external {
type uint8;
description
"Preference for AS external routes.";
}
}
}
}
container nsr {
if-feature nsr;
description
"Non-Stop Routing (NSR) config state.";
leaf enable {
type boolean;
description
"Enable/Disable NSR.";
}
}
container graceful-restart {
if-feature graceful-restart;
description
"Graceful restart config state.";
reference "RFC 3623 - OSPF Graceful Restart
RFC 5187 - OSPFv3 Graceful Restart";
leaf enable {
type boolean;
description
"Enable/Disable graceful restart as defined in RFC 3623
for OSPFv2 and RFC 5187 for OSPFv3.";
}
leaf helper-enable {
type boolean;
description
"Enable graceful restart helper support for restarting
routers (RFC 3623 Section 3).";
}
leaf restart-interval {
type uint16 {
range "1..1800";
}
units seconds;
default "120";
description
"Interval to attempt graceful restart prior
to failing (RFC 3623 Section B.1) (seconds)";
}
leaf helper-strict-lsa-checking {
type boolean;
description
"Terminate graceful restart when an LSA topology change
is detected (RFC 3623 Section B.2).";
}
}
leaf enable {
if-feature admin-control;
type boolean;
default true;
description
"Enable/Disable the protocol.";
}
container auto-cost {
if-feature auto-cost;
description
"Interface Auto-cost configuration state.";
leaf enable {
type boolean;
description
"Enable/Disable interface auto-cost.";
}
leaf reference-bandwidth {
when "../enable = 'true'" {
description "Only when auto cost is enabled";
}
type uint32 {
range "1..4294967";
}
units Mbits;
description
"Configure reference bandwidth used to automatically
determine interface cost (Mbits). The cost is the
reference bandwidth divided by the interface speed
with 1 being the minimum cost.";
}
}
container spf-control {
leaf paths {
if-feature max-ecmp;
type uint16 {
range "1..32";
}
description
"Maximum number of Equal-Cost Multi-Path (ECMP) paths.";
}
container ietf-spf-delay {
if-feature ietf-spf-delay;
uses ietf-spf-delay;
description
"IETF SPF delay algorithm configuration.";
}
description "SPF calculation control.";
}
container database-control {
leaf max-lsa {
if-feature max-lsa;
type uint32 {
range "1..4294967294";
}
description
"Maximum number of LSAs OSPF the router will accept.";
}
description "Database maintenance control.";
}
container stub-router {
if-feature stub-router;
description "Set maximum metric configuration";
choice trigger {
description
"Specific triggers which will enable stub
router state.";
container always {
presence
"Enables unconditional stub router support";
description
"Unconditional stub router state (advertise
transit links with max metric";
}
}
}
container mpls {
description
"OSPF MPLS config state.";
container te-rid {
if-feature te-rid;
description
"Stable OSPF Router IP Address used for Traffic
Engineering (TE)";
leaf ipv4-router-id {
type inet:ipv4-address;
description
"Explicitly configure the TE IPv4 Router ID.";
}
leaf ipv6-router-id {
type inet:ipv6-address;
description
"Explicitly configure the TE IPv6 Router ID.";
}
}
container ldp {
description
"OSPF MPLS LDP config state.";
leaf igp-sync {
if-feature ldp-igp-sync;
type boolean;
description
"Enable LDP IGP synchronization.";
}
}
}
uses instance-fast-reroute-config;
uses node-tag-config;
}
grouping instance-state {
description
"OSPF instance operational state.";
leaf router-id {
type rt-types:router-id;
config false;
description
"Defined in RFC 2328. A 32-bit number
that uniquely identifies the router.";
}
uses local-rib;
container statistics {
config false;
description "Per-instance statistics";
uses instance-stat;
}
container database {
config false;
description "AS-scope Link State Database.";
list as-scope-lsa-type {
key "lsa-type";
description "List OSPF AS-scope LSAs.";
leaf lsa-type {
type uint16;
description "OSPF AS scope LSA type.";
}
container as-scope-lsas {
description "All AS-scope of LSA of this LSA type.";
list as-scope-lsa {
key "lsa-id adv-router";
description "List of OSPF AS-scope LSAs";
uses lsa-key;
uses lsa {
refine "version/ospfv2/ospfv2" {
must "derived-from-or-self( "
+ "../../../../../../"
+ "rt:type, 'ospf:ospfv2')" {
description "OSPFv2 LSA.";
}
}
refine "version/ospfv3/ospfv3" {
must "derived-from-or-self( "
+ "../../../../../../"
+ "rt:type, 'ospf:ospfv3')" {
description "OSPFv3 LSA.";
}
}
}
}
}
}
}
uses spf-log;
uses lsa-log;
}
grouping ospf-config {
description
"OSPF top configuration state - currently empty.";
}
grouping ospf-state {
description
"OSPF top operational state - currently empty.";
}
grouping multi-topology-area-common-config {
description
"OSPF multi-topology area common configuration state.";
leaf summary {
when "derived-from("
+ "../../../../../areas/area[area-id=current()/../area-id]/"
+ "area-type, 'stub-nssa-area')" {
description
"Summary advertisement into the stub/NSSA area.";
}
type boolean;
description
"Enable/Disable summary advertisement into the
topology in the stub or NSSA area.";
}
leaf default-cost {
when "derived-from("
+ "../../../../../areas/area[area-id=current()/../area-id]/"
+ "area-type, 'stub-nssa-area')" {
description
"Cost for LSA default route advertised into the
topology into the stub or NSSA area.";
}
type ospf-metric;
description
"Set the summary default route cost for a
stub or NSSA area.";
}
}
grouping multi-topology-area-config {
description
"OSPF multi-topology area configuration state.";
uses multi-topology-area-common-config;
uses address-family-area-config;
}
grouping multi-topology-area-state {
description
"OSPF multi-topology area operational state.";
}
grouping multi-topology-config {
description
"OSPF multi-topology configuration state.";
}
grouping multi-topology-state {
description
"OSPF multi-topology operational state.";
uses local-rib;
}
grouping multi-topology-interface-config {
description
"OSPF multi-topology configuration state.";
leaf cost {
type uint32;
description
"Interface cost for this topology.";
}
}
grouping multi-topology-interface-state {
description
"OSPF multi-topology operational state.";
}
grouping ospfv3-interface-config {
description
"OSPFv3 interface specific configuration state.";
leaf instance-id {
type uint8 {
range "0 .. 31";
}
description
"OSPFv3 instance ID.";
}
}
grouping ospfv3-interface-state {
description
"OSPFv3 interface specific operational state.";
leaf interface-id {
type uint16;
config false;
description
"OSPFv3 interface ID.";
}
}
grouping lsa-identifiers {
description
"The parameters that uniquely identify an LSA.";
leaf area-id {
type area-id-type;
description
"Area ID";
}
leaf type {
type uint16;
description
"LSA type.";
}
leaf lsa-id {
type yang:dotted-quad;
description "Link-State ID.";
}
leaf adv-router {
type rt-types:router-id;
description
"LSA advertising router.";
}
leaf seq-num {
type uint32;
description
"LSA sequence number.";
}
}
grouping spf-log {
description
"Grouping for SPF log.";
container spf-log {
config false;
description
"This container lists the SPF log.";
list event {
key id;
description
"List of SPF log entries represented
as a wrapping buffer.";
leaf id {
type uint32;
description
"Event identifier - Ppurely internal value.";
}
leaf spf-type {
type enumeration {
enum full {
description
"SPF computation was a Full SPF.";
}
enum intra {
description
"SPF computation was only for intra-area routes.";
}
enum inter {
description
"SPF computation was only for inter-area
summary routes.";
}
enum external {
description
"SPF computation was only for AS external routes.";
}
}
description
"The SPF computation type for the SPF log entry.";
}
leaf schedule-timestamp {
type yang:timestamp;
description
"This is the timestamp when the computation was
scheduled.";
}
leaf start-timestamp {
type yang:timestamp;
description
"This is the timestamp when the computation was
started.";
}
leaf end-timestamp {
type yang:timestamp;
description
"This the timestamp when the computation was
completed.";
}
list trigger-lsa {
description
"The list of LSAs that triggered the computation.";
uses lsa-identifiers;
}
}
}
}
grouping lsa-log {
description
"Grouping for the LSA log.";
container lsa-log {
config false;
description
"This container lists the LSA log.
Local LSA modifications are also included
in the list.";
list event {
key id;
description
"List of LSA log entries represented
as a wrapping buffer.";
leaf id {
type uint32;
description
"Event identifier - purely internal value.";
}
container lsa {
description
"This container describes the logged LSA.";
uses lsa-identifiers;
}
leaf received-timestamp {
type yang:timestamp;
description
"This is the timestamp when the LSA was received.
In case of local LSA update, the timestamp refers
to the LSA origination time.";
}
leaf reason {
type identityref {
base lsa-log-reason;
}
description
"This reason for the LSA log entry.";
}
}
}
}
augment "/rt:routing/rt:control-plane-protocols/"
+ "rt:control-plane-protocol" {
when "derived-from(rt:type, 'ospf:ospf-protocol')" {
description
"This augmentation is only valid for a routing protocol
instance of OSPF (type 'ospfv2' or 'ospfv3').";
}
description "OSPF protocol ietf-routing module
control-plane-protocol augmentation.";
container ospf {
description
"OSPF protocol Instance";
uses ospf-config;
uses ospf-state;
leaf address-family {
type iana-rt-types:address-family;
description
"Address-family of the instance.";
}
uses instance-config;
uses instance-state;
container areas {
description "All areas.";
list area {
key "area-id";
description
"List of OSPF areas";
leaf area-id {
type area-id-type;
description
"Area ID";
}
uses area-config;
uses area-state;
container virtual-links {
when "derived-from-or-self(../area-type, 'normal-area') "
+ "and ../area-id = '0.0.0.0'" {
description
"Virtual links must be in backbone area.";
}
description "All virtual links.";
list virtual-link {
key "transit-area-id router-id";
description
"OSPF virtual link";
leaf transit-area-id {
type leafref {
path "../../../../area/area-id";
}
must "derived-from-or-self("
+ "../../../../area[area-id=current()]/area-type, "
+ "'normal-area') and "
+ "../../../../area[area-id=current()]/area-id != "
+ "'0.0.0.0'" {
error-message "Virtual link transit area must "
+ "be non-zero.";
description
"Virtual-link trasit area must be
non-zero area.";
}
description
"Virtual link tranist area ID.";
}
leaf router-id {
type rt-types:router-id;
description
"Virtual Link remote endpoint Router ID.";
}
uses virtual-link-config;
uses virtual-link-state;
}
}
container sham-links {
if-feature pe-ce-protocol;
description "All sham links.";
list sham-link {
key "local-id remote-id";
description
"OSPF sham link";
leaf local-id {
type inet:ip-address;
description
"Address of the local sham Link endpoint.";
}
leaf remote-id {
type inet:ip-address;
description
"Address of the remote sham Link endpoint.";
}
uses sham-link-config;
uses sham-link-state;
}
}
container interfaces {
description "All interfaces.";
list interface {
key "name";
description
"List of OSPF interfaces.";
leaf name {
type if:interface-ref;
description
"Interface name reference.";
}
uses interface-config;
uses interface-state;
}
}
}
}
}
}
augment "/rt:routing/rt:control-plane-protocols/"
+ "rt:control-plane-protocol/ospf:ospf" {
when "derived-from(../rt:type, 'ospf:ospf-protocol')" {
description
"This augmentation is only valid for OSPF
(type 'ospfv2' or 'ospfv3').";
}
if-feature multi-topology;
description
"OSPF multi-topology instance configuration
state augmentation.";
container topologies {
description "All topologies.";
list topology {
key "name";
description
"OSPF topology - The OSPF topology address-family
must coincide with the routing-instance
address-family.";
leaf name {
type leafref {
path "../../../../../../rt:ribs/rt:rib/rt:name";
}
description "RIB name corresponding to the OSPF
topology.";
}
uses multi-topology-config;
uses multi-topology-state;
container areas {
description "All areas in the topology.";
list area {
key "area-id";
description
"List of OSPF areas";
leaf area-id {
type area-id-type;
description
"Area ID.";
}
uses multi-topology-area-config;
uses multi-topology-area-state;
}
}
}
}
}
augment "/rt:routing/rt:control-plane-protocols/"
+ "rt:control-plane-protocol/ospf:ospf/"
+ "ospf:areas/ospf:area/ospf:interfaces/ospf:interface" {
when "derived-from-or-self(../../../../../rt:type, "
+ "'ospf:ospfv2')" {
description
"This augmentation is only valid for OSPFv2.";
}
if-feature ospf:multi-topology;
description
"OSPF multi-topology interface configuration state
augmentation.";
container topologies {
description "All topologies for the interface.";
list topology {
key "name";
description "OSPF interface topology.";
leaf name {
type leafref {
path "../../../../../../../../../../"
+ "rt:ribs/rt:rib/rt:name";
}
description
"Single topology enabled on this interface.";
}
uses multi-topology-interface-config;
uses multi-topology-interface-state;
}
}
}
augment "/rt:routing/rt:control-plane-protocols/"
+ "rt:control-plane-protocol/ospf:ospf/"
+ "ospf:areas/ospf:area/ospf:interfaces/ospf:interface" {
when "derived-from-or-self(../../../../../rt:type, "
+ "'ospf:ospfv3')" {
description
"This augmentation is only valid for OSPFv3.";
}
description
"OSPFv3 interface specific configuration state
augmentation.";
uses ospfv3-interface-config;
uses ospfv3-interface-state;
}
grouping route-content {
description
"This grouping defines OSPF-specific route attributes.";
leaf metric {
type uint32;
description "OSPF route metric.";
}
leaf tag {
type uint32;
default "0";
description "OSPF route tag.";
}
leaf route-type {
type route-type;
description "OSPF route type";
}
}
augment "/rt:routing/rt:ribs/rt:rib/rt:routes/rt:route" {
when "derived-from(rt:source-protocol, 'ospf:ospf-protocol')" {
description
"This augmentation is only valid for a routes whose
source protocol is OSPF.";
}
description
"OSPF-specific route attributes.";
uses route-content;
}
/*
* RPCs
*/
rpc clear-neighbor {
description
"This RPC request clears a particular set of OSPF neighbors.
If the operation fails for OSPF internal reason, then
error-tag and error-app-tag should be set to a meaningful
value.";
input {
leaf routing-protocol-name {
type leafref {
path "/rt:routing/rt:control-plane-protocols/"
+ "rt:control-plane-protocol/rt:name";
}
mandatory "true";
description
"OSPF protocol instance which information for neighbors
are to be cleared.
If the referenced OSPF instance doesn't exist, then
this operation SHALL fail with error-tag 'data-missing'
and error-app-tag
'routing-protocol-instance-not-found'.";
}
leaf interface {
type if:interface-ref;
description
"Name of the OSPF interface for which neighbors are to
be cleared.
If the referenced OSPF interface doesn't exist, then
this operation SHALL fail with error-tag
'data-missing' and error-app-tag
'ospf-interface-not-found'.";
}
}
}
rpc clear-database {
description
"This RPC request clears a particular OSPF Link State
Database. If the operation fails for OSPF internal reason,
then error-tag and error-app-tag should be set to a
meaningful value.";
input {
leaf routing-protocol-name {
type leafref {
path "/rt:routing/rt:control-plane-protocols/"
+ "rt:control-plane-protocol/rt:name";
}
mandatory "true";
description
"OSPF protocol instance whose Link State Database is to
be cleared.
If the referenced OSPF instance doesn't exist, then
this operation SHALL fail with error-tag 'data-missing'
and error-app-tag
'routing-protocol-instance-not-found'.";
}
}
}
/*
* Notifications
*/
grouping notification-instance-hdr {
description
"This grouping describes common instance specific
data for OSPF notifications.";
leaf routing-protocol-name {
type leafref {
path "/rt:routing/rt:control-plane-protocols/"
+ "rt:control-plane-protocol/rt:name";
}
must "derived-from( "
+ "/rt:routing/rt:control-plane-protocols/"
+ "rt:control-plane-protocol[rt:name=current()]/"
+ "rt:type, 'ospf:ospf-protocol')";
description
"OSPF routing protocol instance name.";
}
leaf address-family {
type leafref {
path "/rt:routing/"
+ "rt:control-plane-protocols/rt:control-plane-protocol"
+ "[rt:name=current()/../routing-protocol-name]/"
+ "ospf:ospf/address-family";
}
description
"Address family of the OSPF instance.";
}
}
grouping notification-interface {
description
"This grouping provides interface information
for the OSPF interface specific notification.";
choice if-link-type-selection {
description
"Options for link type.";
container interface {
description "Normal interface.";
leaf interface {
type if:interface-ref;
description "Interface.";
}
}
container virtual-link {
description "virtual-link.";
leaf transit-area-id {
type area-id-type;
description "Area ID.";
}
leaf neighbor-router-id {
type rt-types:router-id;
description "Neighbor Router ID.";
}
}
container sham-link {
description "sham link.";
leaf area-id {
type area-id-type;
description "Area ID.";
}
leaf local-ip-addr {
type inet:ip-address;
description "Sham link local address.";
}
leaf remote-ip-addr {
type inet:ip-address;
description "Sham link remote address.";
}
}
}
}
grouping notification-neighbor {
description
"This grouping provides the neighbor information
for neighbor specific notifications.";
leaf neighbor-router-id {
type rt-types:router-id;
description "Neighbor Router ID.";
}
leaf neighbor-ip-addr {
type yang:dotted-quad;
description "Neighbor address.";
}
}
notification if-state-change {
uses notification-instance-hdr;
uses notification-interface;
leaf state {
type if-state-type;
description "Interface state.";
}
description
"This notification is sent when an interface
state change is detected.";
}
notification if-config-error {
uses notification-instance-hdr;
uses notification-interface;
leaf packet-source {
type yang:dotted-quad;
description "Source address.";
}
leaf packet-type {
type packet-type;
description "OSPF packet type.";
}
leaf error {
type enumeration {
enum "bad-version" {
description "Bad version.";
}
enum "area-mismatch" {
description "Area mistmatch.";
}
enum "unknown-nbma-nbr" {
description "Unknown NBMA neighbor.";
}
enum "unknown-virtual-nbr" {
description "Unknown virtual link neighbor.";
}
enum "auth-type-mismatch" {
description "Auth type mismatch.";
}
enum "auth-failure" {
description "Auth failure.";
}
enum "net-mask-mismatch" {
description "Network mask mismatch.";
}
enum "hello-interval-mismatch" {
description "Hello interval mismatch.";
}
enum "dead-interval-mismatch" {
description "Dead interval mismatch.";
}
enum "option-mismatch" {
description "Option mismatch.";
}
enum "mtu-mismatch" {
description "MTU mismatch.";
}
enum "duplicate-router-id" {
description "Duplicate Router ID.";
}
enum "no-error" {
description "No error.";
}
}
description "Error code.";
}
description
"This notification is sent when an interface
config error is detected.";
}
notification nbr-state-change {
uses notification-instance-hdr;
uses notification-interface;
uses notification-neighbor;
leaf state {
type nbr-state-type;
description "Neighbor state.";
}
description
"This notification is sent when aa neighbor
state change is detected.";
}
notification nbr-restart-helper-status-change {
uses notification-instance-hdr;
uses notification-interface;
uses notification-neighbor;
leaf status {
type restart-helper-status-type;
description "Restart helper status.";
}
leaf age {
type uint32;
units seconds;
description
"Remaining time in current OSPF graceful restart
interval when the router is acting as a restart
helper for the neighbor.";
}
leaf exit-reason {
type restart-exit-reason-type;
description
"Restart helper exit reason.";
}
description
"This notification is sent when a neighbor restart
helper status change is detected.";
}
notification if-rx-bad-packet {
uses notification-instance-hdr;
uses notification-interface;
leaf packet-source {
type yang:dotted-quad;
description "Source address.";
}
leaf packet-type {
type packet-type;
description "OSPF packet type.";
}
description
"This notification is sent when an OSPF packet that
cannot be parsed is received on an OSPF interface.";
}
notification lsdb-approaching-overflow {
uses notification-instance-hdr;
leaf ext-lsdb-limit {
type uint32;
description
"The maximum number of non-default AS-external LSAs
entries that can be stored in the Link State Database.";
}
description
"This notification is sent when the number of LSAs
in the router's Link State Database has exceeded
ninety percent of the AS-external limit (ext-lsdb-limit).";
}
notification lsdb-overflow {
uses notification-instance-hdr;
leaf ext-lsdb-limit {
type uint32;
description
"The maximum number of non-default AS-external LSAs
entries that can be stored in the Link State Database.";
}
description
"This notification is sent when the number of LSAs
in the router's Link State Database has exceeded the
AS-external limit (ext-lsdb-limit).";
}
notification nssa-translator-status-change {
uses notification-instance-hdr;
leaf area-id {
type area-id-type;
description "Area ID.";
}
leaf status {
type nssa-translator-state-type;
description
"NSSA translator status.";
}
description
"This notification is sent when there is a change
in the router's role in translating OSPF NSSA LSAs
to OSPF AS-External LSAs.";
}
notification restart-status-change {
uses notification-instance-hdr;
leaf status {
type restart-status-type;
description
"Restart status.";
}
leaf restart-interval {
type uint16 {
range "1..1800";
}
units seconds;
default "120";
description
"Restart interval.";
}
leaf exit-reason {
type restart-exit-reason-type;
description
"Restart exit reason.";
}
description
"This notification is sent when the graceful restart
state for the router has changed.";
}
}