<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">

<rfc xmlns:xi="http://www.w3.org/2001/XInclude" docName="draft-ietf-spring-sr-yang-30" number="9020" ipr="trust200902" category="std" obsoletes="" updates="" submissionType="IETF" consensus="true" xml:lang="en" tocInclude="true" tocDepth="4" symRefs="true" sortRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.5.0 -->
  <front>

    <title abbrev="SR YANG Data Model">YANG Data Model for Segment Routing</title>
    <seriesInfo name="RFC" value="9020"/>
    <author fullname="Stephane Litkowski" initials="S" surname="Litkowski">
      <organization>Cisco Systems</organization>
      <address>
        <email>slitkows.ietf@gmail.com</email>
      </address>
    </author>
    <author fullname="Yingzhen Qu" initials="Y" surname="Qu">
      <organization>Futurewei</organization>
      <address>
        <email>yingzhen.qu@futurewei.com</email>
      </address>
    </author>
    <author fullname="Acee Lindem" initials="A" surname="Lindem">
      <organization>Cisco Systems</organization>
      <address>
        <postal>
          <street>301 Mindenhall Way</street>
          <city>Cary</city>
          <region>NC</region>
          <code>27513</code>
          <country>United States of America</country>
        </postal>
        <email>acee@cisco.com</email>
      </address>
    </author>
    <author fullname="Pushpasis Sarkar" initials="P" surname="Sarkar">
      <organization>VMware, Inc</organization>
      <address>
        <email>pushpasis.ietf@gmail.com</email>
      </address>
    </author>
    <author fullname="Jeff Tantsura" initials="J" surname="Tantsura">
      <organization>Juniper Networks</organization>
      <address>
        <email>jefftant.ietf@gmail.com</email>
      </address>
    </author>
    <date month="May" year="2021"/>
    <area/>
    <workgroup>SPRING Working Group</workgroup>
<keyword>mpls</keyword>
    <abstract>
      <t>
   This document defines three YANG data models.  The first is for
   Segment Routing (SR) configuration and operation, which is to be
   augmented by different Segment Routing data planes.  The next is a
   YANG data model that defines a collection of generic types and groupings
   for SR.  The third module defines the configuration and operational states
   for the Segment Routing MPLS data plane.

      </t>
    </abstract>
  </front>
  <middle>
    <section anchor="introduction" toc="default" numbered="true">
      <name>Introduction</name>
      <t>
          This document defines three YANG data models
          <xref target="RFC7950" format="default"/>.  The first one is for
          Segment Routing (SR) <xref target="RFC8402" format="default"/>
          configuration and operation.
          This document does not define the IGP extensions to support SR, but the second
	  module defines generic
          groupings to be reused by IGP extension modules. The reason for this design choice
	  is to not require implementations to support all IGP extensions. For example, an implementation
	  may support the IS-IS extension but not the OSPF extension.
	  The third YANG data model
          defines a module that is intended to be used on network
          elements to configure or operate the SR MPLS data
          plane <xref target="RFC8660" format="default"/>.
      </t>
      <t>The YANG modules in this document conform to the Network Management
        Datastore Architecture (NMDA) <xref target="RFC8342" format="default"/>.
      </t>
    </section>
    <section anchor="term" toc="default" numbered="true">
      <name>Terminology and Notation</name>
      <t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
        NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
        "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
        described in BCP 14 <xref target="RFC2119" format="default"/> <xref target="RFC8174" format="default"/>
        when, and only when, they appear in all capitals, as shown here.</t>
      <section anchor="tree-info" toc="default" numbered="true">
        <name>Tree Diagram</name>
        <t>Tree diagrams used in this document follow the notation defined in
      <xref target="RFC8340" format="default"/>.</t>
      </section>
      <section anchor="sec.prefixes" numbered="true" toc="default">
        <name>Prefixes in Data Node Names</name>
        <t>In this document, names of data nodes, actions, and other
        data model objects are often used without a prefix, as long as
        it is clear from the context in which YANG module each name is
        defined. Otherwise, names are prefixed using the standard prefix
        associated with the corresponding YANG module, as shown in <xref target="tab.prefixes" format="default"/>.</t>
        <table anchor="tab.prefixes" align="center">
          <name>Prefixes and Corresponding YANG Modules</name>
          <thead>
            <tr>
              <th align="left">Prefix</th>
              <th align="left">YANG module</th>
              <th align="left">Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">if</td>
              <td align="left">ietf-interfaces</td>
              <td align="left">
                <xref target="RFC8343" format="default"/></td>
            </tr>
            <tr>
              <td align="left">rt</td>
              <td align="left">ietf-routing</td>
              <td align="left">
                <xref target="RFC8349" format="default"/></td>
            </tr>
            <tr>
              <td align="left">rt-types</td>
              <td align="left">ietf-routing-types</td>
              <td align="left">
                <xref target="RFC8294" format="default"/></td>
            </tr>
            <tr>
              <td align="left">yang</td>
              <td align="left">ietf-yang-types</td>
              <td align="left">
                <xref target="RFC6991" format="default"/></td>
            </tr>
            <tr>
              <td align="left">inet</td>
              <td align="left">ietf-inet-types</td>
              <td align="left">
                <xref target="RFC6991" format="default"/></td>
            </tr>
          </tbody>
        </table>
      </section>
    </section>
    <section anchor="design" toc="default" numbered="true">
      <name>Design of the Data Model</name>
      <t>The ietf-segment-routing YANG module augments the routing container in the
        ietf-routing model <xref target="RFC8349" format="default"/> and defines generic
        SR configuration and operational state. This module is
        augmented by modules supporting different data planes.</t>
      <t>Module ietf-segment-routing-mpls augments ietf-segment-routing and
        supports SR-MPLS data plane configuration and operational state.</t>
      <t>Module ietf-segment-routing-common defines generic types and groupings
        that <bcp14>SHOULD</bcp14> be reused by IGP extension modules.</t>
