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

 <!ENTITY I-D.ietf-mpls-stamp-pw SYSTEM
    "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-mpls-stamp-pw.xml">
 <!ENTITY I-D.ietf-ippm-stamp-yang SYSTEM
    "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-ippm-stamp-yang.xml">
  <!ENTITY RFC10052 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.10052.xml">
 <!ENTITY I-D.ietf-ippm-stamp-ext-hdr SYSTEM
   "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-ippm-stamp-ext-hdr.xml">
  <!ENTITY RFC768 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.768.xml">
  <!ENTITY RFC2119 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
  <!ENTITY RFC2681 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2681.xml">
  <!ENTITY RFC3031 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.3031.xml">
  <!ENTITY RFC4026 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.4026.xml">
  <!ENTITY RFC3032 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.3032.xml">
  <!ENTITY RFC5462 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.5462.xml">
  <!ENTITY RFC6234 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6234.xml">
  <!ENTITY RFC6335 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6335.xml">
  <!ENTITY RFC6374 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6374.xml">
  <!ENTITY RFC6437 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6437.xml">
  <!ENTITY RFC8174 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml">
  <!ENTITY RFC8762 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8762.xml">
  <!ENTITY RFC8972 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8972.xml">
  <!ENTITY RFC9503 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9503.xml">
  <!ENTITY RFC5905 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.5905.xml">
  <!ENTITY RFC6790 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6790.xml">
  <!ENTITY RFC8029 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8029.xml">
  <!ENTITY RFC8402 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8402.xml">
  <!ENTITY RFC9256 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9256.xml">
  <!ENTITY RFC9350 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9350.xml">
  <!ENTITY RFC9545 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9545.xml">
  <!ENTITY RFC9780 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9780.xml">
  <!ENTITY RFC9994 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9994.xml">

]>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" submissionType="IETF" docName="draft-ietf-spring-stamp-srpm-mpls-14" category="std" ipr="trust200902" obsoletes="" xml:lang="en" sortRefs="false" consensus="yes" symRefs="true" tocInclude="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.12.0 -->
  <!-- Generated by id2xml 1.5.0 on 2020-02-06T01:41:26Z -->
    <front>
    <title abbrev="STAMP for Segment Routing over MPLS">Performance Measurement Using Simple Two-Way Active Measurement Protocol (STAMP) for Segment Routing over the MPLS Data Plane</title>
    <seriesInfo name="Internet-Draft" value="draft-ietf-spring-stamp-srpm-mpls-14"/>
    <author fullname="Rakesh Gandhi" initials="R." role="editor" surname="Gandhi">
      <organization>Cisco Systems, Inc.</organization>
      <address>
        <postal>
          <street>Canada</street>
        </postal>
        <email>rgandhi@cisco.com</email>
      </address>
    </author>
    <author fullname="Clarence Filsfils" initials="C." surname="Filsfils">
      <organization>Cisco Systems, Inc.</organization>
      <address>
        <email>cfilsfil@cisco.com</email>
      </address>
    </author>
    <author fullname="Bart Janssens" initials="B." surname="Janssens">
      <organization>Colt</organization>
      <address>
        <email>Bart.Janssens@colt.net</email>
      </address>
    </author>
    <author fullname="Mach(Guoyi) Chen" initials="M." surname="Chen">
      <organization>Huawei</organization>
      <address>
        <email>mach.chen@outlook.com</email>
      </address>
    </author>
    <author fullname="Richard Foote" initials="R." surname="Foote">
      <organization>Nokia</organization>
      <address>
        <email>footer.foote@nokia.com</email>
      </address>
    </author>

   <date year="2026"/>
    <workgroup>SPRING Working Group</workgroup>
    <abstract>
      <t>
   Segment Routing (SR) can be used to steer packets through a
   network employing source routing.  SR can be applied to both MPLS
   (SR-MPLS) and IPv6 (SRv6) data planes.

   This document specifies procedures for performance measurement in SR-MPLS networks using the
   Simple Two-Way Active Measurement Protocol (STAMP), as specified in RFC 8762,
   along with its optional extensions specified in RFC 8972 and the SR-specific extensions specified in RFC 9503.

   These procedures measure SR-MPLS paths, including Segment Lists of SR Policies, SR-MPLS IGP best paths, and SR-MPLS IGP
   Flexible Algorithm (Flex-Algo) paths, as well as Layer-3 services and point-to-point Layer-2 services carried over those paths.
   </t>

    </abstract>
    </front>
  <middle>
    <section anchor="sect-1" numbered="true" toc="default">
      <name>Introduction</name>
   <t>
   Segment Routing (SR) <xref target="RFC8402" format="default"/> can be used to steer packets through a
   network employing source routing.  SR can be applied to both MPLS
   (SR-MPLS) and IPv6 (SRv6) data planes.

   SR can take advantage of Equal-Cost Multipath (ECMP) between source and transit nodes,
   between transit nodes, and between transit and destination nodes. SR
   Policies, as specified in <xref target="RFC9256" format="default"/>, are used
   to steer traffic through specific user-defined paths, each represented by a list of segments.
   </t>

  <t>
  A comprehensive SR performance measurement toolset is essential for measuring network performance and meeting Service Level
  Agreements (SLAs).
   </t>

  <t>
   The Simple Two-Way Active Measurement Protocol (STAMP), as specified in <xref target="RFC8762" format="default"/>, provides
   the capability to measure various performance metrics in IP networks
   without the use of a control channel to pre-signal session parameters.
   <xref target="RFC8972" format="default"/> specifies optional extensions in the form of Type-Length-Value (TLV) objects for STAMP, and
   <xref target="RFC9503" format="default"/> further augments that framework
   to define STAMP extensions for SR networks.
   </t>

   <t>
  This document specifies procedures for measuring performance in SR-MPLS networks using STAMP as specified in <xref target="RFC8762" format="default"/>, along with the optional extensions specified in <xref target="RFC8972" format="default"/> and the SR-specific extensions specified in <xref target="RFC9503" format="default"/>.
  The procedures in this document measure SR-MPLS paths <xref target="RFC8402" format="default"/> including Segment Lists of SR Policies <xref target="RFC9256" format="default"/>, SR-MPLS IGP best paths, and SR-MPLS IGP Flexible Algorithm (Flex-Algo) paths <xref target="RFC9350" format="default"/>, as well as Layer-3 (L3) services and point-to-point Layer-2 (L2) services carried over those paths.
   The procedures specified in this document are intended for deployment in a single network administrative domain.
   </t>

   <t>
  STAMP requires protocol support as specified in <xref target="RFC8762" format="default"/> on the Session-Reflector to process the received STAMP-Test packets, including optional TLVs specified in <xref target="RFC8972" format="default"/>, and to generate Session-Reflector test packets and reflect received TLVs.
  In addition, use of the UDP port number in STAMP-Test packets exposes the Session-Reflector to security threats and requires rate limiting and consideration of operational impacts.
  In practice, these requirements lead implementations to process STAMP-Test packets on an exception path (e.g., by punting them from the IP- or MPLS-forwarding fast path).
  This limits the frequency of STAMP-Test packets and the ability to provide shorter measurement intervals.
  </t>
  <t>
  This document defines new mechanisms to
  enhance the procedures for performance measurement using STAMP, improve scalability by supporting a larger
  number of STAMP sessions, and shorten the measurement interval for SR-MPLS paths by defining three new
  measurement modes: one-way measurement mode, loopback measurement mode, and loopback with Timestamp and Forward (TSF) measurement mode. The loopback measurement mode and the loopback with TSF measurement mode take advantage of source routing.
   </t>

  <t>
  This document covers procedures for point-to-point L2 services carried over SR-MPLS paths. These procedures use the Type 3 exception (TTL=1 in the ultimate L2 service label) for control-plane termination, as specified in <xref target="I-D.ietf-mpls-stamp-pw" format="default"/>.
  </t>

  <t>
  Procedures for measurement modes of non-SR-MPLS LSPs (e.g., LDP-signaled LSPs) and pseudowires that are not carried over SR-MPLS paths are outside the scope of this document.
  This document also does not cover the use of the Type 4 (Generic-Associated-Label-based) or Type 1 (Control-Word-based) exception procedures defined in <xref target="I-D.ietf-mpls-stamp-pw" format="default"/> to encapsulate SR-MPLS paths or L3 and L2 services carried over those paths in the measurement modes specified here.
  </t>

    </section>

    <section anchor="sect-2" numbered="true" toc="default">
      <name>Conventions Used in This Document</name>
      <section anchor="sect-2.1" numbered="true" toc="default">
        <name>Requirements Language</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" format="default"/> <xref target="RFC8174" format="default"/>
    when, and only when, they appear in all capitals, as shown here.
   </t>

      </section>

      <section anchor="sect-2.2" numbered="true" toc="default">
        <name>Terminology</name>
        <t>This document uses the terms Session-Sender, Session-Reflector, and STAMP-Test packet as defined in <xref target="RFC8762" format="default"/>.</t>

        <t>This document uses timestamps T1, T2, T3, and T4 and the one-way delay metric (T2 - T1), the two-way delay metric ((T4 - T1) - (T3 - T2)), and the round-trip delay metric (T4 - T1), as defined in Section 2.4 of <xref target="RFC6374" format="default"/>.</t>

        <t>Round-trip delay: <xref target="RFC2681" section="2.7.2" format="default"/> defines round-trip delay as the wire-time interval from when a test packet leaves the source's network interface (T1) until the corresponding response packet has completely arrived there (T4). When the packet arrives at the destination, the destination sends a corresponding response to the source as soon as possible (<xref target="RFC2681" section="2.6" format="default"/>). The time at the destination between packet receipt (T2) and response transmission (T3) is ideally zero; any nonzero time adds error and uncertainty to the round-trip measurement (<xref target="RFC2681" section="2.7.2" format="default"/>; <xref target="RFC2681" section="2.7.3" format="default"/>).</t>

      </section>

      <section anchor="sect-2.3" numbered="true" toc="default">
        <name>Abbreviations</name>
        <table anchor="abbreviations" align="center">
          <name>Abbreviations</name>
          <thead>
            <tr>
              <th align="left">Abbreviation</th>
              <th align="left">Expansion</th>
              <th align="left">Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr><td>BoS</td><td>Bottom of Stack</td><td><xref target="RFC9994" format="default"/></td></tr>
            <tr><td>ECMP</td><td>Equal-Cost Multipath</td><td><xref target="RFC6790" format="default"/></td></tr>
            <tr><td>HMAC</td><td>Hashed Message Authentication Code</td><td><xref target="RFC6234" format="default"/></td></tr>
            <tr><td>L2VPN</td><td>Layer-2 Virtual Private Network</td><td><xref target="RFC4026" format="default"/></td></tr>
            <tr><td>L3VPN</td><td>Layer-3 Virtual Private Network</td><td><xref target="RFC4026" format="default"/></td></tr>
            <tr><td>LSE</td><td>Label Stack Entry</td><td><xref target="RFC9994" format="default"/></td></tr>
            <tr><td>MBZ</td><td>Must Be Zero</td><td><xref target="RFC8762" format="default"/></td></tr>
            <tr><td>MNA</td><td>MPLS Network Action</td><td><xref target="RFC9994" format="default"/></td></tr>
            <tr><td>MPLS</td><td>Multiprotocol Label Switching</td><td><xref target="RFC3032" format="default"/></td></tr>
            <tr><td>NTP</td><td>Network Time Protocol</td><td><xref target="RFC5905" format="default"/></td></tr>
            <tr><td>PHP</td><td>Penultimate Hop Popping</td><td><xref target="RFC3031" format="default"/></td></tr>
            <tr><td>PTP</td><td>Precision Time Protocol</td><td><xref target="IEEE.1588" format="default"/></td></tr>
            <tr><td>S bit</td><td>Bottom of Stack bit</td><td><xref target="RFC3032" format="default"/></td></tr>
            <tr><td>SHA</td><td>Secure Hash Algorithms</td><td><xref target="RFC6234" format="default"/></td></tr>
            <tr><td>SID</td><td>Segment Identifier</td><td><xref target="RFC8402" format="default"/></td></tr>
            <tr><td>SR</td><td>Segment Routing</td><td><xref target="RFC8402" format="default"/></td></tr>
            <tr><td>SR-MPLS</td><td>Segment Routing over the MPLS data plane</td><td><xref target="RFC8402" format="default"/></td></tr>
            <tr><td>SSID</td><td>STAMP Session Identifier</td><td><xref target="RFC8972" format="default"/></td></tr>
            <tr><td>STAMP</td><td>Simple Two-Way Active Measurement Protocol</td><td><xref target="RFC8762" format="default"/></td></tr>
            <tr><td>TC</td><td>Traffic Class</td><td><xref target="RFC5462" format="default"/></td></tr>
            <tr><td>TLV</td><td>Type-Length-Value</td><td><xref target="RFC8972" format="default"/></td></tr>
            <tr><td>TSF</td><td>Timestamp and Forward</td><td>This document</td></tr>
            <tr><td>TTL</td><td>Time to Live</td><td><xref target="RFC3032" format="default"/></td></tr>
            <tr><td>VPN</td><td>Virtual Private Network</td><td><xref target="RFC4026" format="default"/></td></tr>
          </tbody>
        </table>
      </section>

    </section>

    <section anchor="sect-3" numbered="true" toc="default">
      <name>Overview</name>

    <t>
    For performance measurement in SR-MPLS networks, the STAMP Session-Sender and Session-Reflector use the STAMP-Test packets specified in <xref target="RFC8762" format="default"/>, along with optional extensions specified in <xref target="RFC8972" format="default"/>. The STAMP-Test packets are encapsulated using an IP/UDP header, as specified in <xref target="RFC8762" format="default"/>. In this document, STAMP-Test packets use an IP/UDP header and are further encapsulated with an MPLS header for use in SR-MPLS networks.
    </t>

    <t>
    In SR-MPLS networks, STAMP-Test packets can use one of the following measurement modes, which differ in how the Session-Reflector processes the packets: 
    </t>

    <ol>
      <li><t>Two-Way measurement mode:</t>
          <t>The Session-Reflector generates and transmits Session-Reflector test packets (see <xref target="sect-4.1" format="default"/>).</t>
      </li>

      <li><t>One-Way measurement mode:</t>
          <t>The Session-Reflector does not generate or transmit Session-Reflector test packets (see <xref target="sect-4.2" format="default"/>).</t>
      </li>

      <li><t>Loopback measurement mode:</t>
          <t>The Session-Reflector does not perform STAMP processing (see <xref target="sect-4.3" format="default"/>).</t>
      </li>

      <li><t>Loopback with TSF measurement mode:</t>
          <t>The Session-Reflector writes the receive timestamp in the fast path but does not perform STAMP processing (see <xref target="sect-4.4" format="default"/>).</t>
      </li>
    </ol>

    <t>
    Note that the two-way measurement mode is specified as part of the STAMP process in <xref target="RFC8762" format="default"/> and is further specified for SR-MPLS networks in this document. The other measurement modes are new, specific to SR-MPLS networks, and are not specified in <xref target="RFC8762" format="default"/>.
    </t>

    <t>
    STAMP-Test packets are transmitted on the same path as the data traffic flow being measured to measure the delay and packet loss experienced by the data traffic flow, using the same MPLS encapsulation.
    </t>

    <ul spacing="normal">
    <li> <t>STAMP-Test packets are transmitted on various transport data paths in the network to measure the delay and packet loss experienced by the traffic forwarded on those paths. 
    </t>
    </li>
    <li> <t>STAMP-Test packets are transmitted over L3 and point-to-point L2 services in the network to measure the delay and packet loss experienced by the traffic carried by those services.
    </t>
    </li>
    </ul>

    <t>
    Typically, STAMP Session-Reflector test packets are transmitted along an IP path between the Session-Reflector and Session-Sender. The forward-direction path and the return path of STAMP-Test packets are not guaranteed to match, even for directly connected nodes. In SR-MPLS networks, the same path (i.e., the same set of links and nodes) might be desirable for the STAMP-Test packets in both directions, for example, in an ECMP environment. This is achieved as follows:
    </t>

    <ul spacing="normal">
    <li><t>In two-way measurement mode:</t>
    <t>The optional STAMP extensions for SR-MPLS networks, as specified in <xref target="RFC9503" format="default"/>, are used. The STAMP Session-Reflector uses the return path parameters for the Session-Reflector test packet from the STAMP extensions in the received Session-Sender test packet, as specified in <xref target="RFC9503" format="default"/>.
    </t>
    </li>
    <li><t>In the loopback measurement mode and the loopback with TSF measurement mode: </t> 
    <t>Both the forward path and the return path are included in the MPLS encapsulation of the Session-Sender test packets using source routing.</t>
    </li>
    </ul>

    <t>
    The procedures in this document measure delay and packet loss in SR-MPLS networks by transmitting and receiving STAMP-Test packets. The optional STAMP extensions specified in <xref target="RFC8972" format="default"/> are used for direct measurement in SR-MPLS networks.
    </t>

    </section>


    <section anchor="sect-4" numbered="true" toc="default">
      <name>Measurement Modes</name>

