<?xml version="1.0" encoding="UTF-8"?>
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
  <!-- generated by https://github.com/cabo/kramdown-rfc version 1.6.17 (Ruby 2.6.10) -->


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

]>


<rfc ipr="trust200902" docName="draft-rogaglia-netconf-restconf-trace-ctx-headers-00" category="std" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true">
  <front>
    <title abbrev="rc_trace">RESTCONF Extension to support Trace Context Headers</title>

    <author fullname="Roque Gagliano">
      <organization>Cisco Systems</organization>
      <address>
        <postal>
          <street>Avenue des Uttins 5</street>
          <city>Rolle</city>
          <code>1180</code>
          <country>Switzerland</country>
        </postal>
        <email>rogaglia@cisco.com</email>
      </address>
    </author>
    <author fullname="Kristian Larsson">
      <organization>Deutsche Telekom AG</organization>
      <address>
        <email>kll@dev.terastrm.net</email>
      </address>
    </author>
    <author fullname="Jan Lindblad">
      <organization>Cisco Systems</organization>
      <address>
        <email>jlindbla@cisco.com</email>
      </address>
    </author>

    <date year="2023" month="July" day="06"/>

    <area>Operations and Management</area>
    <workgroup>NETCONF</workgroup>
    <keyword>telemetry</keyword> <keyword>distributed systems</keyword> <keyword>opentelemetry</keyword>

    <abstract>


<t>This document extends the RESTCONF protocol in order to support trace context propagation as defined by the W3C.</t>



    </abstract>

    <note title="About This Document" removeInRFC="true">
      <t>
        The latest revision of this draft can be found at <eref target="TBD"/>.
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-rogaglia-netconf-restconf-trace-ctx-headers/"/>.
      </t>
      <t>
        Discussion of this document takes place on the
        NETCONF Working Group mailing list (<eref target="mailto:netconf@ietf.org"/>),
        which is archived at <eref target="https://mailarchive.ietf.org/arch/browse/netmod/"/>.
        Subscribe at <eref target="https://www.ietf.org/mailman/listinfo/netconf/"/>.
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/TBD"/>.</t>
    </note>


  </front>

  <middle>


<section anchor="introduction"><name>Introduction</name>

<t>Network automation and management systems commonly consist of multiple
sub-systems and together with the network devices they manage, they effectively form a distributed system.  Distributed tracing is a methodology implemented by tracing tools to follow, analyze and debug operations, such as configuration transactions, across multiple distributed systems.  An operation is uniquely identified by a trace-id and through a trace context, carries some metadata about the operation.  Propagating this "trace context" between systems enables forming a coherent view of the entire operation as carried out by all involved systems.</t>

<t>The W3C has defined two HTTP headers (traceparent and tracestate) for context propagation that are useful for distributed systems like the ones defined in <xref target="RFC8309"/>. The goal of this document is to adopt this W3C specification for the RESTCONF protocol.</t>

<t>This document does not define new HTTP extensions but makes those defined in <xref target="W3C-Trace-Context"/> optional headers for the RESTCONF protocol.</t>

<t>In <xref target="I-D.draft-rogaglia-netconf-trace-ctx-extension-03"/>, the NETCONF protocol extension is defined and we will re-use several of the YANG and XML objects defined in that document for RESTCONF. Please refer to that document for additional context and example applications.</t>

<section anchor="terminology"><name>Terminology</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"/> <xref target="RFC8174"/> when, and only when, they appear in all capitals, as shown here.</t>

</section>
</section>
<section anchor="restconf-extensions"><name>RESTCONF Extensions</name>

<t>A RESTCONF server SHOULD support trace context traceparent header as defined in <xref target="W3C-Trace-Context"/>.</t>

<t>A RESTCONF server SHOULD support trace context tracestate header as defined in <xref target="W3C-Trace-Context"/>.</t>

<section anchor="errors-handling"><name>Errors handling</name>

<t>The RESTCONF server SHOULD follow the "Processing Model for Working with Trace Context" as specified in <xref target="W3C-Trace-Context"/>.</t>

<t>If the server rejects the RPC because of the trace context headers values, the server MUST return an rpc-error with the following values:</t>

<figure><artwork><![CDATA[
  error-tag:      operation-failed
  error-type:     protocol
  error-severity: error
]]></artwork></figure>

<t>Additionally, the error-info tag SHOULD contain a relevant details about the error.</t>

<t>Finally, the sx:structure defined in <xref target="I-D.draft-rogaglia-netconf-trace-ctx-extension-03"/> SHOULD be present in any error message from the server.</t>

<t>Example of a badly formated trace context extension using <xref target="RFC8040"/> example B.2.1:</t>

