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

<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902"
     docName="draft-ietf-mpls-base-yang-17" number="8960" category="std"
     obsoletes="" updates="" submissionType="IETF" consensus="true"
     xml:lang="en" tocInclude="true" sortRefs="true" symRefs="true"
     version="3">
  <!-- xml2rfc v2v3 conversion 3.3.0 -->
  <front>
    <title abbrev="MPLS Base YANG Data Model">A YANG Data Model for MPLS Base</title>
    <seriesInfo name="RFC" value="8960"/>
    <author initials="T." surname="Saad" fullname="Tarek Saad">
      <organization>Juniper Networks</organization>
      <address>
        <email>tsaad@juniper.net</email>
      </address>
    </author>
    <author initials="K." surname="Raza" fullname="Kamran Raza">
      <organization>Cisco Systems, Inc.</organization>
      <address>
        <email>skraza@cisco.com</email>
      </address>
    </author>
    <author initials="R." surname="Gandhi" fullname="Rakesh Gandhi">
      <organization>Cisco Systems, Inc.</organization>
      <address>
        <email>rgandhi@cisco.com</email>
      </address>
    </author>
    <author initials="X." surname="Liu" fullname="Xufeng Liu">
      <organization>Volta Networks</organization>
      <address>
        <email>xufeng.liu.ietf@gmail.com</email>
      </address>
    </author>
    <author initials="V." surname="Beeram" fullname="Vishnu Pavan Beeram">
      <organization>Juniper Networks</organization>
      <address>
        <email>vbeeram@juniper.net</email>
      </address>
    </author>
    <date year="2020" month="December"/>

<keyword>MPLS YANG Data Model</keyword>
<keyword>MPLS Model</keyword>
<keyword>MPLS RIB</keyword>
<keyword>MPLS Routing Information Base</keyword>

    <abstract>
      <t>This document contains a specification of the MPLS base YANG data model. The MPLS
base YANG data model serves as a base framework for configuring and managing an MPLS
switching subsystem on an MPLS-enabled router.  It is expected that other MPLS
YANG data models (e.g., MPLS Label Switched Path (LSP) static, LDP, or RSVP-TE
YANG data models) will augment the MPLS base YANG data model.
</t>
    </abstract>
  </front>
  <middle>
    <section anchor="introduction" numbered="true" toc="default">
      <name>Introduction</name>
      <t>A core routing YANG data model is defined in <xref target="RFC8349" format="default"/>; it provides a basis
for the development of routing data models for specific Address Families (AFs).
Specifically, <xref target="RFC8349" format="default"/> defines a model for a generic Routing Information
Base (RIB) that is AF agnostic. <xref target="RFC8349" format="default"/> also defines two
instances of RIBs based on the generic RIB model for IPv4 and IPv6 AFs.</t>
      <t>The MPLS base model defined in this document augments the generic RIB model
defined in <xref target="RFC8349" format="default"/> with additional data that enables MPLS
forwarding for one or more specific destination prefixes present in one or more AF RIBs, as described in
the MPLS architecture document <xref target="RFC3031" format="default"/>.</t>
      <t>The MPLS base model also defines a new instance of the generic RIB YANG data model as
defined in <xref target="RFC8349" format="default"/> to store native MPLS routes. The native MPLS RIB
instance stores one or more routes that are not associated with other AF instance RIBs
(such as IPv4 or IPv6 instance RIBs) but are enabled for MPLS forwarding.
Examples of such native MPLS routes are routes programmed by RSVP on
one or more transit MPLS routers along the path of a Label Switched Path (LSP). Other examples are
MPLS routes that cross-connect to specific Layer 2 adjacencies, such as Layer 2
Attachment Circuits (ACs); or Layer 3 adjacencies, such as Segment Routing
(SR) Adjacency Segments (Adj-SIDs) as described in <xref target="RFC8402" format="default"/>.</t>
      <t>The MPLS base YANG data model serves as a basis for future development of MPLS YANG data
models covering MPLS features and subsystems that are more
sophisticated. The main
purpose is to provide essential building blocks for other YANG data models involving
different control-plane protocols and MPLS functions.</t>
      <t>To this end, it is expected that the MPLS base data model will be augmented by
a number of other YANG modules developed by the IETF (e.g., by the TEAS and MPLS Working
Groups).</t>
      <t>The YANG module defined in this document conforms to the Network Management Datastore
Architecture (NMDA) <xref target="RFC8342" format="default"/>.</t>
      <section anchor="terminology" numbered="true" toc="default">
        <name>Terminology</name>
        <t>The terminology for describing YANG data models is found in <xref target="RFC7950" format="default"/>.</t>
      </section>
      <section anchor="acronyms-and-abbreviations" numbered="true" toc="default">
        <name>Acronyms and Abbreviations</name>
        <dl newline="false" spacing="normal">
          <dt>MPLS:</dt><dd>Multiprotocol Label Switching</dd>
          <dt>RIB:</dt><dd>Routing Information Base</dd>
          <dt>LSP:</dt><dd>Label Switched Path</dd>
          <dt>LSR:</dt><dd>Label Switching Router</dd>
          <dt>NHLFE:</dt><dd>Next Hop Label Forwarding Entry</dd>
        </dl>
      </section>
    </section>
    <section anchor="mpls-base-model" numbered="true" toc="default">
      <name>MPLS Base Model</name>
      <t>This document describes the "ietf-mpls" YANG module, which provides base components