<t>
In Figures <xref target="modes-reference-topology-two-way" format="counter"/> through <xref target="modes-loopback-mode-with-tsf" format="counter"/>, the nodes S1 and R1 may be connected via an SR-MPLS path <xref target="RFC8402" format="default"/>.
</t>

<t>
The SR-MPLS path may be a Segment List of an SR Policy <xref target="RFC9256" format="default"/> on node S1 (referred to as the "head-end") with node R1 as the destination (referred to as the "endpoint"), an SR-MPLS IGP best path, or an SR-MPLS IGP Flex-Algo path <xref target="RFC9350" format="default"/>. Additionally, an L3 or L2 VPN service may be carried over the SR-MPLS path between nodes S1 and R1.
</t>


      <section anchor="sect-4.1" numbered="true" toc="default">
        <name>Two-Way Measurement Mode</name>

<t>
As shown in <xref target="modes-reference-topology-two-way" format="default"/>, in two-way measurement mode, the STAMP Session-Sender S1 initiates a Session-Sender test packet, and the STAMP Session-Reflector R1 generates and transmits a Session-Reflector test packet. The Session-Reflector test packet is sent to the Session-Sender S1 on either the same path (i.e., the same set of links and nodes) or a different path in the reverse direction from the path taken toward the Session-Reflector R1.
</t>

          <figure anchor="modes-reference-topology-two-way">
          <name>Reference Topology for Two-Way Measurement Mode</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
                   T1                           T2
                  /                               \
         +-------+  Session-Sender Test Packet     +-------+
         |       | - - - - - - - - - - - - - - - ->|       |
         |   S1  |=================================|   R1  |
         |       |<- - - - - - - - - - - - - - - - |       |
         +-------+   Session-Reflector test packet +-------+
                  \                               /
                   T4                           T3

     STAMP Session-Sender                 STAMP Session-Reflector
]]></artwork>
        </figure>

<t>
T1 is a transmit timestamp, and T4 is a receive timestamp added by node S1. T2 is a receive timestamp, and T3 is a transmit timestamp added by node R1. All four timestamps are used by the Session-Sender to measure the two-way delay metric, defined as ((T4 - T1) - (T3 - T2)) in <xref target="sect-2.2" format="default"/>. Timestamps T1 and T2 are used by the Session-Sender to measure the forward one-way delay metric, defined as (T2 - T1) in <xref target="sect-2.2" format="default"/>. Note that the delay value (T4 - T3), measured by the Session-Sender, is the reverse one-way delay metric.
The "two-way delay" is the sum of the one-way delays in each direction and reflects the delay of the bidirectional path, irrespective of processing delays within the Session-Reflector.  
</t>

<t>In two-way measurement mode, the round-trip delay interval (T4 - T1) includes the Session-Reflector processing time, including handling the UDP header in the exception path, generating the Session-Reflector test packet, and reflecting optional TLVs. The two-way delay metric subtracts the Session-Reflector interval (T3 - T2) from the round-trip delay interval.</t>

<t>
The computation of the one-way delay metric requires the clocks on the Session-Sender and the Session-Reflector to be synchronized, e.g., using either PTPv2 <xref target="IEEE.1588" format="default"/> or NTPv4 <xref target="RFC5905" format="default"/>.
</t> 

    <t>
    In two-way measurement mode, round-trip packet loss, near-end packet loss (forward direction), and far-end packet loss (backward direction) can be measured.
    Note that packet loss measurement does not require the clocks on the Session-Sender and the Session-Reflector to be synchronized using either PTPv2 or NTPv4.
    </t>
 
      </section>

      <section anchor="sect-4.2" numbered="true" toc="default">
        <name>One-Way Measurement Mode</name>

<t>
As shown in <xref target="modes-reference-topology-one-way" format="default"/>, in one-way measurement mode, the STAMP Session-Sender S1 initiates a Session-Sender test packet. Upon receiving a Session-Sender test packet, the STAMP Session-Reflector does not transmit a Session-Reflector test packet.
</t>


          <figure anchor="modes-reference-topology-one-way">
          <name>Reference Topology for One-Way Measurement Mode</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
                   T1                           T2
                  /                               \
         +-------+  Session-Sender Test Packet     +-------+
         |       | - - - - - - - - - - - - - - - ->|       |
         |   S1  |=================================|   R1  |
         |       |                                 |       |
         +-------+                                 +-------+

     STAMP Session-Sender                 STAMP Session-Reflector
  ]]></artwork>
        </figure>

<t>
T1 is a transmit timestamp added by node S1 and T2 is a receive timestamp added by node R1. Timestamps T1 and T2 are used by the Session-Reflector to measure the one-way delay metric, defined as (T2 - T1) in <xref target="sect-2.2" format="default"/>.
</t>

<t>
The computation of the one-way delay metric requires the clocks on the Session-Sender and the Session-Reflector to be synchronized using either PTPv2 or NTPv4.
</t>

    <t>
    In one-way measurement mode, forward-direction packet loss can be measured. The Session-Reflector compares the Session-Sender Sequence Number in each received Session-Sender test packet with the sequence number in the previously received packet. An increase of k indicates that k-1 test packets were not received, accounting for sequence-number wraparound. This measurement is available at the Session-Reflector.  Note that packet loss measurement does not require the clocks on the Session-Sender and the Session-Reflector to be synchronized using either PTPv2 or NTPv4.        
    </t>


      </section>

      <section anchor="sect-4.3" numbered="true" toc="default">
        <name>Loopback Measurement Mode</name>

<t>
As shown in <xref target="modes-reference-topology-for-loopback" format="default"/>, in loopback measurement mode, the STAMP Session-Sender S1 initiates a Session-Sender test packet to measure the round-trip delay using source routing. The node R1 at the end of the configured forward path forwards the received STAMP-Test packet along the configured return path using its MPLS and service forwarding state in the data plane. The node R1 does not need to support STAMP or maintain a STAMP session.
</t>

          <figure anchor="modes-reference-topology-for-loopback">
          <name>Reference Topology for Loopback Measurement Mode</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
                   T1               
                  /                
         +-------+  Session-Sender Test Packet     +-------+
         |       | - - - - - - - - - - - - - - - - |       |
         |   S1  |================================||   R1  |
         |       |<- - - - - - - - - - - - - - - - |       |
         +-------+     Session-Sender test packet  +-------+
                  \    (Return)     
                   T4               

    STAMP Session-Sender                 STAMP Session-Reflector
                                         (Loopback, Forward)
]]></artwork>
            </figure>

<t>
T1 is a transmit timestamp and T4 is a receive timestamp added by node S1. 
The Session-Sender uses them to measure the round-trip delay metric, defined as (T4 - T1) in <xref target="sect-2.2" format="default"/>. This delay includes test packet processing on the node R1 in the data plane. The processing delay includes only the time required to forward the test packet from the incoming interface to the outgoing interface in the data plane. The node R1 does not timestamp the test packets and therefore does not require a timestamping capability. 
</t>

    <t>
    In loopback measurement mode, only round-trip packet loss can be measured.
    </t>

      </section>

      <section anchor="sect-4.4" numbered="true" toc="default">
        <name>Loopback with TSF Measurement Mode</name>

<t>
As shown in <xref target="modes-loopback-mode-with-tsf" format="default"/>, in loopback with TSF measurement mode, the STAMP Session-Sender S1 initiates a Session-Sender test packet in loopback measurement mode using source routing. The TSF mechanism optimizes the operation of punting the test packet from the data-plane fast path for control-plane processing and generating the return Session-Sender test packet on the STAMP Session-Reflector R1, because timestamp writing is implemented in the data-plane fast path. This helps achieve a higher number of STAMP sessions and faster measurement intervals.
</t>

          <figure anchor="modes-loopback-mode-with-tsf">
          <name>Reference Topology for Loopback with TSF Measurement Mode</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
                   T1                           T2
                  /                               \
         +-------+  Session-Sender Test Packet     +-------+
         |       | - - - - - - - - - - - - - - - - |       |
         |   S1  |================================||   R1  |
         |       |<- - - - - - - - - - - - - - - - |       |
         +-------+     Session-Sender test packet  +-------+
                  \    (Return)               
                   T4                        

     STAMP Session-Sender               STAMP Session-Reflector
                                        (Loopback, TSF)
 ]]></artwork>
        </figure>

<t>
T1 is a transmit timestamp and T4 is a receive timestamp added by node S1. 
The Session-Reflector R1 writes the receive timestamp (T2) in the received STAMP-Test packet in the fast path in the data plane, without punting the test packet from the fast path in the data plane for control-plane STAMP processing.
In this mode, a node that performs the TSF network action needs to support the applicable TSF flag, as specified in <xref target="sect-9.1.1" format="default"/>.
</t>

