<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>

<rfc xmlns:xi="http://www.w3.org/2001/XInclude" submissionType="IETF" category="std" consensus="true" docName="draft-ietf-sfc-ioam-nsh-13" number="0000" ipr="trust200902" obsoletes="" updates="" xml:lang="en" tocInclude="true" tocDepth="4" symRefs="true" sortRefs="true" version="3">
  
  <front>
    <title abbrev="NSH encapsulation for In-situ OAM">Network Service Header
    (NSH) Encapsulation for In-situ OAM (IOAM) Data</title>
    <seriesInfo name="RFC" value="0000"/>
    <author fullname="Frank Brockners" initials="F." role="editor" surname="Brockners">
      <organization abbrev="Cisco">Cisco Systems, Inc.</organization>
      <address>
        <postal>
	  <extaddr>3rd Floor</extaddr>
	  <street>Hansaallee 249</street>
          <city>DUESSELDORF</city>
          <code>40549</code>
          <country>Germany</country>
        </postal>
        <email>fbrockne@cisco.com</email>
      </address>
    </author>
    <author fullname="Shwetha Bhandari" initials="S." role="editor" surname="Bhandari">
      <organization abbrev="Thoughtspot">Thoughtspot</organization>
      <address>
        <postal>
       	  <extaddr>3rd Floor, Indiqube Orion</extaddr>
	  <street>24th Main Rd, Garden Layout, HSR Layout</street>
          <city>Bangalore</city>
          <region>Karnataka</region>
	  <code>560 102</code>
          <country>India</country>
        </postal>
        <email>shwetha.bhandari@thoughtspot.com</email>
      </address>
    </author>
    <date month="May" year="2023"/>
    <area>rtg</area>
    <workgroup>sfc</workgroup>
    <keyword>inband</keyword>
    <keyword>In-situ</keyword>
    <keyword>Telemetry, Tracing</keyword>
    <abstract>
      <t>In-situ Operations, Administration, and Maintenance (IOAM) is used
      for recording and collecting operational and telemetry information while
      the packet traverses a path between two points in the network. This
      document outlines how IOAM data fields are encapsulated with the Network
      Service Header (NSH).</t>
    </abstract>
  </front>
  <middle>
    <section toc="default" numbered="true">
      <name>Introduction</name>
      <t>IOAM, as defined in
      <xref target="RFC9197" format="default"/>, is used to record and collect OAM
      information while the packet traverses a particular network domain. The
      term "in-situ" refers to the fact that the OAM data is added to the data
      packets rather than is being sent within packets specifically dedicated
      to OAM. This document defines how IOAM data fields are transported as
      part of the Network Service Header (NSH) <xref target="RFC8300" format="default"/>
      encapsulation for the Service Function Chaining (SFC) Architecture <xref target="RFC7665" format="default"/>. The IOAM-Data-Fields are defined in
      <xref target="RFC9197" format="default"/>.</t>
    </section>
    <section anchor="Conventions" numbered="true" toc="default">
      <name>Conventions</name>
        <t>
    The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
    NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
    "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
    described in BCP&nbsp;14 <xref target="RFC2119"/> <xref target="RFC8174"/> 
    when, and only when, they appear in all capitals, as shown here.
        </t>

      <t>Abbreviations used in this document:</t>
      <dl newline="false" spacing="normal">
        <dt>IOAM:</dt>
        <dd>In-situ Operations, Administration, and
          Maintenance</dd>
        <dt>NSH:</dt>
        <dd>Network Service Header</dd>
        <dt>OAM:</dt>
        <dd>Operations, Administration, and Maintenance</dd>
        <dt>SFC:</dt>
        <dd>Service Function Chaining</dd>
        <dt>TLV:</dt>
        <dd>Type, Length, Value</dd>
      </dl>
    </section>
    <section numbered="true" anchor="sec3" toc="default">
      <name>IOAM encapsulation with NSH</name>
      <t>The NSH is defined in <xref target="RFC8300"
      format="default"/>. IOAM-Data-Fields are carried as NSH payload using a
      next protocol header which follows the NSH headers. An IOAM header is
      added containing the IOAM-Data-Fields. The IOAM-Data-Fields
      <bcp14>MUST</bcp14> follow the definitions corresponding to
      IOAM-Option-Types (e.g., see <xref target="RFC9197" sectionFormat="of"
      section="4"/> and <xref target="RFC9326" sectionFormat="of"
      section="3.2"/>). In an administrative domain where IOAM is used,
      insertion of the IOAM header in NSH is enabled at the NSH tunnel
      endpoints, which also serve as IOAM encapsulating/decapsulating nodes by
      means of configuration.  The operator <bcp14>MUST</bcp14> ensure that
      SFC-aware nodes along the Service Function Path support IOAM, otherwise
      packets might be dropped (see <xref target="sec3"/> further below, as
      well as <xref target="RFC8300" sectionFormat="of" section="2.2"/>).  The
      IOAM transit nodes (e.g., an Service Function Forwarder)
      <bcp14>MUST</bcp14> process all the IOAM headers that are relevant based
      on its configuration.  See <xref target="RFC9378" format="default"/> for
      a discussion of deployment related aspects of IOAM-Data-fields.</t>