of the MPLS data model. It is expected that other MPLS YANG modules will
augment the "ietf-mpls" YANG module for other MPLS extensions to provision
LSPs (e.g., MPLS static, MPLS LDP, or MPLS RSVP-TE LSPs).</t>
      <section anchor="model-overview" numbered="true" toc="default">
        <name>Model Overview</name>
        <t>This document models MPLS-labeled routes as an
augmentation of the generic routing RIB data model as defined in <xref target="RFC8349" format="default"/>.
For example, IP prefix routes (e.g., routes stored in IPv4 or IPv6 RIBs) are
augmented to carry additional data to enable them for MPLS forwarding.
</t>
        <t>This document also defines a new instance of the generic RIB model defined in
<xref target="RFC8349" format="default"/> to store one or more native MPLS routes (described further in
<xref target="model-design" format="default"/>) by extending the identity "address-family" defined in
<xref target="RFC8349" format="default"/> with a new "mpls" identity;
see <xref target="RFC8349" sectionFormat="of" section="3"/>.
</t>
      </section>
      <section anchor="model-organization" numbered="true" toc="default">
        <name>Model Organization</name>
        <figure anchor="fig-mpls-relation">
          <name>Relationship between MPLS Modules</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
  Routing          +---------------+    v: import
  YANG module      | ietf-routing  |    o: augment
                   +---------------+
                       o
                       |
                       v
  MPLS base        +-----------+    v: import
  YANG module      | ietf-mpls |    o: augment
                   +-----------+
                      o      o------+
                      |              \
                      v               v
              +-------------------+ +---------------------+
  MPLS static | ietf-mpls-static@ | | ietf-mpls-ldp.yang@ | . .
  LSP YANG    +-------------------+ +---------------------+
  module

        @: not in this document; shown for illustration only]]></artwork>
        </figure>
        <t>The "ietf-mpls" YANG module defines the following identities:</t>

      <dl newline="true" spacing="normal">
        <dt>mpls:</dt>
          <dd>Identity that extends the "address-family" identity of RIB
          instances, as defined in <xref target="RFC8349"
          format="default"/>, to represent the native MPLS RIB instance.</dd>
        <dt>label-block-alloc-mode:</dt>
          <dd>A base YANG identity for one or more supported label-block allocation modes.</dd>
      </dl>
        <t>The "ietf-mpls" YANG module contains the following high-level types
        and groupings:</t>
      <dl newline="true" spacing="normal">
        <dt>mpls-operations-type:</dt>
          <dd>An enumeration type that represents support for possible MPLS operation types (impose-and-forward, pop-and-forward, pop-impose-and-forward, and pop-and-lookup).</dd>
        <dt>nhlfe-role:</dt>
          <dd>An enumeration type that represents the role of the 
Next Hop Label Forwarding Entry (NHLFE).</dd>
        <dt>nhlfe-single-contents:</dt>
          <dd>A YANG grouping that describes a single NHLFE and its associated parameters as described in the MPLS architecture document <xref target="RFC3031" format="default"/>. This grouping is
specific to the case when a single next hop is associated with the route.</dd>
      </dl>
        <t>The NHLFE is used when forwarding a labeled packet.  It contains the following information:</t>
    <ol spacing="normal" type="1">
          <li>The packet's next hop. For "nhlfe-single-contents", only a single next hop is expected, while for
"nhlfe-multiple-contents", multiple next hops are possible.</li>
          <li><t>The operation to perform on the packet's label stack. This
        can be one of the following operations:</t>
      <ol type="%c.">
      <li>Replace the label at the top of the label stack with one or more
   specified new labels.</li>
      <li>Pop the label stack.</li>
      <li>Replace the label at the top of the label stack with a
   specified new label, and then push one or more specified new
   labels onto the label stack.</li>
      <li>Push one or more labels onto an unlabeled packet.</li>
       </ol>
     </li>
    </ol>
        <t>The NHLFE may also contain:</t>
    <ol spacing="normal" type="1">
  <li>The data-link encapsulation to use when transmitting the packet.</li>
  <li>The way to encode the label stack when transmitting the packet.</li>
  <li>Any other information needed in order to properly dispose of
     the packet.</li>
    </ol>

     <dl newline="true" spacing="normal">
        <dt>nhlfe-multiple-contents:</dt>
          <dd>A YANG grouping that describes a set of NHLFEs and their associated parameters as described in the MPLS architecture document <xref target="RFC3031" format="default"/>. This grouping
is used when multiple next hops are associated with the route.</dd>
        <dt>interfaces-mpls:</dt>
          <dd>A YANG grouping that describes the list of MPLS-enabled interfaces on a device.</dd>
        <dt>label-blocks:</dt>
          <dd>A YANG grouping that describes the list of assigned MPLS label blocks and their properties.</dd>
        <dt>rib-mpls-properties:</dt>
          <dd>A YANG grouping for the augmentation of the generic RIB with MPLS label forwarding data as defined in <xref target="RFC3031" format="default"/>.</dd>
        <dt>rib-active-route-mpls-input:</dt>
          <dd>A YANG grouping for the augmentation to the "active-route" RPC that is specific to the MPLS RIB instance.</dd>
     </dl>
      </section>
      <section anchor="model-design" numbered="true" toc="default">
        <name>Model Design</name>
        <t>The MPLS routing model is based on the core routing data model defined in <xref target="RFC8349" format="default"/>.
