RFC 9020

YANG Data Model for Segment Routing

πŸ“… published May 2021, from ietf

RFC 9020: YANG Data Model for Segment Routing πŸ’–

okay bestie, here's the header situation πŸŽ€ This is RFC 9020, titled YANG Data Model for Segment Routing. It was published in May 2021, it's a Standards Track doc, and its ISSN is 2070-1721. The authors are S. Litkowski (Cisco Systems), Y. Qu (Futurewei), A. Lindem (Cisco Systems), P. Sarkar (VMware, Inc), and J. Tantsura (Juniper Networks). The header doesn't list any obsoletes or updates, so there's nothing extra to report there πŸ¦‹

Abstract ✨

okay so this doc defines three YANG data models πŸ’… The first is for Segment Routing (SR) configuration and operation, and it's designed to get augmented by different SR data planes. The second is a model full of generic types and groupings for SR. The third one covers configuration and operational state for the Segment Routing MPLS data plane 🌈

Status of This Memo 🧚

this is an Internet Standards Track document ✨

it's a product of the Internet Engineering Task Force (IETF) πŸ’œ It represents the consensus of the IETF community, got public review, and was approved for publication by the Internet Engineering Steering Group (IESG). If you want more info on Internet Standards, check out Section 2 of RFC 7841 πŸ“–

info about the current status of this doc, any errata, and how to send feedback lives at https://www.rfc-editor.org/info/rfc9020 🌸

Copyright (c) 2021 IETF Trust and the persons identified as the document authors. All rights reserved. πŸŽ€

this doc is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) as in effect on the date of publication 🌈 Please read these carefully, because they spell out your rights and restrictions for this doc. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions, and they come without warranty as described in the Simplified BSD License πŸ”₯

Table of Contents 🌸

1.  Introduction
2.  Terminology and Notation
  2.1.  Tree Diagram
  2.2.  Prefixes in Data Node Names
3.  Design of the Data Model
4.  Configuration
5.  IGP Control-Plane Configuration
  5.1.  IGP Interface Configuration
    5.1.1.  Adjacency SID (Adj-SID) Properties
      5.1.1.1.  Bundling
      5.1.1.2.  Protection
6.  State Data
7.  Notifications
8.  YANG Modules
  8.1.  YANG Module for Segment Routing
  8.2.  YANG Module for Segment Routing Common Types
  8.3.  YANG Module for Segment Routing MPLS
9.  Security Considerations
10. IANA Considerations
11. References
  11.1.  Normative References
  11.2.  Informative References
Appendix A.  Configuration Examples
  A.1.  SR-MPLS with IPv4
  A.2.  SR-MPLS with IPv6
Acknowledgements
Authors' Addresses

1. Introduction ✨

okay so this doc defines three YANG data models [RFC7950] πŸ¦‹ The first one is for Segment Routing (SR) [RFC8402] configuration and operation. This doc does not define the IGP extensions that support SR, but the second module has generic groupings that IGP extension modules can reuse πŸ’– The reason for this design? Implementations aren't forced to support every IGP extension. For example, an implementation might support the IS-IS extension but skip the OSPF one πŸ™ˆ The third YANG model is for network elements that configure or operate the SR MPLS data plane [RFC8660] πŸ’œ

the YANG modules in this doc follow the Network Management Datastore Architecture (NMDA) [RFC8342] πŸ’…

2. Terminology and Notation πŸŽ€

the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this doc are to be read as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, just like shown here ✨ lowercase versions are just regular words, bestie 🫢

2.1. Tree Diagram 🌳

the tree diagrams in this doc follow the notation defined in [RFC8340] πŸ¦‹

2.2. Prefixes in Data Node Names πŸ“

so in this doc, data node names, actions, and other data model objects often show up without a prefix, as long as it's clear from context which YANG module each name lives in. Otherwise, names get the standard prefix tied to their YANG module, as listed in Table 1 πŸ’…

           +==========+====================+===========+
           | Prefix   | YANG module        | Reference |
           +==========+====================+===========+
           | if       | ietf-interfaces    | [RFC8343] |
           +----------+--------------------+-----------+
           | rt       | ietf-routing       | [RFC8349] |
           +----------+--------------------+-----------+
           | rt-types | ietf-routing-types | [RFC8294] |
           +----------+--------------------+-----------+
           | yang     | ietf-yang-types    | [RFC6991] |
           +----------+--------------------+-----------+
           | inet     | ietf-inet-types    | [RFC6991] |
           +----------+--------------------+-----------+

              Table 1: Prefixes and Corresponding YANG
                              Modules

3. Design of the Data Model 🧚

okay the ietf-segment-routing YANG module augments the routing container in the ietf-routing model [RFC8349] πŸ’– It defines generic SR configuration and operational state, and other modules that support different data planes can augment it 🌈

ietf-segment-routing-mpls augments ietf-segment-routing and handles SR-MPLS data plane configuration and operational state ✨

ietf-segment-routing-common defines generic types and groupings that IGP extension modules SHOULD reuse πŸ‘‘

here's the full tree for those modules 🌸

module: ietf-segment-routing
  augment /rt:routing:
    +--rw segment-routing