<sourcecode type="yangtree"><![CDATA[
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
]]></sourcecode>
    </section>
    <section anchor="how" toc="default" numbered="true">
      <name>Configuration</name>
      <t>
        The module ietf-segment-routing-mpls augments the "/rt:routing/sr:segment-routing:"
        with an sr-mpls container. This container defines all the configuration
        parameters related to the SR MPLS data plane.
      </t>
      <t>
        The sr-mpls configuration is split into global configuration and interface configuration.
      </t>
      <t>The global configuration includes:
      </t>
      <dl newline="false" spacing="normal">
          <dt>Bindings:</dt>
	  <dd><t>Defines Prefix to Segment Identifier (Prefix-SID) mappings.
	  The operator can control
          advertisement of Prefix-SIDs independently for IPv4 and IPv6. Two
          types of mappings are available:</t>
          <dl newline="false" spacing="normal">
            <dt>Mapping-server:</dt>
	    <dd>Maps prefixes that are not local to a SID. Configuration of bindings does not
           automatically allow advertisement of those
      bindings.  Advertisement must be controlled by each
      routing-protocol instance (see <xref target="cp" format="default"/>). Multiple mapping policies
          may be defined.</dd>
            <dt>Connected prefixes:</dt>
	    <dd>Maps connected prefixes to a SID. Advertisement of the mapping
          will be done by IGP when enabled for SR (see <xref target="cp"
	  format="default"/>). The SID value can be expressed as an index (default) or an absolute
          value.  The "last-hop-behavior" configuration dictates the MPLS Penultimate Hop Popping (PHP)
	  behavior: "explicit-null", "php", or "non-php".</dd>
          </dl></dd>
        <dt>Segment Routing Global Block (SRGB):</dt>
	<dd>Defines a list of label
      blocks represented by a pair of lower-bound/upper-bound labels.
      The SRGB is also agnostic to the control plane used. So, all local
      routing-protocol instances will have to advertise the same SRGB.</dd>
        <dt>Segment Routing Local Block (SRLB):</dt>
	<dd>Defines a list of label
      blocks represented by a pair of lower-bound/upper-bound labels reserved for local SIDs.</dd>
      </dl>
    </section>
    <section anchor="cp" toc="default" numbered="true">
      <name>IGP Control-Plane Configuration</name>
      <t>
    Support of SR extensions for a particular IGP control plane is achieved by augmenting routing-protocol configuration with SR extensions.
        This augmentation <bcp14>SHOULD</bcp14> be part of the routing-protocol YANG modules as not to create any dependency for implementations to support SR extensions for all routing protocols.
      </t>
      <t>
        This module defines groupings that <bcp14>SHOULD</bcp14> be used by IGP SR modules.
      </t>
      <t>The "sr-control-plane" grouping defines the generic global configuration for the IGP.</t>
      <t>The "enabled" leaf enables SR extensions for the
   routing-protocol instance.</t>
      <t>The "bindings" container controls the routing-protocol instance's
   advertisement of local bindings and the processing of received
   bindings.</t>
      <section anchor="igp-interface" toc="default" numbered="true">
        <name>IGP Interface Configuration</name>
        <t>The interface configuration is part of the "igp-interface" grouping and includes Adjacency SID (Adj-SID) properties.</t>
        <section anchor="adj-cfg" toc="default" numbered="true">
          <name>Adjacency SID (Adj-SID) Properties</name>
          <section anchor="adj-cfg-bundling" toc="default" numbered="true">
            <name>Bundling</name>
            <t>
              In case of parallel IP links between routers, an additional Adj-SID <xref target="RFC8402"
	      format="default"/> may be advertised representing more than one adjacency (i.e.,
              a bundle of adjacencies). The "advertise-adj-group-sid" configuration
              controls for which group(s) an additional Adj-SID is advertised.
            </t>
            <t>The "advertise-adj-group-sid" is a list of group IDs. Each group ID will identify interfaces that are bundled together.</t>