<xref target="fig-mpls-rib-relation" format="default"/> shows the extensions introduced by the MPLS base model on defined RIBs.</t>
        <figure anchor="fig-mpls-rib-relation">
          <name>Relationship between MPLS Model and RIB Instances</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
                             +-----------------+
                             | MPLS base model |
                             +-----------------+
                           ____/  |  |_____  |________
                          /       |        \          \
                         /        |         \          \
                        o         o          o          +
                 +---------+  +---------+  +--------+ +-----------+ 
                 | RIB(v4) |  | RIB(v6) |  | RIB(x) | | RIB(mpls) |
                 +---------+  +---------+  +--------+ +-----------+

        +: created by the MPLS base model
        o: augmented by the MPLS base model]]></artwork>
        </figure>
        <t>As shown in <xref target="fig-mpls-rib-relation" format="default"/>, the MPLS base YANG data model augments
defined instances of AF RIBs with additional data that enables MPLS
forwarding for destination prefixes stored in such RIBs. For example, an IPv4 prefix
stored in RIB(v4) is augmented to carry an MPLS local label and one or more per-next-hop
remote labels to enable MPLS forwarding for such a prefix.</t>
        <t>The MPLS base model also creates a separate instance of the generic RIB model
defined in <xref target="RFC8349" format="default"/> to store one or more MPLS
native routes that are enabled for MPLS forwarding but are not stored in one or more other AF RIBs.</t>
        <t>Some examples of such native MPLS routes are:</t>
        <ul spacing="normal">
          <li>Routes programmed by RSVP on Label Switching Routers (LSRs) along
          the path of an LSP,</li>
          <li>Routes that cross-connect an MPLS local label to a Layer 2 or
          Layer 3 Virtual Routing and Forwarding (VRF) entity,</li>
          <li>Routes that cross-connect an MPLS local label to a specific
          Layer 2
adjacency or interface, such as  Layer 2 Attachment Circuits (ACs), or</li>
          <li>Routes that cross-connect an MPLS local label to a Layer 3 adjacency or interface,
such as MPLS Segment Routing (SR) Adjacency Segments (Adj-SIDs) or SR MPLS Binding SIDs as defined in <xref target="RFC8402" format="default"/>.</li>
        </ul>
      </section>
      <section anchor="model-tree-diagram" numbered="true" toc="default">
        <name>Model Tree Diagram</name>
        <t>The MPLS base tree diagram, which follows the notation defined in <xref target="RFC8340" format="default"/>, is shown in <xref target="fig-mpls-base-tree" format="default"/>.</t>
        <figure anchor="fig-mpls-base-tree">
          <name>MPLS Base Tree Diagram</name>
<sourcecode name="" type="yangtree"><![CDATA[
module: ietf-mpls
  augment /rt:routing:
    +--rw mpls
       +--rw ttl-propagate?       boolean
       +--rw mpls-label-blocks
       |  +--rw mpls-label-block* [index]
       |     +--rw index                    string
       |     +--rw start-label?             rt-types:mpls-label
       |     +--rw end-label?               rt-types:mpls-label
       |     +--rw block-allocation-mode?   identityref
       |     +--ro inuse-labels-count?      yang:gauge32
       +--rw interfaces
          +--rw interface* [name]
             +--rw name                      if:interface-ref
             +--rw mpls-enabled?             boolean
             +--rw maximum-labeled-packet?   uint32
  augment /rt:routing/rt:ribs/rt:rib/rt:routes/rt:route:
    +--ro mpls-enabled?         boolean
    +--ro mpls-local-label?     rt-types:mpls-label
    +--ro destination-prefix?   -> ../mpls-local-label
    +--ro route-context?        string
  augment /rt:routing/rt:ribs/rt:rib/rt:routes/rt:route/rt:next-hop
            /rt:next-hop-options/rt:simple-next-hop:
    +--ro mpls-label-stack
       +--ro entry* [id]
          +--ro id               uint8
          +--ro label?           rt-types:mpls-label
          +--ro ttl?             uint8
          +--ro traffic-class?   uint8
  augment /rt:routing/rt:ribs/rt:rib/rt:routes/rt:route/rt:next-hop
            /rt:next-hop-options/rt:next-hop-list/rt:next-hop-list
            /rt:next-hop:
    +--ro index?              string
    +--ro backup-index?       string
    +--ro loadshare?          uint16
    +--ro role?               nhlfe-role
    +--ro mpls-label-stack
       +--ro entry* [id]
          +--ro id               uint8
          +--ro label?           rt-types:mpls-label
          +--ro ttl?             uint8
          +--ro traffic-class?   uint8
  augment /rt:routing/rt:ribs/rt:rib/rt:active-route/rt:input:
    +---w destination-address?   -> ../mpls-local-label
    +---w mpls-local-label?      rt-types:mpls-label
  augment /rt:routing/rt:ribs/rt:rib/rt:active-route/rt:output
            /rt:route/rt:next-hop/rt:next-hop-options
            /rt:simple-next-hop:
    +-- mpls-label-stack
       +-- entry* [id]
          +-- id               uint8
          +-- label?           rt-types:mpls-label
          +-- ttl?             uint8
          +-- traffic-class?   uint8
  augment /rt:routing/rt:ribs/rt:rib/rt:active-route/rt:output
            /rt:route/rt:next-hop/rt:next-hop-options
            /rt:next-hop-list/rt:next-hop-list/rt:next-hop:
    +-- index?              string
    +-- backup-index?       string
    +-- loadshare?          uint16
    +-- role?               nhlfe-role
    +-- mpls-label-stack
       +-- entry* [id]
          +-- id               uint8
          +-- label?           rt-types:mpls-label
          +-- ttl?             uint8
          +-- traffic-class?   uint8]]></sourcecode>
        </figure>
      </section>
      <section anchor="model-yang-module" numbered="true" toc="default">
        <name>MPLS Base YANG Module</name>
        <t>This section describes the "ietf-mpls" YANG module, which provides base