module: ietf-segment-routing-mpls
  augment /rt:routing/sr:segment-routing:
    +--rw sr-mpls
       +--rw bindings
       |  +--rw mapping-server {mapping-server}?
       |  |  +--rw policy* [name]
       |  |     +--rw name       string
       |  |     +--rw entries
       |  |        +--rw mapping-entry* [prefix algorithm]
       |  |           +--rw prefix        inet:ip-prefix
       |  |           +--rw value-type?   enumeration
       |  |           +--rw start-sid     uint32
       |  |           +--rw range?        uint32
       |  |           +--rw algorithm     identityref
       |  +--rw connected-prefix-sid-map
       |  |  +--rw connected-prefix-sid* [prefix algorithm]
       |  |     +--rw prefix               inet:ip-prefix
       |  |     +--rw value-type?          enumeration
       |  |     +--rw start-sid            uint32
       |  |     +--rw range?               uint32
       |  |     +--rw algorithm            identityref
       |  |     +--rw last-hop-behavior?   enumeration
       |  +--rw local-prefix-sid
       |     +--rw local-prefix-sid* [prefix algorithm]
       |        +--rw prefix        inet:ip-prefix
       |        +--rw value-type?   enumeration
       |        +--rw start-sid     uint32
       |        +--rw range?        uint32
       |        +--rw algorithm     identityref
       +--rw srgb
       |  +--rw srgb* [lower-bound upper-bound]
       |     +--rw lower-bound    uint32
       |     +--rw upper-bound    uint32
       +--rw srlb
       |  +--rw srlb* [lower-bound upper-bound]
       |     +--rw lower-bound    uint32
       |     +--rw upper-bound    uint32
       +--ro label-blocks* []
       |  +--ro lower-bound?   uint32
       |  +--ro upper-bound?   uint32
       |  +--ro size?          uint32
       |  +--ro free?          uint32
       |  +--ro used?          uint32
       |  +--ro scope?         enumeration
       +--ro sid-db
          +--ro sid* [target sid source source-protocol binding-type]
             +--ro target             string
             +--ro sid                uint32
             +--ro algorithm?         uint8
             +--ro source             inet:ip-address
             +--ro used?              boolean
             +--ro source-protocol    -> /rt:routing
                                         /control-plane-protocols
                                         /control-plane-protocol/name
             +--ro binding-type       enumeration
             +--ro scope?             enumeration

  notifications:
    +---n segment-routing-srgb-collision
    |  +--ro srgb-collisions* []
    |     +--ro lower-bound?          uint32
    |     +--ro upper-bound?          uint32
    |     +--ro routing-protocol?     -> /rt:routing
    |                                    /control-plane-protocols
    |                                    /control-plane-protocol/name
    |     +--ro originating-rtr-id?   router-or-system-id
    +---n segment-routing-global-sid-collision
    |  +--ro received-target?       string
    |  +--ro new-sid-rtr-id?        router-or-system-id
    |  +--ro original-target?       string
    |  +--ro original-sid-rtr-id?   router-or-system-id
    |  +--ro index?                 uint32
    |  +--ro routing-protocol?      -> /rt:routing
    |                                  /control-plane-protocols
    |                                  /control-plane-protocol/name
    +---n segment-routing-index-out-of-range
       +--ro received-target?    string
       +--ro received-index?     uint32
       +--ro routing-protocol?   -> /rt:routing
                                    /control-plane-protocols
                                    /control-plane-protocol/name

4. Configuration ✨

okay so the module ietf-segment-routing-mpls augments /rt:routing/sr:segment-routing: with an sr-mpls container πŸŽ€ and this container holds ALL the config params for the SR MPLS data plane πŸ’…

the sr-mpls config is split into global config and interface config, so there are two buckets to keep track of πŸ¦‹

the global config has:

  • Bindings: these are the Prefix to Segment Identifier (Prefix-SID) mappings 🌸 the operator gets to control advertisement of Prefix-SIDs separately for IPv4 and IPv6. There are two types of mappings:
    • Mapping-server: maps prefixes that aren't local to a SID. Configuring bindings does NOT automatically let those bindings get advertised, bestie πŸ™ˆ advertisement has to be controlled by each routing-protocol instance (see Section 5). You can define multiple mapping policies too.
    • Connected prefixes: maps connected prefixes to a SID. The IGP does the advertising of this mapping when it's enabled for SR (see Section 5). The SID value can be an index (the default) or an absolute value. The last-hop-behavior config decides the MPLS Penultimate Hop Popping (PHP) behavior: explicit-null, php, or non-php πŸ’œ
  • Segment Routing Global Block (SRGB): a list of label blocks, each one a pair of lower-bound/upper-bound labels 🧚 the SRGB doesn't care which control plane you're using, so every local routing-protocol instance has to advertise the same SRGB. no exceptions πŸ‘‘
  • Segment Routing Local Block (SRLB): a list of label blocks (same lower-bound/upper-bound pairs) reserved for local SIDs πŸ“

5. IGP Control-Plane Configuration

support for SR extensions on a particular IGP control plane happens by augmenting the routing-protocol config with SR extensions ✨ this augmentation SHOULD be part of the routing-protocol YANG modules, so implementations don't get dragged into supporting SR extensions for every routing protocol 🫢

this module defines groupings that SHOULD be used by IGP SR modules πŸ’–

  • The sr-control-plane grouping defines the generic global config for the IGP.
  • The enabled leaf turns SR extensions on for the routing-protocol instance.
  • The bindings container controls the routing-protocol instance's advertisement of local bindings AND how it processes received bindings. it's the whole vibe πŸ’…

5.1. IGP Interface Configuration

the interface config is part of the igp-interface grouping and includes Adjacency SID (Adj-SID) properties πŸ¦‹

5.1.1. Adjacency SID (Adj-SID) Properties

5.1.1.1. Bundling

when there are parallel IP links between routers, an additional Adj-SID [RFC8402] may be advertised, representing more than one adjacency (aka a bundle of adjacencies) 🌈 the advertise-adj-group-sid config controls which group(s) get an additional Adj-SID advertised.

advertise-adj-group-sid is a list of group IDs. Each group ID identifies interfaces that are bundled together πŸ”₯

           +-------+                 +------+
           |       | ------- L1 ---- |      |
           |   R1  | ------- L2 ---- |  R2  |
           |       | ------- L3 ---- |      |
           |       | ------- L4 ---- |      |
           +-------+                 +------+

okay picture this 🌸 R1 and R2 are connected by four links, and a routing protocol adjacency is set up on each one. the operator wants Adj-SIDs that represent bundles of links, and we can imagine two bundles: L1/L2 and L3/L4 ✨ to make that happen, the operator configures a group-id X for L1 and L2, and a group-id Y for L3 and L4.

the result? R1 advertises an additional Adj-SID for each adjacency. For example, an Adj-SID with a value of 400 gets added to L1 and L2, and an Adj-SID with a value of 500 gets added to L3 and L4 πŸŽ€ since L1/L2 and L3/L4 don't share the same group-id, they get different SID values. iconic behavior, honestly 😭

5.1.1.2. Protection

advertise-protection defines how protection for an interface gets advertised πŸ’œ it does NOT control turning protection on or off, so don't mix those up, bestie πŸ™ˆ with the single option, one Adj-SID gets advertised for the interface. If the interface is protected, the B-Flag for that Adj-SID advertisement gets set.

with the dual option, and if the interface is protected, two Adj-SIDs get advertised for the interface adjacencies πŸ‘‘ one of them ALWAYS has the B-Flag set and the other has it clear. this option is meant for traffic engineering, where a path must use either protected segments or unprotected segments 🧚

6. State Data

the operational state holds info reflecting how the allocated SRGB labels are being used πŸ’…

it also includes a list of all global SIDs, their associated bindings, and other info like the associated source protocol and algorithm 🌸

7. Notifications

