<?xml version="1.0" encoding="US-ASCII"?>
<?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-ietf-idr-sr-policy-metric-05"
     ipr="trust200902">
  <front>
    <title abbrev="BGP SR Policy Extensions for Metric">BGP SR Policy
    Extensions for Metric</title>

    <author fullname="Zhenqiang Li" initials="Z." surname="Li">
      <organization>China Mobile</organization>

      <address>
        <postal>
          <street/>

          <city/>

          <region/>

          <code/>

          <country>China</country>
        </postal>

        <email>lizhenqiang@chinamobile.com</email>
      </address>
    </author>

    <author fullname="Ka Zhang" initials="K. " surname="Zhang">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street>Huawei Bld., No.156 Beiqing Rd.</street>

          <city>Beijing</city>

          <code>100095</code>

          <country>China</country>
        </postal>

        <email>zhangka@huawei.com</email>
      </address>
    </author>

    <author fullname="Jie Dong" initials="J. " surname="Dong">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street>Huawei Bld., No.156 Beiqing Rd.</street>

          <city>Beijing</city>

          <code>100095</code>

          <country>China</country>
        </postal>

        <email>jie.dong@huawei.com</email>
      </address>
    </author>

    <author fullname="Ketan Talaulikar" initials="K. " surname="Talaulikar">
      <organization>Cisco Systems</organization>

      <address>
        <postal>
          <country>India</country>
        </postal>

        <email>ketant.ietf@gmail.com</email>
      </address>
    </author>
    
    <author fullname="Rui Gu" initials="R. " surname="Gu">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street>Huawei Bld., No.156 Beiqing Rd.</street>

          <city>Beijing</city>

          <code>100095</code>

          <country>China</country>
        </postal>

        <email>gurui12@huawei.com</email>
      </address>
    </author>    

    <date day="2" month="June" year="2026"/>

    <abstract>
      <t>An SR Policy consists of one or more Candidate Paths (CPs), each
      comprising one or more segment lists. BGP can be used to propogate SR
      Policy CPs to the SR Policy headend nodes in the network. After an SR
      Policy CP is installed on the headend node, packets can be steered into
      the SR Policy.</t>

      <t>For a particular BGP destination, if there are multiple BGP routes
      with different next-hops, BGP best path selection is performed and the
      IGP metric to the next-hop node may be used for tie-breaking to select
      the best path. When the path to the next-hop is resolved over an SR
      Policy, the IGP metric of the SR policy is needed for BGP path
      selection.</t>

      <t>This document defines the BGP extensions to carry the IGP metric of
      segment lists when BGP is used to propagate SR Policy CPs.</t>
    </abstract>

    <note title="Requirements Language">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD 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">
      <t>An SR Policy <xref target="RFC9256"/> is associated with one or more
      Candidate Paths (CPs), each of which is expressed as a segment list or a
      set of segment lists.. BGP SR Policy <xref target="RFC9830"/> can be
      used to propogate SR Policy CPs to the SR Policy headend nodes in the
      network. After an SR Policy CP is installed on the headend node, packets
      can be steered into the SR Policy.</t>

      <t>For a particular BGP destination, if there are multiple BGP routes
      with different next-hops, BGP best path selection <xref
      target="RFC4271"/> is performed and the IGP metric to the next-hop node
      may be used for tie-breaking to select the best path. When the path to
      the next-hop is resolved over an SR Policy, the IGP metric of the SR
      policy is needed for BGP path selection.</t>

      <t>This document defines the BGP extensions to carry the IGP metric of
      segment lists when BGP is used to propagate SR Policy CPs.</t>
    </section>

    <section title="A Typical Scenario">
      <t>In network scenarios where there are multiple BGP routes to a
      particular destination prefix with different next-hops, and some of
      which are resolved via SR Policy, the metric of the SR Policy may be
      needed for BGP best path selection.</t>

      <t>The specific scenarios are as follows:</t>

      <figure suppress-title="false">
        <artwork align="left"><![CDATA[ 

                         +--+         +--+         +---+ 
                _ _ _ _ _|P1|_ _ _ _ _|P2|_ _ _ _ _|PE2|_ _ _ _ 
               |         +--+         +--+         +---+       |        
               |                                               | 
 +---+        +---+                                           +---+ 
 |CE1|_ _ _ _ |PE1|                                           |CE2| 
 +---+        +---+                                           +---+            
               |         +--+         +--+         +---+       | 
               |_ _ _ _ _|P3|_ _ _ _ _|P4|_ _ _ _ _|PE3|_ _ _ _|        
                         +--+         +--+         +---+ 
]]></artwork>
      </figure>

      <t/>

      <t>On PE1, the BGP route to the prefix advertised by CE1 has two
      candidate next-hops: PE2 and PE3. The BGP best path selection to the
      prefix of CE1 may be based on the IGP metric of the paths from PE1 to
      PE2 and from PE1 to PE3 respectively. The path toward PE2 is resolved
      via SR Policy-1, whose endpoint is PE2; similarly, the path toward PE3
      is resolved via SR Policy-2. PE1 needs to know the the IGP metrics of
      the SR Policies to select the SR Policy which best meet the requirement.
      Thus the IGP metric of the Segment Lists which constitute the SR Policy
      CP needs to be conveyed to the headend node of SR Policy.</t>
    </section>

    <section title="SR Policy and Tunnel Encapsulation Attribute Update">
      <t>In order to carry the metric of an SR Policy CP, the tunnel
      encapsulation attribute of the BGP SR Policy is extended.</t>

      <t>The BGP SR Policy Encoding structure is as follows:</t>

      <t>SR Policy SAFI NLRI: &lt;Distinguisher, Policy-Color,
      Endpoint&gt;</t>

      <figure suppress-title="false">
        <artwork align="left"><![CDATA[ 
      Attributes:

      Tunnel Encaps Attribute (23)

              Tunnel Type: SR Policy

                 Binding SID

                 Preference

                 Priority

                 Policy Name

                 Policy Candidate Path Name

                 Explicit NULL Label Policy (ENLP)

                 Segment List

                     Weight
  
                     Metric  

                     Segment

                     Segment

                     ....

                     ....
]]></artwork>
      </figure>

      <t>Where the metric indicates the metric for the segment list.</t>

      <section title="Metric sub-TLV">
        <t>A new sub-TLV called Metric Sub-TLV is defined. Metric sub-TLV
        specifies the metric of an SR policy Segment List. Each sub-TLV is
        encoded as shown in Figure 1. More than one metric Sub-TLVs may be
        present in one Segment List to refer to the metric values of different
        metric types.</t>

        <t><figure suppress-title="false" title="Metric Sub-TLV">
            <artwork align="center"><![CDATA[ 
0               1               2               3
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      Type     |    Length     |   Metric Type    |   Flags   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                     Metric Value                             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
          </figure></t>

        <t>* Type: Metric, 1 octet, TBD.</t>

        <t>* Length: 6 octets.</t>

        <t>* Metric Type: 1-octet field which identifies the type of the
        metric being used. The metric-type code points are listed in Section
        7.2.</t>

        <t>* Flags: None are defined at this stage. Flags MUST be set to zero
        on transmission and MUST be ignored on receipt.</t>

        <t>* Metric Value: 4-octet value which indicates the metric of the
        computed path.</t>
      </section>
    </section>

    <section title="Metric Process of SR Policy Segment List">
      <t>When an SR Policy headend node receives the SR Policy segment list
      with the metric field, the metric may be of any of the defined types:
      (IGP metric, Min Unidirection Link delay, TE metric, Hop Count, or SID
      List length).</t>

      <figure suppress-title="false">
        <artwork align="left"><![CDATA[
The rules for processing SR Policy metrics are as follows:
1. The type of metric to use is determined by the local policy,
which can be user-configured. For example, the user specifies 
the IGP metric as local policy.
2. The metric of the Active Candidate Path is used as the metric
of the SR Policy.
3. The metric of the Active Candidate Path uses the maximum 
metric value of the specified metric type in all segment lists. 
]]></artwork>
      </figure>

      <figure suppress-title="false">
        <artwork align="left"><![CDATA[
Example:
SR Policy: (Headend:1::1, Color: 2, EndPoint: 2::2)
Candidate path preference: 200
Segment list 1: (IGP metric: 20)
Segment list 2: (IGP metric: 30)
Candidate Path preference: 100
Segment list 1: (IGP metric: 40)
Segment list 2: (IGP metric: 30)
Local policy: IGP metric
Active candidate path: preference 200
Active candidate path metric: 30, which is the maximum IGP metric
of all segment lists in the candidate path.
]]></artwork>
      </figure>

      <t/>

      <t>Taking the scenario in Figure 1 as an example, according to the rules
      above, the metric of SR Policy 1 is 30, and the metric of SR Policy 2 is
      40, then according to the BGP path selection tie-breaking rule, the BGP
      route with next-hop PE2 is selected as the metric of SR Policy 1 is
      smaller than that of SR Policy 2.</t>
    </section>

    <section title="Acknowledgements">
      <t>The authors would like to thank Liyan Song for the review and
      discussion.</t>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <section title="New sub-TLV Registration: Metric Sub-TLV">
        <t>IANA is requested to assign a new code point for Metric Sub-TLV in
        the "SR Policy Segment List Sub-TLVs" registry of the "BGP Tunnel
        Encapsulation" registry group.</t>

        <t><figure align="center" title="Metric sub-TLV">
            <artwork><![CDATA[
Value                  Description                  Reference
---------------------- ---------------------------- --------------
TBD                    Metric                       This document
]]></artwork>
          </figure></t>
      </section>

      <section title="Registry of BGP SR Poicy Metric Type">
        <t>The semantics of the Metric Type field in the Metric sub-TLV
        defined in this document is identifical to the metric types in the
        "BGP-LS SR Policy Metric Types" registry in the "BGP-LS Parameters"
        registry group. IANA is requested to rename the existing registry to
        "BGP/BGP-LS SR Policy Metric Types" registry. This is to allow the
        sharing of this registry for metric types in both BGP SR Policy and
        BGP-LS SR Policy. There is no change to the code points in this
        registry.</t>
      </section>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>The BGP extensions defined in this document do not affect the base
      BGP security model. The BGP SR policy extension specified in this
      document is based on <xref target="RFC9830"/>. The security requirements
      and mechanisms described in <xref target="RFC9830"/> also apply to this
      document. SR operates within a trusted SR domain <xref
      target="RFC8402"/> and its security considerations also apply to BGP
      sessions which are used for distributing SR Policy information.</t>

      <t>The distribution of SR Policy with metric information may pose
      additional mission-critical or commercially sensitive information about
      the network. The BGP sessions used for SR Policy distribution not
      automatic established and require configuration, network operator needs
      to ensure that only trusted nodes (that include both routers and
      controller applications) within the SR domain are configured to receive
      such information.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119"?>

      <?rfc include="reference.RFC.8174"?>

      <?rfc include='reference.RFC.4271'?>

      <?rfc include='reference.RFC.9256'?>

      <?rfc include='reference.RFC.9830'?>
    </references>

    <references title="Informative References">
      <?rfc include='reference.RFC.8402'?>

      <?rfc include='reference.RFC.9857'?>
    </references>
  </back>
</rfc>