components of the MPLS data model. Other YANG modules may import and augment
the MPLS base module to add feature-specific data.</t>
        <t>The "ietf-mpls" YANG module imports the following YANG modules:</t>
        <ul spacing="normal">
          <li>"ietf-routing" as defined in <xref target="RFC8349" format="default"/></li>
          <li>"ietf-routing-types" as defined in <xref target="RFC8294" format="default"/></li>
          <li>"ietf-yang-types" as defined in <xref target="RFC6991"/></li>
          <li>"ietf-interfaces" as defined in <xref target="RFC8343" format="default"/></li>
        </ul>

        <t>This YANG module also references the following RFCs in defining the
        types, YANG groupings, and other features of the YANG module:
<xref target="RFC3031" format="default"/>,
<xref target="RFC3032" format="default"/>,
<xref target="RFC4090"/>, <xref target="RFC5714"/>, and
<xref target="RFC7424" format="default"/>.</t>

        <figure anchor="fig-module-mpls-base">
          <name>MPLS Base YANG Module</name>
          <sourcecode name="ietf-mpls@2020-12-18.yang" type="yang" markers="true"><![CDATA[
module ietf-mpls {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-mpls";

  prefix mpls;

  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-yang-types {
    prefix yang;
    reference
      "RFC 6991: Common YANG Data Types";
  }
  import ietf-interfaces {
    prefix if;
    reference
      "RFC 8343: A YANG Data Model for Interface Management";
  }

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

     Editor:   Tarek Saad
               <mailto:tsaad@juniper.net>

     Editor:   Kamran Raza
               <mailto:skraza@cisco.com>

     Editor:   Rakesh Gandhi
               <mailto:rgandhi@cisco.com>

     Editor:   Xufeng Liu
               <mailto:xufeng.liu.ietf@gmail.com>

     Editor:   Vishnu Pavan Beeram
               <mailto:vbeeram@juniper.net>";
  description
    "This YANG module defines the essential components for the
     management of the MPLS subsystem.  The model fully conforms
     to the Network Management Datastore Architecture (NMDA).

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

  revision 2020-12-18 {
    description
      "Initial revision.";
    reference
      "RFC 8960: A YANG Data Model for MPLS Base";
  }

  /* Identities */

  identity mpls {
    base rt:address-family;
    description
      "This identity represents the MPLS address family.";
  }

  identity mpls-unicast {
    base mpls:mpls;
    description
      "This identity represents the MPLS unicast address family.";
  }

  identity label-block-alloc-mode {
    description
      "Base identity for label-block allocation mode.";
  }

  identity label-block-alloc-mode-manager {
    base label-block-alloc-mode;
    description
      "Label-block allocation on the reserved block
       is managed by the label manager.";
  }

  identity label-block-alloc-mode-application {
    base label-block-alloc-mode;
    description
      "Label-block allocation on the reserved block
       is managed by the application.";
  }

  /**
   * Typedefs
   */

  typedef mpls-operations-type {
    type enumeration {
      enum impose-and-forward {
        description
          "Operation to impose one or more outgoing labels and
           forward to the next hop.";
      }
      enum pop-and-forward {
        description
          "Operation to pop the incoming label and forward to the
           next hop.";
      }
      enum pop-impose-and-forward {
        description
          "Operation to pop the incoming label, impose one or more
           outgoing labels, and forward to the next hop.";
      }
      enum swap-and-forward {
        description
          "Operation to swap the incoming label with the outgoing
           label and forward to the next hop.";
      }
      enum pop-and-lookup {
        description
          "Operation to pop the incoming label and perform
           a lookup.";
      }
    }
    description
      "Types of MPLS operations.";
  }

  typedef nhlfe-role {
    type enumeration {
      enum primary {
        description
          "The next hop acts as the primary for carrying traffic.";
      }
      enum backup {
        description
          "The next hop acts as the backup.";
      }
      enum primary-and-backup {
        description
          "The next hop simultaneously acts as both the primary and
           the backup for carrying traffic.";
      }
    }
    description
      "Role of the next hop.";
  }

  grouping nhlfe-single-contents {
    description
      "A grouping that describes a single Next Hop Label Forwarding
       Entry (NHLFE) and its associated parameters as described in
       the MPLS architecture.  This grouping is specific to the case
       when a single next hop is associated with the route.";
    uses rt-types:mpls-label-stack;
  }

  grouping nhlfe-multiple-contents {
    description
      "A grouping that describes a set of NHLFEs and their
       associated parameters as described in the MPLS
       architecture.  This grouping is used when multiple next hops
       are associated with the route.";
    leaf index {
      type string;
      description
        "A user-specified identifier utilized to uniquely
         reference the next-hop entry in the next-hop list.
         The value of this index has no semantic meaning
         other than for referencing the entry.";
    }
    leaf backup-index {
      type string;
      description
        "A user-specified identifier utilized to uniquely
         reference the backup next-hop entry in the NHLFE list.
         The value of this index has no semantic meaning
         other than for referencing the entry.";
      reference
        "RFC 4090: Fast Reroute Extensions to RSVP-TE for LSP Tunnels
         RFC 5714: IP Fast Reroute Framework";
    }
    leaf loadshare {
      type uint16;
      default "1";
      description
        "This value is used to compute a load share to perform
         unequal load balancing when multiple outgoing next hops are
         specified.  A share is computed as a ratio of this number to
         the total under all next hops.";
      reference
        "RFC 3031: Multiprotocol Label Switching Architecture,
         Sections 3.11 and 3.12
         RFC 7424: Mechanisms for Optimizing Link Aggregation Group
         (LAG) and Equal-Cost Multipath (ECMP) Component Link
         Utilization in Networks, Section 5.4";
    }
    leaf role {
      type nhlfe-role;
      description
        "Role of the NHLFE.";
    }
    uses nhlfe-single-contents;
  }

  grouping interfaces-mpls {
    description
      "List of MPLS interfaces.";
    container interfaces {
      description
        "List of MPLS-enabled interfaces.";
      list interface {
        key "name";
        description
          "MPLS-enabled interface entry.";
        leaf name {
          type if:interface-ref;
          description
            "A reference to the name of an interface in the system
             that is to be enabled for MPLS.";
        }
        leaf mpls-enabled {
          type boolean;
          default "false";
          description
            "'true' if MPLS encapsulation is enabled on the
             interface.
             'false' if MPLS encapsulation is disabled on the
             interface.";
        }
        leaf maximum-labeled-packet {
          type uint32;
          units "octets";
          description
            "Maximum labeled packet size.";
          reference
            "RFC 3032: MPLS Label Stack Encoding, Section 3.2";
        }
      }
    }
  }

  grouping globals {
    description
      "MPLS global configuration grouping.";
    leaf ttl-propagate {
      type boolean;
      default "true";
      description
        "Propagate TTL between IP and MPLS.";
    }
  }

  grouping label-blocks {
    description
      "Label-block allocation grouping.";
    container mpls-label-blocks {
      description
        "Label-block allocation container.";
      list mpls-label-block {
        key "index";
        description
          "List of MPLS label blocks.";
        leaf index {
          type string;
          description
            "A user-specified identifier utilized to uniquely
             reference an MPLS label block.";
        }
        leaf start-label {
          type rt-types:mpls-label;
          must '. <= ../end-label' {
            error-message "'start-label' must be less than or equal "
                        + "to 'end-label'";
          }
          description
            "Label-block start.";
        }
        leaf end-label {
          type rt-types:mpls-label;
          must '. >= ../start-label' {
            error-message "'end-label' must be greater than or "
                        + "equal to 'start-label'";
          }
          description
            "Label-block end.";
        }
        leaf block-allocation-mode {
          type identityref {
            base label-block-alloc-mode;
          }
          description
            "Label-block allocation mode.";
        }
        leaf inuse-labels-count {
          when "derived-from-or-self(../block-allocation-mode, "
             + "'mpls:label-block-alloc-mode-manager')";
          type yang:gauge32;
          config false;
          description
            "Number of labels in use in the label block.";
        }
      }
    }
  }

  grouping rib-mpls-properties {
    description
      "A grouping of native MPLS RIB properties.";
    leaf destination-prefix {
      type leafref {
        path "../mpls-local-label";
      }
      description
        "MPLS destination prefix.";
    }
    leaf route-context {
      type string;
      description
        "A context associated with the native MPLS route.";
    }
  }

  grouping rib-active-route-mpls-input {
    description
      "A grouping applicable to native MPLS RIB 'active-route'
       RPC input augmentation.";
    leaf destination-address {
      type leafref {
        path "../mpls-local-label";
      }
      description
        "MPLS native 'active-route' destination.";
    }
    leaf mpls-local-label {
      type rt-types:mpls-label;
      description
        "MPLS local label.";
    }
  }

  augment "/rt:routing" {
    description
      "MPLS augmentation.";
    container mpls {
      description
        "MPLS container to be used as an augmentation target node
         for the configuration of other MPLS sub-features, e.g.,
         MPLS static Label Switched Paths (LSPs), MPLS LDP LSPs,
         and Traffic Engineering MPLS LSP Tunnels.";
      uses globals;
      uses label-blocks;
      uses interfaces-mpls;
    }
  }

  /* Augmentation of MPLS routes */

  augment "/rt:routing/rt:ribs/rt:rib/rt:routes/rt:route" {
    description
      "This augmentation is applicable to all MPLS routes.";
    leaf mpls-enabled {
      type boolean;
      default "false";
      description
        "Indicates whether MPLS is enabled for this route.";
    }
    leaf mpls-local-label {
      when "../mpls-enabled = 'true'";
      type rt-types:mpls-label;
      description
        "MPLS local label associated with the route.";
    }
    uses rib-mpls-properties {
      /* MPLS Address Family (AF) augmentation to the
         native MPLS RIB */
      when "derived-from-or-self(../../rt:address-family, "
         + "'mpls:mpls')" {
        description
          "This augment is valid only for routes of the native MPLS
           RIB.";
      }
    }
  }

  /* MPLS simple-next-hop augmentation */

  augment "/rt:routing/rt:ribs/rt:rib/rt:routes/rt:route/"
        + "rt:next-hop/rt:next-hop-options/rt:simple-next-hop" {
    description
      "Augments the 'simple-next-hop' case in IP unicast routes.";
    uses nhlfe-single-contents {
      when "/rt:routing/rt:ribs/rt:rib/rt:routes/rt:route"
         + "/mpls:mpls-enabled = 'true'";
    }
  }

  /* MPLS next-hop-list augmentation */

  augment "/rt:routing/rt:ribs/rt:rib/rt:routes/rt:route/"
        + "rt:next-hop/rt:next-hop-options/rt:next-hop-list/"
        + "rt:next-hop-list/rt:next-hop" {
    description
      "This leaf augments the 'next-hop-list' case of IP unicast
       routes.";
    uses nhlfe-multiple-contents {
      when "/rt:routing/rt:ribs/rt:rib/rt:routes/rt:route"
         + "/mpls:mpls-enabled = 'true'";
    }
  }

  /* MPLS RPC input augmentation */

  augment "/rt:routing/rt:ribs/rt:rib/rt:active-route/rt:input" {
    description
      "Input MPLS augmentation for the 'active-route' action
       statement.";
    uses rib-active-route-mpls-input {
      /* MPLS AF augmentation to the native MPLS RIB */
      when "derived-from-or-self(../rt:address-family, "
         + "'mpls:mpls')" {
        description
          "This augment is valid only for routes of the native MPLS
           RIB.";
      }
    }
  }

  /* MPLS RPC output augmentation */

  augment "/rt:routing/rt:ribs/rt:rib/rt:active-route/"
        + "rt:output/rt:route/"
        + "rt:next-hop/rt:next-hop-options/rt:simple-next-hop" {
    description
      "Output MPLS augmentation for the 'active-route' action
       statement.";
    uses nhlfe-single-contents;
  }

  augment "/rt:routing/rt:ribs/rt:rib/rt:active-route/"
        + "rt:output/rt:route/"
        + "rt:next-hop/rt:next-hop-options/rt:next-hop-list/"
        + "rt:next-hop-list/rt:next-hop" {
    description
      "Output MPLS augmentation for the 'active-route' action
       statement.";
    uses nhlfe-multiple-contents;
  }
}]]></sourcecode>
        </figure>
      </section>
    </section>
    <section anchor="iana-considerations" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <t>This document registers the following URI in the "ns" subregistry of the "IETF XML Registry"