<figure>
      <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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<-+
|Ver|O|U|    TTL    |   Length  |U|U|U|U|MD Type| NP = TBD_IOAM |  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  N
|          Service Path Identifier              | Service Index |  S
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  H
|                            ...                                |  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<-+
|  IOAM-Type    | IOAM HDR len  |    Reserved   | Next Protocol |  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  I
!                                                               |  O
!                                                               |  A
~                 IOAM Option and Optional Data Space           ~  M
|                                                               |  |
|                                                               |  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<-+
|                                                               |
|                                                               |
|                 Payload + Padding (L2/L3/...)                 |
|                                                               |
|                                                               |
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
</figure>
      <t>The NSH header and fields are defined in <xref target="RFC8300" format="default"/>.
      The O-bit <bcp14>MUST</bcp14> be handled following the rules 
      in <xref target="RFCYYY1" format="default"/>.
      The "NSH Next Protocol" value (referred to as "NP" in the diagram above)
      is TBD_IOAM.</t>
      <t>The IOAM related fields in NSH are defined as follows:</t>
      <dl spacing="normal" newline="true">
            <dt>IOAM-Type:</dt>
            <dd>8-bit field defining the IOAM-Option-Type, as defined in the
            IOAM Option-Type Registry specified in <xref target="RFC9197"
            format="default"/>.</dd>
            <dt>IOAM HDR Len:</dt>
            <dd>8-bit field that contains the length of the IOAM header in
            multiples of 4-octets, including the "IOAM-Type" and "IOAM HDR
            Len" fields.</dd>
            <dt>Reserved bits:</dt>
            <dd>Reserved bits are present for future use. The reserved bits
            <bcp14>MUST</bcp14> be set to 0x0 upon transmission and ignored
            upon receipt.</dd>
            <dt>Next Protocol:</dt>
            <dd>8-bit unsigned integer that determines the type of header
            following IOAM. The semantics of this field are identical to the
            Next Protocol field in <xref target="RFC8300"
            format="default"/>.</dd>
            <dt>IOAM Option and Data Space:</dt>
            <dd>IOAM-Data-Fields as specified by the IOAM-Type
            field. IOAM-Data-Fields are defined corresponding to the
            IOAM-Option-Type (e.g., see <xref target="RFC9197"
            sectionFormat="of" section="4"/> and <xref target="RFC9326"
            sectionFormat="of" section="3.2"/>) and are always aligned by 4
            octets, thus there is no padding field.</dd>
          </dl>

      <t>Multiple IOAM-Option-Types <bcp14>MAY</bcp14> be included within the NSH
      encapsulation. For example, if a NSH encapsulation contains two
      IOAM-Option-Types before a data payload, the Next Protocol field of the
      first IOAM option will contain the value of TBD_IOAM, while the Next
      Protocol field of the second IOAM-Option-Type will contain the "NSH Next
      Protocol" number indicating the type of the data payload. The
      applicability of the IOAM Active and Loopback flags <xref target="RFC9322" format="default"/> is outside the scope of this document and may be 
      specified in the future.</t>
      <t>In case the IOAM Incremental Trace Option-Type is used, an SFC-aware
      node that serves as an IOAM transit node, needs to adjust the "IOAM HDR
      Len" field accordingly, see <xref target="RFC9197" sectionFormat="of"
      section="4.4"/>.</t>
      <t>Per <xref target="RFC8300" sectionFormat="of" section="2.2"/>,
      packets with Next Protocol values not supported <bcp14>SHOULD</bcp14> be
      silently dropped by default.  Thus, when a packet with IOAM is received
      at an NSH based forwarding node such as an Service Function Forwarder
      (SFF) that does not support the IOAM header, it <bcp14>SHOULD</bcp14>
      drop the packet. The mechanism to maintain and notify of such events are
      outside the scope of this document.</t>
    </section>
    <section anchor="IANA" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <t>IANA is requested to allocate a code point for IOAM in the 
      <eref target="https://www.iana.org/assignments/nsh/nsh.xhtml#next-protocol">
      "NSH Next Protocol" registry</eref>: 
      </t>