<t>
Timestamps T1 and T2 are used by the Session-Sender to measure the one-way delay metric, defined as (T2 - T1) in <xref target="sect-2.2" format="default"/>. Timestamps T1 and T4 are used by the Session-Sender to measure the round-trip delay metric, defined as (T4 - T1) in <xref target="sect-2.2" format="default"/>.
</t>

    <t>
    In loopback with TSF measurement mode, only round-trip packet loss can be measured.
    </t>

      </section>

    </section>

    <section anchor="sect-5" numbered="true" toc="default">
      <name>STAMP Reference Model</name>

        <t>
The STAMP Reference Model from <xref target="RFC8762" format="default"/>, augmented with an SDN Controller for Configuration and Management and typical measurement parameters for a STAMP session, is shown in <xref target="ure-reference-model" format="default"/>.
    </t>

        <figure anchor="ure-reference-model">
          <name>STAMP Reference Model</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
                          +------------+
                          |    SDN     |
                          | Controller |
                          +------------+
                               /  \
Measurement Mode              /    \      Stateful or Stateless 
Destination UDP Port Number  /      \     Destination UDP Port Number
Authentication Mode         /        \    Authentication Mode
Authentication Key         /          \   Authentication Key
Timestamp Format          /            \  Timestamp Format 
SSID                     /              \ SSID 
Metric Types            /                \  
                       v                  v
                   +-------+          +-------+
                   |       |  STAMP   |       |
                   |   S1  |==========|   R1  |
                   |       |  Session |       |
                   +-------+          +-------+

            STAMP Session-Sender  STAMP Session-Reflector
]]></artwork>
        </figure>

<t>
The procedures specified in <xref target="RFC8762" format="default"/> and <xref target="RFC8972" format="default"/> correspond to the two-way measurement mode defined in this document.
</t>

<t>
The STAMP-Test packet payloads specified in <xref target="RFC8972" format="default"/> are transported using an IPv4 or IPv6 header and a UDP header.
The IPv4 or IPv6 header and the UDP header follow the procedures specified in <xref target="I-D.ietf-ippm-stamp-ext-hdr" section="3.1" format="default"/>.
The same or a different destination UDP port number may be used for STAMP sessions for SR-MPLS paths and for L3 and L2 services carried over SR-MPLS paths, subject to the mode-specific UDP port selection rules in <xref target="sect-14" format="default"/>.
Similarly, the same or a different source UDP port number can be used for STAMP sessions for SR-MPLS paths and for L3 and L2 services carried over those paths.
</t>

<t>
The Session-Reflector mode can be either Stateful or Stateless, as specified in <xref target="RFC8762" section="4" format="default"/>. Stateless Session-Reflector mode is applicable only in two-way measurement mode.</t>

<t>
For two-way and one-way measurement modes, when authentication is used, the Session-Sender and Session-Reflector MUST be configured with the same HMAC key, as specified in <xref target="RFC8762" section="4.4" format="default"/>. In loopback measurement mode, the Session-Sender can use an HMAC key to add an HMAC to its test packet and verify the HMAC when the packet is returned; the Session-Reflector forwards the packet without validating the HMAC and does not need the key.
</t>

<t>The supported timestamp formats are a 64-bit truncated Precision Time Protocol (PTPv2) timestamp <xref target="IEEE.1588" format="default"/> and a 64-bit Network Time Protocol (NTPv4) timestamp <xref target="RFC5905" format="default"/>. The Z field identifies the timestamp format used by the STAMP Session-Sender and Session-Reflector, as specified in <xref target="RFC8762" section="4.2.1" format="default"/>.</t>

<t>Examples of delay metrics are one-way delay, two-way delay, forward one-way delay, and reverse one-way delay, as specified in <xref target="RFC8762" format="default"/>.</t>

<t>Examples of packet loss metric types are round-trip packet loss, near-end packet loss (forward direction), and far-end packet loss (backward direction), as specified in <xref target="RFC8762" format="default"/>.</t>

<t>
TTL and Hop Limit values in the STAMP-Test packets are set as follows:
</t>

<ul>
  <li><t>The IPv4 TTL or the IPv6 Hop Limit MUST be set to 255, as specified in Section 4.3 of <xref target="I-D.ietf-mpls-stamp-pw" format="default"/>.</t></li>
  <li><t>In SR-MPLS encapsulations, the TTL of each MPLS label MUST be set to 255, including every label in a Segment List, every return-path transport label, and the MNA label (see <xref target="sect-9.1" format="default"/>).</t></li>
  <li>
    <t>The ultimate L2VPN label that invokes the Type 3 exception for control-plane processing MUST have a TTL of 1:</t>
    <ul>
      <li><t>For two-way and one-way measurement modes, this is the forward-direction L2VPN label at the Session-Reflector.</t></li>
      <li><t>For two-way measurement mode, it is also the reverse-direction L2VPN label at the Session-Sender.</t></li>
      <li><t>For loopback measurement mode, it is the return-direction L2VPN label at the Session-Sender.</t></li>
    </ul>
  </li>
    <li><t>In loopback measurement mode, the Session-Reflector forwards the packet in the data plane using the SR-MPLS return-path labels and does not terminate it for STAMP control-plane processing.</t></li>
</ul>

<t>
The Flow Label field is set as follows:
</t>

<ul>
  <li><t>The Flow Label field in the IPv6 header of each Session-Sender test packet MUST be set to the value used by the data packets for the IPv6 traffic flow being measured by the Session-Sender.</t></li>
  <li><t>Unless local policy explicitly specifies otherwise, the Session-Reflector MUST set the Flow Label field in its test packet to the value received in the Session-Sender test packet.</t></li>
  <li><t>Local policy MAY specify that the Session-Reflector replaces the received value with a locally configured value.</t></li>
</ul>

<t>A Software-Defined Networking (SDN) controller can be used for the configuration and management of STAMP sessions, as specified in <xref target="RFC8762" format="default"/>. The controller can also receive streaming telemetry of operational data. The YANG data model for STAMP, defined in <xref target="I-D.ietf-ippm-stamp-yang" format="default"/>, can be used to configure Session-Senders and Session-Reflectors and to stream telemetry of operational data.</t>

<t>In two-way measurement mode, the Session-Sender retrieves timestamp T1, T2, and T3 from the received Session-Reflector test packet as specified in <xref target="RFC8762" format="default"/> and collects the receive timestamp T4 locally. </t>

    <section anchor="sect-5.1" numbered="true" toc="default">
        <name>STAMP for One-Way Measurement Mode</name>
<t>
In one-way measurement mode, the Session-Reflector MUST operate in Stateful mode.
</t>

<t>
In one-way measurement mode, one of the following configurations for the destination UDP port number is used:
</t>

<ul>
  <li><t>A different destination UDP port number MAY be selected instead of the UDP port number used by the Session-Reflector for the two-way measurement mode. A different UDP port number does not by itself signal the measurement mode. When a different UDP port is used, the Session-Reflector MUST associate packets received on that UDP port with the configured one-way session. Destination UDP port selection and endpoint configuration are specified in <xref target="sect-14.7" format="default"/>.</t></li>
  <li><t>If the same Session-Reflector UDP port number is used for one-way and two-way measurement modes, the Session-Sender MUST include the "No Reply Requested" flag in the Control Code Sub-TLV within the Return Path TLV defined in <xref target="RFC9503" format="default"/>. The Session-Reflector MUST process this Control Code Sub-TLV in one-way measurement mode and MUST NOT transmit Session-Reflector test packets in response.</t></li>
</ul>

<t>In one-way measurement mode, the Session-Reflector retrieves timestamp T1 from the Timestamp field of the received Session-Sender test packet and collects the receive timestamp T2 locally.  </t>

    </section>

        <section anchor="sect-5.2" numbered="true" toc="default">
          <name>STAMP for Loopback and Loopback with TSF Measurement Modes</name>

<t>
In the loopback measurement mode and the loopback with TSF measurement mode, the node at the end of the forward path (referred to as the Session-Reflector in this document) MUST process the MPLS header according to the specified forwarding procedure, MUST NOT perform STAMP processing, MUST NOT modify the STAMP-Test packet except where the TSF procedure explicitly requires timestamp modification, and MUST forward the packet using the specified return-path mechanism. A node performing the TSF action MUST support the applicable TSF flag, as specified in <xref target="sect-9.1.1" format="default"/>.
</t>

<t>
The Session-Sender MUST set the destination UDP port number to the UDP port number it uses to receive return Session-Sender test packets. This UDP port MUST NOT be 862, which is the default UDP port number used by the Session-Reflector. The same UDP port number MAY be used as both the destination and source UDP port numbers in the Session-Sender test packets. Port selection is summarized in <xref target="sect-14" format="default"/>.
</t>

<t>
The "Session-Sender Sequence Number", the "Session-Sender Timestamp", the "Session-Sender Error Estimate", and the "Session-Sender TTL" fields in the Session-Reflector test packet, shown in Figure 5 of <xref target="RFC8762" format="default"/>, MUST be set to zero in the transmitted Session-Sender test packets, as specified in <xref target="RFC8762" format="default"/>. These fields MUST be ignored in the return Session-Sender test packets received at the Session-Sender in the loopback measurement mode and the loopback with TSF measurement mode.
</t>

<t>
In both the loopback measurement mode and the loopback with TSF measurement mode, 
the Session-Sender adds the transmit timestamp (T1) to the payload of the Session-Sender test packet.
</t>

<t>
In loopback measurement mode, 
the Session-Sender retrieves timestamp T1 from the Timestamp field of the returned Session-Sender test packet and collects the receive timestamp T4 locally.
</t>

<t>
In loopback with TSF measurement mode, 
the Session-Reflector writes the receive timestamp (T2) in the received STAMP-Test packet in the fast path in the data plane, without punting the test packet from the fast path in the data plane for control-plane STAMP processing.