<xref target="RFC3688" format="default"/>.</t>
   <dl newline="false" spacing="compact">
   <dt>URI:</dt><dd>urn:ietf:params:xml:ns:yang:ietf-mpls</dd>
   <dt>Registrant Contact:</dt><dd>The MPLS WG of the IETF.</dd>
   <dt>XML:</dt><dd>N/A; the requested URI is an XML namespace.</dd>
   </dl>
      <t>This document registers the following YANG module in the "YANG Module Names"
registry <xref target="RFC6020" format="default"/>.</t>
   <dl newline="false" spacing="compact">
   <dt>Name:</dt><dd>ietf-mpls</dd>
   <dt>Namespace:</dt><dd>urn:ietf:params:xml:ns:yang:ietf-mpls</dd>
   <dt>Prefix:</dt><dd>mpls</dd>
   <dt>Reference:</dt><dd>RFC 8960</dd>
   </dl>
    </section>
    <section anchor="security-considerations" numbered="true" toc="default">
      <name>Security Considerations</name>

<t>The YANG module specified in this document defines a schema for data
that is designed to be accessed via network management protocols such
as NETCONF <xref target="RFC6241"/> or RESTCONF <xref target="RFC8040"/>.
The lowest NETCONF layer is the secure transport layer, and the
mandatory-to-implement secure transport is Secure Shell (SSH)
<xref target="RFC6242"/>. The lowest RESTCONF layer is HTTPS, and the
mandatory-to-implement secure transport is TLS <xref target="RFC8446"/>.</t>
<t>The Network Configuration Access Control Model (NACM) <xref target="RFC8341"/>
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 this YANG module 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>
  <dl newline="true" spacing="normal">
      <dt>"/rt:routing/mpls:mpls/mpls:label-blocks":</dt><dd>There are data
      nodes under this path that are writable, such as "start-label" and
      "end-label". Write operations to those data nodes may result in
      disruption to existing traffic.</dd>
  </dl>

