<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?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-path-segment-06"
     ipr="trust200902">
  <front>
    <title abbrev="Path ID and Bi-directional Path in BGP">SR Policy
    Extensions for Path Segment and Bidirectional Path</title>

    <author fullname="Cheng Li" initials="C." surname="Li">
      <organization>Huawei Technologies</organization>

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

          <city>Beijing</city>

          <region/>

          <code>100095</code>

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

        <phone/>

        <facsimile/>

        <email>c.l@huawei.com</email>

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

    <author fullname="Zhenbin Li" initials="Z." surname="Li">
      <organization>Huawei Technologies</organization>

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

          <city>Beijing</city>

          <region/>

          <code>100095</code>

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

        <phone/>

        <facsimile/>

        <email>lizhenbin@huawei.com</email>

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

    <author fullname="Yuanyang Yin" initials="Y." surname="Yin">
      <organization>China Telecom</organization>

      <address>
        <postal>
          <street/>

          <city>Guangzhou</city>

          <region/>

          <code/>

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

        <phone/>

        <facsimile/>

        <email>yinyuany@chinatelecom.cn</email>

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

    <author fullname="Weiqiang Cheng" initials="W." surname="Cheng">
      <organization>China Mobile</organization>

      <address>
        <postal>
          <street/>

          <city>Beijing</city>

          <region/>

          <code/>

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

        <phone/>

        <facsimile/>

        <email>chengweiqiang@chinamobile.com</email>

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

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

      <address>
        <postal>
          <street/>

          <city/>

          <region/>

          <code/>

          <country/>
        </postal>

        <phone/>

        <facsimile/>

        <email>ketant.ietf@gmail.com</email>

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

    <date day="8" month="August" year="2022"/>

    <area>Routing Area</area>

    <workgroup>Interdomain Routing Working Group</workgroup>

    <abstract>
      <t>A Segment Routing (SR) policy is a set of candidate SR paths
      consisting of one or more segment lists with necessary path attributes.
      For each SR path, it may also have its own path attributes, and Path
      Segment is one of them. A Path Segment is defined to identify an SR
      path, which can be used for performance measurement, path correlation,
      and end-2-end path protection. Path Segment can be also used to
      correlate two unidirectional SR paths into a bidirectional SR path which
      is required in some scenarios, for example, mobile backhaul transport
      network.</t>

      <t>This document defines extensions to BGP to distribute SR policies
      carrying Path Segment and bidirectional path information.</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 <xref
      target="RFC2119">RFC 2119</xref>.</t>
    </note>
  </front>

  <middle>
    <section title="Introduction">
      <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"/>. For distributing SR policies to the headend, <xref
      target="RFC9256"/> specifies a mechanism by using BGP, and new sub-TLVs
      are defined for SR Policies in BGP UPDATE message.</t>

      <t/>

      <t>In many use cases such as performance measurement, the path to which
      the packets belong is required to be identified. Futhermore, in some
      scenarios, for example, mobile backhaul transport network, there are
      requirements to support bidirectional path. However, there is no path
      identification information for each Segment List in the SR Policies
      defined in <xref target="RFC9256"/>. Also, the SR Policies defined in
      <xref target="RFC9256"/> only supports unidirectional SR paths.</t>

      <t>Therefore, this document defines the extension to SR policies that
      carry Path Segment in the Segment List and support bidirectional path.
      The Path Segment can be a Path Segment in SR-MPLS <xref
      target="I-D.ietf-spring-mpls-path-segment"/> and SRv6 <xref
      target="I-D.ietf-spring-srv6-path-segment"/>, or other IDs that can
      identify a path. Also, this document defines extensions to BGP to
      distribute SR policies carrying Path Segment and bidirectional path
      information.</t>
    </section>

    <section title="Terminology">
      <t>This memo makes use of the terms defined in <xref target="RFC8402"/>
      and <xref target="RFC9256"/>.</t>

      <section 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>
      </section>
    </section>

    <section title="Path Segment in SR Policy">
      <t>As defined in <xref target="I-D.ietf-idr-segment-routing-te-policy"/>
      , the SR Policy encoding structure is as follows:</t>

      <t><figure>
          <artwork align="left"><![CDATA[
   SR Policy SAFI NLRI: <Distinguisher, Policy-Color, Endpoint>
   Attributes:
      Tunnel Encaps Attribute (23)
         Tunnel Type: SR Policy
             Binding SID
             Preference
             Priority
             Policy Name
             Explicit NULL Label Policy (ENLP)
             Segment List
                 Weight
                 Segment
                 Segment
                 ...
             ...
]]></artwork>
        </figure></t>

      <t>An SR path can be specified by an Segment List sub-TLV that contains
      a set of segment sub-TLVs and other sub-TLVs as shown above. As defined
      in <xref target="RFC9256"/>, a candidate path includes multiple SR paths
      specified by SID list. The Path Segment can be used for identifying an
      SR path(specified by SID list) from the headend and the tailend. Also,
      it can be used for identifying an SR candidate path in some use cases if
      needed. This document defines a new Path Segment sub-TLV within Segment
      List sub-TLV, the details will be described at section 3.1. The new SR
      Policy encoding structure with Path Segmentg sub-TLV is expressed as
      below:</t>

      <t><figure>
          <artwork align="left"><![CDATA[
   SR Policy SAFI NLRI: <Distinguisher, Policy-Color, Endpoint>
   Attributes:
      Tunnel Encaps Attribute (23)
         Tunnel Type: SR Policy
             Binding SID
             Preference
             Priority
             Policy Name
             Explicit NULL Label Policy (ENLP)
             Segment List
                 Weight
                 Path Segment
                 Segment
                 Segment
                 ...
             Segment List
                 Weight
                 Path Segment
                 Segment
                 Segment
                 ...
             ...

]]></artwork>
        </figure></t>

      <t>The Path Segment is used to identified an SR path, and it can be used
      in OAM or IOAM use cases. When all the SID Lists within a candidate path
      share the same Path Segment ID, the Path Segment can be used to collect
      the aggregated information of the candidate path. Multiple Path Segment
      MAY be included in a Segment List for different use cases, all of them
      SHOULD be inserted into the SID List.</t>

      <section title="SR Path Segment Sub-TLV">
        <t>This section defines an SR Path Segment sub-TLV.</t>

        <t>An SR Path Segment sub-TLV is included in the segment list sub-TLV
        to identify an SID list. It has the following format:</t>

        <t><figure>
            <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     |    Length     |    Flags      |  RESERVED     |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                     Path Segment ID (Variable)                |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 //     SRv6 Endpoint Behavior and SID Structure (optional)     //
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                    Figure 1. Path Segment sub-TLV

]]></artwork>
          </figure>Where:</t>

        <t><list style="symbols">
            <t>Type: to be assigned by IANA.</t>

            <t>Length: the total length of the value field not including Type
            and Length fields.</t>

            <t>Flags: 8 bits of flags. Following flags are defined:</t>
          </list><figure>
            <artwork align="left"><![CDATA[  0  1  2  3  4  5  6  7
 +--+--+--+--+--+--+--+--+
 |    Reserved     |B |L |
 +--+--+--+--+--+--+--+--+
]]></artwork>
          </figure></t>

        <t><list style="symbols">
            <t><list style="symbols">
                <t>L-Flag: Local flag. Set when the Path Segment has local
                significance on an SR node.</t>

                <t>B-Flag: This flag, when set, indicates the presence of the
                SRv6 Endpoint Behavior and SID Structure encoding specified in
                Section 2.4.4.2.13 of <xref
                target="I-D.ietf-idr-segment-routing-te-policy"/>. It MUST be
                ignored when the value of length field is smaller than 18.</t>

                <t>The rest bits of Flag are reserved and MUST be set to 0 on
                transmission and MUST be ignored on receipt.</t>
              </list></t>
          </list><list style="symbols">
            <t>Path Segment ID: if the length is 2, then no Path Segment ID is
            present. If the length is 6 then the Path Segment ID is encoded in
            4 octets <xref target="I-D.ietf-spring-mpls-path-segment"/> using
            the format below. TC, S, TTL (Total of 12 bits) are RESERVED and
            SHOULD be set to zero and MUST be ignored.</t>
          </list></t>

        <t/>

        <t><figure>
            <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     |    Length     |    Flags      |  Reserved     |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |         Path Segment Label            | TC  |S|       TTL     |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
              Figure 2. SR-MPLS Path Segment sub-TLV

]]></artwork>
          </figure></t>

        <t>If the length is 18 then the Path Segment ID contains a 16-octet
        SRv6 Path Segment ID <xref
        target="I-D.ietf-spring-srv6-path-segment"/>.</t>

        <t>If the length is larger than 18 and B-flag is set, then SRv6
        Endpoint Behavior and SID Structure TLVs <xref
        target="I-D.ietf-idr-segment-routing-te-policy"/> is included.</t>
      </section>
    </section>

    <section title="SR Policy for Bidirectional Path">
      <t>In some scenarios, for example, mobile backhaul transport network,
      there are requirements to support bidirectional path. In SR, a
      bidirectional path can be represented as a binding of two unidirectional
      SR paths. This document also defines a Reverse Segment List sub-TLV to
      describe the reverse path associated with the forward path specified by
      the Segment List. An SR policy carrying SR bidirectional path
      information is expressed as below:</t>

      <t><figure>
          <artwork align="left"><![CDATA[
    SR Policy SAFI NLRI: <Distinguisher, Policy-Color, Endpoint>
        Attributes: Tunnel Encaps Attribute (23)
        Tunnel Type: SR Policy
            Binding SID
            Preference
            Priority
            Policy Name
            Explicit NULL Label Policy (ENLP)
            Segment List 
                Weight
                Path Segment
                Segment
                Segment
                ...
                Reverse Segment List
                    Path Segment
                    Segment
                    Segment
                    ...

]]></artwork>
        </figure></t>

      <section title="Reverse Path Segment List Sub-TLV">
        <t>A Reverse Path Segment List sub-TLV is defined to specify an SR
        reverse path associated with the path specified by the Segment List,
        and it has the following format:</t>

        <t><figure>
            <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       |             Length            |   RESERVED    |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                        Sub-TLVs (Variable)                    |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
           Figure 3. SR Reverse Path Segment List Sub-TLV

]]></artwork>
          </figure>where:</t>

        <t>Type: TBA.</t>

        <t>Length: the total length of the sub-TLVs encoded within the Reverse
        Path Segment List Sub-TLV not including the Type and Length
        fields.</t>

        <t>RESERVED: 1 octet of reserved bits. SHOULD be unset on transmission
        and MUST be ignored on receipt.</t>

        <t>sub-TLVs, reuse the sub-TLVs in Segment List defined in <xref
        target="I-D.ietf-idr-segment-routing-te-policy"/>. <list
            style="symbols">
            <t>One or more mandatory SR Path Segment sub-TLVs that contains
            the Path Segments of the reverse SR path.</t>

            <t>One or more Segment sub-TLVs to specify the reverse SR
            path.</t>
          </list></t>

        <t>The Segment sub-TLVs in the Reverse Path Segment List sub-TLV
        provides the information of the reverse SR path, which can be used for
        directing egress BFD peer to use specific path for the reverse
        direction of the BFD session <xref
        target="I-D.ietf-mpls-bfd-directed"/> or other applications.</t>
      </section>
    </section>

    <section title="Operations">
      <t>The document does not bring new operation beyond the description of
      operations defined in <xref
      target="I-D.ietf-idr-segment-routing-te-policy"/>. The existing
      operations defined in <xref
      target="I-D.ietf-idr-segment-routing-te-policy"/> can apply to this
      document directly.</t>

      <t>Typically but not limit to, the unidirectional or bidirectional SR
      policies carrying path identification infomation are configured by a
      controller.</t>

      <t>After configuration, the unidirectional or bidirectional SR policies
      carrying path identification infomation will be advertised by BGP update
      messages. The operation of advertisement is the same as defined in <xref
      target="I-D.ietf-idr-segment-routing-te-policy"/>, as well as the
      reception.</t>

      <t>The consumer of the unidirectional or bidirectional SR policies is
      not the BGP process, it can be any applications, such as performance
      measurement <xref target="I-D.gandhi-spring-udp-pm"/>. The operation of
      sending information to consumers is out of scope of this document.</t>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>This document defines new Sub-TLVs in following registries:</t>

      <t/>

      <section title="Existing Registry: BGP Tunnel Encapsulation Attribute sub-TLVs">
        <t/>

        <t>This document defines new sub-TLVs in the registry "SR Policy List
        Sub-TLVs" <xref target="I-D.ietf-idr-segment-routing-te-policy"/> to
        be assigned by IANA:</t>

        <t><figure>
            <artwork><![CDATA[     Codepoint   Description                           Reference
     -------------------------------------------------------------
     TBA         Path Segment sub-TLV                  This document
     TBA         Reverse Segment List sub-TLV          This document

]]></artwork>
          </figure></t>
      </section>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>TBA</t>
    </section>

    <section title="Contributors">
      <t><figure>
          <artwork><![CDATA[
   Mach(Guoyi) Chen
   Huawei Technologies
   Huawei Campus, No. 156 Beiqing Rd.
   Beijing  100095
   China

   Email: Mach.chen@huawei.com


   Jie Dong
   Huawei Technologies
   Huawei Campus, No. 156 Beiqing Rd.
   Beijing  100095
   China

   Email: jie.dong@huawei.com


   James N Guichard
   Futurewei Technologies
   2330 Central Express Way
   Santa Clara
   USA

   Email: james.n.guichard@futurewei.com

   Huanan Chen
   China Telecom
   109 West Zhongshan Ave
   Guangzhou
   China

   Email: chenhuan6@chinatelecom.cn

]]></artwork>
        </figure></t>
    </section>

    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>Many thanks to Shraddha Hedge for her detailed review and
      professional comments.</t>

      <t/>
    </section>
  </middle>

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

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

      <?rfc ?>

      <?rfc include='reference.I-D.ietf-idr-segment-routing-te-policy'?>

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

      <?rfc include='reference.I-D.ietf-spring-mpls-path-segment'?>

      <?rfc include='reference.I-D.ietf-spring-srv6-path-segment'?>

      <?rfc ?>

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

      <?rfc ?>

      <?rfc ?>
    </references>

    <references title="Informative References">
      <?rfc include='reference.I-D.gandhi-spring-udp-pm'?>

      <?rfc ?>

      <?rfc include='reference.I-D.ietf-mpls-bfd-directed'?>

      <?rfc ?>

      <?rfc ?>

      <?rfc ?>
    </references>
  </back>
</rfc>