<artwork name="" type="" align="left" alt=""><![CDATA[
        +-------+                 +------+
        |       | ------- L1 ---- |      |
        |   R1  | ------- L2 ---- |  R2  |
        |       | ------- L3 ---- |      |
        |       | ------- L4 ---- |      |
        +-------+                 +------+
]]></artwork>
            <t>
              In the figure above, R1 and R2 are interconnected by four links. A routing protocol adjacency is established on each link.
              The operator would like to create Adj-SIDs that represent bundles of links. We can imagine two different bundles: L1/L2 and L3/L4.
              To achieve this behavior, the operator will configure a "group-id" X for interfaces L1 and L2 and a "group-id" Y for interfaces L3 and L4.
              This will result in R1 advertising an additional Adj-SID for each adjacency. For example, an Adj-SID with a value of 400 will be added to L1 and L2, and
              an Adj-SID with a value of 500 will be added to L3 and L4. As L1/L2 and L3/L4 do not share the same "group-id", a different SID value will be allocated.
            </t>
          </section>
          <section anchor="adj-cfg-protection" toc="default" numbered="true">
            <name>Protection</name>
            <t>
                                The "advertise-protection" defines how protection for an interface
                   is advertised.  It does not control the activation or deactivation of
                   protection.  If the "single" option is used, a single Adj-SID will be
                   advertised for the interface.  If the interface is protected, the
                   B-Flag for the Adj-SID advertisement will be set. If the "dual"
                   option is used and if the interface is protected, two Adj-SIDs will
                   be advertised for the interface adjacencies. One Adj-SID will always
                   have the B-Flag set, and the other will have the B-Flag clear.
		   This
                   option is intended to be used in the case of traffic engineering
                   where a path must use either protected segments or unprotected
                   segments.
            </t>
          </section>
        </section>
      </section>
    </section>
    <section anchor="states" toc="default" numbered="true">
      <name>State Data</name>
      <t>
        The operational state contains information reflecting the usage of
   allocated SRGB labels.
      </t>
      <t>It also includes a list of all global SIDs, their associated
   bindings, and other information, such as the associated source protocol and
   algorithm.</t>
    </section>
    <section anchor="notif" toc="default" numbered="true">
      <name>Notifications</name>
      <t>
        The model defines the following notifications for SR.
      </t>
      <dl newline="false" spacing="normal">
        <dt>segment-routing-srgb-collision:</dt>
	<dd>Raised when  control-plane-advertised SRGB blocks have conflicts</dd>
        <dt>segment-routing-global-sid-collision:</dt>
	<dd>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)</dd>
        <dt>segment-routing-index-out-of-range:</dt>
	<dd>Raised when a control-plane-advertised index falls outside the range of SRGBs configured for
      the network device</dd>
      </dl>
    </section>
    <section anchor="yang" toc="default" numbered="true">
      <name>YANG Modules</name>
      <t>There are three YANG modules included in this document. </t>
      <t>The following RFCs are not referenced in the document text but
      are referenced in the ietf-segment-routing.yang, ietf-segment-routing-common.yang,
      and/or ietf-segment-routing-mpls.yang modules:
      <xref target="RFC6991" format="default"/>, <xref target="RFC8294" format="default"/>,
      <xref target="RFC8661" format="default"/>, <xref target="RFC8665" format="default"/>,
      <xref target="RFC8667" format="default"/>, <xref target="RFC8669" format="default"/>,
      and <xref target="RFC8814" format="default"/>.</t>
      <section anchor="sr-yang" toc="default" numbered="true">
        <name>YANG Module for Segment Routing</name>
        <dl newline="false" spacing="normal">
	  <dt>ietf-segment-routing.yang:</dt>
	  <dd>This module defines a generic framework
            for Segment Routing (SR), and it is to be augmented by models for different
            SR data planes.</dd>
	</dl>