<t>Some of the readable data nodes in this YANG module 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>
  <dl newline="true" spacing="normal">
<dt>"/rt:routing/rt:ribs/rt:rib/rt:routes/rt:route/rt:next-hop/rt:next-hop-options/rt:next-hop-list/rt:next-hop-list/rt:next-hop" and
"/rt:routing/rt:ribs/rt:rib/rt:active-route/rt:output/rt:route/rt:next-hop/rt:next-hop-options/rt:simple-next-hop":</dt><dd>These
two paths are augmented by additional MPLS leafs defined in this model. Access
to this information may disclose the next-hop information for the prefix route and/or other information.</dd>
  </dl>

<t>Some of the RPC operations in this YANG module may be considered sensitive or
 vulnerable in some network environments. It is thus important to control
 access to these operations. These are the operations and their
 sensitivity/vulnerability:</t>
  <dl newline="true" spacing="normal">
      <dt>"/rt:routing/rt:ribs/rt:rib/rt:active-route/rt:input" and "/rt:routing/rt:ribs/rt:rib/rt:active-route/rt:output/rt:route":</dt><dd>These two paths are augmented
by additional MPLS data nodes that are defined in this model. Access to
those paths may disclose information about per-prefix routes and/or other
information; such disclosure may be used for further attacks.</dd>
  </dl>
      <t>The security considerations spelled out in <xref target="RFC3031" format="default"/> and <xref target="RFC3032" format="default"/> apply for this document as well.</t>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <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.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.8342.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.8340.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.8343.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3032.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.8040.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.8446.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8341.xml"/>
      </references>
      <references>
        <name>Informative References</name>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3031.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4090.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5714.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7424.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7951.xml"/>
      </references>
    </references>

    <section anchor="appendix-a-data-tree-instance-example" numbered="true" toc="default">
      <name>Data Tree Instance Example</name>
      <t>A simple network setup is shown in <xref target="fig-example"/>.  R1 runs the IS-IS routing