<table>
  <name></name>
  <thead>
    <tr>
    <th>Next Protocol</th>
    <th>Descrption</th>
    <th>Reference</th>
    </tr>
    </thead>
    <tbody>
      <tr>
	<td>TBD_IOAM</td>
	<td>IOAM (Next protocol is an IOAM header)</td>
	<td>This document</td>
      </tr>
    </tbody>
</table>

    </section>
    <section anchor="Security" numbered="true" toc="default">
      <name>Security Considerations</name>
      <t>IOAM is considered a "per domain" feature, where the operator decides
      on leveraging and configuring IOAM according to the operator's
      needs. The operator needs to properly secure the IOAM domain to avoid
      malicious configuration and use, which could include injecting malicious
      IOAM packets into a domain. For additional IOAM related security
      considerations, see <xref target="RFC9197" sectionFormat="of"
      section="9"/>.  For additional OAM and NSH related security
      considerations see Section 5 of <xref target="RFCYYY1"
      format="default"/>.</t>
    </section>
    <section numbered="true" toc="default">
      <name>Acknowledgements</name>
      <t>The authors would like to thank <contact fullname="Eric Vyncke"/>,
      <contact fullname="Nalini Elkins"/>, <contact fullname="Srihari
      Raghavan"/>, <contact fullname="Ranganathan T S, Karthik Babu
      Harichandra Babu"/>, <contact fullname="Akshaya Nadahalli"/>, <contact
      fullname="Stefano Previdi"/>, <contact fullname="Hemant Singh"/>,
      <contact fullname="Erik Nordmark"/>, <contact fullname="LJ Wobker"/>,
      <contact fullname="Andrew Yourtchenko"/>, <contact fullname="Greg
      Mirsky"/> and <contact fullname="Mohamed Boucadair"/> for the comments
      and advice.</t>
    </section>
    <section numbered="true" toc="default">
      <name>Contributors</name>
      <t>In addition to editors listed on the title page, the following people
      have contributed to this document:</t>

      <contact fullname="Vengada Prasad Govindan">
        <organization>Cisco Systems, Inc.</organization>
	<address>
          <email>venggovi@cisco.com</email>
        </address>
      </contact>

      <contact fullname="Carlos Pignataro">
        <organization>Cisco Systems, Inc.</organization>
        <address>
          <postal>
            <street>7200-11 Kit Creek Road</street>
            <city>Research Triangle Park</city>
            <region>NC</region><code>27709</code>
            <country>United States of America</country>
          </postal>
          <email>cpignata@cisco.com</email>
        </address>
      </contact>

      <contact fullname="Hannes Gredler">
        <organization> RtBrick Inc.</organization>
        <address>
          <email>hannes@rtbrick.com</email>
        </address>
      </contact>

      <contact fullname="John Leddy">
        <address>
          <email>john@leddy.net</email>
        </address>
      </contact>


      <contact fullname="Stephen Youell">
        <organization>JP Morgan Chase</organization>
        <address>
          <postal>
            <street>25 Bank Street</street>
            <city>London</city>
            <region></region><code>E14 5JP</code>
            <country>United Kingdom</country>
          </postal>
          <email>stephen.youell@jpmorgan.com</email>
        </address>
      </contact>

      <contact fullname="Tal Mizrahi">
        <organization>Huawei Network.IO Innovation Lab</organization>
        <address>
	  <postal>
            <country>Israel</country>
          </postal>
          <email>tal.mizrahi.phd@gmail.com</email>
        </address>
      </contact>

      <contact fullname="David Mozes">
        <address>
          <email>mosesster@gmail.com</email>
        </address>
      </contact>

      <contact fullname="Petr Lapukhov">
        <organization>Facebook</organization>
        <address>
          <postal>
            <street>1 Hacker Way</street>
            <city>Menlo Park</city>
            <region>CA</region><code>94025</code>
            <country>United States of America</country>
          </postal>
          <email>petr@fb.com</email>
        </address>
      </contact>


      <contact fullname="Remy Chang">
        <organization>Barefoot Networks</organization>
        <address>
          <postal>
            <street>2185 Park Boulevard</street>
            <city>Palo Alto</city>
            <region>CA</region><code>94306</code>
            <country>United States of America</country>
          </postal>
          <email></email>
        </address>
      </contact>

    </section>
  </middle>

  <back>

    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9197.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8300.xml"/>

