<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="2"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-ietf-netconf-netconf-event-notifications-05"
     ipr="trust200902">
<front>
    <title abbrev="NETCONF-notifications">NETCONF Support for Event Notifications</title>

      
        <author fullname="Alberto Gonzalez Prieto" initials="A"
            surname="Gonzalez Prieto">
            <organization>VMware</organization>
            <address>
                <email>agonzalezpri@vmware.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="Eric Voit" initials="E." surname="Voit">
            <organization>Cisco Systems</organization>
            <address>
                <email>evoit@cisco.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 day="2" month="October" year="2017"/>

        <area>Operations &amp; Management</area>

        <workgroup>NETCONF</workgroup>

        <keyword>Draft</keyword>

    <abstract>
        <t>This document defines how to transport network subscriptions and event messages on top of the Network Configuration protocol (NETCONF). This includes the full set of RPCs, subscription state changes, and subscribed content needing asynchronous delivery.</t>
    </abstract>
</front>

<middle>
  <section title="Introduction">
       
    <t>This document defines mechanisms that provide a subscription and asynchronous message notification delivery service for the NETCONF protocol <xref target="RFC6241"/> based on <xref target="subscribe"/>. This is an optional capability built on top of the base NETCONF definition. </t>
					
  </section>

  <section title="Terminology">
    <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">RFC 2119</xref>.</t>

    <t>The following terms are defined in <xref target="RFC6241"/>: client, server, operation, RPC.</t>
			
	<t>The following terms are defined in <xref target="subscribe"/>: event, event notification, stream, publisher, receiver, subscriber, subscription, configured subscription.</t> 

	<t>Note that a publisher in <xref target="subscribe"/> corresponds to a server in <xref target="RFC6241"/>.  Similarly, a subscriber corresponds to a client.  A receiver is also a client.  In the remainder of this document, we will use the terminology in <xref target="RFC6241"/>.</t>
  </section>

  <section title="Solution">  
    <t>In this section, we describe and exemplify how <xref target="subscribe"/> is to be supported over NETCONF.</t>
    
    <section title="Event Stream Discovery">
        <t>In the context of <xref target="subscribe"/> 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 server using the "get" operation against   
        the top-level container "/streams" defined in <xref target="subscribe"/>. The reply includes the list of streams supported on the NETCONF server.</t>
			
		<t>The following example illustrates the retrieval of the list of available event streams using the &lt;get&gt; operation.</t>
			
        <figure align="center" anchor="get-streams" title="Get streams request">       
			<artwork><![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-yang-push:1.0"/>
         </filter>
     </get>
   </rpc>
            ]]></artwork>
        </figure>
			
        <t>The NETCONF server returns a list of event streams available.  In this example, the list contains the NETCONF, SNMP, and SYSLOG streams.</t>
			
        <figure align="center" 
                anchor="get-streams-resp" 
                title="Get streams response">       
            <artwork><![CDATA[
   <rpc-reply message-id="101"
           xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <data>
       <streams
          xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
         <stream>
           <stream>NETCONF</stream>
           <description>The NETCONF mandatory event stream</description>
         </stream>
         <stream>
           <stream>SNMP</stream>
           <description>The SNMP event stream</description>
         </stream>
         <stream>
           <stream>SYSLOG</stream>
           <description>The SYSLOG event stream</description>
           <replay-support/>
           <replay-log-creation-time>
             2015-03-09T19:14:55.233Z</replay-log-creation-time>
         </stream>
       </streams>  
     </data>
   </rpc-reply>
            ]]></artwork>
        </figure>

		<t>For <xref target="yang-push"/>, a similar get is needed to retrieve available datastore names.</t>
                
    </section>
            
    <section title="Mandatory NETCONF support">
        <t>A NETCONF server implementation supporting <xref target="subscribe"/> must support dynamic subscriptions and the "NETCONF" notification event stream. 
        The NETCONF event stream contains all NETCONF XML event information supported by the server.</t>
		<t>A NETCONF server implementation supporting <xref target="yang-push"/> must support the "running" datastore.</t>
    </section>
            
	<section title="Dynamic Subscriptions">
		<section title="Establishing Dynamic Subscriptions">
		
			<t>The dynamic subscription RFC and interactions operation is defined in <xref target="subscribe"/>. </t>
		
			<section title="Usage Example">
				<t>An example of interactions over NETCONF transport for one sample subscription is below:</t>
			
				<figure align="center" anchor="establish-subs" title="establish-subscription over NETCONF"> 
					<artwork><![CDATA[
   <netconf:rpc netconf:message-id="102"
          xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
     <establish-subscription
              xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
        <stream>NETCONF</stream>
        <event-filter-type>xpath-event-filter</event-filter-type>
        <event-filter-contents xmlns:ex="http://example.com/event/1.0"
                select="/ex:event[ex:eventClass='fault' and
                         (ex:severity='minor' or ex:severity='major'
                          or ex:severity='critical')]" />
     </establish-subscription>
   </netconf:rpc>
                    ]]></artwork>
				</figure>
			</section>
                
			<section title="Positive Response">
				<t>If the NETCONF server can satisfy the request, the server sends a positive &lt;subscription-result&gt; element, and the subscription-id of the accepted subscription.</t>
				
				<figure align="center" anchor="positive-establish-subs" title="Successful establish-subscription">       
					<artwork><![CDATA[
   <rpc-reply message-id="102"
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <subscription-result
             xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
       ok
     </subscription-result>
     <identifier
             xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
       52
     </identifier>
   </rpc-reply>
                    ]]></artwork>
				</figure>                
			</section>
                
			<section title="Negative Response">
				<t>If the NETCONF server cannot satisfy the request, or the client has no authorization to establish the subscription, the server will send a negative &lt;subscription-result&gt; element. For instance:</t>
			
				<figure align="center" anchor="negative-establish-subs" title="Unsuccessful establish subscription">       
					<artwork><![CDATA[
   <rpc-reply message-id="103"
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <subscription-result
              xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
       stream-unavailable
     </subscription-result>
   </rpc-reply>
                    ]]></artwork>
				</figure>
			</section>
			<section title="Subscription Negotiation">
				<t>If the client request includes parameters the NETCONF server cannot serve, the negative &lt;subscription-result&gt; may include hints at subscription
       				parameters which would have been accepted. For instance, consider the following subscription from <xref target="yang-push"/>, which augments the establish-subscription with some additional parameters, including "period". If the client requests a period which the NETCONF server cannot serve, the back-and-forth exchange may be:</t>
           
				<figure align="center" anchor="negotiate-establish-subs" title="Subscription establishment negotiation">       
					<artwork><![CDATA[
   <netconf:rpc message-id="101"
      xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
      <establish-subscription
            xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
         <datastore>running</datastore>
         <event-filter-type>
           subtree</event-filter-type>
         <event-filter-contents 
               xmlns:ex="http://example.com/sample-data/1.0">
               select="/ex:foo" />
         <dampening-period>10</dampening-period>
         <encoding>encode-xml</encoding>
      </establish-subscription>
   </netconf:rpc>

   <rpc-reply message-id="101"
         xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <subscription-result
           xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
       error-insufficient-resources
     </subscription-result>
     <period-hint
           xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
       2000
     </period-hint>
   </rpc-reply>
                    ]]></artwork>
				</figure>                
			</section>  

			<section title="Message Flow Examples">
				<figure anchor = "mess-flow-subs-establishment-single-session" 
                            title="Multiple subscription establishments over a single NETCONF session">
					<artwork><![CDATA[
                               
+------------+                 +-----------+      
|   Client   |                 |   Server  |      
+------------+                 +-----------+      
      |                              |            
      |    Capability Exchange       |            
      |<---------------------------->|            
      |                              |            
      |                              |            
      |    Establish Subscription    |            
      |----------------------------->|            
      | RPC Reply: OK, id = 22       |            
      |<-----------------------------|            
      |                              |            
      |  Notification (id 22)        |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |    Establish Subscription    |            
      |----------------------------->|            
      | RPC Reply: OK, id = 23       |            
      |<-----------------------------|            
      |                              |                     
      |                              |            
      |  Notification (id 22)        |            
      |<-----------------------------|    
      |  Notification (id 23)        |            
      |<-----------------------------|            
      |                              |            
      |                              |                    
                    ]]></artwork>
				</figure>
			</section>
		</section>
            
        <section title="Modifying a Subscription">
                <t>This operation is defined in <xref target="subscribe"/>.</t>
				
            <section title="Usage Example">
                <t>The following demonstrates modifying a subscription. Consider a subscription from <xref target="yang-push"/>, which augments the establish-subscription with some additional parameters, including "period". A subscription may be established and modified as follows.</t>
                    
                <figure align="center" anchor="simple-modify-subs" title="Subscription modification">       
                    <artwork><![CDATA[
   <netconf:rpc message-id="101"
          xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
     <establish-subscription
              xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">   
        <datastore xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push">
           running</datastore>
        <event-filter-type>subtree-event-filter</event-filter-type>
        <event-filter-contents 
          xmlns:ex="http://example.com/sample-data/1.0">
          select="/ex:foo" />
        <period xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
            1000
        </period>
     </establish-subscription>
   </netconf:rpc>

   <rpc-reply message-id="101"
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <subscription-result
              xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
       ok
     </subscription-result>
     <identifier
              xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
       1922
     </identifier>
   </rpc-reply>


   <netconf:rpc message-id="102"
          xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
     <modify-subscription
              xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
       <identifier>1922</identifier>
       <period>100</period>
     </modify-subscription>
   </netconf:rpc>

                        ]]></artwork>
                </figure>
            </section>
                
            <section title="Positive Response">
                <t>If the NETCONF server can satisfy the request, the server sends a positive &lt;subscription-result&gt; element. This response is like that to an establish-subscription request, but without the subscription identifier.</t>
                    
				<figure align="center" anchor="positive-modify-subs" title="Successful modify subscription">       
                    <artwork><![CDATA[
   <rpc-reply message-id="102"
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <subscription-result
              xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
       ok
     </subscription-result>
   </rpc-reply>

                    ]]></artwork>
                </figure>                
            </section>
                
            <section title="Negative Response">
                <t>If the NETCONF server cannot satisfy the request, the server sends a negative &lt;subscription-result&gt; element. Its contents and semantics are identical to those in an establish-subscription request. For instance:</t>
            
				<figure align="center" anchor="negative-modify-subs" title="Unsuccessful modify subscription">       
                
					<artwork><![CDATA[
   <rpc-reply message-id="102"
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <subscription-result
              xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">  
       period-unsupported
     </subscription-result>
     <period-hint>500</period-hint>
   </rpc-reply>

                    ]]></artwork>
                </figure>                
            </section> 
			
            <section title="Message Flow Example">
                <figure anchor = "mess-flow-subs-modification"
                        title="Message flow for successful subscription modification">
                    <artwork><![CDATA[                  
+------------+                 +-----------+      
|   Client   |                 |   Server  |      
+------------+                 +-----------+      
      |                              |            
      |    Capability Exchange       |            
      |<---------------------------->|            
      |                              |                   
      |    Establish Subscription    |            
      |----------------------------->|
      | RPC Reply: OK, id = 22       |            
      |<-----------------------------|                     
      |                              |            
      |  Notification (id 22)        |            
      |<-----------------------------|                      
      |                              |            
      | Modify Subscription (id 22)  |            
      |----------------------------->|            
      | RPC Reply: OK                |            
      |<-----------------------------|           
      |                              |            
      |  Notification (id 22)        |            
      |<-----------------------------|                       
      |                              |            
                    ]]></artwork>
                </figure>
            </section>
        </section>
           
        <section title="Deleting a Subscription">
            <t>This operation is defined in <xref target="subscribe"/> for events, and enhanced in <xref target="yang-push"/> for datastores.</t>
            
			<section title="Usage Example">
                <t>The following demonstrates deleting a subscription.</t>
                    
                <figure align="center" anchor="simple-delete-subs" title="Delete subscription"> 
                    <artwork><![CDATA[
   <netconf:rpc message-id="101"
          xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
     <delete-subscription
              xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
       <identifier>1922</identifier>
     </delete-subscription>
   </netconf:rpc>   
                    ]]></artwork>
                </figure>
            </section>
                
            <section title="Positive Response">
                <t>If the NETCONF server can satisfy the request, the server sends a positive &lt;subscription-result&gt; element. For example:</t>
                
				<figure align="center" anchor="positive-delete-subs" title="Successful delete subscription">       
                    <artwork><![CDATA[
   <rpc-reply message-id="103"
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <subscription-result
             xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
       ok
     </subscription-result>
   </rpc-reply>
                    ]]></artwork>
                </figure>                
            </section>
                
            <section title="Negative Response">
                <t>If the NETCONF server cannot satisfy the request, the server sends an &lt;subscription-result&gt; element indicating the deletion was not performed. For example:</t>
                			
                <figure align="center" anchor="negative-delete-subs" title="Unsuccessful delete subscription">
                   <artwork><![CDATA[
   <rpc-reply message-id="101"
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <subscription-result
             xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
       no-such-subscription
     </subscription-result>
   </rpc-reply>
                    ]]></artwork>
                </figure>                
            </section>  
        </section>
	</section>
            
    <section title="Configured Subscriptions">
            
		<t>Configured subscriptions are established, modified, and deleted using configuration operations against the top-level subtree of <xref target="subscribe"/> or <xref target="yang-push"/> via configuration interface. This document covers configured subscriptions where the chosen protocol to send the notifications to the receivers is NETCONF.</t>
		<t>Configured subscriptions are supported by NETCONF servers using NETCONF Call Home <xref target="RFC8071"/>.</t>
		<t>Any configuration interface can be used to set a configured subscription that uses NETCONF to push notifications to receivers. Without loss of generality, the examples in this section, use a NETCONF interface to configure the subscriptions</t>

		<section title="Establishing a Configured Subscription" anchor="sec_establish_config_subs">
				                         
			<t>For subscription establishment, a NETCONF client may send:</t>
                
			<figure align="center" anchor="establish-config-subs" title="Establish configured subscription">       
                <artwork><![CDATA[
   <rpc message-id="101"
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <edit-config>
       <target>
         <running/>
       </target>
       <subscription-config
               xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
         <subscription>
           <identifier>
             1922
           </identifier>
           <stream>
             foo
           </stream>
           <receiver>
             <address>
               1.2.3.4
             </address>
             <port>
               1234
             </port>
             <protocol>
               netconf
             </protocol>
           </receiver>
         </subscription>
       </subscription-config>
     </edit-config>
   </rpc>

                ]]></artwork>
            </figure>
					
            <t>if the request is accepted, the server would reply:</t>
                    
			<figure align="center" anchor="success-establish-config-subs" title="Response to a successful configuration subscription establishment">       
                <artwork><![CDATA[
   <rpc-reply message-id="101"
             xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <ok/>
   </rpc-reply>

                ]]></artwork>
            </figure>
					
            <t>if the request is not accepted because the server cannot serve it, no configuration is changed.  Int this case the server may reply:</t>
					
            <figure align="center" anchor="failed-establish-config-subs" title="Response to a failed configured subscription establishment">       
                <artwork><![CDATA[
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <subscription-result
             xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
    error-insufficient-resources
  </subscription-result>
</rpc-reply>
                ]]></artwork>
            </figure>
					
			<t>For every configured receiver, once NETCONF transport session between the server and the receiver is recognized as active, the server will issue a "subscription-started" notification.  After that, the server will send notifications to the receiver as per the subscription notification.
			Note that the server assumes that the receiver is ready to accept notifications on the NETCONF session. This may require coordination between the client that configures the subscription and the clients for which the notifications are intended. This coordination is out of the scope of this document.</t>
			<t>The session is only intended for pushing notifications. Client requests on that session SHOULD be ignored by the server.</t>
			<t>The contents sent by the server on the Call Home session, once established, are identical to those in a dynamic subscription.</t>
					
					
			<t></t>
					
		</section>
			
		<section title="Call Home for Configured Subscriptions" anchor="call-home-config">
            <t>Once the subscription configuration is active, if NETCONF transport is needed but does not exist to one or more target IP address plus port, the server initiates a transport session via <xref target="RFC8071"/> to those receiver(s) in the subscription using the address and port specified.</t>

		</section>

        <section title="Full Establish Message Flow">
            <figure anchor = "mess-flow-subs-establishment-config" 
                    title="Message flow for configured subscription establishment">
                <artwork><![CDATA[                               
+----------+                 +-----------+     +---------+  +---------+
|  Client  |                 |   Server  |     | Rcver A |  | Rcver B |       
+----------+                 +-----------+     +---------+  +---------+
      |                            |                |            |
      |    Capability Exchange     |                |            |            
      |<-------------------------->|                |            |            
      |                            |                |            |            
      |                            |                |            |            
      |        Edit-config         |                |            |            
      |--------------------------->|                |            |            
      |       RPC Reply: OK        |                |            |            
      |<---------------------------|                |            |  
      |                            |   Call Home    |            |            
      |                            |<-------------->|            |
      |                            |<--------------------------->|            
      |                            |                |            |            
      |                            |  Subscription  |            |            
      |                            |  Started       |            |    
      |                            |  (id 22)       |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |            
      |                            |  Notification  |            |            
      |                            |  (id 22)       |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |            
                ]]></artwork>
            </figure>
        </section>
                
        <section title="Modifying a Configured Subscription">
            <t>Configured subscriptions can be modified using configuration operations against the top-level subtree subscription-config.</t>
				
            <t>For example, the subscription established in the previous section could be modified as follows, choosing a different receiver:</t>
                
			<figure align="center" anchor="modify-configured-subs" title="Modify configured subscription">       
                    
				<artwork><![CDATA[
   <rpc message-id="102"
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <edit-config>
       <target>
         <running/>
       </target>
       <subscription-config
               xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
         <subscription>
           <identifier>
             1922
           </identifier>
           <stream>
             foo
           </stream>
           <receiver>
             <address>
               1.2.3.5
             </address>
             <port>
               1234
             </port>
           </receiver>
         </subscription>
       </subscription-config>
     </edit-config>
   </rpc>
                ]]></artwork>
            </figure>
                
			<t>if the request is accepted, the server would reply:</t>
                
			<figure align="center" anchor="success-modify-configured-subs" title="A successful configured subscription modification">                           
				<artwork><![CDATA[
   <rpc-reply message-id="102"
             xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <ok/>
   </rpc-reply>
                ]]></artwork>
            </figure>                                        
                
			<section title="Message Flow Example">
                <figure anchor = "mess-flow-subs-modification-configured"
                        title="Message flow for subscription modification (configured subscription)">
                    <artwork><![CDATA[                               
+----------+                 +-----------+     +---------+  +---------+
|  Client  |                 |   Server  |     | Rcver A |  | Rcver B |       
+----------+                 +-----------+     +---------+  +---------+
      |                            |                |            |
      |    Capability Exchange     |                |            |            
      |<-------------------------->|                |            |            
      |                            |                |            |            
      |                            |                |            |            
      |        Edit-config         |                |            |            
      |--------------------------->|                |            |            
      |       RPC Reply: OK        |                |            |            
      |<---------------------------|                |            |  
      |                            |   Call Home    |            |            
      |                            |<-------------->|            |
      |                            |<--------------------------->|            
      |                            |                |            |            
      |                            |  Subscription  |            |            
      |                            |  Started       |            |   
      |                            |  (id 22)       |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |            
      |                            |  Notification  |            | 
      |                            |  (id 22)       |            |                       
      |                            |--------------->|            |            
      |                            |---------------------------->|           
      |                            |                |            |            
      |        Edit-config         |                |            |            
      |--------------------------->|                |            |            
      |       RPC Reply: OK        |                |            |            
      |<---------------------------|                |            |                      
      |                            |  Subscription  |            |            
      |                            |  Modified      |            |    
      |                            |  (id 22)       |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |            
      |                            |  Notification  |            |            
      |                            |  (id 22)       |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |            

                    ]]></artwork>
                </figure>
            </section>
        </section>
                    
        <section title="Deleting a Configured Subscription">
            <t>Subscriptions can be deleted using configuration operations against the top-level subtree subscription-config. For example:</t>
                    
			<figure align="center" anchor="delete-configured-subs" title="Deleting a configured subscription">       
                <artwork><![CDATA[
   <rpc message-id="103"
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <edit-config>
       <target>
         <running/>
       </target>
       <subscription-config
           xmlns:xc="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
         <subscription xc:operation="delete">
           <identifier>
             1922
           </identifier>
         </subscription>
       </subscription-config>
     </edit-config>
   </rpc>

   <rpc-reply message-id="103"
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <ok/>
   </rpc-reply>

                ]]></artwork>
            </figure>
					
            <section title="Message Flow Example">
                <figure anchor = "mess-flow-subs-deletion-configured"
                         title="Message flow for subscription deletion (configured subscription)">
                    <artwork><![CDATA[
                               
+----------+                 +-----------+     +---------+  +---------+
|  Client  |                 |   Server  |     | Rcver A |  | Rcver B |       
+----------+                 +-----------+     +---------+  +---------+
      |                            |                |            |
      |    Capability Exchange     |                |            |            
      |<-------------------------->|                |            |            
      |                            |                |            |            
      |                            |                |            |            
      |        Edit-config         |                |            |            
      |--------------------------->|                |            |            
      |       RPC Reply: OK        |                |            |            
      |<---------------------------|                |            |  
      |                            |   Call Home    |            |            
      |                            |<-------------->|            |
      |                            |<--------------------------->|            
      |                            |                |            |            
      |                            |  Subscription  |            |            
      |                            |  Started       |            |       
      |                            |  (id 22)       |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |
      |                            |                |            |  
      |                            |  Notification  |            |            
      |                            |  (id 22)       |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |            
      |        Edit-config         |                |            |            
      |--------------------------->|                |            |            
      |       RPC Reply: OK        |                |            |            
      |<---------------------------|                |            |                     
      |                            |  Subscription  |            |            
      |                            |  Terminated    |            |    
      |                            |  (id 22)       |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|         
      |                            |                |            |            
                    ]]></artwork>
                </figure>
            </section>

        </section>
        
        <section title="Event (Data Plane) Notifications">
            <t>Once a dynamic or configured subscription has been created, the NETCONF server sends (asynchronously) event notifications from the subscribed stream to receiver(s) over NETCONF. We refer to these as data plane notifications.
            The data model for Event Notifications is defined in <xref target="subscribe"/>.</t>

            <t>The following is an example of an event notification from <xref target="RFC6020"/>:</t>
				
            <figure align="center" anchor="link-failure-notif" title="Definition of an event notification">       
                <artwork><![CDATA[
   notification link-failure {
     description "A link failure has been detected";
       leaf if-name {
         type leafref {
           path "/interface/name";
         }
       }
       leaf if-admin-status {
         type admin-status;
       }
       leaf if-oper-status {
         type oper-status;
       }
   }
                ]]></artwork>
            </figure>
                
			<t>This notification might result in the following, prior to it being placed into NETCONF.  Note that the mandatory eventTime and Subscription id have been added.</t>	
			
            <figure align="center" anchor="simple-data-plane-notif" title="Event notification">       
                <artwork><![CDATA[
   <notification
          xmlns=" urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
     <eventTime>2007-09-01T10:00:00Z</eventTime>
     <link-failure xmlns="http://acme.example.com/system">
       <if-name>so-1/2/3.0</if-name>
       <if-admin-status>up</if-admin-status>
       <if-oper-status>down</if-oper-status>
     </link-failure>
   </notification>
                ]]></artwork>
            </figure>
                
        </section>
        
        <section title="Subscription State Notifications">
            <t> In addition to data plane notifications, a publisher may send subscription state notifications (defined in <xref target="subscribe"/>) to indicate to receivers that an event related to the subscription management has occurred.
            Subscription state notifications cannot be filtered out. Next we exemplify them: </t>
           
            <section title="subscription-started and subscription-modified">
                    
				<t>A subscription-started would look like:</t>	
						
				<figure align="center" anchor="subscription-started-ctrl-plane-notif" 
                        title="subscription-started subscription state notification">       
                    <artwork><![CDATA[
  <notification
      xmlns=" urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
    <eventTime>2007-09-01T10:00:00Z</eventTime>
    <subscription-started
          xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0"/>
      <identifier>39</identifier>
      <stream>NETCONF</stream>
    </subscription-started/>
  </notification>

                    ]]></artwork>
				</figure>

				<t>The subscription-modified is identical, with just the word "started" being replaced by "modified".</t>
                    
			</section>
                
			<section title="subscription-completed, subscription-resumed, and replay-complete">
				<t>A subscription-completed would look like:</t>	
				
				<figure align="center" 
                            anchor="subscription-completed-XML" 
                            title="subscription-completed notification in XML">       
					<artwork><![CDATA[
  <notification
      xmlns=" urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
    <eventTime>2007-09-01T10:00:00Z</eventTime>
    <subscription-completed
          xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
      <identifier>39</identifier>
    </subscription-completed>
  </notification>
                    ]]></artwork>
				</figure>

				<t>The equivalent using JSON encoding would be:</t>	
				
				<figure align="center" 
                        anchor="subscription-completed-JSON" 
                        title="subscription-completed notification in JSON">       
					<artwork><![CDATA[
   <notification
          xmlns=" urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
     <eventTime>2007-09-01T10:00:00Z</eventTime>
     <notification-contents-json>
          {
             "sn:subscription-completed": { 
             "identifier" : 39
           }
     </notification-contents-json>
   </notification>
                    ]]></artwork>
				</figure>
                
				<t>The subscription-resumed and replay-complete are virtually identical, with "subscription-completed" simply being replaced by "subscription-resumed" and "replay-complete" in both encodings.</t>

			</section>

			<section title="subscription-terminated and subscription-suspended">
			
				<t>A subscription-terminated would look like:</t>	
				
				<figure align="center" 
                        anchor="subscription-modified-ctrl-plane-notif" 
                         title="subscription-modified subscription state notification">       
					<artwork><![CDATA[
  <notification
      xmlns=" urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
    <eventTime>2007-09-01T10:00:00Z</eventTime>
    <subscription-terminated
          xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
      <identifier>39</identifier>
      <error-id>error-insufficient-resources</error-id>
    </subscription-terminated>
  </notification> 
                    ]]></artwork>
				</figure>
                
				<t>The above, and the subscription-suspended are virtually identical, with "subscription-terminated" simply being replaced by "subscription-suspended".</t>

			</section>
			
			<section title="Notification Message Flow Examples">
				<figure anchor = "mess-flow-suspeded-resumed-notif"
                        title="subscription-suspended and resumed notifications">
					<artwork><![CDATA[
                               
+------------+                 +-----------+      
|   Client   |                 |   Server  |      
+------------+                 +-----------+      
      |                              |            
      |    Capability Exchange       |            
      |<---------------------------->|            
      |                              |                     
      |    Establish Subscription    |            
      |<---------------------------->|                    
      |                              |                 
      |        Notification          |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |   Subscription Suspended     |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |                              |            
      |    Subscription Resumed      |            
      |<-----------------------------|            
      |                              |                      
      |        Notification          |            
      |<-----------------------------|            
      |                              |                       
                    ]]></artwork>
				</figure>
                
				<figure anchor = "mess-flow-suspeded-resumed-notif-configured"
						title="Suspended and resumed notifications for a single configured receiver">
					<artwork><![CDATA[
                               
+----------+                 +-----------+     +---------+  +---------+
|  Client  |                 |   Server  |     | Rcver A |  | Rcver B |       
+----------+                 +-----------+     +---------+  +---------+
      |                            |                |            |
      |    Capability Exchange     |                |            |            
      |<-------------------------->|                |            |                     
      |                            |                |            |            
      |        Edit-config         |                |            |            
      |--------------------------->|                |            |            
      |       RPC Reply: OK        |                |            |            
      |<---------------------------|                |            |            
      |                            |  Subscription  |            |            
      |                            |  Started       |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |
      |                            |  Notification  |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |
      |                            |  Subscription  |            |            
      |                            |  Suspended     |            |            
      |                            |--------------->|            |            
      |                            |                |            |
      |                            |  Notification  |            |                      
      |                            |---------------------------->|
      |                            |                |            |
      |                            |  Subscription  |            |            
      |                            |  Resumed       |            |            
      |                            |--------------->|            |            
      |                            |                |            |
      |                            |  Notification  |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |            
                    ]]></artwork>
				</figure>
			</section>
		</section>
	</section>

  </section>
  
  <section title="Interleave Capability">
  	<t> The :interleave capability is originally defined in <xref target="RFC5277"/>. It is incorporated in this document with essentially the same semantics. That is, 
  	the NETCONF server MUST receive, process, and respond to NETCONF requests on a session with active notification subscriptions.</t>
  	<t>The :interleave capability is identified by the following string: urn:ietf:params:netconf:capability:interleave:1.0 </t> 
  	<t>Note that subscription operations MUST be received, processed, and responded on a session with active notification subscriptions
  	That mandatory requirement together with the :interleave capability permits a client performing all operations against a server using a single connection, 
  	allowing for better scalability with respect to the number of NETCONF sessions required to manage an entity.</t>
  	
  </section>
  <section title="Security Considerations">
			
        <t>The &lt;notification&gt; elements are never sent before the transport layer and the NETCONF layer, including capabilities exchange, have been established and the manager has been identified and authenticated.</t>
			
        <t>A secure transport must be used and the server must ensure that the user has sufficient authorization to perform the function they are requesting against the specific subset of content involved.</t>
			
        <t>The contents of notifications, as well as the names of event streams, may contain sensitive information and care should be taken to ensure that they are viewed only by authorized users.  The NETCONF server MUST NOT include any content in a notification that the user is not authorized to view.</t>
			
        <t>If a malicious or buggy NETCONF client sends a number of &lt;establish-subscription&gt;requests, then these subscriptions accumulate and may use up system resources.  In such a situation, subscriptions MAY be terminated by terminating the suspect underlying NETCONF sessions.  The server MAY also suspend or terminate a subset of the active subscriptions on the NETCONF session .</t>
			
        <t>Configured subscriptions from one or more publishers could be used to overwhelm a receiver, which perhaps doesn't even support subscriptions.  Clients that do not want pushed data need only terminate or refuse any transport sessions from the publisher.</t>

		<t>The NETCONF Authorization Control Model <xref target="RFC6536"/> SHOULD be used to control and restrict authorization of subscription configuration. This control models permits specifying per-user permissions to receive specific event notification types. The permissions are specified as a set of access control rules.</t>
  </section>
        
  <section title = "Acknowledgments">
     <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, Kent Watsen, and Guangying Zheng.</t>
  </section>
        
</middle>

<back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119"?>
      <?rfc include="reference.RFC.5277"?>
      <?rfc include="reference.RFC.6020"?>
      <?rfc include="reference.RFC.6241"?>
      <?rfc include="reference.RFC.6536"?>
	  <?rfc include="reference.RFC.8071"?>
    </references>    

    <references title="Informative References">
      <reference anchor="yang-push"
                 target="https://datatracker.ietf.org/doc/draft-ietf-netconf-yang-push/">
        <front>
          <title>Subscribing to YANG datastore push updates</title>

          <author fullname="Alexander Clemm" initials="A" surname="Clemm">
          </author>

          <author fullname="Alberto Gonzalez Prieto" initials="A"
                  surname="Gonzalez Prieto">
          </author>

          <author fullname="Eric Voit" initials="Eric" surname="Voit">
          </author>

          <author fullname="Ambika Prasad Tripathy" initials="A" surname="Tripathy">
          </author>
      
          <author fullname="Einar Nilsen-Nygaard" initials="E"
            surname="Nilsen-Nygaard">
         </author>
         <author fullname="Andy Bierman" initials="A"
            surname="Bierman">
         </author>
         
         <author fullname="Balazs Lengyel" initials="B"
            surname="Lengyel">
         </author>
         
         <date month="September" year="2017"/>
        </front>
      </reference>
        

      <reference anchor="subscribe"
                 target="https://datatracker.ietf.org/doc/draft-ietf-netconf-subscribed-notifications/">
        <front>
          <title>Custom Subscription to Event Notifications</title>

		  <author fullname="Eric Voit" initials="Eric" surname="Voit">
          </author>
		  
          <author fullname="Alexander Clemm" initials="A" surname="Clemm">
          </author>

            
          <author fullname="Alberto Gonzalez Prieto" initials="A"
                  surname="Gonzalez Prieto">
          </author>

          <author fullname="Einar Nilsen-Nygaard" initials="E" surname="Nilsen-Nygaard">
          </author>
            
          <author fullname="Ambika Prasad Tripathy" initials="A" surname="Tripathy">
          </author>
                        
          <date month="September" year="2017"/>
        </front>
      </reference>  
    </references>	  




     <section title="Open Items">
        <t>(To be removed by RFC editor prior to publication)</t>
        <t><list style="symbols">
			<t>Formal definition of: notification-contents-json, and incorporation of the subscription-id in the notifications. It depends on the formal definition of the notification element</t>
        </list></t>
    </section>
    <section title="Changes between revisions">
        <t>(To be removed by RFC editor prior to publication)</t>
		<section title="v04 to v05">
            <t><list style="symbols">
            	<t>Text presentation modifications throughout</t>
            	<t>Modified examples to match the namespace, prefixes, and data node identifiers in <xref target="subscribe"/> and <xref target="yang-push"/></t>
            	<t>Modified examples to include &lt;subscription-result&gt; in all RPC responses</t>			    
            	<t>Modified examples to include mandatory fields in <xref target="subscribe"/> and <xref target="yang-push"/></t>
            </list></t>
        </section>
		<section title="v03 to v04">
            <t><list style="symbols">			    
			    <t>Added additional detail to "configured subscriptions"</t>
			    <t>Added interleave capability</t>
			    <t>Adjusted terminology to that in draft-ietf-netconf-subscribed-notifications</t>
			    <t>Corrected namespaces in examples</t>
            </list></t>
        </section>
		<section title="v01 to v03">
            <t><list style="symbols">
                <t>Text simplifications throughout</t>
			    <t>v02 had no meaningful changes</t>
            </list></t>
        </section>
        <section title="v00 to v01">
            <t><list style="symbols">
                <t>Added Call Home in solution for configured subscriptions.</t>
                <t>Clarified support for multiple subscription on a single session. No need to support multiple create-subscription.</t>
                <t>Added mapping between terminology in <xref target="yang-push"/> and <xref target="RFC6241"/> (the one followed in this document).</t>
                <t>Editorial improvements.</t>
            </list></t>
        </section>
    </section>
</back>
</rfc>