the model defines the following notifications for SR πŸ””

  • segment-routing-srgb-collision: raised when control-plane-advertised SRGB blocks have conflicts πŸ’€
  • segment-routing-global-sid-collision: raised when a control-plane-advertised index is already associated with another target (in this version, the only defined targets are IPv4 and IPv6 prefixes) πŸ™ˆ
  • segment-routing-index-out-of-range: raised when a control-plane-advertised index falls outside the range of SRGBs configured for the network device 😭

8. YANG Modules

there are three YANG modules included in this document πŸ¦‹

the following RFCs aren't referenced in the document text, but they ARE referenced in the ietf-segment-routing.yang, ietf-segment-routing-common.yang, and/or ietf-segment-routing-mpls.yang modules: [RFC6991], [RFC8294], [RFC8661], [RFC8665], [RFC8667], [RFC8669], and [RFC8814] ✨

8.1. YANG Module for Segment Routing

ietf-segment-routing.yang: this module defines a generic framework for Segment Routing (SR), and it's meant to be augmented by models for different SR data planes πŸ’–

<CODE BEGINS> file "ietf-segment-routing@2021-05-26.yang"
module ietf-segment-routing {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-segment-routing";
  prefix sr;

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

  organization
    "IETF SPRING - SPRING Working Group";
  contact
    "WG Web:   <https://datatracker.ietf.org/wg/spring/>
     WG List:  <mailto:spring@ietf.org>

     Author:    Stephane Litkowski
               <mailto:slitkows.ietf@gmail.com>
     Author:    Yingzhen Qu
               <mailto:yingzhen.qu@futurewei.com>
     Author:    Acee Lindem
               <mailto:acee@cisco.com>
     Author:    Pushpasis Sarkar
               <mailto:pushpasis.ietf@gmail.com>
     Author:    Jeff Tantsura
               <jefftant.ietf@gmail.com>

    ";
  description
    "This YANG module defines a generic framework for Segment
     Routing (SR).  It is to be augmented by models for different
     SR data planes.

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

     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.

     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 9020;
     see the RFC itself for full legal notices.";

  reference
    "RFC 9020: YANG Data Model for Segment Routing.";

  revision 2021-05-26 {
    description
      "Initial version";
    reference
      "RFC 9020: YANG Data Model for Segment Routing.";
  }

  augment "/rt:routing" {
    description
      "This module augments the routing data model (RFC 8349)
       with Segment Routing (SR).";
    container segment-routing {
      description
        "Segment Routing configuration.  This container
         is to be augmented by models for different SR
         data planes.";
      reference
        "RFC 8402: Segment Routing Architecture.";
    }
  }
}
<CODE ENDS>

8.2. YANG Module for Segment Routing Common Types ✨

Okay bestie, this one is the shared toolbox πŸ§°πŸ’– It's a YANG module full of generic types and groupings for SR, the stuff defined in [RFC8402], that other SR modules can just grab and reuse.

  • ietf-segment-routing-common.yang: a collection of generic types and groupings for SR, as defined in [RFC8402]. πŸŽ€
   <CODE BEGINS> file "ietf-segment-routing-common@2021-05-26.yang"
   module ietf-segment-routing-common {
     yang-version 1.1;
     namespace
      "urn:ietf:params:xml:ns:yang:ietf-segment-routing-common";
     prefix sr-cmn;

     import ietf-inet-types {
       prefix inet;
       reference
         "RFC 6991: Common YANG Data Types";
     }

     organization
       "IETF SPRING - SPRING Working Group";
     contact
       "WG Web:   <https://datatracker.ietf.org/wg/spring/>
        WG List:  <mailto:spring@ietf.org>

        Author:    Stephane Litkowski
                  <mailto:slitkows.ietf@gmail.com>
        Author:    Yingzhen Qu
                  <mailto:yingzhen.qu@futurewei.com>
        Author:    Acee Lindem
                  <mailto:acee@cisco.com>
        Author:    Pushpasis Sarkar
                  <mailto:pushpasis.ietf@gmail.com>
        Author:    Jeff Tantsura
                  <jefftant.ietf@gmail.com>

       ";
     description
       "This YANG module defines a collection of generic types and
        groupings for Segment Routing (SR), as described in RFC 8402.

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

        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.

        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 9020;
        see the RFC itself for full legal notices.";
     reference
       "RFC 9020: YANG Data Model for Segment Routing";

     revision 2021-05-26 {
       description
         "Initial version";
       reference
         "RFC 9020: YANG Data Model for Segment Routing";
     }

     feature sid-last-hop-behavior {
       description
         "Configurable last-hop behavior.";
       reference
         "RFC 8660: Segment Routing with the MPLS Data Plane";
     }

     identity prefix-sid-algorithm {
       description
         "Base identity for prefix-sid algorithm.";
       reference
         "RFC 8402: Segment Routing Architecture";
     }

     identity prefix-sid-algorithm-shortest-path {
       base prefix-sid-algorithm;
       description
         "Shortest Path First (SPF) Prefix-SID algorithm.  This
          is the default algorithm.";
     }

     identity prefix-sid-algorithm-strict-spf {
       base prefix-sid-algorithm;
       description
         "This algorithm mandates that the packet is forwarded
          according to the ECMP-aware SPF algorithm.";
     }

     grouping srlr {
       description
         "Grouping for SR Label Range configuration.";
       leaf lower-bound {
         type uint32;
         description
           "Lower value in the label range.";
       }
       leaf upper-bound {
         type uint32;
         must '../lower-bound < ../upper-bound' {
           error-message
             "The upper-bound must be greater than the lower-bound.";
           description
             "The value must be greater than lower-bound.";
         }
         description
           "Upper value in the label range.";
       }
     }

     grouping srgb {
       description
         "Grouping for SR Global Label Range.";
       list srgb {
         key "lower-bound upper-bound";
         ordered-by user;
         description
           "List of global blocks to be advertised.";
         uses srlr;
       }
     }

     grouping srlb {
       description
         "Grouping for SR Local Block Range.";
       list srlb {
         key "lower-bound upper-bound";
         ordered-by user;
         description
           "List of SRLBs.";
         uses srlr;
       }
     }

     grouping sid-value-type {
       description
         "Defines how the SID value is expressed.";
       leaf value-type {
         type enumeration {
           enum index {
             description
               "The value will be interpreted as an index.";
           }
           enum absolute {
             description
               "The value will become interpreted as an absolute
                value.";
           }
         }
         default "index";
         description
           "This leaf defines how the value must be interpreted.";
       }
     }

     grouping prefix-sid {
       description
         "This grouping defines configuration of a Prefix-SID.";
       leaf prefix {
         type inet:ip-prefix;
         description
           "Connected Prefix-SID.";
       }
       uses prefix-sid-attributes;
     }

     grouping ipv4-sid {
       description
         "Grouping for an IPv4 Prefix-SID.";
       leaf prefix {
         type inet:ipv4-prefix;
         description
           "Connected IPv4 Prefix-SID.";
       }
       uses prefix-sid-attributes;
     }

     grouping ipv6-sid {
       description
         "Grouping for an IPv6 Prefix-SID.";
       leaf prefix {
         type inet:ipv6-prefix;
         description
           "Connected IPv6 Prefix-SID.";
       }
       uses prefix-sid-attributes;
     }

     grouping last-hop-behavior {
       description
         "Defines last-hop behavior.";
       leaf last-hop-behavior {
         if-feature "sid-last-hop-behavior";
         type enumeration {
           enum explicit-null {
             description
               "Use explicit-null for the SID.";
           }
           enum no-php {
             description
               "Do not use MPLS Penultimate Hop Popping (PHP)
                for the SID.";
           }
           enum php {
             description
               "Use MPLS PHP for the SID.";
           }
         }
         description
           "Configure last-hop behavior.";
       }
     }

     grouping prefix-sid-attributes {
       description
         "Grouping for Segment Routing (SR) prefix attributes.";
       uses sid-value-type;
       leaf start-sid {
         type uint32;
         mandatory true;
         description
           "Value associated with prefix.  The value must be
            interpreted in the context of sid-value-type.";
       }
       leaf range {
         type uint32;
         description
           "Indicates how many SIDs can be allocated.";
       }
       leaf algorithm {
         type identityref {
           base prefix-sid-algorithm;
         }
         description
           "Prefix-SID algorithm.";
       }
     }
   }
   <CODE ENDS>