<sourcecode name="ietf-segment-routing@2021-04-01.yang" type="yang" markers="true"><![CDATA[
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-04-01 {
    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.";
    }
  }
}
]]></sourcecode>
      </section>
      <section anchor="sr-cmn-yang" toc="default" numbered="true">
        <name>YANG Module for Segment Routing Common Types</name>
        <dl newline="false" spacing="normal">
	  <dt>ietf-segment-routing-common.yang:</dt>
	  <dd>This module defines a collection of generic types and
	  groupings for SR, as defined in <xref target="RFC8402" format="default"/>.</dd>
	</dl>
<sourcecode name="ietf-segment-routing-common@2021-04-01.yang" type="yang" markers="true"><![CDATA[
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-04-01 {
    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.";
    }
  }
}
]]></sourcecode>
      </section>
      <section anchor="sr-mpls-yang" toc="default" numbered="true">
        <name>YANG Module for Segment Routing MPLS</name>
	<dl newline="false" spacing="compact">
        <dt>ietf-segment-routing-mpls.yang:</dt>
	<dd>This module defines the configuration
            and operational states for the Segment Routing MPLS data plane.</dd>
	</dl>
<sourcecode name="ietf-segment-routing-mpls@2021-04-01.yang" type="yang" markers="true"><![CDATA[
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-04-01 {
    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.";
  }

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

  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.";
    }
  }
}
]]></sourcecode>
      </section>
    </section>
    <section anchor="Security" toc="default" numbered="true">

      <name>Security Considerations</name>
      <t>The YANG modules specified in this document define a schema for
       data that is designed to be accessed via network
       management protocols, such as NETCONF <xref target="RFC6241" format="default"/> or
       RESTCONF <xref target="RFC8040" format="default"/>. The lowest NETCONF layer is the secure transport
       layer, and the mandatory-to-implement secure transport is Secure Shell (SSH)
       <xref target="RFC6242" format="default"/>. The lowest RESTCONF layer is HTTPS, and the
       mandatory-to-implement secure transport is TLS <xref target="RFC8446" format="default"/>.</t>
      <t>The Network Configuration Access Control Model (NACM) <xref target="RFC8341" format="default"/>
      provides the
      means to restrict access for particular NETCONF or RESTCONF users to a
      preconfigured subset of all available NETCONF or RESTCONF protocol
      operations and content.</t>
      <t>There are a number of data nodes defined in the modules
      that are writable/creatable/deletable (i.e., config true, which is the default).
      These data nodes may be considered sensitive or vulnerable in some network
      environments. Write operations (e.g., edit-config) to these data nodes without
      proper protection can have a negative effect on network operations.
      These are the subtrees and data nodes and their sensitivity/vulnerability:
      </t>
      <ul spacing="normal">
        <li>/segment-routing</li>
        <li>/segment-routing/mpls</li>
        <li>/segment-routing/mpls/bindings -- Modification to the local bindings could result
       in a Denial-of-Service (DoS) attack. An attacker may also try to create segment conflicts
       (using the same segment identifier for different purposes) to redirect traffic within the
       trusted domain. However, the traffic will remain within the trusted domain.
       Redirection could be used to route the traffic to compromised nodes within
       the trusted domain or to avoid certain security functions (e.g., firewall).
       Refer to <xref target="RFC8402" sectionFormat="of" section="8.1"/> for a discussion of the SR-MPLS
       trusted domain.
       </li>
        <li>/segment-routing/mpls/srgb -- Modification of the Segment Routing Global
       Block (SRGB) could be used to mount a DoS attack. For example, if the SRGB
       size is reduced to a very small value, a lot of existing segments could no longer
       be installed leading to a traffic disruption.
       </li>
        <li>/segment-routing/mpls/srlb -- Modification of the Segment Routing Local Block (SRLB)
       could be used to mount a DoS attack similar to those applicable to the SRGB.</li>
      </ul>
      <t>Some of the readable data nodes in these YANG modules
      may be considered sensitive or vulnerable in some network environments. It is thus
      important to control read access (e.g., via get, get-config, or notification)
      to these data nodes. These are the subtrees and data nodes and their sensitivity/vulnerability:
      </t>
      <ul spacing="normal">
        <li>/segment-routing/mpls/bindings -- Knowledge of these data nodes can be used to
	attack the local router with a Denial-of-Service (DoS) attack.</li>
        <li>/segment-routing/mpls/sid-db -- Knowledge of these data nodes can be used to
	attack the other routers in the SR domain with either a Denial-of-Service (DoS) attack or redirection traffic destined for those routers.</li>
      </ul>
    </section>
    <section anchor="IANA" toc="default" numbered="true">
      <name>IANA Considerations</name>
      <t>This document registers a URI in the "IETF XML Registry"
   <xref target="RFC3688" format="default"/>.  Following the format in <xref target="RFC3688" format="default"/>,
   the following registration is requested to be made:
      </t>
      <dl newline="false" spacing="compact">
	<dt>ID:</dt><dd>yang:ietf-segment-routing-common</dd>
   <dt>URI:</dt> <dd>urn:ietf:params:xml:ns:yang:ietf-segment-routing-common</dd>
   <dt>Registrant Contact:</dt> <dd>The IESG.</dd>
   <dt>XML:</dt> <dd>N/A, the requested URI is an XML namespace.</dd>
