Skip to main content

3. OSPF Segment Routing over MPLS YANG Module

This section presents the complete YANG module for OSPF Segment Routing extensions over the MPLS data plane.

Module Structure

The ietf-ospf-sr-mpls YANG module augments the OSPF base YANG model [RFC9129] and integrates with the segment routing base module [RFC9020]. It supports both OSPFv2 [RFC8665] and OSPFv3 [RFC8666].

Module Header

module ietf-ospf-sr-mpls {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-ospf-sr-mpls";
prefix ospf-sr-mpls;

import ietf-routing {
prefix rt;
reference
"RFC 8349: A YANG Data Model for Routing Management
(NMDA Version)";
}

import ietf-segment-routing-mpls {
prefix sr-mpls;
reference
"RFC 9020: YANG Data Model for Segment Routing";
}

import ietf-ospf {
prefix ospf;
reference
"RFC 9129: YANG Data Model for the OSPF Protocol";
}

organization
"IETF LSR - Link State Routing Working Group";

contact
"WG Web: `https://datatracker.ietf.org/wg/lsr/`
WG List: <mailto:[email protected]>

Editor: Yingzhen Qu
<mailto:[email protected]>
Editor: Acee Lindem
<mailto:[email protected]>
Editor: Jeffrey Zhang
<mailto:[email protected]>
Editor: Ing-Wher Chen
<mailto:[email protected]>";

description
"This YANG module defines the configuration and operational
state for OSPF extensions for Segment Routing (SR) over the
MPLS data plane.

This YANG module conforms to the Network Management
Datastore Architecture (NMDA) as described in RFC 8342.

Copyright (c) 2025 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 Revised 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 9903;
see the RFC itself for full legal notices.";

revision 2025-12 {
description
"Initial revision.";
reference
"RFC 9903: A YANG Data Model for OSPF Segment Routing
over the MPLS Data Plane";
}
}

Key Data Nodes

Segment Routing Global Configuration

SRGB Configuration:

  • Path: /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/ospf:ospf/segment-routing/srgb
  • Type: Container with lower-bound and upper-bound leaves
  • Description: Defines the Segment Routing Global Block range

SRLB Configuration:

  • Path: /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/ospf:ospf/segment-routing/srlb
  • Type: Container with lower-bound and upper-bound leaves
  • Description: Defines the Segment Routing Local Block range

MSD Configuration:

  • Path: /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/ospf:ospf/segment-routing/msd
  • Type: uint8
  • Description: Maximum SID Depth the node can impose

Area-Level Configuration

Segment Routing Enable:

  • Path: /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/ospf:ospf/areas/area/segment-routing/enabled
  • Type: boolean
  • Default: false
  • Description: Enable SR-MPLS on all interfaces within the area

Interface-Level Configuration

Adjacency-SID Configuration:

  • Path: /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/ospf:ospf/areas/area/interfaces/interface/segment-routing/adjacency-sid
  • Type: Container
  • Contents:
    • value: SID value or index
    • neighbor: Neighbor router-id (for multi-access networks)
    • flags: Protection and value/index flags

TI-LFA Configuration:

  • Path: /rt:routing/rt:control-plane-protocols/rt:control-plane-protocol/ospf:ospf/areas/area/interfaces/interface/fast-reroute/ti-lfa
  • Type: Container
  • Contents:
    • enable: Enable/disable TI-LFA
    • node-protection: Enable node protection

Operational State Data

OSPFv2 LSA Extensions

The module augments OSPFv2 LSAs with SR-related TLVs:

Extended Prefix Opaque LSA:

  • Extended Prefix TLV
    • Prefix-SID Sub-TLV
      • Flags: NP-flag, M-flag, E-flag, V-flag, L-flag
      • Algorithm
      • SID/Index/Label

Extended Link Opaque LSA:

  • Extended Link TLV
    • Adj-SID Sub-TLV
      • Flags: B-flag, V-flag, L-flag, G-flag, P-flag
      • Weight
      • SID/Label

Router Information Opaque LSA:

  • SR-Algorithm TLV
  • SID/Label Range TLV
  • SR Local Block TLV
  • SRMS Preference TLV

OSPFv3 LSA Extensions

The module augments OSPFv3 E-LSAs with SR-related TLVs:

E-Router LSA:

  • SR-Algorithm TLV
  • SID/Label Range TLV
  • SR Local Block TLV

E-Intra-Area-Prefix LSA:

  • Prefix-SID Sub-TLV (similar to OSPFv2)

E-Link LSA:

  • Adj-SID Sub-TLV
  • LAN Adj-SID Sub-TLV
    • Neighbor Router-ID
    • Flags and SID/Label

Core Terminology

Prefix-SID (Prefix Segment Identifier)

A segment identifier associated with an IP prefix. Prefix-SIDs are globally unique within an SR domain and represent an ECMP-aware shortest path to the prefix.

Key Attributes:

  • Global Scope: Uses SRGB label range
  • Algorithm: Associated with a specific algorithm (e.g., SPF)
  • Node-SID: When prefix is a router loopback address

Adjacency-SID (Adjacency Segment Identifier)

A segment identifier representing a specific adjacency to a neighboring router.

Key Attributes:

  • Local Scope: Uses SRLB or dynamic label range
  • Strict Forwarding: Traffic is forwarded specifically over the adjacency
  • Protection: Can be protected by backup paths

LAN Adjacency-SID

A special form of Adjacency-SID used on multi-access networks (LANs), identifying both the local interface and the neighbor router.

SRGB (Segment Routing Global Block)

The label range reserved for global segments within an SR domain. All nodes should have a consistent SRGB configuration for proper SR operation.

SRLB (Segment Routing Local Block)

The label range reserved for local segments. SRLB labels have local significance only and are not propagated domain-wide.

MSD (Maximum SID Depth)

The maximum number of SIDs a node can impose on a packet. This value is advertised to assist path computation engines in determining feasible SR paths.

Usage Example

See Appendix A for a complete configuration example.

Complete Module Definition

For the complete YANG module definition including all data nodes, augmentations, and notifications, please refer to:


Note: The complete YANG module code (approximately 600+ lines) includes detailed descriptions, constraints, and references for each data node. Network operators should use YANG validation tools to ensure configuration compliance with the module's constraints.

Implementation Considerations

OSPFv2 vs OSPFv3 Differences

While both protocols support the same SR concepts, the LSA encoding differs:

  • OSPFv2: Uses Opaque LSAs (Type 9/10/11)
  • OSPFv3: Uses E-LSAs with TLV encoding

The YANG module provides a unified configuration interface that abstracts these differences.

Interoperability

When deploying SR-MPLS in OSPF networks:

  1. SRGB Consistency: Ensure all nodes have compatible SRGB ranges
  2. Algorithm Support: Verify all nodes support the same SR algorithms
  3. MSD Advertisement: Properly configure and advertise MSD values
  4. Prefix-SID Uniqueness: Avoid SID conflicts across the domain

Migration Strategies

For networks migrating to SR-MPLS:

  1. Incremental Deployment: Enable SR on a subset of nodes initially
  2. Coexistence with LDP: SR-MPLS can coexist with LDP during transition
  3. Mapping Server: Use SR Mapping Server for nodes not yet SR-capable
  4. Monitoring: Continuously monitor SR path establishment and traffic flow