<!-- [I-D.ietf-sfc-oam-packet] in EDIT state as of 05/18/23; companion document RFC YYY1 -->

<reference anchor='RFCYYY1' target='https://www.rfc-editor.org/info/rfcYYY1'>
<front>
<title>
OAM Packet and Behavior in the Network Service Header (NSH)
</title>
<author initials="M." surname="Boucadair" fullname="Mohamed Boucadair">
<organization>Orange</organization>
</author>
<date month="March" day="26" year="2023"/>
<abstract>
<t>
This document clarifies an ambiguity in the Network Service Header (NSH) specification related to the handling of O bit. In particular, this document clarifies the meaning of "OAM packet". This document updates RFC 8300.
</t>
</abstract>
</front>
<seriesInfo name="RFC" value="YYY1"/>
<seriesInfo name="DOI" value="10.17487/RFCYYY1"/>
</reference>

      </references>
      <references>
        <name>Informative References</name>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7665.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9378.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9326.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9322.xml"/>
      </references>
    </references>
    <section anchor="appendix" numbered="true" toc="default">
      <name>Discussion of the IOAM encapsulation approach</name>
      <t>This section lists several approaches considered for encapsulating
      IOAM with NSH and presents the rationale for the approach chosen in this
      document.</t>
      <t>An encapsulation of IOAM-Data-Fields in NSH should be friendly to an
      implementation in both hardware as well as software forwarders and
      support a wide range of deployment cases, including large networks that
      desire to leverage multiple IOAM-Data-Fields at the same time.</t>
      <t>Hardware and software friendly implementation: Hardware forwarders
      benefit from an encapsulation that minimizes iterative look-ups of
      fields within the packet: Any operation which looks up the value of a
      field within the packet, based on which another lookup is performed,
      consumes additional gates and time in an implementation - both of which
      are desired to be kept to a minimum. This means that flat TLV structures
      are to be preferred over nested TLV structures. IOAM-Data-Fields are
      grouped into several categories, including trace, proof-of-transit, and
      edge-to-edge. Each of these options defines a TLV structure. A
      hardware-friendly encapsulation approach avoids grouping these three
      option categories into yet another TLV structure, but would rather carry
      the options as a serial sequence.</t>
      <t>Total length of the IOAM-Data-Fields: The total length of
      IOAM-Data-Fields can grow quite large in case multiple different
      IOAM-Data-Fields are used and large path-lengths need to be considered.
      If for example an operator would consider using the IOAM Trace
      Option-Type and capture node-id, app_data, egress/ingress interface-id,
      timestamp seconds, timestamps nanoseconds at every hop, then a total of
      20 octets would be added to the packet at every hop. In case this
      particular deployment would have a maximum path length of 15 hops in the
      IOAM domain, then a maximum of 300 octets were to be encapsulated in the
      packet.</t>
      <t>Different approaches for encapsulating IOAM-Data-Fields in NSH could
      be considered:</t>
      <ol spacing="normal" type="1">
	<li>Encapsulation of IOAM-Data-Fields as "NSH MD Type 2" (see <xref
	target="RFC8300" sectionFormat="comma" section="2.5"/>). Each
	IOAM-Option-Type (e.g., trace, proof-of-transit, and edge-to-edge)
	would be specified by a type, with the different IOAM-Data-Fields
	being TLVs within this the particular option type. NSH MD Type 2
	offers support for variable length meta-data. The length field is
	6-bits, resulting in a maximum of 256 (2^6 x 4) octets.</li>
        <li>Encapsulation of IOAM-Data-Fields using the "Next Protocol"
        field. Each IOAM-Option-Type (e.g trace, proof-of-transit, and
        edge-to-edge) would be specified by its own "next protocol".</li>
        <li>Encapsulation of IOAM-Data-Fields using the "Next Protocol"
        field. A single NSH protocol type code point would be allocated for
        IOAM. A "sub-type" field would then specify what IOAM options type
        (trace, proof-of-transit, edge-to-edge) is carried.</li>
      </ol>
      <t>The third option has been chosen here. This option avoids the
      additional layer of TLV nesting that the use of NSH MD Type 2 would
      result in. In addition, this option does not constrain IOAM data to a
      maximum of 256 octets, thus allowing support for very large
      deployments.</t>
    </section>
  </back>
</rfc>
