<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc [
  <!ENTITY nbsp   "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>

<rfc version="3"
     category="std"
     docName="draft-liu-idr-bgp-sr-policy-cp-threshold-03"
     ipr="trust200902"
     submissionType="IETF"
     consensus="true">

  <front>
    <title abbrev="BGP for CP Threshold Constraints">BGP Extension for Distributing CP Threshold Constraints of SR Policy</title>

    <author fullname="Yisong Liu" initials="Y." surname="Liu">
      <organization>China Mobile</organization>
      <address>
        <postal>
          <city>Beijing</city>
          <country>China</country>
        </postal>
        <email>liuyisong@chinamobile.com</email>
      </address>
    </author>

    <author fullname="Changwang Lin" initials="C." surname="Lin">
      <organization>New H3C Technologies</organization>
      <address>
        <postal>
          <city>Beijing</city>
          <country>China</country>
        </postal>
        <email>linchangwang.04414@h3c.com</email>
      </address>
    </author>

    <author fullname="Yuanxiang Qiu" initials="Y." surname="Qiu">
      <organization>New H3C Technologies</organization>
      <address>
        <postal>
          <city>Beijing</city>
          <country>China</country>
        </postal>
        <email>qiuyuanxiang@h3c.com</email>
      </address>
    </author>

    <date year="2026"/>

    <workgroup>IDR Working Group</workgroup>

    <abstract>
      <t>This document defines the extension of BGP to distribute the
      threshold constraint parameters of candidate paths for SR Policy to
      achieve flexible path selection.</t>
    </abstract>
  </front>

  <middle>

    <section numbered="true">
      <name>Introduction</name>
      <t>Segment Routing (SR) <xref target="RFC8402"/> is a source routing
      paradigm that explicitly indicates the forwarding path for packets at
      the ingress node. The ingress node steers packets into a specific path
      according to the Segment Routing Policy (SR Policy) as defined in
      <xref target="RFC9256"/>. An SR Policy may have multiple candidate
      paths that are provisioned or signaled
      <xref target="RFC9830"/>
      <xref target="RFC8664"/> from one or more sources.</t>
      <t><xref target="I-D.ietf-spring-sr-policy-flexible-cp-selection"/>
      proposes a flexible SR policy candidate path selection method. Based on
      the real-time resource usage and forwarding quality of candidate paths,
      the head node can perform dynamic path switching among multiple
      candidate paths in the SR policy.</t>
      <t>Multiple threshold parameters for SR Policy candidate path selection
      are listed in Section 4.1 of
      <xref target="I-D.ietf-spring-sr-policy-flexible-cp-selection"/>. This
      document defines extensions to BGP to distribute threshold constraint
      parameters of candidate path (CP) for an SR Policy.</t>
    </section>

    <section numbered="true">
      <name>Terminology</name>
      <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>
      <t>The definitions of the basic terms are identical to those found in
      Segment Routing Policy Architecture <xref target="RFC9256"/>.</t>
    </section>

    <section numbered="true">
      <name>Carrying Threshold Constraint Parameters of CP in BGP</name>
      <t>As defined in <xref target="RFC9830"/>, the
      SR Policy SAFI with codepoint 73 is used to advertise an SR Policy
      Candidate Path in the NLRI. According to
      <xref target="RFC9830"/>, the content of the SR
      Policy Candidate Path is encoded in the Tunnel Encapsulation Attribute
      defined in <xref target="RFC9012"/> using the Tunnel-Type called the
      "SR Policy" type with codepoint 15. The use of the SR Policy Tunnel
      Type is applicable only for the AFI/SAFI pairs of (1/73, 2/73), and
      the use of any other Tunnel Type with the SR Policy SAFI MUST be
      considered malformed and handled by the "treat-as-withdraw" strategy
      <xref target="RFC7606"/>.</t>
      <t>This document defines the following Sub-TLV to carry the
      threshold constraint parameters for candidate paths.</t>
      <ul spacing="normal">
        <li>SR Metric Constraint Sub-TLV</li>
      </ul>
      <t>The new SR Policy encoding structure with the Sub-TLV of CP threshold
      constraint parameters is expressed as below:</t>
      <artwork type="ascii-art"><![CDATA[
     SR Policy SAFI NLRI: <Distinguisher, Color, Endpoint>
        Attributes:
           Tunnel Encaps Attribute (23)
              Tunnel Type: SR Policy (15)
                  Binding SID
                  SRv6 Binding SID
                  Preference
                  Priority
                  SR Policy Name
                  SR Policy Candidate Path Name
                  Explicit NULL Label Policy (ENLP)
                  SR Metric Constraint Sub-TLV
                  Segment List
                      Weight
                      Segment
                      Segment
                      ...
                  ...
]]></artwork>
    </section>

    <section numbered="true">
      <name>SR Metric Constraint Sub-TLV</name>
      <t>The SR Metric Constraint sub-TLV is used to carry the threshold
      constraint of a candidate path.</t>
      <t>The SR Metric Constraint sub-TLV is optional. Multiple instances of
      this sub-TLV may be used to carry different metric types.</t>
      <t>The format of the SR Metric Constraint Sub-TLV is defined as
      follows:</t>
      <artwork type="ascii-art"><![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      |   Length      | Metric Type   |     Flags     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                         Metric Margin                         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                         Metric Bound                          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
      <t>where:</t>
      <ul spacing="normal">
        <li>Type: to be assigned by IANA.</li>
        <li>Length: Specifies the length of the value field. The value MUST
        be 10.</li>
        <li>
          <t>Flags: 1-octet field that indicates the semantics of the Metric
          Margin and Metric Bound.  The following bit positions are defined
          and the other bits MUST be cleared by the originator and MUST be
          ignored by a receiver:</t>
          <artwork type="ascii-art"><![CDATA[
 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+
|M|A|B|F|       |
+-+-+-+-+-+-+-+-+
]]></artwork>
          <t>where:</t>
          <ul spacing="normal">
            <li>M-Flag: Indicates that the metric margin allowed is
            specified when set.</li>
            <li>A-Flag: Indicates that the metric margin is specified as an
            absolute value when set and is expressed as a percentage of the
            metric when clear.</li>
            <li>B-Flag: Indicates that the metric bound allowed for the path
            is specified when set.</li>
            <li>F-Flag: Indicates that the Metric Margin and Metric Bound
            are floating-point numbers when set to 1. When set to 0, it
            indicates they are integer numbers.</li>
          </ul>
        </li>
        <li>
          <t>Metric Type: 1-octet field which identifies the type of the
          metric being used. The metric type code points are as follows:</t>
          <ul spacing="normal">
            <li>0: Available bandwidth threshold in bytes per second.</li>
            <li>1: Actual bandwidth threshold in bytes per second.</li>
            <li>2: Round trip delay threshold in microseconds.</li>
            <li>3: Round trip loss threshold. The unit is 0.000003%.</li>
            <li>4: Jitter threshold in microseconds.</li>
          </ul>
        </li>
        <li>Metric Margin: 4-octet value which indicates the minimum
        threshold when the M-flag is set. The metric margin is specified as
        either an absolute value or as a percentage of the path metric based
        on the A-Flag.</li>
        <li>Metric Bound: 4-octet value which indicates the maximum threshold
        that is allowed when the B-flag is set. If the path metric crosses
        the specified bound value then the path is considered invalid.</li>
      </ul>
    </section>

    <section numbered="true">
      <name>Operations</name>
      <t>The document does not bring new operation beyond the description of
      operations defined in Section 4 of
      <xref target="RFC9830"/>. The existing operations
      defined in <xref target="RFC9830"/> can apply to
      this document directly.</t>
      <t>Typically, but not limited to, the SR policies carrying the
      threshold constraint parameters of CP are configured by a controller.</t>
      <t>After configuration, the SR policies carrying the threshold
      constraint parameters of CP will be advertised by BGP update messages.  The
      operation of advertisement is the same as defined in
      <xref target="RFC9830"/>, as well as the
      reception.</t>
    </section>

    <section numbered="true">
      <name>IANA Considerations</name>
      <t>This document defines a new sub-TLV in the registry "BGP Tunnel
      Encapsulation Attribute sub-TLVs" to be assigned by IANA:</t>
      <artwork type="ascii-art"><![CDATA[
   +=======+==================================+=================+
   | Value | Description                      |  Reference      |
   +=======+==================================+=================+
   |  TBA1 | SR Metric Constraint sub-TLV     |  This document  |
   +-------+----------------------------------+-----------------+
]]></artwork>
      <t>This document also requests that IANA create a new registry named
      "SR Metric Constraint Metric Types" for the Metric Type field of the
      SR Metric Constraint sub-TLV. The registration procedure for this
      registry is Specification Required
      <xref target="RFC8126"/>. The initial values of this registry are
      as follows:</t>
      <artwork type="ascii-art"><![CDATA[
   +=======+===============================+===============+
   | Value | Description                   | Reference     |
   +=======+===============================+===============+
   |   0   | Available bandwidth threshold | This document |
   |   1   | Actual bandwidth threshold    | This document |
   |   2   | Round trip delay threshold    | This document |
   |   3   | Round trip loss threshold     | This document |
   |   4   | Jitter threshold              | This document |
   +-------+-------------------------------+---------------+
]]></artwork>
    </section>

    <section numbered="true">
      <name>Security Considerations</name>
      <t><xref target="RFC9830"/> has discussed the
      security considerations for distributing SR Policy through BGP. This
      document does not introduce any new security issues.</t>
    </section>

  </middle>

  <back>

    <references>
      <name>References</name>

      <references>
        <name>Normative References</name>

        <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119">
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <author initials="S." surname="Bradner" fullname="Scott Bradner"/>
            <date month="March" year="1997"/>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="2119"/>
          <seriesInfo name="DOI" value="10.17487/RFC2119"/>
        </reference>

        <reference anchor="RFC7606" target="https://www.rfc-editor.org/info/rfc7606">
          <front>
            <title>Revised Error Handling for BGP UPDATE Messages</title>
            <author initials="E." surname="Chen" fullname="Enke Chen" role="editor"/>
            <author initials="J." surname="Scudder" fullname="John G. Scudder" role="editor"/>
            <author initials="P." surname="Mohapatra" fullname="Pradosh Mohapatra"/>
            <author initials="K." surname="Patel" fullname="Keyur Patel"/>
            <date month="August" year="2015"/>
          </front>
          <seriesInfo name="RFC" value="7606"/>
          <seriesInfo name="DOI" value="10.17487/RFC7606"/>
        </reference>

        <reference anchor="RFC8126" target="https://www.rfc-editor.org/info/rfc8126">
          <front>
            <title>Guidelines for Writing an IANA Considerations Section in RFCs</title>
            <author initials="M." surname="Cotton" fullname="Michelle Cotton"/>
            <author initials="B." surname="Leiba" fullname="Barry Leiba"/>
            <author initials="T." surname="Narten" fullname="Thomas Narten"/>
            <date month="June" year="2017"/>
          </front>
          <seriesInfo name="BCP" value="26"/>
          <seriesInfo name="RFC" value="8126"/>
          <seriesInfo name="DOI" value="10.17487/RFC8126"/>
        </reference>

        <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174">
          <front>
            <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
            <author initials="B." surname="Leiba" fullname="Barry Leiba"/>
            <date month="May" year="2017"/>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="8174"/>
          <seriesInfo name="DOI" value="10.17487/RFC8174"/>
        </reference>

        <reference anchor="RFC8402" target="https://www.rfc-editor.org/info/rfc8402">
          <front>
            <title>Segment Routing Architecture</title>
            <author initials="C." surname="Filsfils" fullname="Clarence Filsfils" role="editor"/>
            <author initials="S." surname="Previdi" fullname="Stefano Previdi" role="editor"/>
            <author initials="L." surname="Ginsberg" fullname="Les Ginsberg"/>
            <author initials="B." surname="Decraene" fullname="Bruno Decraene"/>
            <author initials="S." surname="Litkowski" fullname="Stephane Litkowski"/>
            <author initials="R." surname="Shakir" fullname="Rob Shakir"/>
            <date month="July" year="2018"/>
          </front>
          <seriesInfo name="RFC" value="8402"/>
          <seriesInfo name="DOI" value="10.17487/RFC8402"/>
        </reference>

        <reference anchor="RFC8664" target="https://www.rfc-editor.org/info/rfc8664">
          <front>
            <title>Path Computation Element Communication Protocol (PCEP) Extensions for Segment Routing</title>
            <author initials="S." surname="Sivabalan" fullname="Siva Sivabalan"/>
            <author initials="C." surname="Filsfils" fullname="Clarence Filsfils"/>
            <author initials="J." surname="Tantsura" fullname="Jeff Tantsura"/>
            <author initials="W." surname="Henderickx" fullname="Wim Henderickx"/>
            <author initials="J." surname="Hardwick" fullname="Jonathan Hardwick"/>
            <date month="December" year="2019"/>
          </front>
          <seriesInfo name="RFC" value="8664"/>
          <seriesInfo name="DOI" value="10.17487/RFC8664"/>
        </reference>

        <reference anchor="RFC9012" target="https://www.rfc-editor.org/info/rfc9012">
          <front>
            <title>The BGP Tunnel Encapsulation Attribute</title>
            <author initials="K." surname="Patel" fullname="Keyur Patel"/>
            <author initials="D." surname="Voyer" fullname="Daniel Voyer"/>
            <author initials="M." surname="Bernier" fullname="Mathieu Bernier" role="editor"/>
            <date month="June" year="2022"/>
          </front>
          <seriesInfo name="RFC" value="9012"/>
          <seriesInfo name="DOI" value="10.17487/RFC9012"/>
        </reference>

        <reference anchor="RFC9256" target="https://www.rfc-editor.org/info/rfc9256">
          <front>
            <title>Segment Routing Policy Architecture</title>
            <author initials="C." surname="Filsfils" fullname="Clarence Filsfils"/>
            <author initials="K." surname="Talaulikar" fullname="Ketan Talaulikar"/>
            <author initials="D." surname="Voyer" fullname="Daniel Voyer"/>
            <author initials="A." surname="Bogdanov" fullname="Andrew Bogdanov"/>
            <author initials="P." surname="Mattes" fullname="Paul Mattes"/>
            <date month="July" year="2022"/>
          </front>
          <seriesInfo name="RFC" value="9256"/>
          <seriesInfo name="DOI" value="10.17487/RFC9256"/>
        </reference>

        <reference anchor="RFC9830" target="https://www.rfc-editor.org/info/rfc9830">
          <front>
            <title>Advertising Segment Routing Policies in BGP</title>
            <author initials="S." surname="Previdi" fullname="Stefano Previdi"/>
            <author initials="C." surname="Filsfils" fullname="Clarence Filsfils"/>
            <author initials="K." surname="Talaulikar" fullname="Ketan Talaulikar" role="editor"/>
            <author initials="P." surname="Mattes" fullname="Peter Mattes"/>
            <author initials="D." surname="Jain" fullname="Deepak Jain"/>
            <date month="September" year="2025"/>
          </front>
          <seriesInfo name="RFC" value="9830"/>
          <seriesInfo name="DOI" value="10.17487/RFC9830"/>
        </reference>

      </references>

      <references>
        <name>Informative References</name>

        <reference anchor="I-D.ietf-spring-sr-policy-flexible-cp-selection">
          <front>
            <title>Flexible Candidate Path Selection of SR Policy</title>
            <author initials="Y." surname="Liu" fullname="Yisong Liu"/>
            <author initials="C." surname="Lin" fullname="Changwang Lin"/>
            <author initials="S." surname="Peng" fullname="Shaofu Peng"/>
            <author initials="R." surname="Chen" fullname="Ran Chen"/>
            <author initials="Z." surname="Ali" fullname="Zafar Ali"/>
            <date month="October" year="2026"/>
          </front>
          <seriesInfo name="Internet-Draft" value="draft-ietf-spring-sr-policy-flexible-cp-selection-02"/>
        </reference>

        <reference anchor="I-D.liu-pce-sr-policy-cp-threshold">
          <front>
            <title>PCEP Extensions to Support Signaling Candidate Path Threshold Constraints of SR Policy</title>
            <author initials="Y." surname="Liu" fullname="Yisong Liu"/>
            <author initials="C." surname="Lin" fullname="Changwang Lin"/>
            <author initials="S." surname="Peng" fullname="Shaofu Peng"/>
            <author initials="Y." surname="Qiu" fullname="Yuanxiang Qiu"/>
            <date month="February" year="2025"/>
          </front>
          <seriesInfo name="Internet-Draft" value="draft-liu-pce-sr-policy-cp-threshold-03"/>
        </reference>

      </references>

    </references>

    <section>
      <name>Cross-WG Information</name>
      <t>This section describes cross&nbhy;working group information for use
      during the IETF review process. This section, including the reference
      to <xref target="I-D.liu-pce-sr-policy-cp-threshold"/> which is cited
      only within this appendix, will be removed by the RFC Editor prior to
      publication.</t>

      <section>
        <name>Spring WG</name>
        <t>This document builds directly on the work of the SPRING Working
        Group. The threshold constraint parameters for SR Policy candidate
        path selection defined in Section 4.1 of
        <xref target="I-D.ietf-spring-sr-policy-flexible-cp-selection"/>
        are carried by the BGP extensions specified here. The SPRING WG
        should be aware that this BGP extension is intended to be consistent
        with the flexible candidate path selection framework and that no
        changes to the semantics of the parameters are introduced. The
        definitions of the metric types and their usage remain as described
        in the SPRING document.</t>
      </section>

      <section>
        <name>PCE WG</name>
        <t>The PCE Working Group has a companion document
        <xref target="I-D.liu-pce-sr-policy-cp-threshold"/> that defines
        PCEP extensions for carrying the same set of threshold constraint
        parameters. Both the BGP mechanism (this document) and the PCEP
        mechanism serve the same architectural goal: allowing a controller
        to communicate candidate path threshold constraints to a headend.
        Implementations or deployments that use both BGP and PCEP for SR
        Policy distribution should ensure semantic alignment between the
        two protocols. The PCE WG may wish to note that the format and flag
        definitions in this document have been aligned with those in the
        PCEP extension to ease interworking.</t>
      </section>
    </section>

    <section numbered="false">
      <name>Acknowledgments</name>
      <t>TBD</t>
    </section>

  </back>

</rfc>