<figure><artwork><![CDATA[
  POST /restconf/data/example-jukebox:jukebox/library HTTP/1.1
  Host: example.com
  Content-Type: application/yang-data+json
  traceparent: SomeBadFormatHere
  tracestate: OrSomeBadFormatHere

  {
    "example-jukebox:artist" : [
      {
        "name" : "Foo Fighters"
      }
    ]
  }
]]></artwork></figure>

<t>And the expected error message:</t>

<figure><artwork><![CDATA[
 HTTP/1.1 400 Bad Request
 Date: Tue, 20 Jun 2023 20:56:30 GMT
 Server: example-server
 Content-Type: application/yang-data+json

 { "ietf-restconf:errors" : {
     "error" : [
       {
         "error-type" : "protocol",
         "error-tag" : "operation-failed",
         "error-severity" : "error",
         "error-message" : 
         "OTLP traceparent attribute incorrectly formatted",
         "error-info": {
           "ietf-netconf-otlp-context:meta-name" : "traceparent",
           "ietf-netconf-otlp-context:meta-value" : 
           "SomeBadFormatHere",
           "ietf-netconf-otlp-context:error-type" : 
           "ietf-netconf-otlp-context:bad-format"
         }
       }
     ]
   }
 }
]]></artwork></figure>

</section>
<section anchor="trace-context-header-versionning"><name>Trace Context header versionning</name>

<t>This extension refers to the <xref target="W3C-Trace-Context"/> trace context capability. The W3C traceparent and trace-state headers include the notion of versions. It would be desirable for a RESTCONF client to be able to discover the one or multiple versions of these headers supported by a server. We would like to achieve this goal avoiding the deffinition of new RESTCONF capabilities for each headers' version.</t>

<t><xref target="I-D.draft-rogaglia-netconf-trace-ctx-extension-03"/> defines a pair YANG modules that SHOULD be included in the YANG library per <xref target="RFC8525"/> of the RESTCONF server supporting the RESTCONF Trace Context extension that will refer to the headers' supported versions. Future updates of this document could include additional YANG modules for new headers' versions.</t>

</section>
</section>
<section anchor="security-considerations"><name>Security Considerations</name>

<t>TODO Security</t>

</section>
<section anchor="iana-considerations"><name>IANA Considerations</name>

<t>This document has no IANA actions.</t>

</section>
<section anchor="acknowledgments"><name>Acknowledgments</name>

<t>We would like to acknowledge</t>

</section>


  </middle>

  <back>


    <references title='Normative References'>



<reference anchor='RFC2119' target='https://www.rfc-editor.org/info/rfc2119'>
  <front>
    <title>Key words for use in RFCs to Indicate Requirement Levels</title>
    <author fullname='S. Bradner' initials='S.' surname='Bradner'/>
    <date month='March' year='1997'/>
    <abstract>
      <t>In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
    </abstract>
  </front>
  <seriesInfo name='BCP' value='14'/>
  <seriesInfo name='RFC' value='2119'/>
  <seriesInfo name='DOI' value='10.17487/RFC2119'/>
</reference>

<reference anchor='RFC8174' target='https://www.rfc-editor.org/info/rfc8174'>
  <front>
    <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
    <author fullname='B. Leiba' initials='B.' surname='Leiba'/>
    <date month='May' year='2017'/>
    <abstract>
      <t>RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
    </abstract>
  </front>
  <seriesInfo name='BCP' value='14'/>
  <seriesInfo name='RFC' value='8174'/>
  <seriesInfo name='DOI' value='10.17487/RFC8174'/>
</reference>

<reference anchor='RFC8525' target='https://www.rfc-editor.org/info/rfc8525'>
  <front>
    <title>YANG Library</title>
    <author fullname='A. Bierman' initials='A.' surname='Bierman'/>
    <author fullname='M. Bjorklund' initials='M.' surname='Bjorklund'/>
    <author fullname='J. Schoenwaelder' initials='J.' surname='Schoenwaelder'/>
    <author fullname='K. Watsen' initials='K.' surname='Watsen'/>
    <author fullname='R. Wilton' initials='R.' surname='Wilton'/>
    <date month='March' year='2019'/>
    <abstract>
      <t>This document describes a YANG library that provides information about the YANG modules, datastores, and datastore schemas used by a network management server. Simple caching mechanisms are provided to allow clients to minimize retrieval of this information. This version of the YANG library supports the Network Management Datastore Architecture (NMDA) by listing all datastores supported by a network management server and the schema that is used by each of these datastores.</t>
    </abstract>
  </front>
  <seriesInfo name='RFC' value='8525'/>
  <seriesInfo name='DOI' value='10.17487/RFC8525'/>
</reference>