The Session-Sender retrieves timestamp T1 from the Timestamp field of the returned Session-Sender test packet. It retrieves timestamp T2 from the location of the Receive Timestamp field and collects the receive timestamp T4 locally.
</t>


        </section>

              <section anchor="sect-5.4" numbered="true" toc="default">
        <name>Measurement Mode Comparison for STAMP</name>
        <table anchor="measurement-mode-comparison" align="center">
          <name>Measurement Mode Comparison for Applicability in STAMP</name>
          <thead>
            <tr>
              <th align="left">Mode</th>
              <th align="left">STAMP Reflector</th>
              <th align="left">Timestamp</th>
              <th align="left">Delay Metrics</th>
              <th align="left">Loss Metrics</th>
              <th align="left">Direct Measurement</th>
              <th align="left">Reference</th>
            </tr>
          </thead>
          <tbody>
          <tr><td>Two-Way</td><td>Stateful or Stateless</td><td>T1/T2/T3/T4</td><td>OW, TW</td><td>One-Way, Round-trip</td><td>Applicable</td><td><xref target="RFC8762" format="default"/></td></tr>
            <tr><td>One-Way</td><td>Stateful</td><td>T1/T2</td><td>OW</td><td>One-Way</td><td>Applicable</td><td>This document</td></tr>
            <tr><td>Loopback</td><td>N/A</td><td>T1/T4</td><td>RT</td><td>Round-trip</td><td>Not Applicable</td><td>This document</td></tr>
            <tr><td>Loopback with TSF</td><td>N/A</td><td>T1/T2/T4</td><td>OW, RT</td><td>Round-trip</td><td>Not Applicable</td><td>This document</td></tr>
          </tbody>
        </table>

    <t>Delay metric abbreviations and clock synchronization requirements:</t>
    <ul>
      <li><t>OW: One-way delay metric (T2 - T1); computation requires clock synchronization.</t></li>
      <li><t>TW: Two-way delay metric ((T4 - T1) - (T3 - T2)); computation does not require clock synchronization.</t></li>
      <li><t>RT: Round-trip delay metric (T4 - T1); computation does not require clock synchronization.</t></li>
    </ul>

      <section anchor="sect-5.4.1" numbered="true" toc="default">
        <name>STAMP TLV Applicability</name>

      <t>The following STAMP TLVs specified for the two-way measurement mode are applicable in the one-way measurement mode, the loopback measurement mode, and the loopback with TSF measurement mode:</t>
      <ul>
        <li><t>Type 1 (Extra Padding) <xref target="RFC8972" format="default"/>.</t></li>
      </ul>

      <t>Type 8 (HMAC) <xref target="RFC8972" format="default"/> is applicable in the one-way measurement mode and the loopback measurement mode, but is not applicable in the loopback with TSF measurement mode.</t>

      <t>Within Type 10 (Return Path) <xref target="RFC9503" format="default"/>, the following Sub-TLVs are applicable:</t>
      <ul>
        <li>
          <t>Control Code Sub-TLV:</t>
          <ul>
            <li><t>When the same Session-Reflector UDP port number is used for one-way and two-way sessions, the "No Reply Requested" requirement specified in <xref target="sect-5.1" format="default"/> applies.</t></li>
            <li><t>The "Reply Requested on the Same Link" value is applicable in two-way measurement mode.</t></li>
          </ul>
        </li>
        <li><t>The Return IPv4 or IPv6 Address (Sub-TLV Type 2) is applicable only in two-way measurement mode.</t></li>
        <li><t>The SR-MPLS Label Stack of the Return Path (Sub-TLV Type 3) is applicable only in two-way measurement mode.</t></li>
      </ul>

      <t>Type 5 (Direct Measurement) <xref target="RFC8972" format="default"/> is applicable in the two-way measurement mode and the one-way measurement mode. It is not applicable in the loopback measurement mode or the loopback with TSF measurement mode.</t>

      <t>In the two-way measurement mode and the one-way measurement mode, Type 9 (Destination Node IPv4 or IPv6 Address) <xref target="RFC9503" format="default"/> carries the Session-Reflector IP address. In the loopback measurement mode and the loopback with TSF measurement mode, it carries the Session-Sender IP address.</t>

      <t>The following STAMP TLVs specified for the two-way measurement mode are not applicable in the one-way measurement mode, the loopback measurement mode, and the loopback with TSF measurement mode:</t>
      <ul>
        <li><t>Type 2 (Location) <xref target="RFC8972" format="default"/>.</t></li>
        <li><t>Type 3 (Timestamp Information) <xref target="RFC8972" format="default"/>.</t></li>
        <li><t>Type 4 (Class of Service) <xref target="RFC8972" format="default"/>.</t></li>
        <li><t>Type 6 (Access Report) <xref target="RFC8972" format="default"/>.</t></li>
        <li><t>Type 7 (Follow-Up Telemetry) <xref target="RFC8972" format="default"/>.</t></li>
        <li><t>Type 12 (Reflected Test Packet Control) <xref target="RFC10052" format="default"/>.</t></li>
        <li><t>Reflected Fixed Header Data <xref target="I-D.ietf-ippm-stamp-ext-hdr" format="default"/>.</t></li>    
      </ul>

      <t>A STAMP session operating in the one-way measurement mode, the loopback measurement mode, or the loopback with TSF measurement mode MUST ignore any TLV listed above that is not applicable to that mode when the session receives a STAMP-Test packet containing that TLV.</t>

      </section>

      </section>


    <section anchor="sect-5.5" numbered="true" toc="default">
      <name>STAMP Session Identifier for SR-MPLS</name>

      <t>
      For SR-MPLS paths, the Session-Sender and Session-Reflector MUST identify STAMP sessions using the procedures specified in <xref target="I-D.ietf-mpls-stamp-pw" section="3.3" format="default"/> for test packets with an IP/UDP header.
      As specified in <xref target="I-D.ietf-mpls-stamp-pw" section="3.3" format="default"/>, 
      the Session-Sender MUST include a nonzero SSID in each Session-Sender test packet. The following procedures apply to STAMP session identification using the SSID in each measurement mode:</t>

      <ul>
        <li><t>Two-way measurement mode: A Session-Reflector that receives a Session-Sender test packet with an SSID of zero follows the procedure specified in [RFC8972]. For a nonzero SSID, the Session-Reflector MUST use the SSID to identify the configured session and MUST copy the SSID into its reply as specified in <xref target="RFC8972" format="default"/>. A Session-Sender that receives a Session-Reflector test packet with a zero SSID MAY stop the session, as specified in Section 3 of <xref target="RFC8972" format="default"/>.</t></li>
        <li><t>One-way measurement mode: A Session-Reflector that receives a Session-Sender test packet with an SSID of zero MUST discard it. For a nonzero SSID, the Session-Reflector MUST use the SSID to identify the configured session. The Session-Reflector MUST associate each received Session-Sender test packet with a STAMP session using the Source IP address, the SSID, the destination UDP port number, and the measurement mode configured locally for that SSID.</t></li>
        <li><t>Loopback measurement mode and loopback with TSF measurement mode: The Session-Sender MUST identify a returned Session-Sender test packet using the source IP address, SSID, destination UDP port number, and measurement mode configured locally for that SSID. The returned test packet is the Session-Sender's own test packet, so its source IP address identifies the Session-Sender and cannot be used as the Session-Reflector address for session identification. The Session-Sender MUST discard a returned Session-Sender test packet with a zero or non-matching SSID. 
    </t>
    <t>
    These fields identify the local STAMP session on the Session-Sender but do not identify the endpoint node that forwarded the packet; the intended endpoint node is determined by the provisioned forward path and service label. </t></li>
      </ul>
    </section>

    </section>
    

    <section anchor="sect-6" numbered="true" toc="default">
      <name>Encapsulations for Two-Way Measurement Mode</name>


    <section anchor="sect-6.1" numbered="true" toc="default">
        <name>Session-Sender Test Packet</name>
   <t>
  The content of a Session-Sender test packet is shown in <xref target="ure-dm-sender-test-packet" format="default"/>.
  The Session-Sender transmits the test packet payload, as specified in
  <xref target="RFC8972" section="3" format="default"/>,
  with an IP header and a UDP header <xref target="RFC768" format="default"/>.
   </t>

        <figure anchor="ure-dm-sender-test-packet">
          <name>Content of Session-Sender Test Packet</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
 +---------------------------------------------------------------+
 | IP Header                                                     |
 .  Source IP Address = Session-Sender IP Address                .
 .  Destination IP Address = Session-Reflector IP Address        .
 .  IPv4 Protocol or IPv6 Next-header = 17 (UDP)                 .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header                                                    |
 .  Source Port = Selected by Session-Sender                     .
 .  Destination Port = User-configured Destination Port Or 862   .
 .                                                               .
 +---------------------------------------------------------------+
 | Payload = Test Packet as specified in Figure 1 and Figure 3   |
 .           in Section 3 of RFC 8972                            .
 .                                                               .
 +---------------------------------------------------------------+
]]></artwork>
        </figure>

   </section>


<section anchor="sect-6.2" numbered="true" toc="default">
            <name>Session-Sender Test Packet for SR-MPLS Data Plane</name>

<section anchor="sect-6.2.1" numbered="true" toc="default">
            <name>Session-Sender Test Packet for SR-MPLS Paths</name>

        <t>
A Session-Sender test packet using the same SR-MPLS encapsulation as the data traffic on the path is shown in <xref target="ure-test-packet-for-sr-mpls-policy" format="default"/>.
</t>

            <figure anchor="ure-test-packet-for-sr-mpls-policy">
              <name>Content of Session-Sender Test Packet for an SR-MPLS Path</name>
              <artwork name="" type="" align="left" alt=""><![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
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Label(1) (Top of Stack)    | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .                                                               .
 .                                                               .
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Label(n)                   | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Test Packet as shown in Figure 6                   |
 .                                                               .
 +---------------------------------------------------------------+
]]></artwork>
            </figure>

<section anchor="sect-6.2.1.1" numbered="true" toc="default">
  <name>SR Policy Paths</name>

<t>
A valid Candidate Path of an SR Policy contains one or more Segment Lists, each of which is a stack of MPLS labels <xref target="RFC9256" format="default"/>.
To measure delay for an SR Policy, the Session-Sender SHOULD transmit test packets for each Segment List selected for monitoring, using a separate STAMP session for each list. The Candidate Paths and Segment Lists selected for monitoring depend on the operational objective, as described in <xref target="sect-14.6" format="default"/>.
</t>

<t>
Each SR-MPLS Segment List contains a list of 32-bit Label Stack Entries (LSEs), where each LSE includes a 20-bit label value, an 8-bit Time to Live (TTL) field, a 3-bit Traffic Class (TC) field, and a 1-bit Bottom of Stack (BoS) field <xref target="RFC3032" format="default"/>.
</t>

<t>
The IP header's Source IP Address field MUST contain the IP address of the SR Policy's head-end node.
There are two cases for the SR Policy endpoints, as described below.
</t>

<ol>
    <li>
    <t>If the SR Policy's endpoint is specified and is not the null endpoint, its IP address MUST be used as the Destination IP Address in the IP header.</t>
    </li>
    <li>
    <t>For an SR Policy with Color-Only Destination Steering, where the endpoint is an unspecified IPv4 address (the null endpoint is 0.0.0.0, as specified in <xref target="RFC9256" section="8.8.1" format="default"/>), an IPv4 loopback address from the 127/8 range is used as the Destination IP Address in the IPv4 header.
    </t>
    <t>
    For IPv6 traffic, the Session-Sender's IPv6 address is used as the Source IP Address, and an IPv6 address from the Dummy IPv6 Prefix 100:0:0:1::/64 block <xref target="RFC9780" format="default"/> <xref target="IANA-IPv6-REG" format="default"/> is used as the Destination IP Address in the IPv6 header.
    </t>
    <t>
    In this case, the Segment List of the Session-Sender test packets MUST end with a label that causes the packets to be delivered to the Session-Reflector at the SR Policy endpoint (for example, by adding the Prefix SID label of the endpoint in the Segment List).
    </t>
    <t>
    Because a non-routable destination IP address does not identify the Session-Reflector, the Session-Sender SHOULD include the Type 9 ("Destination Node IPv4 or IPv6 Address") STAMP TLV defined in <xref target="RFC9503" format="default"/>, with the IP address of the intended Session-Reflector. When a non-routable destination IP address as described in Section 5.1 of <xref target="I-D.ietf-mpls-stamp-pw" format="default"/> is used, and the intended destination node is not verified by other means, a misforwarded STAMP-Test packet or a packet whose Segment List ends early may be processed by another node and produce an incorrect measurement without indication.
    </t>
    </li>
</ol>

 </section>

<section anchor="sect-6.2.1.2" numbered="true" toc="default">
  <name>SR-MPLS IGP Paths</name>

  <t>
  Each IGP Flex-Algo path and IGP best path in SR-MPLS networks <xref target="RFC9350" format="default"/> has Prefix SID labels advertised by the nodes. The Session-Sender test packet uses the Prefix SID labels.
  </t>

  <t>The forward-direction MPLS label stack carries the Session-Reflector's Prefix SID label: the Flex-Algo Prefix SID for an IGP Flex-Algo path, and the IGP Prefix SID for an IGP best path.
   The SR-MPLS Segment List Sub-TLV in the Return Path TLV carries the Session-Sender's Prefix SID label for the reverse direction, as specified in <xref target="sect-6.3.1" format="default"/>.</t>

  <t>
  An IGP Prefix SID label identifies a destination within an IGP or Flex-Algo forwarding context; it does not identify a specific SR-MPLS path. A test packet using an IGP Prefix SID therefore measures forwarding according to the IGP-selected path, which may include multiple ECMP paths. <xref target="sect-12" format="default"/> describes how the Session-Sender can influence the ECMP paths using hashing inputs, although it generally cannot deterministically select a particular path. This differs from measuring a specific SR Policy Segment List of a valid Candidate Path, as described above. However, a Segment List can itself encounter multiple ECMP paths when it uses an IGP Prefix SID label.
  </t>
</section>

    </section>

    <section anchor="sect-6.2.2" numbered="true" toc="default">
          <name>Session-Sender Test Packet for Layer-3 Services over an SR-MPLS Path</name>

<t>
To measure delay for an L3 service carried over an SR-MPLS path, the Session-Sender MUST use the SR-MPLS label stack of the data packets transmitted over the L3 service, including the L3 Virtual Private Network (L3VPN) label advertised by the Session-Reflector, to encapsulate the Session-Sender test packets, as shown in <xref target="ure-test-packet-for-sr-l3-mpls" format="default"/>.
</t>

            <figure anchor="ure-test-packet-for-sr-l3-mpls">
              <name>Content of Session-Sender Test Packet for an L3 Service over an SR-MPLS Path</name>
              <artwork name="" type="" align="left" alt=""><![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
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Label(1) (Top of Stack)    | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .                                                               .
 .                                                               .
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            L3VPN Label                | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Test Packet as shown in Figure 6                   |
 .            Destination IP Address in L3VPN table              .
 .            Source IP Address in L3VPN table-reverse direction .
 .                                                               .
 +---------------------------------------------------------------+
]]></artwork>
            </figure>

<t>
An IP header, as shown in <xref target="ure-dm-sender-test-packet" format="default"/>, is added to the Session-Sender test packets after the MPLS header. The Destination IP Address in the IP header MUST be reachable via the IP table lookup associated with the L3VPN label added for the L3 service on the Session-Reflector. The Source IP Address in the IP header of the Session-Sender test packets MUST be reachable via the IP table lookup associated with the L3 service in the reverse direction.
</t>

      </section>

    <section anchor="sect-6.2.3" numbered="true" toc="default">
          <name>Session-Sender Test Packet for Layer-2 Services over an SR-MPLS Path</name>

<t>
To measure a point-to-point L2VPN service carried over an SR-MPLS path, the Session-Sender MUST use the SR-MPLS label stack of the data packets transmitted over the L2VPN service, including the L2VPN label advertised by the Session-Reflector, to encapsulate the Session-Sender test packets, as shown in <xref target="ure-test-packet-for-sr-l2-mpls" format="default"/>.
</t>

     <figure anchor="ure-test-packet-for-sr-l2-mpls">
              <name>Content of Session-Sender Test Packet for an L2 Service over an SR-MPLS Path</name>
              <artwork name="" type="" align="left" alt=""><![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
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Label(1) (Top of Stack)    | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .                                                               .
 .                                                               .
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            L2VPN Label                | TC  |1|      TTL=1    |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Test Packet as shown in Figure 6                   |
 .                                                               .
 +---------------------------------------------------------------+
]]></artwork>
            </figure>