</dl>
<dl newline="false" spacing="compact">
   <dt>ID:</dt><dd>yang:ietf-segment-routing</dd>
   <dt>URI:</dt> <dd>urn:ietf:params:xml:ns:yang:ietf-segment-routing</dd>
   <dt>Registrant Contact:</dt> <dd>The IESG.</dd>
   <dt>XML:</dt> <dd>N/A, the requested URI is an XML namespace.</dd>
</dl>
<dl newline="false" spacing="compact">
  <dt>ID:</dt><dd>yang:ietf-segment-routing-mpls</dd>
   <dt>URI:</dt> <dd>urn:ietf:params:xml:ns:yang:ietf-segment-routing-mpls</dd>
   <dt>Registrant Contact:</dt> <dd>The IESG.</dd>
   <dt>XML:</dt> <dd>N/A, the requested URI is an XML namespace.</dd>
</dl>
      <t>This document registers YANG modules in the "YANG Module Names"
      registry <xref target="RFC6020" format="default"/>.
      </t>
<dl newline="false" spacing="compact">
   <dt>Name:</dt> <dd>ietf-segment-routing-common</dd>
   <dt>Maintained by IANA:</dt> <dd>N</dd>
   <dt>Namespace:</dt> <dd>urn:ietf:params:xml:ns:yang:ietf-segment-routing-common</dd>
   <dt>Prefix:</dt> <dd>sr-cmn</dd>
   <dt>Reference:</dt> <dd>RFC 9020</dd>
</dl>
<dl newline="false" spacing="compact">
   <dt>Name:</dt> <dd>ietf-segment-routing</dd>
   <dt>Maintained by IANA:</dt> <dd>N</dd>
   <dt>Namespace:</dt> <dd>urn:ietf:params:xml:ns:yang:ietf-segment-routing</dd>
   <dt>Prefix:</dt> <dd>sr</dd>
   <dt>Reference:</dt> <dd>RFC 9020</dd>