protocol and learns about the reachability of two IPv4 prefixes
(P1: 198.51.100.1/32 and P2: 198.51.100.2/32) and two IPv6 prefixes 
(P3: 2001:db8:0:10::1/128 and P4: 2001:db8:0:10::2/128).  We also assume that
R1 learns about local and remote MPLS label bindings for each prefix
using IS-IS (e.g., using Segment Routing (SR) extensions).</t>
      <figure anchor="fig-example">
        <name>Example of Network Configuration</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[
State on R1:
============
    IPv4 Prefix           MPLS Label
P1: 198.51.100.1/32       16001
P2: 198.51.100.2/32       16002

    IPv6 Prefix           MPLS Label
P3: 2001:db8:0:10::1/128  16003
P4: 2001:db8:0:10::2/128  16004

RSVP MPLS LSPv4-Tunnel:
 Source:        198.51.100.3
 Destination:   198.51.100.4
 Tunnel-ID:     10
 LSP-ID:        1
                               192.0.2.5/30
                               2001:db8:0:1::1/64
                              eth0
                              +---
                             /
                        +-----+
                        | R1  |
                        +-----+
                             \
                              +---
                              eth1
                               192.0.2.13/30
                               2001:db8:0:2::1/64]]></artwork>
      </figure>
      <t>The instance data tree could then be 
illustrated as shown in <xref target="fib-ribs"/>, using JSON format <xref target="RFC7951"/>:</t>

      <figure anchor="fib-ribs">
        <name>Instance Data Tree Example</name>