<t>
For two-way and one-way measurement modes, the Session-Sender MUST set the TTL of the ultimate forward-direction L2VPN label to 1. This invokes the Type 3 exception specified in <xref target="I-D.ietf-mpls-stamp-pw" format="default"/> and terminates the test packet for control-plane processing on the Session-Reflector.
</t>

<t>
The Session-Sender MUST add an IP header, as shown in <xref target="ure-dm-sender-test-packet" format="default"/>, to the Session-Sender test packets after the MPLS header. The header MUST contain the Session-Sender IP address as the Source IP Address and the Session-Reflector IP address as the Destination IP Address.
</t>

      </section>
      </section>


  <section anchor="sect-6.3" numbered="true" toc="default">
          <name>Session-Reflector Test Packet</name>

<t>
In two-way measurement mode, the Session-Reflector transmits the Session-Reflector test packets over SR-MPLS paths, L3 services, or L2 services carried over SR-MPLS paths in the reverse direction toward the Session-Sender.
</t>

<t>
The Session-Reflector decapsulates the MPLS header, if present, from the received Session-Sender test packet.
</t>

<t>
The Session-Reflector MUST generate the Session-Reflector test packet using the source and destination IP addresses and UDP port numbers extracted from the received Session-Sender test packet, except that a Return Address Sub-TLV, when present, specifies the destination IP address, as described in <xref target="sect-6.3.1" format="default"/>. The packet format is shown in <xref target="ure-test-reply-packet" format="default"/>.
</t>

        <figure anchor="ure-test-reply-packet">
          <name>Content of Session-Reflector Test Packet</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
 +---------------------------------------------------------------+
 | IP Header                                                     |
 .  Source IP Address                                            .
 .     = Session-Reflector IP Address                            .
 .  Destination IP Address                                       .
 .     = Source IP Address from Session-Sender Test Packet       .
 .       (unless overridden by Return Address Sub-TLV)           .
 .  IPv4 Protocol or IPv6 Next-header = 17 (UDP)                 .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header                                                    |
 .  Source Port = Selected by Session-Reflector                  .
 .  Destination Port                                             .
 .     = Source Port from Session-Sender Test Packet             .
 .                                                               .
 +---------------------------------------------------------------+
 | Payload = Test Packet as specified in Figure 2 and Figure 4   |
 .           in Section 3 of RFC 8972                            .
 .                                                               .
 +---------------------------------------------------------------+
]]></artwork>
        </figure>

<t>
The Session-Reflector test packet fields are set as follows:
</t>

<ul>
  <li><t>The payload contains the Session-Reflector test packet specified in <xref target="RFC8972" section="3" format="default"/>.</t></li>
  <li><t>The source UDP port number in the received UDP header MUST be used as the destination UDP port number, and the destination UDP port number in the received UDP header MUST be used as the source UDP port number.</t></li>
  <li><t>The source IP address in the received IP header MUST be used as the destination IP address unless a Return Address Sub-TLV is present, in which case the specified address MUST be used.</t></li>
  <li><t>The Session-Reflector IP address MUST be used as the source IP address.</t></li>
</ul>

<t>
The Session-Reflector MUST encapsulate the Session-Reflector test packets for transmission over SR-MPLS paths, L3 services, or L2 services carried over SR-MPLS paths in the reverse direction.
</t>

        <section anchor="sect-6.3.1" numbered="true" toc="default">
          <name>Session-Reflector Test Packet for an SR-MPLS Path</name>

<t>
When the Session-Reflector receives an SR-MPLS Label Stack Sub-TLV in the Return Path TLV defined in <xref target="RFC9503" format="default"/>, it MUST use the label stack carried in that Sub-TLV as the reverse-direction SR-MPLS path and encapsulate the Session-Reflector test packet with the corresponding MPLS label stack.
</t>

<t>
The Session-Reflector MUST process a Control Code Sub-TLV as specified in <xref target="RFC9503" section="4.1.1" format="default"/>:
</t>

<ul>
  <li><t>When the Reply Request flag indicates "No Reply Requested", the Session-Reflector MUST NOT transmit a Session-Reflector test packet and MUST terminate the received STAMP-Test packet.</t></li>
  <li><t>When it indicates "Reply Requested on the Same Link", the Session-Reflector MUST transmit the Session-Reflector test packet over the incoming link in the reverse direction.</t></li>
  <li><t>As specified in <xref target="RFC9503" section="4.1" format="default"/>, a Control Code Sub-TLV cannot be included in the same Return Path TLV as a Return Address or SR-MPLS Label Stack Sub-TLV.</t></li>
</ul>

<t>
A Return Address Sub-TLV MAY be present together with an SR-MPLS Label Stack Sub-TLV. When both are present, the Session-Reflector MUST use the label stack for the reverse SR-MPLS path and MUST use the Return Address as the destination IP address of the Session-Reflector test packet, as specified in <xref target="RFC9503" section="4.1.2" format="default"/>.
</t>

<t>
Examples of specific SR-MPLS return paths include:
</t>

<ul>
  <li>The SR-MPLS label stack of the associated reverse Candidate Path.</li>
  <li>The Binding SID label of the reverse SR Policy.</li>
  <li>The SR-MPLS Prefix SID label of the Session-Sender.</li>
</ul>

<t>
For an SR-MPLS IGP Flex-Algo path, the SR-MPLS Label Stack Sub-TLV in the Return Path TLV carries the SR-MPLS Prefix SID label of the Session-Sender for the same SR-MPLS IGP Flex-Algo path and requests that the Session-Reflector transmit the Session-Reflector test packet over that path in the reverse direction.
</t>

<t>
If no Return Path TLV is received, or if the received Return Path TLV contains neither a Control Code Sub-TLV nor an SR-MPLS Label Stack Sub-TLV, the Session-Reflector MUST transmit the Session-Reflector test packet over the locally selected reverse SR-MPLS path.
</t>

<t>
If no reverse SR-MPLS path can be selected, the Session-Reflector MUST transmit the test packet shown in <xref target="ure-test-reply-packet" format="default"/> using IP forwarding.
</t>

        </section>

        <section anchor="sect-6.3.2" numbered="true" toc="default">
          <name>Session-Reflector Test Packet for an L3 Service Over an SR-MPLS Path</name>

<t>
The Session-Reflector MUST transmit the Session-Reflector test packet using the reverse-direction L3 service label stack associated with the L3VPN label received for the forward-direction L3 service.
</t>

<t>
The Session-Reflector MUST add the MPLS header using reachability information for the Source IP Address in the IP header of the received test packet. This address MUST be reachable through the IPv4 or IPv6 table lookup associated with the L3VPN label for the forward-direction L3 service instantiated on the Session-Reflector.
</t>

<t>
The IP header shown in <xref target="ure-test-reply-packet" format="default"/> uses the source and destination IP addresses from the received IP header as its destination and source IP addresses, respectively.
</t>

<t>
If the Session-Reflector cannot find the corresponding reverse-direction L3 service, it MUST drop the test packet and MUST NOT transmit a Session-Reflector test packet.
</t>

        </section>

        <section anchor="sect-6.3.3" numbered="true" toc="default">
          <name>Session-Reflector Test Packet for an L2 Service Over an SR-MPLS Return Path</name>

<t>
The Session-Reflector MUST transmit the Session-Reflector test packet using the reverse-direction L2 service label stack associated with the L2VPN label received for the forward-direction L2 service.
</t>

<t>
For two-way measurement mode, the Session-Reflector MUST set the TTL of the ultimate reverse-direction L2VPN label to 1. This invokes the Type 3 exception specified in <xref target="I-D.ietf-mpls-stamp-pw" format="default"/> and terminates the Session-Reflector test packet for control-plane processing on the Session-Sender.
</t>

<t>
If the Session-Reflector cannot find the corresponding reverse-direction L2 service, it MUST drop the test packet and MUST NOT transmit a Session-Reflector test packet.
</t>

        </section>

        </section>
     </section>

         <section anchor="sect-7" numbered="true" toc="default">
      <name>Encapsulations for One-Way Measurement Mode</name>

<t>
In one-way measurement mode for SR-MPLS paths and for L3 and L2 services carried over those paths, the Session-Sender transmits STAMP-Test packets using the encapsulations defined in <xref target="sect-6.2" format="default"/>.

Because no Session-Reflector test packets are transmitted, the encapsulation defined in <xref target="sect-6.3" format="default"/> does not apply.
</t>

        </section>

        <section anchor="sect-8" numbered="true" toc="default">
          <name>Encapsulations for Loopback Measurement Mode</name>

<t>
In loopback measurement mode for SR-MPLS paths and L3 and L2 services carried over SR-MPLS paths, the Session-Sender MUST transmit STAMP-Test packets. The Session-Sender MUST add an IP header for the return path to its test packets and MUST set the Destination IP Address to the Session-Sender IP address, as shown in <xref target="ure-dm-sender-test-packet-lb-return" format="default"/>.
</t>

        <figure anchor="ure-dm-sender-test-packet-lb-return">
          <name>Content of Return Session-Sender Test Packet in Loopback Measurement Mode</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
 +---------------------------------------------------------------+
 | IP Header (Return Path)                                       |
 .  Source IP Address = Session-Sender IP Address                .
 .  Destination IP Address = Session-Sender IP Address           .
 .  IPv4 Protocol or IPv6 Next-header = 17 (UDP)                 .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header                                                    |
 .  Source Port = Selected by Session-Sender                     .
 .  Destination Port = Source Port                               .
 .                                                               .
 +---------------------------------------------------------------+
 | Payload = Test Packet as specified in Figure 1 and Figure 3   |
 .           in Section 3 of RFC 8972                            .
 .                                                               .
 +---------------------------------------------------------------+
]]></artwork>
        </figure>

<t>
When an SR-MPLS return path is included, the forward-path and return-path labels form one MPLS label stack. Once the forward-path labels are consumed, the first return-path label is processed, and the packet is forwarded along the return path. The node at the end of the forward path does not need to identify the boundary between the paths or process the packet differently; it forwards the packet according to the label stack.
</t>


  <section anchor="sect-8.1" numbered="true" toc="default">
       <name>Loopback Measurement Mode for SR-MPLS Paths</name>

<t>
In loopback measurement mode for SR-MPLS paths, the Session-Sender test packet carries either only the Segment List for the forward path or Segment Lists for both the forward and return paths in the MPLS header, as shown in <xref target="ure-dm-sender-test-packet-lb-mpls" format="default"/>.
</t>

<t>
When an SR-MPLS IGP path is used for the forward path, the Session-Sender MUST include the Session-Reflector's Prefix SID label in the forward-direction Segment List: the Flex-Algo Prefix SID for an IGP Flex-Algo path, and the IGP Prefix SID for an IGP best path.
</t>

         <figure anchor="ure-dm-sender-test-packet-lb-mpls">
          <name>Content of Session-Sender Test Packet in Loopback Measurement Mode for an SR-MPLS Path</name>
          <artwork name="" type="" align="left" alt=""><![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
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Label(1) (Top of Stack)    | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .                                                               .
 .                                                               .
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Label(n)                   | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Return Path Label(1)       | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .                                                               .
 .                                                               .
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Return Path Label(n)       | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Test Packet as shown in Figure 11 (Return Path)    |
 .                                                               .
 +---------------------------------------------------------------+

       Example 1: Encapsulation Using SR-MPLS Return Path

 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
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Label(1) (Top of Stack)    | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .                                                               .
 .                                                               .
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Label(n)                   | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Test Packet as shown in Figure 11 (Return Path)    |
 .                                                               .
 +---------------------------------------------------------------+

       Example 2: Encapsulation Using IP Return Path
]]></artwork>
        </figure>

<t>
For an SR Policy using PHP, the Session-Sender MUST include the Prefix SID label of the SR Policy endpoint as the final label in the forward-direction Segment List
to ensure that the Session-Sender test packets reach the SR Policy endpoint.
</t>

  <section anchor="sect-8.1.1" numbered="true" toc="default">
       <name>SR-MPLS Return Path</name>

<t>
For an SR-MPLS return path, the Session-Sender test packets MUST carry the return path in the MPLS label stack in addition to the forward-direction path, as shown in Example 1 of <xref target="ure-dm-sender-test-packet-lb-mpls" format="default"/>. Examples of specific SR-MPLS return paths include:
</t>

<ul>
  <li>The SR-MPLS label stack of the Segment List of the associated reverse Candidate Path.</li>
  <li>The Binding SID label of the reverse SR Policy.</li>
  <li>The SR-MPLS Prefix SID label of the Session-Sender.</li>
</ul>

<t>
For an SR-MPLS IGP return path, the Session-Sender test packets MUST carry the Session-Sender's Prefix SID label for the reverse direction. The Flex-Algo Prefix SID MUST be used for the same IGP Flex-Algo path in the reverse direction, and the Session-Sender's IGP Prefix SID MUST be used for an IGP best path.
</t>

