<?xml version='1.0' encoding='utf-8'?>

<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="std" number="9999"
     ipr="pre5378Trust200902" obsoletes="" updates="" submissionType="IETF"
     consensus="true" xml:lang="en" tocInclude="true" tocDepth="2" symRefs="true" sortRefs="true" version="3">

<!-- xml2rfc v2v3 conversion 2.23.1 -->
  <front>
    <title abbrev="NETCONF-notif">Dynamic Subscription to YANG Events and
 Datastores over NETCONF</title>

<seriesInfo name="RFC" value="9999"/>

    <author fullname="Eric Voit" initials="E." surname="Voit">
      <organization>Cisco Systems</organization>
      <address>
        <email>evoit@cisco.com</email>
      </address>
    </author>
    <author fullname="Alexander Clemm" initials="A" surname="Clemm">
      <organization>Huawei</organization>
      <address>
        <email>ludwig@clemm.org</email>
      </address>
    </author>
    <author fullname="Alberto Gonzalez Prieto" initials="A" surname="Gonzalez Prieto">
      <organization>Microsoft</organization>
      <address>
        <email>alberto.gonzalez@microsoft.com</email>
      </address>
    </author>
    <author fullname="Einar Nilsen-Nygaard" initials="E" surname="Nilsen-Nygaard">
      <organization>Cisco Systems</organization>
      <address>
        <email>einarnn@cisco.com</email>
      </address>
    </author>
    <author fullname="Ambika Prasad Tripathy" initials="A" surname="Tripathy">
      <organization>Cisco Systems</organization>
      <address>
        <email>ambtripa@cisco.com</email>
      </address>
    </author>
    <date month="July" year="2019"/>

    <abstract>
      <t>This document provides a Network Configuration Protocol (NETCONF) binding to the dynamic subscription capability of both subscribed notifications and YANG-Push.</t>
    </abstract>
  </front>

  <middle>
    <section numbered="true" toc="default">
      <name>Introduction</name>
      <t>This document specifies the binding of a stream of events which form
      part of a dynamic subscription to the NETCONF protocol <xref
      target="RFC6241" format="default"/>. Dynamic subscriptions are defined
      in <xref target="RFCYYYY"
      format="default"/>. In addition, as <xref
      target="RFCZZZZ" format="default"/> is itself
      built upon <xref
      target="RFCYYYY"
      format="default"/>, this document enables a NETCONF client to request
      via a dynamic subscription and receive updates from a YANG datastore
      located on a NETCONF server.</t>
      <t>This document assumes that the reader is familiar with the terminology and concepts defined in <xref target="RFCYYYY" format="default"/>.</t>
    </section>
    <section numbered="true" toc="default">
      <name>Terminology</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&#160;14 <xref target="RFC2119"/>
    <xref target="RFC8174"/> when, and only when, they appear in all capitals,
    as shown here.</t>

      <t>The following terms are defined in <xref target="RFCYYYY" format="default"/>: dynamic subscription, event stream, notification message, publisher, receiver, subscriber, subscription. No additional terms are defined.</t>
    </section>
    <section numbered="true" toc="default">
      <name>Compatibility with RFC-5277's create-subscription</name>
      <t>A publisher is allowed to concurrently support dynamic subscription RPCs of <xref target="RFCYYYY" format="default"/> at the same time as <xref target="RFC5277" format="default"/>'s "create-subscription" RPC.  However a single NETCONF transport session <bcp14>MUST NOT</bcp14> support both this specification and a subscription established by <xref target="RFC5277" format="default"/>'s "create-subscription" RPC. To protect against any attempts to use a single NETCONF transport session in this way:</t>
      <ul spacing="compact">
        <li>A solution <bcp14>MUST</bcp14> reply with the <xref target="RFC6241" format="default"/> "rpc-error" element containing the "error-tag" value of "operation-not-supported" if a "create-subscription" RPC is received on a NETCONF session where an <xref target="RFCYYYY" format="default"/> established subscription exists.</li>
        <li>A solution <bcp14>MUST</bcp14> reply with the <xref target="RFC6241" format="default"/> "rpc-error" element containing the "error-tag" value of "operation-not-supported" if an "establish-subscription" request has been received on a NETCONF session where the "create-subscription" RPC has successfully <xref target="RFC5277" format="default"/> created a subscription. </li>
      </ul>
      <t>If a publisher supports this specification but not subscriptions via <xref target="RFC5277" format="default"/>, the publisher <bcp14>MUST NOT</bcp14> advertise "urn:ietf:params:netconf:capability:notification:1.0".</t>
    </section>
    <section numbered="true" toc="default">
      <name>Mandatory XML, event stream and datastore support</name>
      <t>The "encode-xml" feature of <xref target="RFCYYYY" format="default"/> <bcp14>MUST</bcp14> be supported.  This indicates that XML is a valid encoding for RPCs, state change notifications, and subscribed content.</t>
      <t>A NETCONF publisher supporting event stream subscription via <xref target="RFCYYYY" format="default"/> <bcp14>MUST</bcp14> support the "NETCONF" event stream identified in that document.</t>
    </section>
    <section numbered="true" toc="default">
      <name>NETCONF connectivity and the Dynamic Subscriptions</name>
      <t>Management of dynamic subscriptions occurs via RPCs as defined in 
    <xref target="RFCZZZZ" format="default"/> and <xref target="RFCYYYY" format="default"/>. For a dynamic subscription, if the NETCONF session involved with the "establish-subscription" terminates, the subscription <bcp14>MUST</bcp14> be terminated.</t>
      <t>For a dynamic subscription, any "modify-subscription", "delete-subscription", or "resync-subscription" RPCs <bcp14>MUST</bcp14> be sent using the same NETCONF session upon which the referenced subscription was established.</t>
    </section>
    <section numbered="true" toc="default">
      <name>Notification Messages</name>
      <t>Notification messages transported over the NETCONF protocol
      <bcp14>MUST</bcp14> be encoded in a &lt;notification&gt; message as
      defined
      within <xref target="RFC5277" sectionFormat="comma" section="4"/>.
      And per <xref target="RFC5277" format="default"/>'s "eventTime" object
      definition, the "eventTime" is populated with the event occurrence
      time.</t>

      <t>For dynamic subscriptions, all notification messages <bcp14>MUST</bcp14> use the NETCONF transport session used by the "establish-subscription" RPC.</t>
    </section>
    <section numbered="true" toc="default">
      <name>Dynamic Subscriptions and RPC Error Responses</name>
      <t>When an RPC error occurs as defined in <xref target="RFCYYYY" format="default"/> Section 2.4.6 and <xref target="RFCZZZZ" format="default"/> Appendix A, the NETCONF RPC reply <bcp14>MUST</bcp14> include an "rpc-error" element per <xref target="RFC6241" format="default"/> with the error information populated as follows:
    
      </t>
      <ul spacing="compact">
        <li>An "error-type" node of "application".</li>
        <li>An "error-tag" node with the value being a string that corresponds to an identity associated with the error.  For the mechanisms specified in this document, this "error-tag" will come from one of two places.  Either it will correspond to the error identities within <xref target="RFCYYYY" format="default"/> section 2.4.6 for general subscription errors:</li>
      </ul>
      <artwork name="" type="" align="left" alt=""><![CDATA[      
          error identity         uses error-tag
          ---------------------- --------------
          dscp-unavailable       invalid-value
          encoding-unsupported   invalid-value 
          filter-unsupported     invalid-value
          insufficient-resources resource-denied 
          no-such-subscription   invalid-value
          replay-unsupported     operation-not-supported
       ]]></artwork>
      <ul spacing="compact">
        <li>Or this "error-tag" will correspond to the error identities within <xref target="RFCZZZZ" format="default"/> Appendix A.1 for subscription errors specific to YANG datastores:</li>
      </ul>
      <artwork name="" type="" align="left" alt=""><![CDATA[       
          error identity              uses error-tag
          ----------------------      --------------
          cant-exclude                operation-not-supported
          datastore-not-subscribable  invalid-value
          no-such-subscription-resync invalid-value
          on-change-unsupported       operation-not-supported
          on-change-sync-unsupported  operation-not-supported
          period-unsupported          invalid-value
          update-too-big              too-big
          sync-too-big                too-big
          unchanging-selection        operation-failed
       ]]></artwork>
      <ul spacing="compact">
        <li>an "error-severity" of "error" (this MAY be included). </li>
        <li>an "error-app-tag" node with the value being a string that corresponds to
      an identity associated with the error, as defined in 
      <xref target="RFCYYYY" format="default"/> section 2.4.6 for general subscriptions, 
      and <xref target="RFCZZZZ" format="default"/> Appendix A.1, for datastore subscriptions. The specific identity to use depends on the RPC for which the error occurred.  Each error identity will be inserted as the "error-app-tag"  following the form &lt;modulename&gt;:&lt;identityname&gt;.  An example of such as valid encoding would be "ietf-subscribed-notifications:no-such-subscription". Viable errors for different RPCs are as follows:</li>
      </ul>
      <artwork name="" type="" align="left" alt=""><![CDATA[
         RPC                     have base identity
         ----------------------  ----------------------------
         establish-subscription  establish-subscription-error     
         modify-subscription     modify-subscription-error
         delete-subscription     delete-subscription-error    
         kill-subscription       delete-subscription-error
         resync-subscription     resync-subscription-error
            ]]></artwork>
      <ul spacing="compact">
        <li>In case of error responses to an "establish-subscription" or "modify-subscription" request there is the option of including an "error-info" node.  This node may contain XML-encoded data with hints for parameter settings that might lead to successful RPC requests in the future.   Following are the yang-data structures from <xref target="RFCYYYY" format="default"/> 
      and <xref target="RFCZZZZ" format="default"/> which may be returned:</li>
      </ul>
      <artwork name="" type="" align="left" alt=""><![CDATA[    
      establish-subscription returns hints in yang-data structure
      ---------------------- ------------------------------------         
      target: event stream   establish-subscription-stream-error-info
      target: datastore      establish-subscription-datastore-error-info
            
      modify-subscription    returns hints in yang-data structure
      ---------------------- ------------------------------------         
      target: event stream   modify-subscription-stream-error-info
      target: datastore      modify-subscription-datastore-error-info
      ]]></artwork>      

      <t>The yang-data included within "error-info"
      <bcp14>SHOULD NOT</bcp14> include the
      optional leaf "reason", as such a leaf would be redundant
      with information that is already placed within the
      "error-app-tag".</t>

      <t>In case of an rpc error resulting from a "delete-subscription",
      "kill-subscription", or "resync-subscription" request, no "error-info"
      needs to be included, as the "subscription-id" is the only RPC input
      parameter and no hints regarding this RPC input parameters need to be
      provided.</t>
    </section>
    <section numbered="true" toc="default">
      <name>Security Considerations</name>
      <t>This document does not introduce additional Security Considerations for dynamic subscriptions beyond those discussed in <xref target="RFCYYYY" format="default"/>.  But there is one consideration worthy of more refinement based on the connection oriented nature of the NETCONF protocol.  Specifically, if a buggy or compromised NETCONF subscriber sends a number of "establish-subscription" requests, then these subscriptions accumulate and may use up system resources. In such a situation, subscriptions MAY be terminated by terminating the underlying NETCONF session. The publisher MAY also suspend or terminate a subset of the active subscriptions on that NETCONF session in order to reclaim resources and preserve normal operation for the other subscriptions.</t>
    </section>
    <section numbered="true" toc="default">
      <name>IANA Considerations</name>
      <t>This document has no IANA actions.</t>
    </section>

  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119">
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <seriesInfo name="DOI" value="10.17487/RFC2119"/>
            <seriesInfo name="RFC" value="2119"/>
            <seriesInfo name="BCP" value="14"/>
            <author initials="S." surname="Bradner" fullname="S. Bradner">
              <organization/>
            </author>
            <date year="1997" month="March"/>
            <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>
        </reference>
        <reference anchor="RFC5277" target="https://www.rfc-editor.org/info/rfc5277">
          <front>
            <title>NETCONF Event Notifications</title>
            <seriesInfo name="DOI" value="10.17487/RFC5277"/>
            <seriesInfo name="RFC" value="5277"/>
            <author initials="S." surname="Chisholm" fullname="S. Chisholm">
              <organization/>
            </author>
            <author initials="H." surname="Trevino" fullname="H. Trevino">
              <organization/>
            </author>
            <date year="2008" month="July"/>
            <abstract>
              <t>This document defines mechanisms that provide an asynchronous message notification delivery service for the Network Configuration protocol (NETCONF).  This is an optional capability built on top of the base NETCONF definition.  This document defines the capabilities and operations necessary to support this service.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
        </reference>
        <reference anchor="RFC6241" target="https://www.rfc-editor.org/info/rfc6241">
          <front>
            <title>Network Configuration Protocol (NETCONF)</title>
            <seriesInfo name="DOI" value="10.17487/RFC6241"/>
            <seriesInfo name="RFC" value="6241"/>
            <author initials="R." surname="Enns" fullname="R. Enns" role="editor">
              <organization/>
            </author>
            <author initials="M." surname="Bjorklund" fullname="M. Bjorklund" role="editor">
              <organization/>
            </author>
            <author initials="J." surname="Schoenwaelder" fullname="J. Schoenwaelder" role="editor">
              <organization/>
            </author>
            <author initials="A." surname="Bierman" fullname="A. Bierman" role="editor">
              <organization/>
            </author>
            <date year="2011" month="June"/>
            <abstract>
              <t>The Network Configuration Protocol (NETCONF) defined in this document provides mechanisms to install, manipulate, and delete the configuration of network devices.  It uses an Extensible Markup Language (XML)-based data encoding for the configuration data as well as the protocol messages.  The NETCONF protocol operations are realized as remote procedure calls (RPCs).  This document obsoletes RFC 4741.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
        </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>
            <seriesInfo name="DOI" value="10.17487/RFC8174"/>
            <seriesInfo name="RFC" value="8174"/>
            <seriesInfo name="BCP" value="14"/>
            <author initials="B." surname="Leiba" fullname="B. Leiba">
              <organization/>
            </author>
            <date year="2017" month="May"/>
            <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>
        </reference>

  <reference anchor="RFCZZZZ" target="https://www.rfc-editor.org/info/rfcZZZZ">
    <front>
      <title>A YANG Data Model for Subscriptions to YANG Datastores</title>
        <author fullname="A Clemm" initials="Alexander" surname="Clemm"/>
        <author fullname="E Voit" initials="Eric" surname="Voit"/>
        <date month="July" year="2019"/>
      </front>
      <seriesInfo name="RFC" value="ZZZZ"/>
      <seriesInfo name="DOI" value="10.17487/RFCZZZZ"/>
  </reference>

  <reference anchor="RFCYYYY" target="https://www.rfc-editor.org/info/rfcYYYY">
    <front>
      <title>A YANG Data Model for Subscriptions to Event Notifications</title>
      <author fullname="Eric Voit" initials="E" surname="Voit">
        <organization/>
      </author>
      <author fullname="Alexander Clemm" initials="A" surname="Clemm">
        <organization/>
      </author>
      <author fullname="Alberto Gonzalez Prieto" initials="A" surname="Gonzalez Prieto">
        <organization/>
      </author>
      <author fullname="Ambika Prasad Tripathy" initials="A" surname="Tripathy">
        <organization/>
      </author>
      <author fullname="Einar Nilsen-Nygaard" initials="E" surname="Nilsen-Nygaard">
        <organization/>
      </author>
      <date month="July" year="2019"/>
    </front>
    <seriesInfo name="RFC" value="YYYY"/>
    <seriesInfo name="DOI" value="10.17487/RFCYYYY"/>
        </reference>

      </references>
      <references>
        <name>Informative References</name>
        <reference anchor="RFC8347" target="https://www.rfc-editor.org/info/rfc8347">
          <front>
            <title>A YANG Data Model for the Virtual Router Redundancy Protocol (VRRP)</title>
            <seriesInfo name="DOI" value="10.17487/RFC8347"/>
            <seriesInfo name="RFC" value="8347"/>
            <author initials="X." surname="Liu" fullname="X. Liu" role="editor">
              <organization/>
            </author>
            <author initials="A." surname="Kyparlis" fullname="A. Kyparlis">
              <organization/>
            </author>
            <author initials="R." surname="Parikh" fullname="R. Parikh">
              <organization/>
            </author>
            <author initials="A." surname="Lindem" fullname="A. Lindem">
              <organization/>
            </author>
            <author initials="M." surname="Zhang" fullname="M. Zhang">
              <organization/>
            </author>
            <date year="2018" month="March"/>
            <abstract>
              <t>This document describes a data model for the Virtual Router Redundancy Protocol (VRRP).  Both versions 2 and 3 of VRRP are covered.</t>
            </abstract>
          </front>
        </reference>
        <reference anchor="XPATH" target="http://www.w3.org/TR/1999/REC-xpath-19991116">
          <front>
            <title>XML Path Language (XPath) Version 1.0</title>
            <author fullname="J Clark" initials="J" surname="Clark"/>
            <author fullname="S DeRose" initials="S" surname="DeRose"/>
            <date month="November" year="1999"/>
          </front>
        </reference>
      </references>
    </references>
    <section numbered="true" toc="default">
      <name>Examples</name>
      <t>This section is non-normative.  Additionally the subscription "id" values of 22, 23, and 39 used below are just examples. In production, the actual values of "id" may not be small integers.</t>
      <section numbered="true" toc="default">
        <name>Event Stream Discovery</name>
        <t>As defined in <xref target="RFCYYYY" format="default"/> an event stream exposes a continuous set of events available for subscription.  A NETCONF client can retrieve the list of available event streams from a NETCONF publisher using the "get" operation against the top-level container "/streams" defined in <xref target="RFCYYYY" format="default"/> Section 3.1.</t>
        <t>The following example illustrates the retrieval of the list of available event streams:</t>

        <figure anchor="get-streams">
          <name>Get Streams Request</name>
          <sourcecode name="ex-get-streams.xml" type="xml"><![CDATA[
<rpc message-id="101"
  xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <get>
    <filter type="subtree">
      <streams
     xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications"/>
    </filter>
  </get>
</rpc>  ]]></sourcecode>
        </figure>
        <t>After such a request, the NETCONF publisher returns a list of event streams available, as well as additional information which might exist in the container. </t>
      </section>
      <section numbered="true" toc="default">
        <name>Dynamic Subscriptions</name>
        <section numbered="true" toc="default">
          <name>Establishing Dynamic Subscriptions</name>
          <t>The following figure shows two successful "establish-subscription" RPC requests as per <xref target="RFCYYYY" format="default"/>.  The first request is given a subscription "id" of 22, the second, an "id" of 23.</t>
          <figure anchor="mess-flow-establishment">
            <name>Multiple Subscriptions over a NETCONF Session</name>
            <artwork name="" type="" align="left" alt=""><![CDATA[
   +------------+                 +-----------+
   | Subscriber |                 | Publisher |
   +------------+                 +-----------+
         |                              |
         |    Capability Exchange       |
         |<---------------------------->|
         |                              |
         |                              |
         |    establish-subscription    |
         |----------------------------->|  (a)
         | RPC Reply: OK, id = 22       |
         |<-----------------------------|  (b)
         |                              |
         | notification message (for 22)|
         |<-----------------------------|
         |                              |
         |                              |
         |    establish-subscription    |
         |----------------------------->|
         | notification message (for 22)|
         |<-----------------------------|
         | RPC Reply: OK, id = 23       |
         |<-----------------------------|
         |                              |
         |                              |
         | notification message (for 22)|
         |<-----------------------------|
         | notification message (for 23)|
         |<-----------------------------|
         |                              |                
          ]]></artwork>
          </figure>
          <t>To provide examples of the information being transported, example messages for interactions (a) and (b) in  <xref target="mess-flow-establishment" format="default"/> are detailed below:</t>
          <figure anchor="establish-subs">
            <name>&quot;establish-subscription&quot; Request (a)</name>
            <sourcecode name="ex-establish-subscription.xml" type="xml"><![CDATA[
<rpc message-id="102" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <establish-subscription 
      xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
    <stream-xpath-filter xmlns:ex="http://example.com/events">
      /ex:foo/
    </stream-xpath-filter>
    <stream>NETCONF</stream>
    <dscp>10</dscp>
  </establish-subscription>
</rpc>    ]]></sourcecode>
          </figure>
          <t>As NETCONF publisher was able to fully satisfy the request (a), the publisher sends the subscription "id" of the accepted subscription within message (b):</t>
          <figure anchor="positive-establish-subs">
            <name>&quot;establish-subscription&quot; Success (b)</name>
            <sourcecode name="ex-establish-subscription-resp.xml" type="xml"><![CDATA[
<rpc-reply message-id="102" 
  xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <id 
    xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
    22
  </id>
</rpc-reply>
           ]]></sourcecode>
          </figure>
          <t>If the NETCONF publisher had not been able to fully satisfy the request, or subscriber has no authorization to establish the subscription, the publisher would have sent an RPC error response. For instance, if the "dscp" value of 10 asserted by the subscriber in <xref target="establish-subs" format="default"/> proved unacceptable, the publisher may have returned:</t>
          <figure anchor="negative-establish-subs">
            <name>An Unsuccessful Establish Subscription</name>
            <sourcecode name="ex-establish-subscription-err-resp.xml" type="xml"><![CDATA[
<rpc-reply message-id="102" 
  xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <rpc-error>
   <error-type>application</error-type>
   <error-tag>invalid-value</error-tag>
   <error-severity>error</error-severity>
   <error-app-tag>
     ietf-subscribed-notifications:dscp-unavailable
   </error-app-tag>    
  </rpc-error>
</rpc-reply>  ]]></sourcecode>
          </figure>
          <t>The subscriber can use this information in future attempts to establish a subscription.</t>
        </section>
        <section numbered="true" toc="default">
          <name>Modifying Dynamic Subscriptions</name>
          <t>An existing subscription may be modified.  The following exchange shows a negotiation of such a modification via several exchanges between a subscriber and a publisher.  This negotiation consists of a failed RPC modification request/response, followed by a successful one.</t>
          <figure anchor="mess-flow-subs-modification">
            <name>Interaction Model for Successful Subscription Modification</name>
            <artwork name="" type="" align="left" alt=""><![CDATA[         
   +------------+                 +-----------+
   | Subscriber |                 | Publisher |
   +------------+                 +-----------+
         |                              |
         | notification message (for 23)|
         |<-----------------------------|
         |                              |
         | modify-subscription (id = 23)|
         |----------------------------->|  (c)
         | RPC error (with hint)        |
         |<-----------------------------|  (d)
         |                              |
         | modify-subscription (id = 23)|
         |----------------------------->|
         | RPC Reply: OK                |
         |<-----------------------------|
         |                              |
         | notification message (for 23)|
         |<-----------------------------|
         |                              |          
          ]]></artwork>
          </figure>
          <t>If the subscription being modified in <xref target="mess-flow-subs-modification" format="default"/> is a datastore subscription as per <xref target="RFCZZZZ" format="default"/>, the modification request made in (c) may look like that shown in <xref target="simple-modify-subs" format="default"/>.  As can be seen, the modifications being attempted are the application of a new XPath filter as well as the setting of a new periodic time interval.</t>
          <figure anchor="simple-modify-subs">
            <name>Subscription Modification Request (c)</name>
            <sourcecode name="ex-modify-subscription.xml" type="xml"><![CDATA[
<rpc message-id="303"
  xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <modify-subscription
       xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications"
       xmlns:yp="urn:ietf:params:xml:ns:yang:ietf-yang-push">
    <id>23</id>
    <yp:datastore-xpath-filter xmlns:ex="http://example.com/datastore">  
        /ex:foo/ex:bar
    </yp:datastore-xpath-filter>
    <yp:periodic>
      <yp:period>500</yp:period>
    </yp:periodic> 
  </modify-subscription>
</rpc>      ]]></sourcecode>
          </figure>
          <t>If the NETCONF publisher can satisfy both changes, the publisher sends a positive result for the RPC. If the NETCONF publisher cannot satisfy either of the proposed changes, the publisher sends an RPC error response (d).  The following is an example RPC error response for (d) which includes a hint. This hint is an alternative time period value which might have resulted in a successful modification:</t>
          <figure anchor="negative-modify-subs">
            <name>&quot;modify-subscription&quot; Failure with Hint (d)</name>
            <sourcecode name="ex-modify-subscription-err-resp.xml" type="xml"><![CDATA[
<rpc-reply message-id="303"
  xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>invalid-value</error-tag>
    <error-severity>error</error-severity>
    <error-app-tag>
        ietf-yang-push:period-unsupported 
    </error-app-tag>
    <error-info>
      <modify-subscription-datastore-error-info
          xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push">
        <period-hint>
            3000
        </period-hint>
      </modify-subscription-datastore-error-info>
    </error-info>
  </rpc-error>
</rpc-reply>    ]]></sourcecode>
          </figure>
        </section>
        <section numbered="true" toc="default">
          <name>Deleting Dynamic Subscriptions</name>
          <t>The following demonstrates deleting a subscription.  This subscription may have been to either a stream or a datastore.</t>
          <figure anchor="simple-delete-subs">
            <name>&quot;delete-subscription&quot;</name>
            <sourcecode name="ex-delete-subscription.xml" type="xml"><![CDATA[
<rpc message-id="103"
  xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <delete-subscription
    xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
    <id>22</id>
  </delete-subscription>
</rpc>   ]]></sourcecode>  </figure>
          <t>If the NETCONF publisher can satisfy the request, the publisher replies with success to the RPC request.</t>
          <t>If the NETCONF publisher cannot satisfy the request, the publisher sends an error-rpc element indicating the modification didn't work. <xref target="negative-delete-subs" format="default"/> shows a valid response for existing valid subscription "id", but that subscription "id" was created on a different NETCONF transport session:</t>
          <figure anchor="negative-delete-subs">
            <name>Unsuccessful &quot;delete-subscription&quot;</name>
            <sourcecode name="ex-delete-subscription-err-resp.xml" type="xml"><![CDATA[
<rpc-reply message-id="103"
  xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>invalid-value</error-tag>
    <error-severity>error</error-severity>
    <error-app-tag>
        ietf-subscribed-notifications:no-such-subscription
    </error-app-tag>
  </rpc-error>
</rpc-reply>    ]]></sourcecode>
          </figure>
        </section>
      </section>
      <section numbered="true" toc="default">
        <name>Subscription State Notifications</name>
        <t>A publisher will send subscription state notifications for dynamic subscriptions according to the definitions within <xref target="RFCYYYY" format="default"/>.</t>
        <section numbered="true" toc="default">
          <name>subscription-modified</name>
          <t>As per Section 2.7.2 of <xref target="RFCYYYY" format="default"/>, a "subscription-modified" might be sent over NETCONF if the definition of a configured filter changes. A subscription state notification encoded in XML would look like:</t>
          <figure anchor="subscription-modified-ctrl-plane-notif">
            <name>&quot;subscription-modified&quot; Subscription State Notification</name>
        <sourcecode name="ex-subscription-modified-notification.xml" type="xml"><![CDATA[
<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
  <eventTime>2007-09-01T10:00:00Z</eventTime>
  <subscription-modified 
      xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
    <id>39</id>
    <stream-xpath-filter xmlns:ex="http://example.com/events">
      /ex:foo
    </stream-xpath-filter>
    <stream>NETCONF</stream>
  </subscription-modified>
</notification>     ]]></sourcecode>
          </figure>
        </section>
        <section numbered="true" toc="default">
          <name>subscription-resumed, and replay-complete</name>
          <t>A "subscription-resumed" would look like:</t>
          <figure anchor="subscription-resumed">
            <name>&quot;subscription-resumed&quot; Notification in XML</name>
            <sourcecode name="ex-subscription-resumed-notification.xml" type="xml"><![CDATA[
<notification
  xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
  <eventTime>2007-09-01T10:00:00Z</eventTime>
  <subscription-resumed
    xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
    <id>39</id>
  </subscription-resumed>
</notification>      ]]></sourcecode>
          </figure>
          <t>The "replay-complete" is virtually identical, with "subscription-resumed" simply being replaced by "replay-complete".</t>
        </section>
        <section numbered="true" toc="default">
          <name>subscription-terminated and subscription-suspended</name>
          <t>A "subscription-terminated" would look like:</t>
          <figure anchor="subscription-terminated">
            <name>&quot;subscription-terminated&quot; Subscription State Notification</name>
            <sourcecode name="ex-subscription-terminated-notification.xml" type="xml"><![CDATA[
<notification
  xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
  <eventTime>2007-09-01T10:00:00Z</eventTime>
  <subscription-terminated
    xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
    <id>39</id>
    <reason>
       suspension-timeout
    </reason>
  </subscription-terminated>
</notification>  ]]></sourcecode>
          </figure>
          <t>The "subscription-suspended" is virtually identical, with "subscription-terminated" simply being replaced by "subscription-suspended".</t>
        </section>
      </section>
      <section numbered="true" toc="default">
        <name>Filter Examples</name>
        <t>This section provides examples which illustrate both XPath and subtree methods of filtering event record contents.  The examples are based on the YANG notification "vrrp-protocol-error-event" as defined per the ietf-vrrp.yang model within <xref target="RFC8347" format="default"/>.  Event records based on this specification which are generated by the publisher might appear as:</t>
        <figure anchor="VRRP-notification">
          <name>RFC 8347 (VRRP) - Example Notification</name>
          <sourcecode name="ex-vrrp-notification.xml" type="xml"><![CDATA[
<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
  <eventTime>2018-09-14T08:22:33.44Z</eventTime>
  <vrrp-protocol-error-event 
       xmlns="urn:ietf:params:xml:ns:yang:ietf-vrrp">
     <protocol-error-reason>checksum-error</protocol-error-reason>  
  </vrrp-protocol-error-event>
</notification>    ]]></sourcecode>
        </figure>
        <t>Suppose a subscriber wanted to establish a subscription which only passes instances of event records where there is a "checksum-error" as part of a VRRP protocol event.  Also assume the publisher places such event records into the NETCONF stream.  To get a continuous series of matching event records, the subscriber might request the application of an XPath filter against the NETCONF stream.  An "establish-subscription" RPC to meet this objective might be:</t>
        <figure anchor="VRRP-XPATH">
          <name>Establishing a Subscription Error Reason via XPath</name>
          <sourcecode name="ex-establish-subscription-xpath.xml" type="xml"><![CDATA[
<rpc message-id="601" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <establish-subscription
    xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
    <stream>NETCONF</stream>
    <stream-xpath-filter xmlns="urn:ietf:params:xml:ns:yang:ietf-vrrp">
      /vrrp-protocol-error-event[
         vrrp:protocol-error-reason="vrrp:checksum-error"]
    </stream-xpath-filter>
  </establish-subscription>
</rpc>    ]]></sourcecode>
        </figure>
        <t>For more examples of XPath filters, see <xref target="XPATH" format="default"/>.</t>
        <t>Suppose the "establish-subscription" in <xref target="VRRP-XPATH" format="default"/> was accepted. And suppose later a subscriber decided they wanted to broaden this subscription cover to all VRRP protocol events (i.e., not just those with a "checksum error").  The subscriber might attempt to modify the subscription in a way which replaces the XPath filter with a subtree filter which sends all VRRP protocol events to a subscriber. Such a "modify-subscription" RPC might look like:</t>
        <figure anchor="VRRP-Subtree"> 
        <name>"Example &quot;modify-subscription&quot; RPC"</name>
          <sourcecode name="ex-establish-subscription-subtree.xml" type="xml"><![CDATA[ 
<rpc message-id="602" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <modify-subscription
     xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
    <id>99</id>
    <stream-subtree-filter>
     <vrrp-protocol-error-event 
            xmlns="urn:ietf:params:xml:ns:yang:ietf-vrrp"/>
    </stream-subtree-filter>
  </modify-subscription>
</rpc>
         ]]></sourcecode>
        </figure>
        <t>For more examples of subtree filters, see <xref target="RFC6241" format="default"/>, section 6.4.</t>
      </section>
    </section>

    <section numbered="false" toc="default">
      <name>Acknowledgments</name>
      <t>We wish to acknowledge the helpful contributions, comments, and suggestions that were received from: Andy Bierman, Yan Gang, Sharon Chisholm, Hector Trevino, Peipei Guo, Susan Hares, Tim Jenkins, Balazs Lengyel, Martin Bjorklund, Mahesh Jethanandani, Kent Watsen, Qin Wu, and Guangying Zheng.</t>
    </section>

  </back>
</rfc>
