<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC0768 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.0768.xml">
<!ENTITY RFC2119 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC8174 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!ENTITY RFC8762 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8762.xml">
<!ENTITY RFC8972 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8972.xml">
<!ENTITY RFC2104 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2104.xml">
<!ENTITY RFC2113 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2113.xml">
<!ENTITY RFC4291 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4291.xml">
<!ENTITY RFC4868 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4868.xml">
<!ENTITY RFC5082 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5082.xml">
<!ENTITY RFC5884 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5884.xml">
<!ENTITY RFC6335 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6335.xml">
<!ENTITY RFC6437 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6437.xml">
<!ENTITY RFC6790 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6790.xml">
<!ENTITY RFC6936 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6936.xml">
<!ENTITY RFC7404 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7404.xml">
<!ENTITY RFC7820 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7820.xml">
<!ENTITY RFC8029 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8029.xml">
<!ENTITY RFC8085 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8085.xml">
<!ENTITY RFC8126 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8126.xml">
<!ENTITY RFC8186 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8186.xml">
<!ENTITY RFC8321 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8321.xml">
<!ENTITY RFC8402 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8402.xml">
<!ENTITY RFC8754 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8754.xml">
<!ENTITY RFC8986 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8986.xml">
<!ENTITY I-D.ietf-spring-segment-routing-policy SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-spring-segment-routing-policy.xml">
<!ENTITY I-D.ietf-spring-sr-replication-segment SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-spring-sr-replication-segment.xml">
<!ENTITY I-D.ietf-pim-sr-p2mp-policy SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-pim-sr-p2mp-policy.xml">
<!ENTITY I-D.shen-spring-p2mp-transport-chain SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.shen-spring-p2mp-transport-chain.xml">
<!ENTITY I-D.ietf-spring-mpls-path-segment SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-spring-mpls-path-segment.xml">
<!ENTITY I-D.ietf-pce-binding-label-sid SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-pce-binding-label-sid.xml">
<!ENTITY I-D.ietf-ippm-stamp-yang SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-ippm-stamp-yang.xml">
<!ENTITY I-D.ietf-pce-sr-bidir-path SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-pce-sr-bidir-path.xml">
<!ENTITY I-D.ietf-spring-srv6-path-segment SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-spring-srv6-path-segment.xml">
<!ENTITY I-D.ietf-ippm-stamp-srpm SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-ippm-stamp-srpm.xml">
]>
<rfc submissionType="IETF" docName="draft-ietf-spring-stamp-srpm-00" category="std" ipr="trust200902">
    <!-- Generated by id2xml 1.5.0 on 2020-02-06T01:41:26Z -->
    <?rfc compact="yes"?>
    <?rfc text-list-symbols="oo*+-"?>
    <?rfc subcompact="no"?>
    <?rfc sortrefs="no"?>
    <?rfc symrefs="yes"?>
    <?rfc strict="yes"?>
    <?rfc toc="yes"?>
    <front>
    <title abbrev="Using Simple TWAMP for Segment Routing">Performance Measurement Using Simple TWAMP (STAMP) for Segment Routing Networks</title>
    <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="Daniel Voyer" initials="D." surname="Voyer">
    <organization>Bell Canada</organization>
        <address>
        <email>daniel.voyer@bell.ca</email>
    </address>
    </author>

    <author fullname="Mach(Guoyi) Chen" initials="M." surname="Chen">
    <organization>Huawei</organization>
        <address>
        <email>mach.chen@huawei.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="Richard Foote" initials="R." surname="Foote">
    <organization>Nokia</organization>
        <address>
    <email>footer.foote@nokia.com</email>
    </address>
    </author>
    
    
    <date day="06" month="July" year="2021"/>
    <workgroup>SPRING Working Group</workgroup>
    <abstract><t>
   Segment Routing (SR) leverages the source routing paradigm.  SR is
   applicable to both Multiprotocol Label Switching (SR-MPLS) and IPv6
   (SRv6) data planes.  This document describes procedures  
   for Performance Measurement in SR networks using the 
   mechanisms defined in RFC 8762 (Simple Two-Way Active Measurement Protocol (STAMP))
   and its optional extensions defined in RFC 8972 and further augmented in draft-ietf-ippm-stamp-srpm.
   The procedure described is applicable
   to SR-MPLS and SRv6 data planes and is used for both links and
   end-to-end SR paths including SR Policies.</t>
    </abstract>
    </front>

    <middle>
    <section title="Introduction" anchor="sect-1"><t>
   Segment Routing (SR) leverages the source routing paradigm and
   greatly simplifies network operations for Software Defined Networks
   (SDNs).  SR is applicable to both Multiprotocol Label Switching
   (SR-MPLS) and IPv6 (SRv6) data planes <xref target="RFC8402"/>.  SR takes advantage of the
   Equal-Cost Multipaths (ECMPs) between source and transit nodes,
   between transit nodes and between transit and destination nodes.  SR
   Policies as defined in <xref target="I-D.ietf-spring-segment-routing-policy"/> are used
   to steer traffic through a specific, user-defined paths using a stack
   of Segments.  Built-in SR Performance Measurement (PM) is one of the
   essential requirements to provide Service Level Agreements (SLAs).</t>

   <t>The Simple Two-way Active Measurement Protocol (STAMP) provides
   capabilities for the measurement of various performance
   metrics in IP networks <xref target="RFC8762"/>
   without the use of a control channel to pre-signal session parameters. 
   <xref target="RFC8972"/> defines optional extensions for STAMP.
   <xref target="I-D.ietf-ippm-stamp-srpm"/> augments that framework 
   to define STAMP extensions for SR networks.</t>

   <t>This document describes procedures for Performance Measurement in SR networks using the 
   mechanisms defined in STAMP <xref target="RFC8762"/> 
   and its optional extensions defined in <xref target="RFC8972"/> 
   and further augmented in <xref target="I-D.ietf-ippm-stamp-srpm"/>. 
   The procedure described is applicable to SR-MPLS and SRv6 data planes and
   is used for both links and end-to-end SR paths including SR Policies <xref target="RFC8402"/>.</t>

   </section>

   <section title="Conventions Used in This Document" anchor="sect-2">
       
   <section title="Requirements Language" anchor="sect-2.1"><t>
   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in <xref target="RFC2119"/> <xref target="RFC8174"/>
   when, and only when, they appear in all capitals, as shown here.</t>

    </section>

   <section title="Abbreviations" anchor="sect-2.2"><t>
   BSID: Binding Segment ID.</t>

    <t>
   DM: Delay Measurement.</t>

    <t>
   ECMP: Equal Cost Multi-Path.</t>

    <t>
   HL: Hop Limit.</t>

    <t>
   HMAC: Hashed Message Authentication Code.</t>

    <t>
   LM: Loss Measurement.</t>

    <t>
   MPLS: Multiprotocol Label Switching.</t>

    <t>
   NTP: Network Time Protocol.</t>

    <t>
   OWAMP: One-Way Active Measurement Protocol.</t>

    <t>
   PM: Performance Measurement.</t>

    <t>
   PSID: Path Segment Identifier.</t>

    <t>
   PTP: Precision Time Protocol.</t>

    <t>
   SHA: Secure Hash Algorithm.</t>

    <t>
   SID: Segment ID.</t>

    <t>
   SL: Segment List.</t>

    <t>
   SR: Segment Routing.</t>

    <t>
   SRH: Segment Routing Header.</t>

    <t>
   SR-MPLS: Segment Routing with MPLS data plane.</t>

    <t>
   SRv6: Segment Routing with IPv6 data plane.</t>

    <t>
   SSID: STAMP Session Identifier.</t>

    <t>
   STAMP: Simple Two-way Active Measurement Protocol.</t>

    <t>
   TC: Traffic Class.</t>

    <t>
   TTL: Time To Live.</t>

   </section>

   <section title="Reference Topology" anchor="sect-2.3"><t>
   In the Reference Topology shown below, the STAMP Session-Sender R1 initiates a
   STAMP test packet and the STAMP Session-Reflector R3
   transmits a reply test packet.  The reply test packet may be transmitted 
   to the STAMP Session-Sender R1 on the same path (same set of links and nodes) or a different path 
   in the reverse direction from the path taken towards the Session-Reflector.</t>  

   <t>The nodes R1 and R3 may be
   connected via a link or an SR path <xref target="RFC8402"/>.  
   The link may be a physical interface, virtual link, 
   or Link Aggregation Group (LAG) <xref target="IEEE802.1AX"/>, or LAG member link. 
   The SR path may be an SR Policy <xref target="I-D.ietf-spring-segment-routing-policy"/> 
   on node R1 (called head-end) with destination to node R3 (called tail-end).</t>

   <figure><artwork><![CDATA[
                       T1                T2
                      /                   \
             +-------+     Test Packet     +-------+
             |       | - - - - - - - - - ->|       |
             |   R1  |=====================|   R3  |
             |       |<- - - - - - - - - - |       |
             +-------+  Reply Test Packet  +-------+
                      \                   /
                       T4                T3

         STAMP Session-Sender        STAMP Session-Reflector

                       Reference Topology
]]></artwork>
    </figure>
    </section>

   </section>

   
    <section title="Overview" anchor="sect-3"><t>
    For performance measurement in SR networks, the STAMP Session-Sender and 
    Session-Reflector test packets defined in <xref target="RFC8762"/> are used.
    The STAMP test packets require to be encapsulated to be transmitted on a
    desired path under measurement.  The base STAMP
    test packets can be encapsulated using IP/UDP header and may 
    use Destination UDP port 862 <xref target="RFC8762"/>. In this document,
    the STAMP packets using IP/UDP header are considered for SR networks. 
    </t>

    <t>The STAMP test packets are used in one-way, two-way (i.e. round-trip) and loopback measurement modes. 
    Note that one-way and round-trip are referred to in <xref target="RFC8762"/> 
    and are further described in this document because of the introduction of 
    loopback measurement mode in SR networks.  The procedures defined in this document 
    are also used to infer packet loss in SR networks.</t> 
    
    <t>The STAMP test packets are transmitted on the same path as the data 
    traffic flow under measurement to measure the delay and packet 
    loss experienced by the data traffic flow.</t>
 
    <t>Typically, the STAMP test packets are transmitted along an IP path 
    between a Session-Sender and a Session-Reflector to measure delay and 
    packet loss along that IP path.  Matching the forward and reverse 
    direction paths for STAMP test packets, even for directly connected 
    nodes is not guaranteed.</t>

    <t>It may be desired in SR networks that the same path (same set of 
    links and nodes) between the Session-Sender and Session-Reflector 
    be used for the STAMP test packets in both directions.  
    This is achieved by using the optional STAMP extensions for SR-MPLS 
    and SRv6 networks specified in <xref target="I-D.ietf-ippm-stamp-srpm"/>.  
    The STAMP Session-Reflector uses the return path parameters 
    for the reply test packet from the received STAMP test packet,
    as described in <xref target="I-D.ietf-ippm-stamp-srpm"/>.
    This way signaling and maintaining dynamic SR network state for 
    the STAMP sessions on the Session-Reflector are avoided.</t>

    <t>The optional STAMP extensions defined in <xref target="RFC8972"/> are
    used for direct measurement packet loss in SR networks.</t>

    <section title="Example STAMP Reference Model" anchor="sect-3.1"><t>
    An example of a STAMP reference model with some of the typical measurement 
    parameters including the Destination UDP port 
    for STAMP test session is shown in the following Figure 1:</t>

   <figure title="Example STAMP Reference Model" anchor="ure-example-reference-model"><artwork><![CDATA[

                            +------------+
                            | Controller |
                            +------------+
                                /    \
  Destination UDP Port         /      \      Destination UDP Port
  Authentication Mode         /        \     Authentication Mode
      Key-chain              /          \        Key-chain
  Timestamp Format          /            \   Timestamp Format
  Packet Loss Type         /              \  Session-Reflector Mode
  Delay Measurement Mode  /                \
                         v                  v
                     +-------+          +-------+
                     |       |          |       |
                     |   R1  |==========|   R3  |
                     |       |          |       |
                     +-------+          +-------+

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

    <t>A Destination UDP port number is selected as described in
    <xref target="RFC8762"/>.  The same Destination UDP 
    port can be used for STAMP test sessions for link and end-to-end SR paths.
    In this case, the Destination UDP port does not distinguish between 
    link or end-to-end SR path measurements.</t>

    <t>Example of the Timestamp Format is Precision Time Protocol 64-bit truncated 
    (PTPv2) <xref target="IEEE1588"/> and Network Time Protocol (NTP).
    By default, the Session-Reflector replies in kind to the timestamp 
    format received in the received Session-Sender test packet, 
    as indicated by the "Z" field in the Error Estimate field 
    as described in <xref target="RFC8762"/>.</t>

    <t>The Session-Reflector mode can be Stateful or Stateless as 
    defined in <xref target="RFC8762"/>.</t>          

    <t>Example of Delay Measurement Mode is one-way, two-way (i.e. round-trip) and 
    loopback mode as described in this document.</t>

    <t>Example of Packet Loss Type can be round-trip, near-end (forward) and far-end 
    (backward) packet loss as defined in <xref target="RFC8762"/>.</t>

    <t>When using the authenticated mode for the STAMP test sessions, the matching
    Authentication Type (e.g. HMAC-SHA-256) and Key-chain are user-configured
    on STAMP Session-Sender and STAMP Session-Reflector <xref target="RFC8762"/>.</t>

    <t>The controller shown in the example reference model is not intended 
    for the dynamic signaling of the SR parameters for STAMP test sessions 
    between the STAMP Session-Sender and STAMP Session-Reflector.</t>

    <t>Note that the YANG data model defined in <xref target="I-D.ietf-ippm-stamp-yang"/>
    can be used to provision the STAMP Session-Sender and STAMP Session-Reflector.</t>

    </section>

    </section>

   <section title="Delay Measurement for Links and SR Paths" anchor="sect-4">

   <section title="Session-Sender Test Packet" anchor="sect-4.1"><t>
   The content of an example STAMP Session-Sender test packet using an 
   UDP header <xref target="RFC0768"/> is shown in Figure 2. 
   The payload contains the STAMP Session-Sender test 
   packet defined in <xref target="RFC8762"/>.</t> 

    <figure title="Example Session-Sender Test Packet" anchor="ure-dm-sender-test-packet"><artwork><![CDATA[
 +---------------------------------------------------------------+
 | IP Header                                                     |
 .  Source IP Address = Session-Sender IPv4 or IPv6 Address      .
 .  Destination IP Address=Session-Reflector IPv4 or IPv6 Address.
 .  Protocol = UDP                                               .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header                                                    |
 .  Source Port = As chosen by Session-Sender                    .
 .  Destination Port = User-configured Destination Port | 862    .
 .                                                               .
 +---------------------------------------------------------------+
 | Payload = Test Packet as specified in Section 3 of RFC 8972   |
 .           in Figure 1 and Figure 3                            .
 .                                                               .
 +---------------------------------------------------------------+
]]></artwork>
    </figure>

   <section title="Session-Sender Test Packet for Links" anchor="sect-4.1.1"><t>
   The STAMP Session-Sender test packet as shown in Figure 2 is 
   transmitted over the link under delay measurement.
   The local and remote IP addresses of the link are used 
   as Source and Destination Addresses, respectively. 
   For IPv6 links, the link local addresses <xref target="RFC7404"/> can be used in the IPv6 header.
   The Session-Sender may use the local Address Resolution Protocol (ARP) table,
   Neighbor Solicitation or other bootstrap method to find the IP address for the links and refresh.
   SR encapsulation (e.g. adjacency SID of the link) can be added for transmitting the STAMP test packets for links.
   </t>
    </section>

    
   <section title="Session-Sender Test Packet for SR Paths" anchor="sect-4.1.2"><t>
   The delay measurement for end-to-end SR path in an SR network is
   applicable to both end-to-end SR-MPLS and SRv6 paths including SR Policies.</t>

   <t>The STAMP Session-Sender (the head-end of the SR Policy) 
   IPv4 or IPv6 address MUST be used as the Source Address in the IP header of the test packet. 
   The STAMP Session-Reflector (the SR Policy endpoint) IPv4 or IPv6 address MUST be
   used as the Destination Address in the IP header of the test packet.</t>
   
   <t>In the case of Color-Only Destination Steering, with IPv4 endpoint
   of 0.0.0.0 or IPv6 endpoint of ::0 <xref target="I-D.ietf-spring-segment-routing-policy"/>,
   the loopback address from the range 127/8 for IPv4, or the loopback address ::1/128 
   for IPv6 <xref target="RFC4291"/> is used as the Session-Reflector Address, respectively.</t>

    <section title="Session-Sender Test Packet for SR-MPLS Policies" anchor="sect-4.1.2.1"><t>
   An SR-MPLS Policy may contain a number of Segment Lists (SLs).
   A STAMP Session-Sender test packet MUST be transmitted for each Segment List of the SR-MPLS Policy.
   The content of an example STAMP Session-Sender test packet for an
   end-to-end SR-MPLS Policy is shown in Figure 3.</t>

    <figure title="Example Session-Sender Test Packet for SR-MPLS Policy" anchor="ure-test-packet-for-sr-mpls-policy"><artwork><![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
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                Segment(1)             | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .                                                               .
 .                                                               .
 .                                                               .
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                Segment(n)             | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                PSID                   | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                Test Packet as shown in Figure 2               |
 .                                                               .
 +---------------------------------------------------------------+
]]></artwork>
    </figure>
   <t>The Segment List can be empty in case of a single-hop SR-MPLS Policy with Implicit NULL label.</t>

   <t>The Path Segment Identifier (PSID) <xref target="I-D.ietf-spring-mpls-path-segment"/> of
   an SR-MPLS Policy can be carried in the MPLS header as shown in Figure 3,
   and can be used for direct measurement as described in Section 6, titled "Direct Measurement for Links and SR Paths".</t>

    </section>

   <section title="Session-Sender Test Packet for SRv6 Policies" anchor="sect-4.1.2.2"><t>
   An SRv6 Policy may contain a number of Segment Lists.
   A STAMP Session-Sender test packet MUST be transmitted for each Segment List of the SRv6 Policy.
   An SRv6 Policy can contain an SRv6 Segment Routing Header (SRH) carrying 
   a Segment List as described in <xref target="RFC8754"/>. 
   The content of an example STAMP Session-Sender test packet for an end-to-end 
   SRv6 Policy is shown in Figure 4.</t>

  <t>The SRv6 network programming is described in <xref target="RFC8986"/>. 
   The procedure defined for Upper-Layer Header processing for SRv6 End SIDs 
   in Section 4.1.1 in <xref target="RFC8986"/>
   is used to process the IPv6/UDP header in the received test packets
   on the Session-Reflector.</t>

    <figure title="Example Session-Sender Test Packet for SRv6 Policy" anchor="ure-test-packet-for-srv6-policy"><artwork><![CDATA[
 +---------------------------------------------------------------+
 | IP Header                                                     |
 .  Source IP Address = Session-Sender IPv6 Address              .
 .  Destination IP Address = Destination IPv6 Address            .
 .  Protocol = UDP                                               .
 .                                                               .
 +---------------------------------------------------------------+
 | SRH as specified in RFC 8754                                  |
 .  <PSID, Segment List>                                         .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header                                                    |
 .  Source Port = As chosen by Session-Sender                    .
 .  Destination Port = User-configured Destination Port | 862    .
 .                                                               .
 +---------------------------------------------------------------+
 | Payload = Test Packet as specified in Section 3 of RFC 8972   |
 .           in Figure 1 and Figure 3                            .
 .                                                               .
 +---------------------------------------------------------------+
]]></artwork>
    </figure>
   <t>The Segment List (SL) may be empty and no SRH may be carried.</t>

   <t>The Path Segment Identifier (PSID) <xref target="I-D.ietf-spring-srv6-path-segment"/> of
   the SRV6 Policy can be carried in the SRH as shown in Figure 4 
   and can be used for direct measurement as described in 
   Section 6, titled "Direct Measurement for Links and SR Paths".</t>

    </section>
    </section>
    </section>

   <section title="Session-Reflector Test Packet" anchor="sect-4.2"><t>
   The STAMP Session-Reflector reply test packet uses the IP/UDP
   information from the received test packet as shown in Figure 5.</t>

    <figure title="Example Session-Reflector Test Packet" anchor="ure-test-reply-packet"><artwork><![CDATA[
 +---------------------------------------------------------------+
 | IP Header                                                     |
 .  Source IP Address = Session-Reflector IPv4 or IPv6 Address   .
 .  Destination IP Address                                       .
 .              = Source IP Address from Received Test Packet    .
 .  Protocol = UDP                                               .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header                                                    |
 .  Source Port = As chosen by Session-Reflector                 .
 .  Destination Port = Source Port from Received Test Packet     .
 .                                                               .
 +---------------------------------------------------------------+
 | Payload = Test Packet as specified in Section 3 of RFC 8972   |
 .           in Figure 2 and Figure 4                            .
 .                                                               .
 +---------------------------------------------------------------+
]]></artwork>
    </figure>
 
   <section title="One-way Measurement Mode" anchor="sect-4.2.1"><t>
   In one-way delay measurement mode, a reply test packet
   as shown in Figure 5 is transmitted by the STAMP Session-Reflector,
   for both links and end-to-end SR Policies.  The reply test packet may be 
   transmitted on the same path or a different path in the reverse direction.</t>

   <t>The STAMP Session-Sender address may not
   be reachable via IP route from the STAMP Session-Reflector.  The STAMP Session-Sender
   in this case MUST send its reachability path information to the
   STAMP Session-Reflector using the Return Path TLV defined 
   in <xref target="I-D.ietf-ippm-stamp-srpm"/>.</t>

   <t>In this mode, as per Reference Topology, 
   all timestamps T1, T2, T3, and T4 are collected by the test packets.
   However, only timestamps T1 and T2 are used to measure one-way delay as (T2 - T1).
   The one-way delay measurement mode requires the clock on the Session-Sender 
   and Session-Reflector to be synchronized.</t>

    </section>

   <section title="Two-way Measurement Mode" anchor="sect-4.2.2"><t>
   In two-way (i.e. round-trip) delay measurement mode, a reply test packet as shown in 
   Figure 5 is transmitted by the STAMP Session-Reflector 
   on the same path in the reverse direction, 
   e.g. on the reverse direction link or associated reverse SR path
   <xref target="I-D.ietf-pce-sr-bidir-path"/>.</t>

   <t>For two-way delay measurement mode for links, 
   the STAMP Session-Reflector transmits 
   the reply test packet on the same link where the
   test packet is received.  The STAMP Session-Sender
   can request in the test packet to the STAMP Session-Reflector to
   transmit the reply test packet back on the same link 
   using the Control Code Sub-TLV in the 
   Return Path TLV defined in <xref target="I-D.ietf-ippm-stamp-srpm"/>.
  </t>

   <t>For two-way delay measurement mode for end-to-end SR paths, 
   the STAMP Session-Reflector transmits 
   the reply test packet on a specific reverse path.  The STAMP Session-Sender
   can request in the test packet to the STAMP Session-Reflector to
   transmit the reply test packet back on a given reverse path 
   using a Segment List sub-TLV in the 
   Return Path TLV defined in <xref target="I-D.ietf-ippm-stamp-srpm"/>.
  </t>

   <t>In this mode, as per Reference Topology, 
   all timestamps T1, T2, T3, and T4 are collected by the test packets.
   All four timestamps are used to measure two-way delay as ((T4 - T1) - (T3 - T2)).
   When clock synchronization on the Session-Sender and Session-Reflector nodes is
   not possible, the one-way delay can be derived using two-way delay divided by two.</t>

   <section title="Session-Reflector Test Packet for SR-MPLS Policies" anchor="sect-4.2.2.1"><t>
   The content of an example STAMP Session-Reflector reply test packet transmitted on the
   same path as the data traffic flow under measurement for two-way delay 
   measurement of an end-to-end SR-MPLS Policy is shown in Figure 6.</t>

    <figure title="Example Session-Reflector Test Packet for SR-MPLS Policy" anchor="ure-test-reply-packet-for-sr-mpls-policy"><artwork><![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
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                Segment(1)             | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .                                                               .
 .                                                               .
 .                                                               .
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                Segment(n)             | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                Test Packet as shown in Figure 5               |
 .                                                               .
 +---------------------------------------------------------------+
]]></artwork>
    </figure>
 
    </section>

   <section title="Session-Reflector Test Packet for SRv6 Policies" anchor="sect-4.2.2.2"><t>
   The content of an example STAMP Session-Reflector reply test packet transmitted on the
   same path as the data traffic flow under measurement for two-way delay 
   measurement of an end-to-end SRv6 Policy with SRH is shown in Figure 7.</t>

   <t>The procedure defined for Upper-Layer Header processing for SRv6 End SIDs
   in Section 4.1.1 in <xref target="RFC8986"/>
   is used to process the IPv6/UDP header in the received reply test packets
   on the Session-Sender.</t>

    <figure title="Example Session-Reflector Test Packet for SRv6 Policy" anchor="ure-test-reply-packet-for-srv6-policy"><artwork><![CDATA[
 +---------------------------------------------------------------+
 | IP Header                                                     |
 .  Source IP Address = Session-Reflector IPv6 Address           .
 .  Destination IP Address = Destination IPv6 Address            .
 .  Protocol = UDP                                               .
 .                                                               .
 +---------------------------------------------------------------+
 | SRH as specified in RFC 8754                                  |
 .  <Segment List>                                               .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header                                                    |
 .  Source Port = As chosen by Session-Reflector                 .
 .  Destination Port = Source Port from Received Test Packet     .
 .                                                               .
 +---------------------------------------------------------------+
 | Payload = Test Packet as specified in Section 3 of RFC 8972   |
 .           in Figure 2 and Figure 4                            .
 .                                                               .
 +---------------------------------------------------------------+
]]></artwork>
    </figure>

    </section>
    </section>

   <section title="Loopback Measurement Mode" anchor="sect-4.2.3"><t>
   The STAMP Session-Sender test packets are transmitted in loopback mode to 
   measure loopback delay of a bidirectional circular path. In this mode,  
   the received Session-Sender test packets are not punted out of the fast path in forwarding 
   (i.e. to slow path or control-plane) at the STAMP Session-Reflector. In other words, 
   the Session-Reflector does not process them and generate Session-Reflector test packets.
   This is a new measurement mode, not defined by STAMP process  
   <xref target="RFC8762"/>.
   </t>
 
   <t>The STAMP Session-Sender MUST set the Destination UDP port to 
   the UDP port it uses to receive the reply STAMP test packets.
   Since the Session-Reflector does not support the STAMP process, the loopback function simply 
   makes the necessary changes to the encapsulation including IP and UDP headers 
   to return the test packet to the Session-Sender.  The typical Session-Reflector test packet 
   is not used in this mode.  The loopback function simply returns the received Session-Sender test packet 
   to the Session-Sender without STAMP modifications defined in <xref target="RFC8762"/>.
   </t>

   <t>In case of SR-MPLS paths, the SR-MPLS header can contain the MPLS label stack of 
   the forward path or both forward and the reverse paths.
   The IP header of the STAMP Session-Sender test packets
   MUST set the Destination Address equal to the STAMP Session-Sender address
   and the Source Address equal to the STAMP Session-Reflector address.</t> 

   <t>In case of SRv6 paths, the SRH can contain the Segment List of 
   the forward path or both forward and the reverse paths.
   In the former case, an inner IPv6 header (after SRH and before UDP header) MUST be added that contains
   the Destination Address equal to the STAMP Session-Sender address
   and the Source Address equal to the STAMP Session-Reflector address.</t> 

   <t>The Session-Sender may use the SSID field in the received reply test packet 
   or local configuration to identify its test session using the loopback mode.
   In the received Session-Sender test packet at the Session-Sender,
   the 'Session-Sender Sequence Number', 'Session-Sender Timestamp', 
   'Session-Sender Error Estimate', and 'Session-Sender TTL' fields are not present in this mode.
   </t>

   <t>In this mode, as per Reference Topology, the test packet received back 
   at the Session-Sender retrieves the timestamp T1 from the test packet and adds the received timestamp T4 locally. 
   Both these timestamps are used to
   measure the loopback delay as (T4 - T1).  
   The one-way delay can be derived using the loopback delay divided by two.  
   In loopback mode, the loopback delay includes the processing delay on the Session-Reflector.
   The Session-Reflector processing delay component includes only the time
   required to loop the test packet from the incoming interface to the
   outgoing interface in forwarding plane.
   </t>

     </section>
   </section>

    <section title="Delay Measurement for P2MP SR Policies" anchor="sect-4.6"> <t>
   The Point-to-Multipoint (P2MP) SR path
   that originates from a root node terminates on multiple destinations called leaf nodes 
   (e.g. P2MP SR Policy <xref target="I-D.ietf-pim-sr-p2mp-policy"/>).</t>

   <t>The procedures for delay and loss measurement described in this
   document for end-to-end P2P SR Policies are also equally applicable to the P2MP SR Policies. 
   The procedure for one-way measurement is defined as following:</t>

   <t><list style="symbols"><t>The STAMP Session-Sender root node transmits test packets using the
      Tree-SID defined in <xref target="I-D.ietf-pim-sr-p2mp-policy"/> for the
      P2MP SR-MPLS Policy as shown in Figure 8.  The STAMP Session-Sender test packets may contain
      the replication SID as defined in <xref target="I-D.ietf-spring-sr-replication-segment"/>.</t>

      <t>The Destination Address MUST be set to the loopback 
      address from the range 127/8 for IPv4, or the loopback address ::1/128 for IPv6.</t>

      <t>Each STAMP Session-Reflector leaf node MUST transmit its node address in the Source
      Address of the reply test packets shown in Figure 5.  This
      allows the STAMP Session-Sender root node to identify the STAMP Session-Reflector leaf nodes
      of the P2MP SR Policy.</t>

      <t>The P2MP root node measures the delay for each P2MP leaf node individually.</t>

    </list>
    </t>

    <figure title="Example Session-Sender Test Packet with Tree-SID for SR-MPLS Policy" anchor="ure-with-replication-segment-for-sr-mpls-policy"><artwork><![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
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |              Tree-SID                 | TC  |S|      TTL      |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 .                                                               .
 .                                                               .
 .                                                               .
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |   Test Packet as shown in Figure 2                            |
 .                                                               .
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
    </figure>


    <t>The considerations for two-way mode for P2MP SR Policy (e.g. 
    for co-routed bidirectional SR-MPLS path) are outside the scope of this document.</t>

    </section>

      <section title="Additional STAMP Test Packet Processing Rules" anchor="sect-4.5"><t>
   The processing rules described in this section are applicable to the
   STAMP test packets for links and end-to-end SR paths including SR Policies.</t>        
        
   <section title="TTL" anchor="sect-4.5.1"><t>
   The TTL field in the IPv4 and MPLS headers of the
   STAMP Session-Sender and STAMP Session-Reflector test packet 
   is set to 255 as per Generalized TTL Security Mechanism (GTSM) <xref target="RFC5082"/>.</t>

    </section>

   <section title="IPv6 Hop Limit" anchor="sect-4.5.2"><t>
   The Hop Limit (HL) field in the IPv6 and SRH headers of the
   STAMP Session-Sender and STAMP Session-Reflector test packet
   is set to 255 as per Generalized TTL Security Mechanism (GTSM) <xref target="RFC5082"/>.</t>


   </section>

   <section title="Router Alert Option" anchor="sect-4.5.3"><t>
   The Router Alert IP option (RAO) <xref target="RFC2113"/> is 
   not set in the STAMP test packets for links and end-to-end SR paths.</t>

   </section>


   <section title="UDP Checksum" anchor="sect-4.5.4">
    <t>For IPv4 test packets, where the hardware is not capable
    of re-computing the UDP checksum or adding checksum complement
    <xref target="RFC7820"/>, the Session-Sender may set the UDP checksum value to 0 <xref target="RFC8085"/>.</t>
 
    <t>For IPv6 test packets, where the hardware is not capable
    of re-computing the UDP checksum or adding checksum complement
    <xref target="RFC7820"/>, the Session-Sender and Session-Reflector
    may use the procedure defined in <xref target="RFC6936"/>
    for the UDP checksum.</t>
 
   </section>
   </section>

   </section>

   <section title="Packet Loss Measurement for Links and SR Paths" anchor="sect-5"><t>
   The procedure described in Section 4 for delay measurement using STAMP test packets 
   can be used to detect (test) packet loss for links and end-to-end SR paths.
   The Sequence Number field in the STAMP test packet is used as 
   described in Section 4 "Theory of Operation" 
   where Stateful and Stateless Session-Reflector operations are defined            
   <xref target="RFC8762"/>, to detect round-trip, near-end (forward) and far-end 
   (backward) packet loss.  In the case of 
   the loopback mode introduced in this document, only the round-trip packet loss is applicable.</t>

   <t>This method can be used for inferred packet loss measurement,
   however, it provides only approximate view of the data packet loss.</t>

    </section>

   <section title="Direct Measurement for Links and SR Paths" anchor="sect-6"><t>
   The STAMP "Direct Measurement" TLV (Type 5) defined in <xref target="RFC8972"/> 
   can be used in SR networks for data packet loss measurement.
   The STAMP test packets with this TLV are transmitted using the
   procedures described in Section 4 to collect the transmit and receive counters 
   of the data flow for the links and end-to-end SR paths.</t>

   <t>The PSID carried in the received data packet for the traffic
   flow under measurement can be used to measure receive data packets 
   (for receive traffic counter) for an end-to-end SR path  
   on the STAMP Session-Reflector.  The PSID in the received Session-Sender test packet
   header can be used to associate the receive traffic counter on 
   the Session-Reflector for the end-to-end SR path.</t>

   <t>The STAMP "Direct Measurement" TLV (Type 5) lacks the support to
   identify the Block Number of the Direct Measurement traffic counters, which is  
   required for Alternate-Marking Method <xref target="RFC8321"/> 
   for accurate data packet loss metric.</t>

   </section>

     <section title="Session State for Links and SR Paths" anchor="sect-7"><t>
   The STAMP test session state allows to know if the performance measurement test is active.
   The threshold-based notification may not be generated if the delay 
   values do not change significantly.  For an unambiguous monitoring, 
   the controller needs to distinguish the cases whether the performance 
   measurement is active, or delay values are not changing to cross threshold.</t>

   <t>The STAMP test session state initially is declared active when 
   one or more reply test packets are received at the STAMP Session-Sender.
   The STAMP test session state is declared idle (or failed)  when consecutive 
   N number of reply test packets are not received at the STAMP 
   Session-Sender, where N is locally provisioned value.</t>

     </section>

    <section title="ECMP Support for SR Policies" anchor="sect-8"><t>
   An SR Policy can have ECMPs between the source and transit nodes,
   between transit nodes and between transit and destination nodes.
   Usage of Anycast SID <xref target="RFC8402"/> by an SR Policy can result in ECMP
   paths via transit nodes part of that Anycast group.  The test
   packets SHOULD be transmitted to traverse different ECMP paths to measure
   end-to-end delay of an SR Policy.</t>

   <t>Forwarding plane has various hashing functions available to forward
   packets on specific ECMP paths.  The mechanisms described in
   <xref target="RFC8029"/> and <xref target="RFC5884"/> for 
   handling ECMPs are also applicable to the delay measurement.</t>

   <t>For SR-MPLS Policy, sweeping of MPLS entropy label <xref target="RFC6790"/> values can 
   be used in Session-Sender test packets and Session-Reflector test 
   packets to take advantage of the hashing function in forwarding 
   plane to influence the ECMP path taken by them.</t>

   <t>In IPv4 header of the STAMP Session-Sender test packets,
   sweeping of Session-Reflector Address from the range 127/8 can be 
   used to exercise ECMP paths.  In this case, both the forward and the 
   return paths MUST be SR-MPLS paths when using the loopback mode.</t>

   <t>As specified in <xref target="RFC6437"/>, Flow Label field in
   the outer IPv6 header can also be used for sweeping to exercise different IPv6 ECMP paths.</t>

   <t>The "Destination Node Address" TLV <xref target="I-D.ietf-ippm-stamp-srpm"/> MUST be carried 
   in the STAMP Session-Sender test packet to identify the intended Session-Reflector,
   when using IPv4 Session-Reflector Address from 127/8 range for a P2P SR Policy, 
   when the STAMP test packet is encapsulated by a tunneling protocol 
   or an MPLS Segment List.</t> 

   </section>

   <section title="Security Considerations" anchor="sect-9"><t>
   The performance measurement is intended for deployment in
   well-managed private and service provider networks.  As such, it
   assumes that a node involved in a measurement operation has
   previously verified the integrity of the path and the identity of the
   far-end STAMP Session-Reflector.</t>

   <t>If desired, attacks can be mitigated by performing basic validation
   and sanity checks, at the STAMP Session-Sender, of the counter or timestamp fields
   in received measurement reply test packets.  The minimal state
   associated with these protocols also limits the extent of measurement
   disruption that can be caused by a corrupt or invalid packet to a
   single test cycle.</t>

   <t>Use of HMAC-SHA-256 in the authenticated mode protects the data
   integrity of the test packets.  SRv6 has HMAC protection
   authentication defined for SRH <xref target="RFC8754"/>.
   Hence, test packets for SRv6 may not need authentication mode.
   Cryptographic measures may be enhanced by the correct configuration
   of access-control lists and firewalls.</t>

   <t>The security considerations specified in <xref target="RFC8762"/>
   and <xref target="RFC8972"/> also apply to the procedures
   described in this document.</t> 

   <t>The Security Considerations specified in <xref target="I-D.ietf-ippm-stamp-srpm"/> 
   are also equally applicable to the procedures defined in this document.</t>

   <t>When using the procedures defined in [RFC6936], the 
   security considerations specified in <xref target="RFC6936"/>
   also apply.</t> 
    </section>

   <section title="IANA Considerations" anchor="sect-10"><t>
   This document does not require any IANA action.</t>

    </section>

    </middle>

    <back>
    <references title="Normative References">
    &RFC0768;
    &RFC2119;
    &RFC8174;
    &RFC8762;
    &RFC8972;
    &I-D.ietf-ippm-stamp-srpm;        
    </references>
    <references title="Informative References">
    <reference anchor="IEEE1588"><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>
    &RFC2113;
    &RFC4291;
    &RFC5082;
    &RFC5884;
    &RFC6437;
    &RFC6790;
    &RFC6936;
    &RFC7404;
    &RFC7820;
    &RFC8029;
    &RFC8321;
    &RFC8085;
    &RFC8402;
    &RFC8754;
    &RFC8986;
    &I-D.ietf-spring-segment-routing-policy;
    &I-D.ietf-spring-sr-replication-segment;
    &I-D.ietf-pim-sr-p2mp-policy;
    &I-D.ietf-spring-mpls-path-segment;
    &I-D.ietf-spring-srv6-path-segment;
    &I-D.ietf-pce-sr-bidir-path;
    &I-D.ietf-ippm-stamp-yang;

    <reference anchor="IEEE802.1AX"> 
    <front>
    <title>IEEE Standard for Local and metropolitan area networks - Link Aggregation</title>
    <author>    
      <organization>
       IEEE Std. 802.1AX
      </organization>
    </author>
    <date month="November" year="2008"/>
    </front>
    </reference>

    </references>
    <section title="Acknowledgments" numbered="no" anchor="acknowledgments"><t>
   The authors would like to thank Thierry Couture for the discussions
   on the use-cases for Performance Measurement in Segment Routing.  The authors
   would also like to thank Greg Mirsky, Gyan Mishra, Xie Jingrong, 
   and Mike Koldychev for reviewing this document and
   providing useful comments and suggestions.  Patrick Khordoc and Radu
   Valceanu have helped improve the mechanisms described in this document.</t>

    </section>

    </back>

    </rfc>