<t>
The Binding SID label of the reverse SR Policy can be configured on the Session-Sender using, for example, an SDN controller.
</t>

   </section>

  <section anchor="sect-8.1.2" numbered="true" toc="default">
       <name>IP Return Path</name>

<t>
For an IP return path, the Session-Sender test packets MUST carry only the SR-MPLS label stack for the forward-direction path in the MPLS header, as shown in Example 2 of <xref target="ure-dm-sender-test-packet-lb-mpls" format="default"/>.
</t>

<t>
When the forward path is an SR-MPLS IGP path, the forward-direction label stack carries the Session-Reflector's Prefix SID label, as described in <xref target="sect-8.1" format="default"/>.
</t>

<t>
The Session-Reflector decapsulates the MPLS header and forwards the test packet to the Session-Sender using the IP header.
</t>

   </section>
   </section>

      <section anchor="sect-8.2" numbered="true" toc="default">
         <name>Loopback Measurement Mode for Layer-3 Services over an SR-MPLS Path</name>

<t>
In loopback measurement mode for an L3 service carried over an SR-MPLS path, the Session-Sender MUST use the SR-MPLS label stack of the data packets transmitted over the L3 service to encapsulate its test packets, as shown in <xref target="ure-dm-sender-test-packet-lb-l3-mpls" format="default"/>.
</t>

         <figure anchor="ure-dm-sender-test-packet-lb-l3-mpls">
          <name>Content of Session-Sender Test Packet in Loopback Measurement Mode for an L3 Service over an SR-MPLS Path</name>
      <artwork name="" type="" align="left" alt=""><![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
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Label(1) (Top of Stack)    | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .                                                               .
 .                                                               .
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Label(n)                   | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Return Path Label(1)       | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .                                                               .
 .                                                               .
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            L3VPN Label (Return Path)  | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Test Packet as shown in Figure 11 (Return Path)    |
 .            Source and Destination IP Address in L3VPN table   .
 .                                                               .
 +---------------------------------------------------------------+

       Example 1: Encapsulation Using SR-MPLS Return Path


 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
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Label(1) (Top of Stack)    | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .                                                               .
 .                                                               .
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            L3VPN Label (Forward Path) | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Test Packet as shown in Figure 11 (Return Path)    |
 .            Source and Destination IP Address in L3VPN table   .
 .                                                               .
 +---------------------------------------------------------------+

       Example 2: Encapsulation Using IP Return Path
]]></artwork>
        </figure>

<t>
The Destination IP Address in the return-path IP header MUST be reachable via the IP table lookup associated with the L3VPN label added to the test packets.
</t>

  <section anchor="sect-8.2.1" numbered="true" toc="default">
       <name>SR-MPLS Return Path</name>

<t>
The Session-Sender MUST add the SR-MPLS label stack for the forward-direction L3 service, excluding the L3VPN label advertised by the Session-Reflector, to the test packets.
</t>

<t>
In addition, the Session-Sender MUST add the SR-MPLS label stack for the reverse-direction L3 service, including its L3VPN label advertised by the Session-Sender, to the test packets.
 </t>

  </section>

  <section anchor="sect-8.2.2" numbered="true" toc="default">
        <name>IP Return Path</name>

<t>
The Session-Sender MUST add the SR-MPLS label stack, including the L3VPN label advertised by the Session-Reflector, for the forward-direction L3 service to the test packets.
</t>

<t>
The Session-Reflector decapsulates the MPLS header and forwards the Session-Sender test packet back to the Session-Sender using the IP header, with the SR-MPLS encapsulation for the reverse-direction L3 service.
</t>

   </section>

   </section>

    <section anchor="sect-8.3" numbered="true" toc="default">
       <name>Loopback Measurement Mode for Layer-2 Services over an SR-MPLS Path</name>

<t>
In loopback measurement mode for an L2 service carried over an SR-MPLS path, the Session-Sender MUST use the SR-MPLS label stack of the data packets transmitted over the L2 service to encapsulate its test packets, as shown in <xref target="ure-dm-sender-test-packet-lb-l2-mpls" format="default"/>.
</t>


         <figure anchor="ure-dm-sender-test-packet-lb-l2-mpls">
          <name>Content of Session-Sender Test Packet in Loopback Measurement Mode for an L2 Service over an SR-MPLS Path</name>
          <artwork name="" type="" align="left" alt=""><![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
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Label(1) (Top of Stack)    | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .                                                               .
 .                                                               .
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Label(n)                   | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Return Path Label(1)       | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .                                                               .
 .                                                               .
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            L2VPN Label (Return Path)  | TC  |1|      TTL=1    |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Test Packet as shown in Figure 11 (Return Path)    |
 .                                                               .
 +---------------------------------------------------------------+

              Encapsulation Using SR-MPLS Return Path
]]></artwork>
        </figure>

  <section anchor="sect-8.3.1" numbered="true" toc="default">
        <name>SR-MPLS Return Path</name>

<t>
The Session-Sender MUST add the SR-MPLS label stack for the forward-direction L2 service, excluding the L2VPN label advertised by the Session-Reflector, to the test packets.
</t>

<t>
In addition, the Session-Sender MUST add the SR-MPLS label stack for the reverse-direction L2 service, including its L2VPN label advertised by the Session-Sender, to the test packets. The TTL of the ultimate reverse-direction L2VPN label MUST be set to 1 to invoke the Type 3 exception specified in <xref target="I-D.ietf-mpls-stamp-pw" format="default"/> and terminate the returned test packet for control-plane processing on the Session-Sender. The Session-Reflector forwards the test packet using the SR-MPLS return-path labels in the data plane; it does not terminate the packet for STAMP control-plane processing in loopback measurement mode.
</t>


   </section>

  <section anchor="sect-8.3.2" numbered="true" toc="default">
        <name>IP Return Path</name>
    <t>
    An IP return path is not supported for an L2 service because the Session-Reflector has no IP forwarding context associated with the L2 service for forwarding the returned Session-Sender test packet. The return path therefore uses the SR-MPLS label stack for the reverse-direction L2 service, as specified in <xref target="sect-8.3.1" format="default"/>.
    </t>

   </section>
   </section>


   </section>

    <section anchor="sect-9" numbered="true" toc="default">
      <name>Encapsulations for Loopback with TSF Measurement Mode</name>

      <t>
      Loopback with TSF measurement mode MUST use the encapsulation defined for SR-MPLS paths. For L3 and L2 services carried over SR-MPLS paths, the applicable service label MUST follow the Select-scope NAS in the MPLS label stack, so that the TSF action is applied before the packet is forwarded in the service context.
      </t>

      <t>
Loopback with TSF measurement mode MUST use unauthenticated STAMP-Test packets. The TSF action applies only when the "Receive Timestamp" field is at an offset of 16 bytes from the start of the STAMP-Test packet payload. The Session-Sender MUST NOT use authenticated mode with loopback with TSF measurement mode.
</t>

<section anchor="sect-9.1" toc="default" numbered="true">
    <name>STAMP TSF Network Actions</name>

<t>
The MPLS Network Action (MNA) Sub-Stack is specified in <xref target="RFC9994" format="default"/>.

This document defines two TSF Network Action Flags without Ancillary Data. They are encoded as Flag-Based Network Action Indicators without AD using network action opcode 1, as specified in <xref target="RFC9994" section="6.2" format="default"/>. 
</t>

<t>
When a Session-Reflector processes the flag for the selected timestamp format, it writes T2, the Session-Reflector's receive timestamp defined in <xref target="RFC8762" section="4.3.1" format="default"/>, in the "Receive Timestamp" field <xref target="RFC8972" format="default"/> at an offset of 16 bytes from the start of the STAMP-Test packet payload, as shown in Figure 2 of <xref target="RFC8972" section="3" format="default"/>.
</t>

<ul>
  <li>STAMP TSF with PTPv2 (flag at bit position TBA1): A 64-bit PTPv2 timestamp written at an offset of 16 bytes from the start of the STAMP-Test packet payload.</li>
  <li>STAMP TSF with NTPv4 (flag at bit position TBA2): A 64-bit NTPv4 timestamp written at an offset of 16 bytes from the start of the STAMP-Test packet payload.</li>
  <li>Flag encoding: The Session-Sender MUST NOT set both TSF flags, TBA1 and TBA2, in the same STAMP-Test packet. It MUST set the flag corresponding to the selected timestamp format. Bit positions are relative to the most significant bit of the Format B or Format C Data field, as specified in <xref target="RFC9994" section="13.2.1" format="default"/>.</li>
  <li><t>Both TSF flags set: If a node receives a packet with both TBA1 and TBA2 set, it MUST NOT write either timestamp. It MUST process the packet according to the U-bit rules in Section 5.4 of <xref target="RFC9994" format="default"/>: if U is 0, it skips both TSF flags and continues processing the NAS; if U is 1, it drops the packet.</t></li>
  <li>Format: The LSE Format B or the LSE Format C <xref target="RFC9994" format="default"/> can carry either TSF flag.</li>
  <li><t>Scope: The scope is carried in the IHS field of a NAS for all network actions in the NAS, as specified in <xref target="RFC9994" format="default"/>. It applies to the TSF network action whether the action is carried in an LSE Format B or Format C. Hop-by-Hop scope is not used for these TSF actions. When the return path is SR-MPLS (see <xref target="sect-8.1.1" format="default"/>), the scope MUST be set to "Select" because the node that writes the timestamp pops the top label but does not remove the MPLS header. When the return path is IP/UDP (see <xref target="sect-8.1.2" format="default"/>), the scope MUST be set to "I2E" because the node that writes the timestamp removes the MPLS header and forwards the packet using the IP header. A node that cannot process a TSF action for its indicated scope MUST handle the packet according to the U-bit processing rules specified in <xref target="RFC9994" format="default"/>.</t></li>
  <li>Ancillary Data: The TSF flags do not carry ancillary data; the data field carries the flag bits.</li>
  <li>Interactions: Any other network action opcodes defined in their respective specifications outside of this document may be present in the same NAS and are processed independently; the TSF flags do not interact with them.</li>
  <li>U bit: The Session-Sender MUST set the U bit to 0. A node that does not recognize TBA1 or TBA2 MUST process the unrecognized flag according to the U-bit rules in Section 5.4 of <xref target="RFC9994" format="default"/>. With U set to 0, the node skips the unrecognized flag and continues processing the NAS. The Session-Sender MUST NOT set the U bit to 1, which directs the node to drop the packet. The NASL and NAL MUST be set as specified in <xref target="RFC9994" format="default"/>.</li>
</ul>

<t>
For SR-MPLS paths in loopback with TSF measurement mode, the Session-Sender test packets MUST carry the MNA Sub-Stack with network action opcode 1 and the applicable TSF flag set in the MPLS header, as shown in <xref target="ure-test-packet-header-for-sr-mpls-with-timestamp-label" format="default"/>.
</t>

        <figure anchor="ure-test-packet-header-for-sr-mpls-with-timestamp-label">
          <name>Content of Session-Sender Test Packet in Loopback with TSF Measurement Mode Network Action in Format-B LSE for SR-MPLS Paths</name>
          <artwork name="" type="" align="left" alt=""><![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
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Label(1) (Top of Stack)    | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .                                                               .
 .                                                               .
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Label(n)                   | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            MNA Label                  | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | Opcode = 1  |   Flag: TBA1 or TBA2    |R|IHS|S| NASL  |U| NAL |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .                                                               .
 .                                                               .
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |            Test Packet as shown in Figure 11 (Return Path)    |
 .                                                               .
 +---------------------------------------------------------------+
  ]]></artwork>
        </figure>

<t>
The Session-Sender MAY add the SR-MPLS label stack of the return path after the MNA Sub-Stack to receive the return Session-Sender test packet on a specific path, as specified in the loopback measurement mode for SR-MPLS paths in this document.
</t>

<t>
When a Session-Reflector receives a STAMP-Test packet with an MNA Sub-Stack containing network action opcode 1 and the applicable TSF flag set, it MUST write the timestamp to the STAMP-Test packet payload, remove the NAS as specified in <xref target="RFC9994" format="default"/>, and forward the test packet as defined in the loopback measurement mode for SR-MPLS paths.
</t>

        <section anchor="sect-9.1.1" toc="default" numbered="true">
          <name>TSF Network Action Node Capability</name>

<t>
Before enabling loopback with TSF measurement mode:
</t>

<ul>
  <li><t>The Session-Sender MUST determine whether the Session-Reflector supports network action opcode 1, the selected TSF flag, and the associated timestamp format.</t></li>
  <li><t>The capability information can be statically configured on the Session-Sender or obtained using a capability signaling mechanism described in Section 8 of <xref target="RFC9994" format="default"/>.</t></li>
  <li><t>If no signaling mechanism is used, the capability MUST be statically configured on the Session-Sender.</t></li>
  <li><t>If support for the selected TSF flag and its associated timestamp format cannot be confirmed, the Session-Sender MUST NOT enable the TSF measurement session.</t></li>
</ul>

<t>
To detect whether the TSF action was skipped:
</t>