</dl>
<dl newline="false" spacing="compact">
   <dt>Name:</dt> <dd>ietf-segment-routing-mpls</dd>
   <dt>Maintained by IANA:</dt> <dd>N</dd>
   <dt>Namespace:</dt> <dd>urn:ietf:params:xml:ns:yang:ietf-segment-routing-mpls</dd>
   <dt>Prefix:</dt> <dd>sr-mpls</dd>
   <dt>Reference:</dt> <dd>RFC 9020</dd>
</dl>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
      <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3688.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6020.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6241.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6242.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6991.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7950.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8040.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8294.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8341.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8342.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8343.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8349.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8402.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8446.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8660.xml"/>
	<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8661.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8665.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8667.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8669.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8814.xml"/>

<reference anchor='W3C.REC-xml11-20060816'
           target='https://www.w3.org/TR/2006/REC-xml11-20060816'>
<front>
<title>Extensible Markup Language (XML) 1.1 (Second Edition)</title>

<author initials='T.' surname='Bray' fullname='Tim Bray'>
    <organization />
</author>

<author initials='J.' surname='Paoli' fullname='Jean Paoli'>
    <organization />
</author>

<author initials='M.' surname='Sperberg-McQueen' fullname='Michael Sperberg-McQueen'>
    <organization />
</author>

<author initials='E.' surname='Maler' fullname='Eve Maler'>
    <organization />
</author>

<author initials='F.' surname='Yergeau' fullname='François Yergeau'>
    <organization />
</author>

<author initials='J.' surname='Cowan' fullname='John Cowan'>
    <organization />
</author>

<date month='August' day='16' year='2006' />
</front>

<seriesInfo name='World Wide Web Consortium Recommendation' value='REC-xml11-20060816' />
<format type='HTML' target='https://www.w3.org/TR/2006/REC-xml11-20060816' />
</reference>

      </references>
      <references>
        <name>Informative References</name>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8340.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8792.xml"/>
      </references>
    </references>
    <section anchor="examples" numbered="true" toc="default">
      <name>Configuration Examples</name>
      <t>Note: '\' line wrapping per <xref target="RFC8792" format="default"/>.</t>
      <section anchor="ipv4" numbered="true" toc="default">
        <name>SR-MPLS with IPv4</name>
        <t>The following is an XML <xref target='W3C.REC-xml11-20060816' format="default"/> example using the SR-MPLS YANG modules with IPv4 addresses.</t>
<sourcecode type="xml"><![CDATA[
<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>
]]></sourcecode>
        <t>The following is the same example using JSON format.</t>
<sourcecode type="json"><![CDATA[
{
  "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
            }
          ]
        }
      }
    }
  }
}
]]></sourcecode>
      </section>
      <section anchor="ipv6" numbered="true" toc="default">
        <name>SR-MPLS with IPv6</name>
        <t>The following is an XML  <xref target='W3C.REC-xml11-20060816' format="default"/> example using the SR-MPLS YANG modules with IPv6 addresses.</t>
<sourcecode type="xml"><![CDATA[
<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>
]]></sourcecode>
        <t>The following is the same example using JSON format.</t>
<sourcecode type="json"><![CDATA[
{
  "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
            }
          ]
        }
      }
    }
  }
}
]]></sourcecode>
      </section>
    </section>
    <section anchor="Acknowledgements" toc="default" numbered="false">
      <name>Acknowledgements</name>
      <t>The authors would like to thank <contact fullname="Derek Yeung"/>, <contact
      fullname="Greg Hankins"/>, <contact fullname="Hannes Gredler"/>, <contact fullname="Uma Chunduri"/>,
      <contact fullname="Jeffrey Zhang"/>, <contact fullname="Shradda Hedge"/>, and <contact
      fullname="Les Ginsberg"/> for their contributions.</t>
      <t>Thanks to <contact fullname="Ladislav Lhotka"/> and <contact fullname="Tom Petch"/> for
      their thorough reviews and helpful comments.</t>
      <t>The authors would like to thank <contact fullname="Benjamin Kaduk"/>, <contact
      fullname="Alvaro Retana"/>, and <contact fullname="Roman Danyliw"/> for IESG
         review and comments.</t>
    </section>
  </back>
</rfc>