<?xml version="1.0" encoding="US-ASCII"?>
<?xml-model href="rfc7991bis.rnc"?>
<!DOCTYPE rfc [
  <!ENTITY IANA_LPID_TLV "TBD1">
]>
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>

<rfc category="std" docName="draft-younsi-grow-local-path-id-03"
  ipr="trust200902"
  xmlns:xi="http://www.w3.org/2001/XInclude"
  submissionType="IETF"
  version="3">
  <front> <!-- updates bmp tlv? -->
    <title abbrev="local-path-id">BMP Local Path-ID</title>

    <author fullname="Maxence Younsi" initials="M." surname="Younsi">
      <organization>INSA-Lyon</organization>

      <address>
        <postal>
          <city>Villeurbanne</city>
          <country>France</country>
        </postal>

        <phone />

        <email>maxence.younsi@insa-lyon.fr</email>
      </address>
    </author>

    <author fullname="Pierre Francois" initials="P." surname="Francois">
      <organization>INSA-Lyon</organization>

      <address>
        <postal>
          <city>Villeurbanne</city>
          <country>France</country>
        </postal>

        <phone />

        <email>pierre.francois@insa-lyon.fr</email>
      </address>
    </author>

    <author fullname="Paolo Lucente" initials="P." surname="Lucente">
      <organization>NTT</organization>

      <address>
        <postal>
          <street>Siriusdreef 70-72</street>

          <city>Hoofddorp, WT 2132</city>

          <region />

          <code />

          <country>NL</country>
        </postal>

        <phone />

        <email>paolo@ntt.net</email>

        <uri />
      </address>
    </author>

    <date day="3" month="July" year="2024" />

    <workgroup></workgroup>

    <abstract>

      <t> Intelligence is required to track BGP paths throughout the various
        RIBs and VRFs of a routing platform, due to potential attribute modifications
        and the use of BGP multipath. This document introduces the option to identify
        a path within a router in order to ease correlation in monitoring. A BMPv4 TLV
        is defined in order to communicate this locally significant identifier in
        monitoring messages.</t>

    </abstract>

    <note title="Requirements Language">
      <t>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 <xref target="RFC2119" /> <xref target="RFC8174" /> when,
        and only when, they appear in all capitals, as shown here.</t>
    </note>
  </front>

  <middle>
    <section title="Introduction" anchor="introduction">

      <t> When using VRFs and/or BGP Multipath, multiple paths to the same
        destination may be shared among various routing information bases. From a
        collection perspective, tracking the identity of a path thus requires some form
        of modeling, which is subject to inaccuracy. This aspect is exacerbated as
        path attributes may be modified in the process. This is especially problematic
        when a PE using BGP multipath in VPN instances exports multiple paths for the
        same destination into the default VRF, which were learned from different peers.
      </t>

      <t> While BGP ADD-PATH <xref target="RFC7911" /> provides a way to identify paths in BGP
        multi-path scenarios, the scope of the ADD-PATH path-id is local to a single BGP peering
        session, and thus cannot be used to distinguish paths received over multiple sessions. <!--(ie.
        to a peer for routing purposes and to a route-collector for
        monitoring purposes). -->
      </t>

      <t> This document introduces a way to identify paths globally within a router, allowing
        operators to not resort to modeling when monitoring BGP paths on a router. In <xref
          target="local_path_id" />, we introduce the concept of Local Path ID, which is an
        identifier of a path for a given NLRI, preserved through the import/export operations
        performed onto them. In <xref
          target="bmp_advertising_local_path_id" />, we introduce a BMPv4 TLV allowing to
        communicate the value of a Local Path ID on a BMP session. </t>

    </section>

    <section title="Local Path ID" anchor="local_path_id">

      <t> In this section, we define an identifier called Local Path ID, which
        allows to uniquely identify a path for a given NLRI on a router.
      </t>

      <t> According to this specification, a path to be advertised by BMP is
        provided with an associated Local Path ID. The Local Path ID is an opaque
        numerical value with a few properties guaranteeing its utility. The exact
        approach to generate a Local Path ID is however left for the implementation.
      </t>

      <section title="Local Path ID Properties" anchor="local_path_id_properties">
        <t>
          The Local Path ID of each path MUST be unique for a given NLRI.
          We scope the identifier space to each NLRI to keep it a small value. Indeed,
          most Internet routers have at most a few tens of paths for a given NLRI.
          While we put a minimum scope (the NLRI) for the identifier space,
          an implementor may decide to use a broader space for this unicity, as long as
          Local Path IDs are still unique for a given NLRI.
          For example, Local Path IDs can be unique accross VRFs,
          even though they will have to be larger, as this does not violate the rule.
        </t>

        <t>
          The Local Path ID only has a meaning local to the router generating it.
        </t>

        <t>
          Once generated, the Local Path ID MUST be preserved between VRFs, and Routing Information
          Bases. It is however not intended to be exchanged or synchronized between routers.
        </t>

        <t>
          To ensure traceability in monitoring, the Local Path ID SHOULD be transmitted 
          when paths are redistributed between processes.
          If the Local Path ID is not transmitted then the process receiving the path SHOULD allocate one.
        </t>

        <t>
          The value of 0 for a Local Path ID is reserved.
        </t>
      </section>

      <section title="Design Recommendation">

        <t> In this section, we give general recommendations for the Local Path
        ID generation. These recommendations may or may not be applicable depending on
        the platform, the implementation of BGP, etc. The actual generation process of
        the Local Path ID does not matter as long as the the properties defined in
        <xref target="local_path_id_properties" /> are respected. </t>

        <t>
          We recommend having the Local Path ID made of three concatenated parts:
          &lt; process_id | vrf_id | path_discriminator &gt;.
        </t>

        <t anchor="path_discriminator"> The path_discriminator allows
        for differentiation between paths for a given NLRI, coming from the same table
        and process (with the same vrf_id and process_id). The process originating the
        path is in charge of guaranteeing the uniqueness of the path_discriminator it
        produces for each path of its NLRIs.  </t>

        <t anchor="vrf_id"> The vrf_id represents a unique identifier for the VRF in
          which the path to the NLRI is contained. It allows leveraging the already existing
          routing table structures of most BGP implementations by having to guarantee
          the uniqueness of the path_discriminator only within the table.
        </t>

        <t anchor="process_id"> The process_id is the identifier of the process
          which produced, originated, or received a path. The process_id allows
          differentiation between path IDs generated in BGP from path IDs generated
          in other processes like an IGP.
          Redistributed IGP paths will then have a different Local Path ID no
          matter if BGP or another IGP has chosen the same path_discriminator value.
          Using the process_id avoids requiring interprocess synchronization of
          path_discriminators or the use of a Local Path ID management process.</t>

      </section>

    </section>

    <section title="Advertising the Local Path ID in BMP" anchor="bmp_advertising_local_path_id">

      <t> The Local Path ID is to be included in BMPv4 Route Monitoring
        messages <xref target="I-D.ietf-grow-bmp-tlv" /> as a BMPv4 TLV, called "Local
        Path ID TLV". This TLV can carry multiple types of data which are discriminated
        by the "TLV Sub-Type" field. The "TLV Sub-Type" field can take the values given
        in <xref target="lpid_tlv_sub_types_table" />.  When a Local Path ID is
        allocated for a path, the router includes it using the "TLV Sub-Type" value
        0x00 (Local Path ID Value). When a Local Path ID is not allocated, the router
        includes a "TLV Sub-Type" value 0x01 (Unavailability Reason Code) that
        describes why the Local Path ID is not available for the path. In practice,
        this means that a Local Path ID enabled router SHOULD always associate a 
        Path ID TLV with a path advertised in BMP. </t>

      <t>
        On the collector side, a path should be identified using the Local Path ID Value when
        provided, and only resort to network modeling when the Local Path ID is not available.
      </t>

      <section title="Local Path ID TLV">
        <t> The encoding of the "Local Path ID TLV" is illustrated in <xref
            target="BMP-indexed-TLV-header" />. </t>

        <figure anchor="BMP-indexed-TLV-header" align="center">
          <artwork align="center">
          <![CDATA[
0                   1                   2                   3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Type (2 octets)        |       Length (2 octets)       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|        Index (2 octets)       |   Sub-Type    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~                        Value (variable)                       ~        
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
          ]]>
          </artwork>
        </figure>

        <dl>
          <dt>Type:</dt>
          <dd>set to &IANA_LPID_TLV;</dd>

          <dt>Length:</dt>
          <dd>the length of the "TLV Sub-Type" field + the length of the "Value" field, in bytes</dd>

          <dt>Index:</dt>

          <dd>index of the NLRI in the BGP Update PDU as described by <xref
              target="I-D.ietf-grow-bmp-tlv" />. The Index MUST refer to a single NLRI (no Group
            TLV).</dd>

          <dt>Sub-Type:</dt>

          <dd>a one byte TLV Sub-Type, as listed in <xref target="lpid_tlv_sub_types_table" /></dd>

          <dt>Value:</dt>

          <dd>the value corresponding to the TLV Sub-Type as described in <xref
              target="lpid_tlv_sub_types" /></dd>

        </dl>
      </section>

      <section title="Local Path ID TLV Sub-Types" anchor="lpid_tlv_sub_types">

        <t> The <xref target="lpid_tlv_sub_types_table" /> defines the list of TLV Sub-Types and
          references the section defining their associated values. </t>

        <table anchor="lpid_tlv_sub_types_table">
          <name>Local Path ID TLV Sub-Types</name>
          <thead>
            <tr>
              <th>Code</th>
              <th>Name</th>
              <th>Length</th>
              <th>Section</th>
            </tr>
          </thead>

          <tbody>
            <tr>
              <td>0x00</td>
              <td>Local Path ID Value</td>
              <td>Variable</td>
              <td>
                <xref target="lpid_tlv_sub_type_lpid" />
              </td>
            </tr>

            <tr>
              <td>0x01</td>
              <td>Unavailability Reason Code</td>
              <td>2 bytes</td>
              <td>
                <xref target="lpid_tlv_sub_type_reason_code" />
              </td>
            </tr>
          </tbody>
        </table>

        <section title="Local Path ID Value" anchor="lpid_tlv_sub_type_lpid">
          <t>
            When the Local Path ID is available for a path, the router exports the Local Path ID
            using a "Local Path ID TLV" with "TLV Sub-Type" = 0x00.
          </t>
          <t> The Local Path ID Value contains the raw bytes of the generated Local Path ID (<xref
              target="local_path_id" />). The Length field is thus set to the length, in bytes, of
            the Local Path ID, plus one (for the TLV Sub-Type field). </t>
        </section>

        <section title="Unavailability Reason Codes" anchor="lpid_tlv_sub_type_reason_code">
          <t> An implementation enabled for Local Path ID usage MUST notify if a Local
            Path ID is unavailable (for any reason) by using the "TLV Sub-Type" = 0x01.
          </t>
          <t> When "TLV Sub-Type" is 0x01, the TLV Value is a 2-byte error code from <xref
              target="error_handling_error_codes" />. The Length field of the "Local Path ID TLV" is
            thus set to 3 in this case. </t>

          <table anchor="error_handling_error_codes">
            <name>Local Path ID Unavailability Reason Codes</name>
            <thead>
              <tr>
                <th>Code</th>
                <th>Reason</th>
                <th>Description</th>
              </tr>
            </thead>

            <tbody>
              <tr>
                <td>0x00</td>
                <td>Unknown Reason</td>
                <td>A unknown error occurred during the allocation of the Local Path ID</td>
              </tr>

              <tr>
                <td>0x01</td>
                <td>Origin process did not provide a Local Path ID.</td>
                <td>A path is imported from another process, the latter
                  does not provide a Local Path ID for the imported path 
                  and the receiving process did not allocate one either</td>
              </tr>

              <tr>
                <td>0x02</td>
                <td>All Local Path ID have been allocated.</td>
                <td>A Local Path ID could not be allocated for a path because the
                  entire range of Local Path IDs is in use</td>
              </tr>
            </tbody>
          </table>
        </section>
      </section>
    </section>
    
    <section title="IANA Considerations">
      <t> This document requests that IANA assigns the following new parameters to the "BMP Route
        Monitoring TLVs" <xref target="I-D.ietf-grow-bmp-tlv" /> registry </t>
      <ul>
        <li> Type = &IANA_LPID_TLV;: Local Path ID TLV type. The value of this TLV is defined in <xref
            target="bmp_advertising_local_path_id" />
        </li>
      </ul>
      <t> This document also requests the definition of a "Local Path ID Reason Codes" registry in
        the "BMP Parameters" namespace, seeded as follows:
      </t>
      <ul>
        <li>
          Type = 0: Unknown Reason. Set to 0
          when an unknown error occurred during the allocation of the Local Path ID.
        </li>
        <li>
          Type = 1: Origin Process did not provide a Local Path ID. Set to 1
          when a path is imported from another process, the latter
          does not provide a Local Path ID for the imported path 
          and the receiving process did not allocate one either.
        </li>
        <li>
          Type = 2: All Local Path ID have been allocated. Set to 2
          when a Local Path ID could not be allocated for a path because the
          entire range of Local Path IDs is in use.
        </li>
      </ul>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml" />
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7911.xml" />
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml" />
      <xi:include href="https://datatracker.ietf.org/doc/bibxml3/draft-ietf-grow-bmp-tlv-13.xml" />
    </references>

    <!--
    <references title="Informative References">


    </references>-->

  </back>
</rfc>