<ul>
  <li><t>The Session-Sender MUST initialize the Receive Timestamp field to zero in each Session-Sender test packet.</t></li>
  <li><t>If the Session-Reflector does not support the selected TSF flag, it skips the TSF action according to the U-bit processing rules in <xref target="RFC9994" format="default"/> and returns the packet without updating T2. The returned packet therefore has a zero Receive Timestamp field.</t></li>
  <li><t>The Session-Sender MUST discard that packet and MUST NOT use it to compute delay metrics.</t></li>
</ul>

        </section>
    </section>

    </section>

    <section anchor="sect-12" numbered="true" toc="default">
      <name>ECMP Measurement in SR-MPLS Networks</name>

<t>
The Segment List of an SR-MPLS path can have ECMP paths between the source and transit nodes, between transit nodes, and between transit and destination nodes, for example, due to:
</t>

      <ul>
        <li>Use of a Node Prefix SID label <xref target="RFC8402" format="default"/>.</li>

        <li>Use of an Anycast SID label <xref target="RFC8402" format="default"/>, which can result in ECMP paths via transit nodes that are part of that anycast group.</li>
      </ul>

<t>
ECMP load-balancing behavior and the hashing inputs are implementation-specific.
The Session-Sender can influence the ECMP path taken by STAMP-Test packets by varying one or more fields that are used as input to the hashing function, while keeping the remaining fields constant.
</t>

<t>
To measure delay on different ECMP paths of a Segment List, the Session-Sender can transmit STAMP-Test packets using the following mechanisms:
</t>

<ul>
  <li>The Session-Sender may use different entropy label values <xref target="RFC6790" format="default"/> in the forward- and reverse-direction MPLS label stacks to influence ECMP hashing. In two-way measurement mode, the Session-Sender includes the reverse-direction entropy label in the SR-MPLS Label Stack Sub-TLV in the Return Path TLV so that the Session-Reflector uses it in its Session-Reflector test packet.</li>

  <li>The Session-Sender may use different destination IPv4 addresses from the 127/8 range in its test packets to traverse different IPv4 ECMP paths, as specified in <xref target="RFC8029" section="2.1" format="default"/>. The Session-Sender SHOULD include the Type 9 ("Destination Node IPv4 or IPv6 Address") STAMP TLV to identify the intended Session-Reflector IP address, as specified in <xref target="sect-6.2.1.1" format="default"/>.</li>

  <li>The Session-Sender may use different IPv6 Flow Label values <xref target="RFC6437" format="default"/> in its test packets to influence ECMP hashing. The Session-Reflector copies the received Flow Label into its test packet unless local policy specifies otherwise, as described in <xref target="sect-5" format="default"/>.</li>
</ul>

<t>
In general, the Session-Sender cannot deterministically select a specific ECMP path.
Instead, a set of entropy label values, IPv4 destination addresses from the 127/8 range, or IPv6 Flow Label values that map to distinct ECMP paths can be determined empirically and then used for ongoing monitoring.
A separate STAMP session can be created for each selected entropy label value, IPv4 destination address from the 127/8 range, or IPv6 Flow Label value.
</t>

<t>
Alternatively, within a single STAMP session, the Session-Sender may vary the entropy label value, destination IPv4 address value, or IPv6 Flow Label value on a per-packet basis so that different ECMP paths are exercised over time.
In this case, the resulting measurement represents an aggregate across the ECMP paths exercised over time.
</t>

<t>
To limit Session-Sender and Session-Reflector state, operators can limit the number of ECMP probe values in use at any time and rotate among probe values when monitoring a large ECMP set.
</t>

<t>
The considerations for loss measurement for different ECMP paths of an SR-MPLS path are outside the scope of this document.
</t>

    </section>

    <section anchor="sect-13" numbered="true" toc="default">
      <name>Implementation Status</name>
    <t>
    Editorial note: Please remove this section prior to publication.
    </t>

    <section anchor="sect-13.1" numbered="true" toc="default">
      <name>Cisco Implementation</name>

    <t>
    The following Cisco routing platforms running the IOS XR operating system have participated in
    interoperability testing for the one-way measurement mode, the two-way measurement mode, and the loopback measurement mode for SR-MPLS:
    </t>

    <t>
    *  Cisco 8000 (based on Cisco Silicon One ASIC)
      </t>

    <t>
    *  Cisco ASR9904 with Lightspeed line card and Tomahawk line card
      </t>

    <t>
    *  Cisco NCS5500 (based on Broadcom Jericho1 ASIC)
      </t>

    <t>
    *  Cisco NCS5700 (based on Broadcom Jericho2 ASIC)
      </t>

    </section>

    </section>

    <section anchor="sect-14" numbered="true" toc="default">
      <name>Operational and Manageability Considerations</name>

<t>
The operational considerations specified in <xref target="RFC8762" section="5"/> also apply to the procedures specified in this document.
Further, the operation and management considerations for performance measurement based on STAMP specified in <xref target="RFC8762" section="3"/>
also apply to the procedures specified in this document.
The manageability considerations described in <xref target="RFC8402" section="9" format="default"/> apply to this specification.
</t>

    
<t>
The operational considerations specified in <xref target="RFC9994" format="default"/> are also applicable to the procedures specified in this document.
</t>


<t>
The operational considerations specified in <xref target="I-D.ietf-mpls-stamp-pw" format="default"/> apply when selecting a routable IP address or a non-routable IP address (e.g., an IPv4 address from the 127/8 range) as a destination IP address.
</t>

<t>
The procedures can be used to compute delay statistics, such as the average, minimum, maximum, and variance, as well as packet-loss statistics, such as the percentage of packets lost and the number of consecutive packets lost. They can also track STAMP session-state changes. Notification behavior for locally configured metric thresholds and STAMP session-state changes is described in <xref target="sect-14.4" format="default"/>.
</t>

<section anchor="sect-14.1" numbered="true" toc="default">
  <name>Measurement Mode and Parameters</name>

<t>
The measurement mode is configured for each STAMP session; this document specifies no default mode or general in-band negotiation of mode support:
</t>

<ul>
  <li><t>The Session-Sender cannot rely on an unsupported-mode indication or automatic fallback. Packets sent to an endpoint that lacks the required support may be dropped or processed according to its supported behavior, so the resulting measurement may be invalid.</t></li>
  <li><t>Operators should configure each Session-Sender and relevant Session-Reflector consistently and use a mode for which the required endpoint behavior is supported. If support cannot be established, operators should use a mutually supported mode or leave the session disabled.</t></li>
  <li><t>The Session-Reflector mode (Stateful or Stateless) is configured per session, and no default is specified for the two-way measurement mode. See <xref target="sect-5" format="default"/> for the mode-specific Stateful and Stateless requirements.</t></li>
  <li><t>In the loopback measurement mode and the loopback with TSF measurement mode, the node at the end of the forward path does not need to maintain a STAMP session; the loopback with TSF measurement mode additionally requires support for the applicable TSF action.</t></li>
  <li><t>During staged deployment of TSF, operators should follow the capability verification procedures in <xref target="sect-9.1.1" format="default"/> before enabling loopback with TSF. Other endpoints can continue to use loopback without TSF or another mutually supported mode.</t></li>
</ul>

<t>
This document specifies no default measurement interval or packet transmission rate, and no mode-specific minimum or maximum interval. These values need to be configured for each session. Operators should choose them based on the desired measurement frequency, the capacity of the path and the processing capacity of the Session-Reflector, and any rate limits in the implementation.
Operators should account for the aggregate traffic and processing load across sessions, Segment Lists, and ECMP probes when setting intervals and rates.</t>
</section>

<section anchor="sect-14.2" numbered="true" toc="default">
  <name>MTU Considerations</name>

<t>
This document does not specify an SR-MPLS-specific default test packet size:
</t>

<ul>
  <li><t>The packet size follows the STAMP packet format and any optional TLVs, including Extra Padding, used by a session.</t></li>
  <li><t>Operators should select a size that reflects the traffic being measured where appropriate.</t></li>
  <li><t>When checking the path MTU, operators should account for the IP/UDP header, MPLS and service labels, any MNA data, and optional TLVs.</t></li>
  <li><t>STAMP-Test packets MUST NOT exceed the path MTU and MUST NOT be fragmented.</t></li>
</ul>
</section>


<section anchor="sect-14.3" numbered="true" toc="default">
  <name>STAMP Session Scale</name>

<t>
When STAMP sessions are created for the Segment Lists of SR Policies, operators need to consider the scalability of the resulting number of STAMP sessions. To manage the load, operators are advised to limit the number of sessions or increase their measurement intervals.
</t>

<t>
Monitoring different IPv6 Flow Label values separately can require a distinct STAMP session for each value and a mapping between each session and the corresponding data flow, which can limit the number of flows monitored. The ECMP measurement procedures in <xref target="sect-12" format="default"/> describe the tradeoffs between using separate sessions for probe values and varying values per packet.
</t>
</section>

<section anchor="sect-14.4" numbered="true" toc="default">
  <name>STAMP Session State Notification</name>
<t>
Threshold-based notifications for delay and packet-loss metrics are generated when locally configured thresholds are crossed. This document specifies no default threshold values; operators configure them according to service objectives and expected measurement variation. These metric notifications are distinct from session-state notifications. An active STAMP session may have metrics that remain within the configured thresholds, in which case no metric notifications are generated. A failed session does not transmit or receive test packets, so no metrics are computed.
</t>
<t>
Monitoring the STAMP session state allows the Session-Sender, in the two-way measurement mode, the loopback measurement mode, and the loopback with TSF measurement mode, to determine whether the STAMP test is idle, active, or failed and generate state-change notifications as specified in <xref target="I-D.ietf-ippm-stamp-ext-hdr" format="default"/>.
</t>

<t> 
In one-way measurement mode, the Session-Reflector can track packet reception using a local receive status and generate status-change notifications as follows. This receive status is distinct from the Session-Sender's STAMP session state defined in <xref target="I-D.ietf-ippm-stamp-ext-hdr" format="default"/>. In particular, the Session-Reflector's initial "waiting" status does not indicate that the Session-Sender is idle; the Session-Sender may be transmitting packets that are lost before reaching the Session-Reflector.
</t>

    <ul spacing="normal">
      <li>The receive status is initially reported as "waiting" when no Session-Sender test packets have been received.</li>
      <li>The receive status changes to "receiving" when one or more Session-Sender test packets are received.</li>
      <li>The receive status changes to "loss-detected" when N consecutive Session-Sender test packets are not received after the status has changed to "receiving", where N (the consecutive packet loss count) is a locally provisioned value. This document specifies no default value for N. Operators should choose N based on the measurement interval, expected transient loss, and the desired failure-detection time; a larger N reduces sensitivity to short loss bursts but delays failure detection.</li>
      <li>The receive status changes from "loss-detected" back to "receiving" when at least one Session-Sender test packet is again received.</li>
    </ul>

<t>
Because STAMP-Test packets are transmitted over the SR-MPLS path or over the L3 or L2 service being measured on that path, a connectivity failure typically manifests as the continuous packet loss specified above, resulting in the receive status being reported as "loss-detected".
</t>

</section>

<section anchor="sect-14.5" numbered="true" toc="default">
  <name>Operational Considerations for TSF</name>

<t>
For TSF capability verification, including support for the selected TSF flag and timestamp format, see <xref target="sect-9.1.1" format="default"/>.
</t>

<t>
The Session-Sender cannot determine from the returned timestamp whether the Session-Reflector wrote it in the requested format. If the Session-Reflector uses a different format, the Session-Sender may compute an incorrect delay metric.
</t>

<t>
Implementations are recommended to maintain per-network-action counters for the following TSF Network Action events:
</t>

<ul>
  <li>Packets received with the TSF Network Action.</li>
  <li>Packets for which the TSF Network Action was invoked.</li>
  <li>Packets carrying the TSF Network Action that were dropped because they were malformed.</li>
  <li>Packets for which the TSF timestamp write failed.</li>
</ul>

<t>
Implementations that process MPLS Network Actions may also maintain counters for packets dropped or forwarded because an MPLS Network Action opcode was unknown:
</t>

<ul>
  <li>Packets dropped after receiving an unknown MPLS Network Action opcode.</li>
  <li>Packets forwarded after skipping an unknown MPLS Network Action opcode.</li>
</ul>

<t>
Implementations should distinguish successful and failed TSF network action invocations, for example through implementation-specific counters or logs. Any implementation-specific notifications for sustained failures, malformed packets, or excessive packets with the TSF network action should be rate-limited.
</t>

</section>

<section anchor="sect-14.6" numbered="true" toc="default">
  <name>Operational Considerations for Path Changes</name>

<t>
Operators should review STAMP session configuration when a monitored service changes to ensure that it continues to match the monitoring objective.
</t>

