module ietf-ospf-sr {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-ospf-sr";
prefix ospf-sr;
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-routing {
prefix "rt";
reference "RFC 8349 - A YANG Data Model for Routing
Management (NMDA Version)";
}
import ietf-segment-routing-common {
prefix "sr-cmn";
}
import ietf-segment-routing-mpls {
prefix "sr-mpls";
}
import ietf-ospf {
prefix "ospf";
}
organization
"IETF LSR - Link State Routing Working Group";
contact
"WG Web:
WG List:
Editor: Derek Yeung
Author: Derek Yeung
Author: Yingzhen Qu
Author: Acee Lindem
Author: Jeffrey Zhang
Author: Ing-Wher Chen
Author: Greg Hankins
";
description
"This YANG module defines the generic configuration
and operational state for OSPF Segment Routing, which is
common across all of the vendor implementations. It is
intended that the module will be extended by vendors to
define vendor-specific OSPF Segment Routing configuration
and operational parameters and policies.
This YANG model conforms to the Network Management
Datastore Architecture (NMDA) as described in RFC 8242.
Copyright (c) 2021 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject to
the license terms contained in, the Simplified BSD License set
forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(https://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC XXXX
(https://www.rfc-editor.org/info/rfcXXXX); see the RFC itself
for full legal notices.
The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL
NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED',
'MAY', and 'OPTIONAL' in this document are to be interpreted as
described in BCP 14 (RFC 2119) (RFC 8174) when, and only when,
they appear in all capitals, as shown here.
This version of this YANG module is part of RFC XXXX;
see the RFC itself for full legal notices.";
reference "RFC XXXX";
revision 2021-01-10 {
description
"Initial revision.";
reference
"RFC XXXX: A YANG Data Model for OSPF Segment Routing.";
}
feature ti-lfa {
description
"Topology-Independent Loop-Free Alternate (TI-LFA)
computation using segment routing.";
}
identity prefix-sid-bit {
description
"Base identity for prefix sid sub-tlv bits.";
}
identity np-bit {
base prefix-sid-bit;
description
"No-PHP flag.";
}
identity m-bit {
base prefix-sid-bit;
description
"Mapping server flag.";
}
identity e-bit {
base prefix-sid-bit;
description
"Explicit-NULL flag.";
}
identity v-bit {
base prefix-sid-bit;
description
"Value/Index flag.";
}
identity l-bit {
base prefix-sid-bit;
description
"Local flag.";
}
identity extended-prefix-range-bit {
description
"Base identity for extended prefix range TLV bits.";
}
identity ia-bit {
base extended-prefix-range-bit;
description
"Inter-Area flag. If set, advertisement is of inter-area type.";
}
identity adj-sid-bit {
description
"Base identity for adj sid sub-tlv bits.";
}
identity b-bit {
base adj-sid-bit;
description
"Backup flag.";
}
identity vi-bit {
base adj-sid-bit;
description
"Value/Index flag.";
}
identity lo-bit {
base adj-sid-bit;
description
"Local/Global flag.";
}
identity g-bit {
base adj-sid-bit;
description
"Group flag.";
}
identity p-bit {
base adj-sid-bit;
description
"Persistent flag.";
}
typedef uint24 {
type uint32 {
range "0 .. 16777215";
}
description
"24-bit unsigned integer.";
}
/* Groupings */
grouping sid-sub-tlv {
description "SID/Label sub-TLV grouping.";
container sid-sub-tlv {
description
"Used to advertise the SID/Label associated with a
prefix or adjacency.";
leaf sid {
type uint32;
description
"Segment Identifier (SID) - A 20 bit label or
32 bit SID.";
}
}
}
grouping prefix-sid-sub-tlvs {
description "Prefix Segment ID (SID) sub-TLVs.";
container perfix-sid-sub-tlvs{
description "Prefix SID sub-TLV.";
list prefix-sid-sub-tlv {
description "Prefix SID sub-TLV.";
container prefix-sid-flags {
leaf-list bits {
type identityref {
base prefix-sid-bit;
}
description
"Prefix SID Sub-TLV flag bits list.";
}
description "Segment Identifier (SID) Flags.";
}
leaf mt-id {
type uint8;
description "Multi-topology ID.";
}
leaf algorithm {
type uint8;
description
"The algorithm associated with the prefix-SID.";
}
leaf sid {
type uint32;
description "An index or label.";
}
}
}
}
grouping extended-prefix-range-tlvs {
description "Extended prefix range TLV grouping.";
container extended-prefix-range-tlvs {
description "The list of range of prefixes.";
list extended-prefix-range-tlv { //type=2?
description "The range of prefixes.";
leaf prefix-length {
type uint8;
description "Length of prefix in bits.";
}
leaf af {
type uint8;
description "Address family for the prefix.";
}
leaf range-size {
type uint16;
description "The number of prefixes covered by the
advertisement.";
}
container extended-prefix-range-flags {
leaf-list bits {
type identityref {
base extended-prefix-range-bit;
}
description "Extended prefix range TLV flags list.";
}
description "Extended Prefix Range TLV flags.";
}
leaf prefix {
type inet:ip-prefix;
description "Address prefix.";
}
uses prefix-sid-sub-tlvs;
uses ospf:unknown-tlvs;
}
}
}
grouping sr-algorithm-tlv {
description "SR algorithm TLV grouping.";
container sr-algorithm-tlv {
description "All SR algorithm TLVs.";
leaf-list sr-algorithm {
type uint8;
description
"The Segment Routing (SR) algorithms that the router is
currently using.";
}
}
}
grouping sid-range-tlvs {
description "SID Range TLV grouping.";
container sid-range-tlvs {
description "List of SID range TLVs.";
list sid-range-tlv {
description "SID range TLV.";
leaf range-size {
type uint24;
description "The SID range.";
}
uses sid-sub-tlv;
}
}
}
grouping local-block-tlvs {
description "The SR local block TLV contains the
range of labels reserved for local SIDs.";
container local-block-tlvs {
description "List of SRLB TLVs.";
list local-block-tlv {
description "SRLB TLV.";
leaf range-size {
type uint24;
description "The SID range.";
}
uses sid-sub-tlv;
}
}
}
grouping srms-preference-tlv {
description "The SRMS preference TLV is used to advertise
a preference associated with the node that acts
as an SR Mapping Server.";
container srms-preference-tlv {
description "SRMS Preference TLV.";
leaf preference {
type uint8 {
range "0 .. 255";
}
description "SRMS preference TLV, vlaue from 0 to 255.";
}
}
}
/* Configuration */
augment "/rt:routing/rt:control-plane-protocols"
+ "/rt:control-plane-protocol/ospf:ospf" {
when "../rt:type = 'ospf:ospfv2' or "
+ "../rt:type = 'ospf:ospfv3'" {
description
"This augments the OSPF routing protocol when used.";
}
description
"This augments the OSPF protocol configuration
with segment routing.";
uses sr-mpls:sr-control-plane;
container protocol-srgb {
if-feature sr-mpls:protocol-srgb;
uses sr-cmn:srgb;
description
"Per-protocol SRGB.";
}
}
augment "/rt:routing/rt:control-plane-protocols/"
+ "rt:control-plane-protocol/ospf:ospf/"
+ "ospf:areas/ospf:area/ospf:interfaces/ospf:interface" {
when "../../../../../rt:type = 'ospf:ospfv2' or "
+ "../../../../../rt:type = 'ospf:ospfv3'" {
description
"This augments the OSPF interface configuration
when used.";
}
description
"This augments the OSPF protocol interface
configuration with segment routing.";
uses sr-mpls:igp-interface;
}
augment "/rt:routing/rt:control-plane-protocols/"
+ "rt:control-plane-protocol/ospf:ospf/"
+ "ospf:areas/ospf:area/ospf:interfaces/ospf:interface/"
+ "ospf:fast-reroute" {
when "../../../../../../rt:type = 'ospf:ospfv2' or "
+ "../../../../../../rt:type = 'ospf:ospfv3'" {
description
"This augments the OSPF routing protocol when used.";
}
description
"This augments the OSPF protocol IP-FRR with TI-LFA.";
container ti-lfa {
if-feature ti-lfa;
leaf enable {
type boolean;
description
"Enables TI-LFA computation.";
}
description
"Topology Independent Loop Free Alternate
(TI-LFA) support.";
}
}
/* Database */
augment "/rt:routing/"
+ "rt:control-plane-protocols/rt:control-plane-protocol/"
+ "ospf:ospf/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-opaque/ospf:extended-prefix-tlv" {
when "../../../../../../../../../../../../../../"
+ "rt:type = 'ospf:ospfv2'" {
description
"This augmentation is only valid for OSPFv2.";
}
description
"SR specific TLVs for OSPFv2 extended prefix TLV
in type 9 opaque LSA.";
uses prefix-sid-sub-tlvs;
}
augment "/rt:routing/"
+ "rt:control-plane-protocols/rt:control-plane-protocol/"
+ "ospf:ospf/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-opaque/ospf:extended-prefix-tlv" {
when "../../../../../../../../../../../../"
+ "rt:type = 'ospf:ospfv2'" {
description
"This augmentation is only valid for OSPFv2.";
}
description
"SR specific TLVs for OSPFv2 extended prefix TLV
in type 10 opaque LSA.";
uses prefix-sid-sub-tlvs;
}
augment "/rt:routing/"
+ "rt:control-plane-protocols/rt:control-plane-protocol/"
+ "ospf:ospf/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-opaque/ospf:extended-prefix-tlv" {
when "../../../../../../../../../../"
+ "rt:type = 'ospf:ospfv2'" {
description
"This augmentation is only valid for OSPFv2.";
}
description
"SR specific TLVs for OSPFv2 extended prefix TLV
in type 11 opaque LSA.";
uses prefix-sid-sub-tlvs;
}
augment "/rt:routing/"
+ "rt:control-plane-protocols/rt:control-plane-protocol/"
+ "ospf:ospf/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-opaque/ospf:extended-link-tlv" {
when "../../../../../../../../../../../../"
+ "rt:type = 'ospf:ospfv2'" {
description
"This augmentation is only valid for OSPFv2.";
}
description
"SR specific TLVs for OSPFv2 extended link TLV
in type 10 opaque LSA.";
container adj-sid-sub-tlvs {
description "Adjacency SID optional sub-TLVs.";
list adj-sid-sub-tlv {
description "List of Adjacency SID sub-TLVs.";
container adj-sid-flags {
leaf-list bits {
type identityref {
base adj-sid-bit;
}
description "Adj sid sub-tlv flags list.";
}
description "Adj-sid sub-tlv flags.";
}
leaf mt-id {
type uint8;
description "Multi-topology ID.";
}
leaf weight {
type uint8;
description "Weight used for load-balancing.";
}
leaf sid {
type uint32;
description "Segment Identifier (SID) index/label.";
}
}
}
container lan-adj-sid-sub-tlvs {
description "LAN Adjacency SID optional sub-TLVs.";
list lan-adj-sid-sub-tlv {
description "List of LAN adjacency SID sub-TLVs.";
container lan-adj-sid-flags {
leaf-list bits {
type identityref {
base adj-sid-bit;
}
description "LAN adj sid sub-tlv flags list.";
}
description "LAN adj-sid sub-tlv flags.";
}
leaf mt-id {
type uint8;
description "Multi-topology ID.";
}
leaf weight {
type uint8;
description "Weight used for load-balancing.";
}
leaf neighbor-router-id {
type yang:dotted-quad;
description "Neighbor router ID.";
}
leaf sid {
type uint32;
description "Segment Identifier (SID) index/label.";
}
}
}
}
augment "/rt:routing/"
+ "rt:control-plane-protocols/rt:control-plane-protocol/"
+ "ospf:ospf/ospf:areas/ospf:area/"
+ "ospf:interfaces/ospf:interface/ospf:database/"
+ "ospf:link-scope-lsa-type/ospf:link-scope-lsas/"
+ "ospf:link-scope-lsa/ospf:version/ospf:ospfv2/"
+ "ospf:ospfv2/ospf:body/ospf:opaque" {
when "../../../../../../../../../../../../"
+ "rt:type = 'ospf:ospfv2'" {
description
"This augmentation is only valid for OSPFv2.";
}
description
"SR specific TLVs for OSPFv2 type 9 opaque LSA.";
uses extended-prefix-range-tlvs;
uses sr-algorithm-tlv;
uses sid-range-tlvs;
uses local-block-tlvs;
uses srms-preference-tlv;
}
augment "/rt:routing/"
+ "rt:control-plane-protocols/rt:control-plane-protocol/"
+ "ospf:ospf/ospf:areas/"
+ "ospf:area/ospf:database/"
+ "ospf:area-scope-lsa-type/ospf:area-scope-lsas/"
+ "ospf:area-scope-lsa/ospf:version/ospf:ospfv2/"
+ "ospf:ospfv2/ospf:body/ospf:opaque" {
when "../../../../../../../../../../"
+ "rt:type = 'ospf:ospfv2'" {
description
"This augmentation is only valid for OSPFv2.";
}
description
"SR specific TLVs for OSPFv2 type 10 opaque LSA.";
uses extended-prefix-range-tlvs;
uses sr-algorithm-tlv;
uses sid-range-tlvs;
uses local-block-tlvs;
uses srms-preference-tlv;
}
augment "/rt:routing/"
+ "rt:control-plane-protocols/rt:control-plane-protocol/"
+ "ospf:ospf/ospf:database/"
+ "ospf:as-scope-lsa-type/ospf:as-scope-lsas/"
+ "ospf:as-scope-lsa/ospf:version/ospf:ospfv2/"
+ "ospf:ospfv2/ospf:body/ospf:opaque" {
when "../../../../../../../../"
+ "rt:type = 'ospf:ospfv2'" {
description
"This augmentation is only valid for OSPFv2.";
}
description
"SR specific TLVs for OSPFv2 type 11 opaque LSA.";
uses extended-prefix-range-tlvs;
uses sr-algorithm-tlv;
uses sid-range-tlvs;
uses local-block-tlvs;
uses srms-preference-tlv;
}
}