8.3. YANG Module for Segment Routing MPLS πŸ¦‹

Next up is the MPLS one! πŸ’… It's the config and operational states for the Segment Routing MPLS data plane, and it's giving "I import a whole bunch of stuff and I'm not even sorry" 😭 It pulls in the common types and the base SR module, plus a few routing types from other RFCs.

  • ietf-segment-routing-mpls.yang: the configuration and operational states for the Segment Routing MPLS data plane. 🌸
   <CODE BEGINS> file "ietf-segment-routing-mpls@2021-05-26.yang"
   module ietf-segment-routing-mpls {
     yang-version 1.1;
     namespace "urn:ietf:params:xml:ns:yang:ietf-segment-routing-mpls";
     prefix sr-mpls;

     import ietf-inet-types {
       prefix inet;
       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-routing-types {
       prefix rt-types;
       reference
         "RFC 8294: Common YANG Data Types for the
                    Routing Area";
     }
     import ietf-segment-routing {
       prefix sr;
       reference
         "RFC 9020: YANG Data Model for Segment Routing";
     }
     import ietf-segment-routing-common {
       prefix sr-cmn;
       reference
         "RFC 9020: YANG Data Model for Segment Routing";
     }

     organization
       "IETF SPRING - SPRING Working Group";
     contact
       "WG Web:   <https://datatracker.ietf.org/wg/spring/>
        WG List:  <mailto:spring@ietf.org>

        Author:    Stephane Litkowski
                  <mailto:slitkows.ietf@gmail.com>
        Author:    Yingzhen Qu
                  <mailto:yingzhen.qu@futurewei.com>
        Author:    Acee Lindem
                  <mailto:acee@cisco.com>
        Author:    Pushpasis Sarkar
                  <mailto:pushpasis.ietf@gmail.com>
        Author:    Jeff Tantsura
                  <jefftant.ietf@gmail.com>

       ";
     description
       "This YANG module defines a generic configuration model for
        the Segment Routing MPLS data plane.

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

        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.

        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 9020;
        see the RFC itself for full legal notices.";
     reference
       "RFC 9020: YANG Data Model for Segment Routing";

     revision 2021-05-26 {
       description
         "Initial version";
       reference
         "RFC 9020: YANG Data Model for Segment Routing";
     }

     feature mapping-server {
       description
         "Support for Segment Routing Mapping Server (SRMS).";
       reference
         "RFC 8661: Segment Routing MPLS Interworking
                    with LDP";
     }

     feature protocol-srgb {
       description
         "Support for per-protocol Segment Routing Global Block
          (SRGB) configuration.";
       reference
         "RFC 8660: Segment Routing with the MPLS
                    Data Plane";
     }

     typedef system-id {
       type string {
         pattern '[0-9A-Fa-f]{4}\.[0-9A-Fa-f]{4}\.[0-9A-Fa-f]{4}';
       }
       description
         "This type defines an IS-IS system-id using a pattern.
          An example system-id is 0143.0438.AEF0.";
     }

     typedef router-or-system-id {
       type union {
         type rt-types:router-id;
         type system-id;
       }
       description
         "OSPF/BGP router-id or IS-IS system ID.";
     }

Ooh, we're mid-module now, so the MPLS definitions keep going from here πŸ’œ

okay bestie, this chunk is pure YANG, so the code stays exactly as written and the vibes live in the little asides around it πŸ’…πŸŽ€

grouping sr-control-plane {
  description
    "Defines protocol configuration.";
  container segment-routing {
    description
      "Segment Routing global configuration.";
    leaf enabled {
      type boolean;
      default "false";
      description
        "Enables Segment Routing control-plane protocol
         extensions.";
    }
    container bindings {
      if-feature "mapping-server";
      description
        "Control of binding advertisement and reception.";
      container advertise {
        description
          "Control advertisement of local mappings
           in binding TLVs.";
        leaf-list policies {
          type leafref {
            path "/rt:routing/sr:segment-routing/sr-mpls:sr-mpls"
               + "/sr-mpls:bindings/sr-mpls:mapping-server"
               + "/sr-mpls:policy/sr-mpls:name";
          }
          description
            "List of binding advertisement policies.";
        }
      }
      leaf receive {
        type boolean;
        default "true";
        description
          "Allow the reception and usage of binding TLVs.";
      }
    }
  }
}

grouping igp-interface {
  description
    "Grouping for IGP interface configuration.";
  container segment-routing {
    description
      "Container for SR interface configuration.";
    container adjacency-sid {
      description
        "Adjacency SID (Adj-SID) configuration.";
      reference
        "RFC 8660: Segment Routing with the MPLS
                   Data Plane";
      list adj-sids {
        key "value";
        uses sr-cmn:sid-value-type;
        leaf value {
          type uint32;
          description
            "Value of the Adj-SID.";
        }
        leaf protected {
          type boolean;
          default "false";
          description
            "It is used to protect the Adj-SID, e.g., using
             IP Fast Reroute (IPFRR) or MPLS-FRR.";
        }
        leaf weight {
          type uint8;
          description
            "The load-balancing factor over parallel adjacencies.";
          reference
            "RFC 8402: Segment Routing Architecture
             RFC 8665: OSPF Extensions for Segment Routing
             RFC 8667: IS-IS Extensions for Segment
                       Routing";
        }
        description
          "List of Adj-SIDs and their configuration.";
      }
      list advertise-adj-group-sid {
        key "group-id";
        description
          "Control advertisement of S-flag or G-flag.  Enable
           advertisement of a common Adj-SID for parallel
           links.";
        reference
          "RFC 8665: OSPF Extensions for Segment Routing,
                     Section 6.1
           RFC 8667: IS-IS Extensions for Segment
                     Routing, Section 2.2.1";
        leaf group-id {
          type uint32;
          description
            "The value is an internal value to identify a
             group-ID. Interfaces with the same group-ID
             will be bundled together.";
        }
      }
      leaf advertise-protection {
        type enumeration {
          enum single {
            description
              "A single Adj-SID is associated with the
               adjacency and reflects the protection
               configuration.";
          }
          enum dual {
            description
              "Two Adj-SIDs will be associated with the adjacency
               if the interface is protected.  In this case, one
               Adj-SID will be advertised with the backup-flag
               set and the other with the backup-flag clear.  In
               the case where protection is not configured, a
               single Adj-SID will be advertised with the
               backup-flag clear.";
          }
        }
        description
          "If set, the Adj-SID refers to a protected adjacency.";
        reference
          "RFC 8665: OSPF Extensions for Segment Routing,
                     Section 6.1
           RFC 8667: IS-IS Extensions for Segment
                     Routing, Section 2.2.1";
      }
    }
  }
}

augment "/rt:routing/sr:segment-routing" {
  description
    "This augments the routing data model (RFC 8349)
     with Segment Routing (SR) using the MPLS data plane.";
  container sr-mpls {
    description
      "Segment Routing global configuration and
       operational state.";
    container bindings {
      description
        "List of bindings.";
      container mapping-server {
        if-feature "mapping-server";
        description
          "Configuration of mapping-server local entries.";
        list policy {
          key "name";
          description
            "List mapping-server policies.";
          leaf name {
            type string;
            description
              "Name of the mapping policy.";
          }
          container entries {
            description
              "IPv4/IPv6 mapping entries.";
            list mapping-entry {
              key "prefix algorithm";
              description
                "Mapping entries.";
              uses sr-cmn:prefix-sid;
            }
          }
        }
      }
      container connected-prefix-sid-map {
        description
          "Prefix-SID configuration.";
        list connected-prefix-sid {
          key "prefix algorithm";
          description
            "List of mappings of Prefix-SIDs to IPv4/IPv6
             local prefixes.";
          uses sr-cmn:prefix-sid;
          uses sr-cmn:last-hop-behavior;
        }
      }
      container local-prefix-sid {
        description
          "Local SID configuration.";
        list local-prefix-sid {
          key "prefix algorithm";
          description
            "List of local IPv4/IPv6 Prefix-SIDs.";
          uses sr-cmn:prefix-sid;
        }
      }
    }
    container srgb {
      description
        "Global SRGB configuration.";
      uses sr-cmn:srgb;
    }
    container srlb {
      description
        "Segment Routing Local Block (SRLB) configuration.";
      uses sr-cmn:srlb;
    }
    list label-blocks {
      config false;
      description
        "List of label blocks currently in use.";
      leaf lower-bound {
        type uint32;
        description
          "Lower bound of the label block.";
      }
      leaf upper-bound {
        type uint32;
        description
          "Upper bound of the label block.";
      }
      leaf size {
        type uint32;
        description
          "Number of indexes in the block.";
      }
      leaf free {
        type uint32;
        description
          "Number of free indexes in the block.";
      }
      leaf used {
        type uint32;
        description
          "Number of indexes in use in the block.";
      }
      leaf scope {
        type enumeration {
          enum global {
            description
              "Global SID.";
          }
          enum local {
            description
              "Local SID.";
          }
        }
        description
          "Scope of this label block.";
      }
    }
    container sid-db {
      config false;
      description
        "List of prefix and SID associations.";
      list sid {
        key "target sid source source-protocol binding-type";
        ordered-by system;
        description
          "SID binding.";
        leaf target {
          type string;
          description
            "Defines the target of the binding.  It can be a
             prefix or something else.";
        }
        leaf sid {
          type uint32;
          description
            "Index associated with the prefix.";
        }
        leaf algorithm {
          type uint8;
          description
            "Algorithm to be used for the Prefix-SID.";
          reference
            "RFC 8665: OSPF Extensions for Segment Routing
             RFC 8667: IS-IS Extensions for Segment
                       Routing
             RFC 8669: Segment Routing Prefix Segment
                       Identifier Extensions to BGP";
        }
        leaf source {
          type inet:ip-address;
          description
            "IP address of the router that owns the binding.";
        }
        leaf used {
          type boolean;
          description
            "Indicates if the binding is installed in the
             forwarding plane.";
        }
        leaf source-protocol {
          type leafref {
            path "/rt:routing/rt:control-plane-protocols/"
               + "rt:control-plane-protocol/rt:name";
          }
          description
            "Routing protocol that owns the binding.";
        }
        leaf binding-type {
          type enumeration {
            enum prefix-sid {
              description
                "Binding is learned from a Prefix-SID.";
            }
            enum binding-tlv {
              description
                "Binding is learned from a binding TLV.";
            }
          }
          description
            "Type of binding.";
        }
        leaf scope {
          type enumeration {
            enum global {
              description
                "Global SID.";
            }
            enum local {
              description
                "Local SID.";
            }
          }
          description
            "SID scoping.";
        }
      }
    }
  }
}

notification segment-routing-srgb-collision {
  description
    "This notification is sent when SRGB blocks received from
     different routers collide.";
  list srgb-collisions {
    description
      "List of SRGB blocks that collide.";
    leaf lower-bound {
      type uint32;
      description
        "Lower value in the block.";
    }
    leaf upper-bound {
      type uint32;
      description
        "Upper value in the block.";
    }
    leaf routing-protocol {
      type leafref {
        path "/rt:routing/rt:control-plane-protocols/"
           + "rt:control-plane-protocol/rt:name";
      }
      description
        "Routing protocol reference for SRGB collision.";
    }
    leaf originating-rtr-id {
      type router-or-system-id;
      description
        "Originating router ID of this SRGB block.";
    }
  }
}

the grouping that handles the control plane, the Adj-SID stuff with its protection flags, the augment that gives sr-mpls its whole personality, and that SRGB collision notification? iconic, no notes πŸ¦‹βœ¨

     notification segment-routing-global-sid-collision {
       description
         "This notification is sent when a new mapping is learned
          containing a mapping where the SID is already used.
          The notification generation must be throttled with at least
          a 5-second gap between notifications.";
       leaf received-target {
         type string;
         description
           "Target received in the router advertisement that caused
            the SID collision.";
       }
       leaf new-sid-rtr-id {
         type router-or-system-id;
         description
           "Router ID that advertised the colliding SID.";
       }
       leaf original-target {
         type string;
         description
           "Target already available in the database with the same SID
            as the received target.";
       }
       leaf original-sid-rtr-id {
         type router-or-system-id;
         description
           "Router ID for the router that originally advertised the
            colliding SID, i.e., the instance in the database.";
       }
       leaf index {
         type uint32;
         description
           "Value of the index used by two different prefixes.";
       }
       leaf routing-protocol {
         type leafref {
           path "/rt:routing/rt:control-plane-protocols/"
              + "rt:control-plane-protocol/rt:name";
         }
         description
           "Routing protocol reference for colliding SID.";
       }
     }

     notification segment-routing-index-out-of-range {
       description
         "This notification is sent when a binding is received
          containing a segment index that is out of the local
          configured ranges.  The notification generation must be
          throttled with at least a 5-second gap between
          notifications.";
       leaf received-target {
         type string;
         description
           "A human-readable string representing the target
            received in the protocol-specific advertisement
            corresponding to the out-of-range index.";
       }
       leaf received-index {
         type uint32;
         description
           "Value of the index received.";
       }
       leaf routing-protocol {
         type leafref {
           path "/rt:routing/rt:control-plane-protocols/"
              + "rt:control-plane-protocol/rt:name";
         }
         description
           "Routing protocol reference for out-of-range indexed.";
       }
     }
   }
   <CODE ENDS>

9. Security Considerations ✨

okay bestie, this part is SERIOUS πŸ’€ but also super important, so let's get into it πŸ”. The YANG modules in this document define a schema for data that's meant to be accessed through network management protocols, like NETCONF [RFC6241] or RESTCONF [RFC8040]. For NETCONF, the lowest layer is the secure transport layer, and the mandatory-to-implement secure transport is Secure Shell (SSH) [RFC6242]. For RESTCONF, the lowest layer is HTTPS, and the mandatory-to-implement secure transport is TLS [RFC8446] 🫢.

The Network Configuration Access Control Model (NACM) [RFC8341] is the bouncer πŸ’…. It lets you restrict particular NETCONF or RESTCONF users to a preconfigured subset of all the available protocol operations and content. Main character access control, honestly πŸ‘‘.

There are a bunch of data nodes in these modules that are writable, creatable, and deletable (that's config true, which is the default) 😭. These nodes may be considered sensitive or vulnerable in some network environments. Write operations (like edit-config) to them without proper protection can have a negative effect on network operations, so please don't be careless πŸ™ˆ. Here are the subtrees and data nodes, plus why they're sensitive:

  • /segment-routing
  • /segment-routing/mpls
  • /segment-routing/mpls/bindings -- Modifying the local bindings could result in a Denial-of-Service (DoS) attack πŸ’€. An attacker might also try to create segment conflicts (using the same segment identifier for different purposes) to redirect traffic within the trusted domain πŸ¦‹. The traffic does stay within the trusted domain, though. Redirection could be used to route traffic to compromised nodes inside that domain, or to dodge certain security functions (like a firewall) 🚨. For a discussion of the SR-MPLS trusted domain, check out Section 8.1 of [RFC8402] πŸ“–.
  • /segment-routing/mpls/srgb -- Modifying the Segment Routing Global Block (SRGB) could be used to mount a DoS attack 😱. For example, if the SRGB size gets shrunk to a very small value, a lot of existing segments could no longer be installed, and that leads to traffic disruption. Not it πŸ’”.
  • /segment-routing/mpls/srlb -- Modifying the Segment Routing Local Block (SRLB) could be used to mount a DoS attack similar to the ones that apply to the SRGB πŸ₯².

Some of the readable data nodes in these YANG modules may also be considered sensitive or vulnerable in some network environments πŸ‘€. So it's really important to control read access to them (for example through get, get-config, or notification). Here are those subtrees and data nodes:

  • /segment-routing/mpls/bindings -- Knowing about these data nodes can be used to attack the local router with a Denial-of-Service (DoS) attack πŸ™…β€β™€οΈ.
  • /segment-routing/mpls/sid-db -- Knowing about these data nodes can be used to attack the other routers in the SR domain with either a Denial-of-Service (DoS) attack, or by redirecting traffic destined for those routers πŸŒͺ️.

10. IANA Considerations πŸŽ€

This document registers a URI in the "IETF XML Registry" [RFC3688]. Following the format in [RFC3688], the following registration is requested to be made πŸ“:

ID:  yang:ietf-segment-routing-common
URI:  urn:ietf:params:xml:ns:yang:ietf-segment-routing-common
Registrant Contact:  The IESG.
XML:  N/A, the requested URI is an XML namespace.

ID:  yang:ietf-segment-routing
URI:  urn:ietf:params:xml:ns:yang:ietf-segment-routing
Registrant Contact:  The IESG.
XML:  N/A, the requested URI is an XML namespace.

ID:  yang:ietf-segment-routing-mpls
URI:  urn:ietf:params:xml:ns:yang:ietf-segment-routing-mpls
Registrant Contact:  The IESG.
XML:  N/A, the requested URI is an XML namespace.

This document also registers YANG modules in the "YANG Module Names" registry [RFC6020] ✨. Here's what gets added:

Name:  ietf-segment-routing-common
Maintained by IANA:  N
Namespace:  urn:ietf:params:xml:ns:yang:ietf-segment-routing-common
Prefix:  sr-cmn
Reference:  RFC 9020

Name:  ietf-segment-routing
Maintained by IANA:  N
Namespace:  urn:ietf:params:xml:ns:yang:ietf-segment-routing
Prefix:  sr
Reference:  RFC 9020

Name:  ietf-segment-routing-mpls
Maintained by IANA:  N
Namespace:  urn:ietf:params:xml:ns:yang:ietf-segment-routing-mpls
Prefix:  sr-mpls
Reference:  RFC 9020

11. References πŸ“š

11.1. Normative References ✨

okay bestie, these are the must-read RFCs the whole spec leans on πŸ“šπŸ«Ά

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

[RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, DOI 10.17487/RFC3688, January 2004, <https://www.rfc-editor.org/info/rfc3688>.

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

[RFC6242] Wasserman, M., "Using the NETCONF Protocol over Secure Shell (SSH)", RFC 6242, DOI 10.17487/RFC6242, June 2011, <https://www.rfc-editor.org/info/rfc6242>.

[RFC6991] Schoenwaelder, J., Ed., "Common YANG Data Types", RFC 6991, DOI 10.17487/RFC6991, July 2013, <https://www.rfc-editor.org/info/rfc6991>.

[RFC7950] Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language", RFC 7950, DOI 10.17487/RFC7950, August 2016, <https://www.rfc-editor.org/info/rfc7950>.

[RFC8040] Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF Protocol", RFC 8040, DOI 10.17487/RFC8040, January 2017, <https://www.rfc-editor.org/info/rfc8040>.

[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, <https://www.rfc-editor.org/info/rfc8174>.

[RFC8294] Liu, X., Qu, Y., Lindem, A., Hopps, C., and L. Berger, "Common YANG Data Types for the Routing Area", RFC 8294, DOI 10.17487/RFC8294, December 2017, <https://www.rfc-editor.org/info/rfc8294>.

[RFC8341] Bierman, A. and M. Bjorklund, "Network Configuration Access Control Model", STD 91, RFC 8341, DOI 10.17487/RFC8341, March 2018, <https://www.rfc-editor.org/info/rfc8341>.

[RFC8342] Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K., and R. Wilton, "Network Management Datastore Architecture (NMDA)", RFC 8342, DOI 10.17487/RFC8342, March 2018, <https://www.rfc-editor.org/info/rfc8342>.

[RFC8343] Bjorklund, M., "A YANG Data Model for Interface Management", RFC 8343, DOI 10.17487/RFC8343, March 2018, <https://www.rfc-editor.org/info/rfc8343>.

[RFC8349] Lhotka, L., Lindem, A., and Y. Qu, "A YANG Data Model for Routing Management (NMDA Version)", RFC 8349, DOI 10.17487/RFC8349, March 2018, <https://www.rfc-editor.org/info/rfc8349>.

[RFC8402] Filsfils, C., Ed., Previdi, S., Ed., Ginsberg, L., Decraene, B., Litkowski, S., and R. Shakir, "Segment Routing Architecture", RFC 8402, DOI 10.17487/RFC8402, July 2018, <https://www.rfc-editor.org/info/rfc8402>.

[RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, <https://www.rfc-editor.org/info/rfc8446>.

[RFC8660] Bashandy, A., Ed., Filsfils, C., Ed., Previdi, S., Decraene, B., Litkowski, S., and R. Shakir, "Segment Routing with the MPLS Data Plane", RFC 8660, DOI 10.17487/RFC8660, December 2019, <https://www.rfc-editor.org/info/rfc8660>.

[RFC8661] Bashandy, A., Ed., Filsfils, C., Ed., Previdi, S., Decraene, B., and S. Litkowski, "Segment Routing MPLS Interworking with LDP", RFC 8661, DOI 10.17487/RFC8661, December 2019, <https://www.rfc-editor.org/info/rfc8661>.

[RFC8665] Psenak, P., Ed., Previdi, S., Ed., Filsfils, C., Gredler, H., Shakir, R., Henderickx, W., and J. Tantsura, "OSPF Extensions for Segment Routing", RFC 8665, DOI 10.17487/RFC8665, December 2019, <https://www.rfc-editor.org/info/rfc8665>.

[RFC8667] Previdi, S., Ed., Ginsberg, L., Ed., Filsfils, C., Bashandy, A., Gredler, H., and B. Decraene, "IS-IS Extensions for Segment Routing", RFC 8667, DOI 10.17487/RFC8667, December 2019, <https://www.rfc-editor.org/info/rfc8667>.

[RFC8669] Previdi, S., Filsfils, C., Lindem, A., Ed., Sreekantiah, A., and H. Gredler, "Segment Routing Prefix Segment Identifier Extensions for BGP", RFC 8669, DOI 10.17487/RFC8669, December 2019, <https://www.rfc-editor.org/info/rfc8669>.

[RFC8814] Tantsura, J., Chunduri, U., Talaulikar, K., Mirsky, G., and N. Triantafillis, "Signaling Maximum SID Depth (MSD) Using the Border Gateway Protocol - Link State", RFC 8814, DOI 10.17487/RFC8814, August 2020, <https://www.rfc-editor.org/info/rfc8814>.

[W3C.REC-xml11-20060816] Bray, T., Paoli, J., Sperberg-McQueen, M., Maler, E., Yergeau, F., and J. Cowan, "Extensible Markup Language (XML) 1.1 (Second Edition)", World Wide Web Consortium Recommendation REC-xml11-20060816, 16 August 2006, <https://www.w3.org/TR/2006/REC-xml11-20060816>.

11.2. Informative References 🌸

these ones are the friendly extras that give you background 🧚

[RFC8340] Bjorklund, M. and L. Berger, Ed., "YANG Tree Diagrams", BCP 215, RFC 8340, DOI 10.17487/RFC8340, March 2018, <https://www.rfc-editor.org/info/rfc8340>.

[RFC8792] Watsen, K., Auerswald, E., Farrel, A., and Q. Wu, "Handling Long Lines in Content of Internet-Drafts and RFCs", RFC 8792, DOI 10.17487/RFC8792, June 2020, <https://www.rfc-editor.org/info/rfc8792>.


Appendix A. Configuration Examples πŸŽ€

Note: '' line wrapping per [RFC8792]. πŸ’…

A.1. SR-MPLS with IPv4 πŸ¦‹

okay so this first example is an XML [W3C.REC-xml11-20060816] config using the SR-MPLS YANG modules with IPv4 addresses, and it's giving everything 😭✨

<routing xmlns="urn:ietf:params:xml:ns:yang:ietf-routing">
  <segment-routing
    xmlns="urn:ietf:params:xml:ns:yang:ietf-segment-routing">
    <sr-mpls
      xmlns="urn:ietf:params:xml:ns:yang:ietf-segment-routing-mpls">
      <bindings>
        <mapping-server>
          <policy>
            <name>mapping 1</name>
            <entries>
              <mapping-entry>
                <prefix>198.51.100.0/24</prefix>
                <algorithm xmlns:sr-cmn="urn:ietf:params:xml:ns:yang\
                  :ietf-segment-routing-common">\
                  sr-cmn:prefix-sid-algorithm-shortest-path\
                </algorithm>
                <start-sid>200</start-sid>
                <range>100</range>
              </mapping-entry>
            </entries>
          </policy>
        </mapping-server>
        <connected-prefix-sid-map>
          <connected-prefix-sid>
            <prefix>192.0.2.0/24</prefix>
            <algorithm xmlns:sr-cmn="urn:ietf:params:xml:ns:yang:\
              ietf-segment-routing-common">\
              sr-cmn:prefix-sid-algorithm-strict-spf</algorithm>
            <start-sid>100</start-sid>
            <range>1</range>
            <last-hop-behavior>php</last-hop-behavior>
          </connected-prefix-sid>
        </connected-prefix-sid-map>
      </bindings>
      <srgb>
        <srgb>
          <lower-bound>45000</lower-bound>
          <upper-bound>55000</upper-bound>
        </srgb>
      </srgb>
    </sr-mpls>
  </segment-routing>
</routing>

and here's the exact same thing in JSON, for the bestie who prefers curly braces πŸ“πŸ’œ

{
  "ietf-routing:routing": {
    "ietf-segment-routing:segment-routing": {
      "ietf-segment-routing-mpls:sr-mpls": {
        "bindings": {
          "mapping-server": {
            "policy": [
              {
                "name": "mapping 1",
                "entries": {
                  "mapping-entry": [
                    {
                      "prefix": "198.51.100.0/24",
                      "algorithm": "ietf-segment-routing-common:\
                      prefix-sid-algorithm-shortest-path",
                      "start-sid": 200,
                      "range": 100
                    }
                  ]
                }
              }
            ]
          },
          "connected-prefix-sid-map": {
            "connected-prefix-sid": [
              {
                "prefix": "192.0.2.0/24",
                "algorithm": "ietf-segment-routing-common:\
                prefix-sid-algorithm-strict-spf",
                "start-sid": 100,
                "range": 1,
                "last-hop-behavior": "php"
              }
            ]
          }
        },
        "srgb": {
          "srgb": [
            {
              "lower-bound": 45000,
              "upper-bound": 55000
            }
          ]
        }
      }
    }
  }
}

A.2. SR-MPLS with IPv6 ✨

okay bestie, this one's the IPv6 twin of the last example 🌈 same SR-MPLS YANG modules, just with IPv6 prefixes. here's the XML version, and it's giving [W3C.REC-xml11-20060816] πŸ’…

<routing xmlns="urn:ietf:params:xml:ns:yang:ietf-routing">
  <segment-routing
    xmlns="urn:ietf:params:xml:ns:yang:ietf-segment-routing">
    <sr-mpls
      xmlns="urn:ietf:params:xml:ns:yang:ietf-segment-routing-mpls">
      <bindings>
        <mapping-server>
          <policy>
            <name>mapping 1</name>
            <entries>
              <mapping-entry>
                <prefix>2001:db8:aaaa:bbbb::/64</prefix>
                <algorithm xmlns:sr-cmn="urn:ietf:params:xml:ns:yang\
                  :ietf-segment-routing-common">\
                  sr-cmn:prefix-sid-algorithm-shortest-path\
                </algorithm>
                <start-sid>200</start-sid>
                <range>100</range>
              </mapping-entry>
            </entries>
          </policy>
        </mapping-server>
        <connected-prefix-sid-map>
          <connected-prefix-sid>
            <prefix>2001:db8:aaaa:cccc::/64</prefix>
            <algorithm xmlns:sr-cmn="urn:ietf:params:xml:ns:yang:\
              ietf-segment-routing-common">\
              sr-cmn:prefix-sid-algorithm-strict-spf</algorithm>
            <start-sid>100</start-sid>
            <range>1</range>
            <last-hop-behavior>php</last-hop-behavior>
          </connected-prefix-sid>
        </connected-prefix-sid-map>
      </bindings>
      <srgb>
        <srgb>
          <lower-bound>45000</lower-bound>
          <upper-bound>55000</upper-bound>
        </srgb>
      </srgb>
    </sr-mpls>
  </segment-routing>
</routing>

and here's the exact same thing in JSON, if that's more your vibe 🧚

{
  "ietf-routing:routing": {
    "ietf-segment-routing:segment-routing": {
      "ietf-segment-routing-mpls:sr-mpls": {
        "bindings": {
          "mapping-server": {
            "policy": [
              {
                "name": "mapping 1",
                "entries": {
                  "mapping-entry": [
                    {
                      "prefix": "2001:db8:aaaa:bbbb::/64",
                      "algorithm": "ietf-segment-routing-common:\
                      prefix-sid-algorithm-shortest-path",
                      "start-sid": 200,
                      "range": 100
                    }
                  ]
                }
              }
            ]
          },
          "connected-prefix-sid-map": {
            "connected-prefix-sid": [
              {
                "prefix": "2001:db8:aaaa:cccc::/64",
                "algorithm": "ietf-segment-routing-common:\
                prefix-sid-algorithm-strict-spf",
                "start-sid": 100,
                "range": 1,
                "last-hop-behavior": "php"
              }
            ]
          }
        },
        "srgb": {
          "srgb": [
            {
              "lower-bound": 45000,
              "upper-bound": 55000
            }
          ]
        }
      }
    }
  }
}

Acknowledgements 🫢

the authors wanna give a huge shoutout to Derek Yeung, Greg Hankins, Hannes Gredler, Uma Chunduri, Jeffrey Zhang, Shradda Hedge, and Les Ginsberg for their contributions πŸ’–

thanks x2 to Ladislav Lhotka and Tom Petch for their thorough reviews and helpful comments 🌸

and the authors also want to thank Benjamin Kaduk, Alvaro Retana, and Roman Danyliw for IESG review and comments πŸ‘‘


Authors' Addresses πŸ’…

the people who wrote this, with their contact details πŸ¦‹

Stephane Litkowski
Cisco Systems

Email: slitkows.ietf@gmail.com


Yingzhen Qu
Futurewei

Email: yingzhen.qu@futurewei.com


Acee Lindem
Cisco Systems
301 Mindenhall Way
Cary, NC 27513
United States of America

Email: acee@cisco.com


Pushpasis Sarkar
VMware, Inc

Email: pushpasis.ietf@gmail.com


Jeff Tantsura
Juniper Networks

Email: jefftant.ietf@gmail.com

that's a wrap on RFC 9020 πŸŽ€βœ¨

πŸ“¦ where this page comes from