<sourcecode name="" type="json"><![CDATA[
{
  "ietf-routing:routing":{
    "ribs":{
      "rib":[
        {
          "name":"RIB-V4",
          "address-family":
          "ietf-ipv4-unicast-routing:v4ur:ipv4-unicast",
          "routes":{
            "route":[
              {
                "next-hop":{
                  "outgoing-interface":"eth0",
                  "ietf-mpls:mpls-label-stack":{
                    "entry":[
                      {
                        "id":1,
                        "label":16001,
                        "ttl":255
                      }
                    ]
                  },
                  "ietf-ipv4-unicast-routing:next-hop-address":
                  "192.0.2.5"
                },
                "source-protocol":"ietf-isis:isis",
                "ietf-mpls:mpls-enabled":true,
                "ietf-mpls:mpls-local-label":16001,
                "ietf-ipv4-unicast-routing:destination-prefix":
                "198.51.100.1/32",
                "ietf-mpls:route-context":"SID-IDX:1"
              },
              {
                "next-hop":{
                  "next-hop-list":{
                    "next-hop":[
                      {
                        "outgoing-interface":"eth0",
                        "ietf-mpls:index":"1",
                        "ietf-mpls:backup-index":"2",
                        "ietf-mpls:role":"primary-and-backup",
                        "ietf-mpls:mpls-label-stack":{
                          "entry":[
                            {
                              "id":1,
                              "label":16002,
                              "ttl":255
                            }
                          ]
                        },
                        "ietf-ipv4-unicast-routing:address":
                        "192.0.2.5"
                      },
                      {
                        "outgoing-interface":"eth1",
                        "ietf-mpls:index":"2",
                        "ietf-mpls:backup-index":"1",
                        "ietf-mpls:role":"primary-and-backup",
                        "ietf-mpls:mpls-label-stack":{
                          "entry":[
                            {
                              "id":1,
                              "label":16002,
                              "ttl":255
                            }
                          ]
                        },
                        "ietf-ipv4-unicast-routing:address":
                        "192.0.2.13"
                      }
                    ]
                  }
                },
                "source-protocol":"ietf-isis:isis",
                "ietf-mpls:mpls-enabled":true,
                "ietf-mpls:mpls-local-label":16002,
                "ietf-ipv4-unicast-routing:destination-prefix":
                "198.51.100.2/32",
                "ietf-mpls:route-context":"SID-IDX:2"
              }
            ]
          }
        },
        {
          "name":"RIB-V6",
          "address-family":
          "ietf-ipv6-unicast-routing:v6ur:ipv6-unicast",
          "routes":{
            "route":[
              {
                "next-hop":{
                  "outgoing-interface":"eth0",
                  "ietf-mpls:mpls-label-stack":{
                    "entry":[
                      {
                        "id":1,
                        "label":16003,
                        "ttl":255
                      }
                    ]
                  },
                  "ietf-ipv6-unicast-routing:next-hop-address":
                  "2001:db8:0:1::1"
                },
                "source-protocol":"ietf-isis:isis",
                "ietf-mpls:mpls-enabled":true,
                "ietf-mpls:mpls-local-label":16003,
                "ietf-ipv6-unicast-routing:destination-prefix":
                "2001:db8:0:10::1/128",
                "ietf-mpls:route-context":"SID-IDX:3"
              },
              {
                "next-hop":{
                  "next-hop-list":{
                    "next-hop":[
                      {
                        "outgoing-interface":"eth0",
                        "ietf-mpls:index":"1",
                        "ietf-mpls:backup-index":"2",
                        "ietf-mpls:role":"primary-and-backup",
                        "ietf-mpls:mpls-label-stack":{
                          "entry":[
                            {
                              "id":1,
                              "label":16004,
                              "ttl":255
                            }
                          ]
                        },
                        "ietf-ipv6-unicast-routing:address":
                        "2001:db8:0:1::1"
                      },
                      {
                        "outgoing-interface":"eth1",
                        "ietf-mpls:index":"2",
                        "ietf-mpls:backup-index":"1",
                        "ietf-mpls:role":"primary-and-backup",
                        "ietf-mpls:mpls-label-stack":{
                          "entry":[
                            {
                              "id":1,
                              "label":16004,
                              "ttl":255
                            }
                          ]
                        },
                        "ietf-ipv6-unicast-routing:address":
                        "2001:db8:0:2::1"
                      }
                    ]
                  }
                },
                "source-protocol":"ietf-isis:isis",
                "ietf-mpls:mpls-enabled":true,
                "ietf-mpls:mpls-local-label":16004,
                "ietf-ipv6-unicast-routing:destination-prefix":
                "2001:db8:0:10::2/128",
                "ietf-mpls:route-context":"SID-IDX:4"
              }
            ]
          }
        },
        {
          "name":"RIB-MPLS",
          "address-family":"ietf-mpls:mpls:mpls",
          "routes":{
            "route":[
              {
                "next-hop":{
                  "outgoing-interface":"eth0",
                  "ietf-mpls:mpls-label-stack":{
                    "entry":[
                      {
                        "id":1,
                        "label":24002,
                        "ttl":255
                      }
                    ]
                  },
                  "ietf-ipv4-unicast-routing:next-hop-address":
                  "192.0.2.5"
                },
                "source-protocol":"ietf-rsvp:rsvp",
                "ietf-mpls:mpls-enabled":true,
                "ietf-mpls:mpls-local-label":24001,
                "ietf-mpls:destination-prefix":"24001",
                "ietf-mpls:route-context":
                "RSVP Src:198.51.100.3,Dst:198.51.100.4,T:10,L:1"
              }
            ]
          }
        }
      ]
    },
    "ietf-mpls:mpls":{
      "mpls-label-blocks":{
        "mpls-label-block":[
          {
           "index":"mpls-srgb-label-block",
           "start-label":16000,
           "end-label":16500,
           "block-allocation-mode":
           "ietf-mpls:label-block-alloc-mode-manager"
          }
        ]
      },
      "interfaces":{
        "interface":[
          {
            "name":"eth0",
            "mpls-enabled":true,
            "maximum-labeled-packet":1488
          },
          {
            "name":"eth1",
            "mpls-enabled":true,
            "maximum-labeled-packet":1488
          }
        ]
      }
    }
  }
}]]></sourcecode>
      </figure>
    </section>

    <section anchor="acknowledgments" numbered="false" toc="default">
      <name>Acknowledgments</name>
      <t>The authors would like to thank <contact fullname="Xia Chen"/> for
      her contributions to the early draft revisions of this document.</t>
    </section>
    <section anchor="contributors" numbered="false" toc="default">
      <name>Contributors</name>
      <contact fullname="Igor Bryskin">
        <organization>Huawei Technologies</organization>
        <address>
          <postal>
            <street></street>
            <city></city>
            <region></region><code></code>
            <country></country>
          </postal>
          <email>i_bryskin@yahoo.com</email>
        </address>
      </contact>
      <contact fullname="Himanshu Shah">
        <organization>Ciena</organization>
        <address>
          <postal>
            <street></street>
            <city></city>
            <region></region><code></code>
            <country></country>
          </postal>
          <email>hshah@ciena.com</email>
        </address>
      </contact> 
    </section>
  </back>
</rfc>