<reference anchor='RFC8040' target='https://www.rfc-editor.org/info/rfc8040'>
  <front>
    <title>RESTCONF Protocol</title>
    <author fullname='A. Bierman' initials='A.' surname='Bierman'/>
    <author fullname='M. Bjorklund' initials='M.' surname='Bjorklund'/>
    <author fullname='K. Watsen' initials='K.' surname='Watsen'/>
    <date month='January' year='2017'/>
    <abstract>
      <t>This document describes an HTTP-based protocol that provides a programmatic interface for accessing data defined in YANG, using the datastore concepts defined in the Network Configuration Protocol (NETCONF).</t>
    </abstract>
  </front>
  <seriesInfo name='RFC' value='8040'/>
  <seriesInfo name='DOI' value='10.17487/RFC8040'/>
</reference>


<reference anchor='I-D.draft-rogaglia-netconf-trace-ctx-extension-03' target='https://datatracker.ietf.org/doc/html/draft-rogaglia-netconf-trace-ctx-extension-03'>
   <front>
      <title>NETCONF Extension to support Trace Context propagation</title>
      <author fullname='Roque Gagliano' initials='R.' surname='Gagliano'>
         <organization>Cisco Systems</organization>
      </author>
      <author fullname='Kristian Larsson' initials='K.' surname='Larsson'>
         <organization>Deutsche Telekom AG</organization>
      </author>
      <author fullname='Jan Lindblad' initials='J.' surname='Lindblad'>
         <organization>Cisco Systems</organization>
      </author>
      <date day='6' month='July' year='2023'/>
      <abstract>
	 <t>   This document defines how to propagate trace context information
   across the Network Configuration Protocol (NETCONF), that enables
   distributed tracing scenarios.  It is an adaption of the HTTP-based
   W3C specification.

	 </t>
      </abstract>
   </front>
   <seriesInfo name='Internet-Draft' value='draft-rogaglia-netconf-trace-ctx-extension-03'/>
   
</reference>


<reference anchor="W3C-Trace-Context" target="https://www.w3.org/TR/2021/REC-trace-context-1-20211123/">
  <front>
    <title>W3C Recommendation on Trace Context</title>
    <author >
      <organization></organization>
    </author>
    <date year="2021" month="November" day="23"/>
  </front>
</reference>


    </references>

    <references title='Informative References'>



<reference anchor='RFC8309' target='https://www.rfc-editor.org/info/rfc8309'>
  <front>
    <title>Service Models Explained</title>
    <author fullname='Q. Wu' initials='Q.' surname='Wu'/>
    <author fullname='W. Liu' initials='W.' surname='Liu'/>
    <author fullname='A. Farrel' initials='A.' surname='Farrel'/>
    <date month='January' year='2018'/>
    <abstract>
      <t>The IETF has produced many modules in the YANG modeling language. The majority of these modules are used to construct data models to model devices or monolithic functions.</t>
      <t>A small number of YANG modules have been defined to model services (for example, the Layer 3 Virtual Private Network Service Model (L3SM) produced by the L3SM working group and documented in RFC 8049).</t>
      <t>This document describes service models as used within the IETF and also shows where a service model might fit into a software-defined networking architecture. Note that service models do not make any assumption of how a service is actually engineered and delivered for a customer; details of how network protocols and devices are engineered to deliver a service are captured in other modules that are not exposed through the interface between the customer and the provider.</t>
    </abstract>
  </front>
  <seriesInfo name='RFC' value='8309'/>
  <seriesInfo name='DOI' value='10.17487/RFC8309'/>
</reference>




    </references>


<section anchor="example-restconf-calls"><name>Example RESTCONF calls</name>

<t>TBD</t>

</section>
<section anchor="changes-to-be-deleted-by-rfc-editor"><name>Changes (to be deleted by RFC Editor)</name>

</section>
<section anchor="to-do-list-to-be-deleted-by-rfc-editor"><name>TO DO List (to be deleted by RFC Editor)</name>

<t><list style="symbols">
  <t>Security Considerations</t>
  <t>Example RESTCONF Calls</t>
  <t>The W3C is working on a draft document to introduce the concept of "baggage" that we expect part of a future draft for NETCONF and RESTCONF</t>
</list></t>

</section>


  </back>

<!-- ##markdown-source:
H4sIAFg3p2QAA6VZWXMbuRF+n1/RRT8kW9HwkOw9+JKlddja6IpM12YrtbUF
zoAkrOGAC2BE0S7993yNY0hKVDbeqFTWDNBA3193j/M8z0pd1GIhh1QaMXW5
0TMxq5TIa+kKXU9zI214cEYUMi/cQz6XopTG5v1+5pSrcJZuTz+M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