<ul>
  <li><t>For monitoring active forwarding SR-MPLS paths, operators should create, activate, update, or remove sessions as needed to match the Segment Lists selected for the active Candidate Path as it is created, selected, or changes state, or as its Segment Lists change.</t></li>
  <li><t>For assessing the readiness of standby or backup SR-MPLS paths, operators may also configure sessions for the corresponding Candidate Paths or Segment Lists. These measurements assess the tested paths under the measurement conditions and do not represent traffic currently using the active forwarding path.
  The additional sessions used to monitor standby or backup paths also contribute to the session scale and measurement load described in <xref target="sect-14.3" format="default"/>.
  </t></li>
</ul>

<t>
A change to the path used by an existing Segment List, for example because of fast reroute (FRR), may affect the STAMP measurements: delay metrics may change, and packet loss may occur. Operators should investigate sudden changes in delay or packet-loss metrics for possible path changes, including FRR events. </t>

</section>

<section anchor="sect-14.7" numbered="true" toc="default">
  <name>Destination UDP Port Number Considerations</name>

<t>
Configuration of the destination UDP port number depends on the measurement mode:
</t>

<ul>

  <li><t>For two-way and one-way measurement modes, the Session-Reflector receives STAMP-Test packets on UDP port number 862 by default. Any alternative destination UDP port number MUST be selected from the User Ports (1024-49151) or Dynamic Ports (49152-65535) ranges <xref target="RFC6335" format="default"/>; use of a User Port is subject to the network-impact study and agreement specified in <xref target="RFC8762" section="4.1"/>. For an alternative destination UDP port number, the Session-Sender and Session-Reflector MUST be configured to use it, and the Session-Reflector MUST be configured to receive STAMP-Test packets on that UDP port number. </t></li>

  <li><t>For the loopback measurement mode and the loopback with TSF measurement mode, see <xref target="sect-5.2" format="default"/> for the destination UDP port number requirements. The endpoint node forwarding the packet does not require configuration of a STAMP UDP port number.</t></li>

  <li><t>A Session-Reflector that is not configured to receive test packets on the selected UDP port number MUST drop them. </t></li>
</ul>
</section>

    </section>

    <section anchor="sect-15" numbered="true" toc="default">
      <name>Security Considerations</name>
<t>
The security considerations in <xref target="RFC8762" format="default"/>, <xref target="RFC8972" format="default"/>, <xref target="RFC9503" format="default"/>, Section 9 of <xref target="RFC8402" format="default"/>, Section 11 of <xref target="RFC9994" format="default"/>, <xref target="I-D.ietf-ippm-stamp-ext-hdr" format="default"/>, and <xref target="I-D.ietf-mpls-stamp-pw" format="default"/> apply to the procedures specified in this document.
</t>

<t>A secure transport for STAMP specified in <xref target="RFC8762" section="4.5" format="default"/> can be used.</t>

<t>
The procedures specified in this document are intended for deployment in a single network administrative domain. 
To mitigate threats, STAMP-Test packets MUST be filtered at administrative-domain boundaries. 
Additionally, the following considerations apply:
</t>

<ul>
  <li><t>The Session-Sender and Session-Reflector IP addresses are provisioned by the operator for the STAMP session.</t></li>
  <li><t>The operator is assumed to have verified the integrity of the forward and return paths taken by the STAMP-Test packets.</t></li>
  <li><t>The source UDP port number is selected as specified in <xref target="I-D.ietf-ippm-stamp-ext-hdr" section="3.1" format="default"/>.</t></li>
  <li><t><xref target="RFC8972" format="default"/> leaves SSID generation to the implementation. For SR-MPLS sessions, implementations can use a Cryptographically Secure Pseudorandom Number Generator <xref target="NIST-CSPRNG" format="default"/> to make SSID assignment less predictable and off-path attacks more difficult. </t></li>
</ul>

<t>
If desired, attacks can be mitigated by performing basic validation
checks on the timestamp fields of STAMP-Test packets received by the
Session-Sender. For example, verifying that T2 is later than T1 in
the STAMP Reference Topology shown in <xref target="modes-reference-topology-two-way" format="default"/> requires clock
synchronization between the Session-Sender and Session-Reflector. In
contrast, checking that T3 is greater than or equal to T2, or that T4
is later than T1, compares timestamps generated at the same node and
does not require clock synchronization.
</t>

<t>
The effect of an individual invalid test packet on the measurement
results is generally limited to the affected measurement cycle.
However, repeated injection of invalid or replayed packets can cause
sustained measurement disruption or resource consumption. Stateful
measurement modes and TSF processing may also introduce additional
resource-exhaustion risks.
</t>

<t>
A Session-Reflector MUST process a STAMP-Test packet received with an L3 or L2 service label only in the context of that service, and MUST NOT forward it or reply to it in any other context.
</t>

<section anchor="sect-15.1" numbered="true" toc="default">
  <name>Security Considerations for Measurement Modes</name>

<t>
The procedures in this document introduce additional security considerations:
</t>

<ul spacing="normal">
  <li><t>For L3 and L2 service measurements (Sections 6.2.2, 6.2.3, 8.2, and 8.3), STAMP-Test packets use operator-selected addresses and are forwarded in a customer service context. If the destination address is not local to the intended Session-Reflector, or, for a loopback return packet, the Session-Sender address is not local or reachable in that service context, ordinary forwarding may send the packet toward a CE or drop it. This can expose STAMP-Test packets to an unintended endpoint or service. Operators should use addresses local to the relevant service context and filter STAMP-Test packets at service boundaries.</t></li>

  <li><t>In one-way measurement mode, the Session-Reflector maintains per-session state, and unauthenticated STAMP-Test packets can cause state to be allocated or consumed. An attacker can exhaust state or other resources by sending such packets; filtering, rate limiting, and limits on state allocation can mitigate this risk.</t></li>

  <li><t>In the loopback measurement mode and the loopback with TSF measurement mode, the returned packet is a self-addressed UDP packet. No node on the return path authenticates itself as the intended STAMP endpoint; in the loopback with TSF measurement mode, a node may write a timestamp but does not authenticate the forwarding node. Any node that receives the packet and has IP reachability to the Session-Sender can forward it to the Session-Sender. The returned packet does not identify the forwarding node. HMAC does not authenticate the forwarding node.</t></li>

  <li><t>In the loopback measurement mode and the loopback with TSF measurement mode, the Session-Sender ignores the Sequence Number field, so sequence-number-based replay detection is unavailable and replayed packets may be accepted as measurement results. Timestamp validation can help detect stale or inconsistent packets, but HMAC alone does not provide replay protection.</t></li>

</ul>


<t>
HMAC-SHA-256 in authenticated mode provides integrity protection for STAMP-Test packets, but it does not provide confidentiality or prevent eavesdropping. HMAC, as specified in <xref target="RFC8762" section="4.4" format="default"/>, is supported as follows:
</t>

<ul>
  <li><t>In two-way measurement mode, the Session-Sender and Session-Reflector each validate the STAMP-Test packet they receive.</t></li>
  <li><t>In one-way measurement mode, the Session-Reflector validates the Session-Sender test packet it receives.</t></li>
  <li><t>In loopback measurement mode, the Session-Sender validates the returned Session-Sender test packet.</t></li>
</ul>


</section>

<section anchor="sect-15.2" numbered="true" toc="default">
  <name>Security Considerations for TSF</name>

<t>
The TSF network actions use IANA-assigned flag positions TBA1 and TBA2 for the PTPv2 and NTPv4 timestamp formats, respectively.
The security considerations for MPLS Network Actions in <xref target="RFC9994" section="11" format="default"/> apply to the TSF Network Action.
</t>

<t>
An attacker who can inject packets carrying the TSF Network Action could cause unauthorized data-plane timestamping.
STAMP-Test packets carrying the TSF Network Action are covered by the administrative-domain filtering requirement in this Section.
</t>

<t>
The Session-Reflector writes the timestamp defined by the applicable TSF flag in the STAMP-Test packet payload. Implementations MUST validate the MNA Sub-Stack, the network action opcode, the selected TSF flag, the timestamp format, and the available payload length before writing the timestamp. Implementations MUST perform bounds checking to prevent malformed packets from causing memory corruption, packet corruption, or denial-of-service conditions. Any malformed packet carrying the TSF Network Action MUST be dropped.
</t>

</section>

<section anchor="sect-15.3" numbered="true" toc="default">
  <name>Privacy Considerations</name>

<t>
STAMP-Test packets and their MPLS and service encapsulations contain information such as source and destination IP addresses, UDP port numbers, SSIDs, MPLS labels (including Segment Lists and service labels), and timestamps. These fields, together with delay, loss, and session-state measurements, can be correlated with network inventory or subscriber records to identify users, devices, services, network paths, and activity patterns. This information is visible to nodes that process or observe the packets. HMAC provides integrity protection but does not encrypt these fields.
</t>

<t>
Measurement results, session state, and associated logs or notifications can expose similar information when retained or exported through management systems. Operators should limit collection, access, retention, and sharing to what is needed for operations, protect stored data and management interfaces, and use aggregation or remove identifying details when fine-grained records are not needed.
</t>

</section>

    </section>
    <section anchor="sect-16" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <t>
    IANA is requested to assign two bit positions from the IETF Review range of the "Network Action Flags Without Ancillary Data" registry in the "MPLS Network Actions" group, as shown in <xref target="tsf-network-action-flags" format="default"/>.
    </t>

    <table anchor="tsf-network-action-flags" align="center">
      <name>Network Action Flags Without Ancillary Data</name>
      <thead>
        <tr>
          <th align="left">Bit Position</th>
          <th align="left">Description</th>
          <th align="left">Reference</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td align="left">TBA1</td>
          <td align="left">STAMP TSF with PTPv2</td>
          <td align="left">This document</td>
        </tr>
        <tr>
          <td align="left">TBA2</td>
          <td align="left">STAMP TSF with NTPv4</td>
          <td align="left">This document</td>
        </tr>
      </tbody>
    </table>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>

    &RFC768;
    &RFC2119;
    &RFC6335;
    &RFC6374;
    &RFC8174;
    &RFC8762;
    &RFC8972;
    &RFC9503;
    &RFC3032;
    &RFC5905;
    &RFC8402;
    &RFC9256;
    &RFC9350;
    &RFC9994;
    &I-D.ietf-mpls-stamp-pw;
    &I-D.ietf-ippm-stamp-ext-hdr;

    <reference anchor="IEEE.1588">
          <front>
            <title>1588-2008 IEEE Standard for a Precision Clock Synchronization Protocol for Networked Measurement and Control Systems</title>
            <author>
              <organization>IEEE</organization>
            </author>
            <date month="March" year="2008"/>
          </front>
    </reference>

      </references>

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

    &RFC4026;
    &RFC3031;
    &RFC2681;
    &RFC5462;
    &RFC6234;
    &RFC6437;
    &RFC6790;
    &RFC8029;
    &RFC9780;

    &RFC10052;
    &I-D.ietf-ippm-stamp-yang;

    <reference anchor="NIST-CSPRNG" target="https://doi.org/10.6028/NIST.SP.800-90Ar1">
          <front>
            <title>Recommendation for Random Number Generation Using Deterministic Random Bit Generators</title>
            <author>
              <organization>NIST Special Publication 800-90A Revision 1</organization>
            </author>
            <date month="January" year="2015"/>
          </front>
    </reference>

    <reference anchor="IANA-IPv6-REG" target="https://www.iana.org/assignments/iana-ipv6-special-registry" quoteTitle="true">
      <front>
        <title>IANA IPv6 Special-Purpose Address Registry</title>
        <author>
          <organization>IANA</organization>
        </author>
      </front>
    </reference>

    </references>
    </references>

    <section numbered="false" anchor="acknowledgments" toc="default">
      <name>Acknowledgments</name>
      <t>
The authors would like to thank Ianik Semco and Thierry Couture for their discussions on the use cases for Performance Measurement in Segment Routing. The authors would also like to thank Greg Mirsky, Gyan Mishra, Xie Jingrong, Zafar Ali, Boris Hassanov, Ruediger Geib, Liyan Gong, Zhenqiang Li, Maria Matejka, William Hawkins, Mike Koldychev, and Bruno Decraene for reviewing this document and providing useful comments and suggestions. Additionally, Patrick Khordoc, Haowei Shi, Amila Tharaperiya Gamage, Pengyan Zhang, Ruby Lin, Senni Tan, and Radu Valceanu have helped improve the mechanisms specified in this document. The authors would also like to thank Haoyu Song for the Shepherd's review and Alvaro Retana for the WG chair's review, which helped improve this document.
      </t>
    </section>

  <section numbered="false" anchor="contributors">
  <name>Contributors</name>

   <t>The following people have substantially contributed to this document:</t>

   <artwork><![CDATA[Daniel Voyer
Cisco Systems, Inc.
Email: davoyer@cisco.com

]]></artwork>

   <artwork><![CDATA[Navin Vaghamshi
Reliance
Email: Navin.Vaghamshi@ril.com

]]></artwork>

   <artwork><![CDATA[Moses Nagarajah
Individual
Email: mosesnehru@gmail.com

]]></artwork>

   <artwork><![CDATA[Amit Dhamija
Arrcus
India
Email: amitd@arrcus.com

]]></artwork>

    </section>

  </back>
</rfc>
