<?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-gonzalez-netconf-event-notifications-00"
     ipr="trust200902">
    <front>
        <title abbrev="NETCONF-notifications">NETCONF Support for Event Notifications</title>

      
        <author fullname="Alberto Gonzalez Prieto" initials="A"
            surname="Gonzalez Prieto">
            <organization>Cisco Systems</organization>
            <address>
                <email>albertgo@cisco.com</email>
            </address>
        </author>

        <author fullname="Alexander Clemm" initials="A" surname="Clemm">
            <organization>Cisco Systems</organization>
            <address>
                <email>alex@cisco.com</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>
        
         <author fullname="Sharon Chisholm" initials="S" surname="Chisholm">
             <organization>Ciena</organization>
             <address>
                 <email>schishol@ciena.com</email>
             </address>
        </author>
        <author fullname="Hector Trevino" initials="H" surname="Trevino">
            <organization>Cisco Systems</organization>
            <address>
                <email>htrevino@cisco.com</email>
            </address>
        </author>

        <date day="15" month="June" year="2016"/>

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

        <workgroup>NETCONF</workgroup>

        <keyword>Draft</keyword>

        <abstract>
            <t>This document defines the support of <xref target="event-notifications"/> by the Network Configuration protocol (NETCONF). <xref target="event-notifications"/> describes capabilities and operations for providing asynchronous message notification delivery. This document discussed how to provide them on top of NETCONF. The capabilities and operations defined between this document and <xref target="event-notifications"/> are intended to obsolete RFC 5277.</t>
        </abstract>
    </front>

    <middle>
        <section title="Introduction">
            <t><xref target="RFC6241"/> can be conceptually partitioned into four layers:</t>
        
            <figure anchor="NETCONF-layers" title="NETCONF layer architecture">                
                <artwork><![CDATA[      Layer                         Example
    +-------------+     +-------------------------------------------+
    |   Content   |     |     Configuration data                    |
    +-------------+     +-------------------------------------------+
          |                           |
    +-------------+     +-------------------------------------------+
    | Operations  |     |<get-config>, <edit-config>, <notification>|
    +-------------+     +-------------------------------------------+
          |                           |                       |
    +-------------+     +-----------------------------+       |
    |     RPC     |     |    <rpc>, <rpc-reply>       |       |
    +-------------+     +-----------------------------+       |
          |                           |                       |
    +-------------+     +-------------------------------------------+
    |  Transport  |     |          BEEP, SSH, SSL, console          |
    |  Protocol   |     |                                           |
    +-------------+     +-------------------------------------------+
          ]]></artwork>
            </figure>
               

        
            <t>This document defines mechanisms that provide an asynchronous message notification delivery service for the NETCONF protocol <xref target="RFC6241"/> based on <xref target="event-notifications"/>. This is an optional capability built on top of the base NETCONF definition. </t>
            <t><xref target="event-notifications"/> and this document enhance the capabilities of RFC 5277 while maintaining backwards capability with existing implementations.  It is intended that a final version of this document might obsolete <xref target="RFC5277"/>.</t>
            <t>The enhancements over <xref target="RFC5277"/> include the ability to terminate subscriptions without terminating the client session, to modify existing subscriptions, and to have multiple subscriptions on a NETCONF session.</t>
            <t>These enhancements do not affect <xref target="RFC5277"/> clients that do not support these particular subscription requirements.</t>
            <t><xref target="event-notifications"/> covers the following functionality:</t>
                <t><list style="symbols">
                    <t>Ability to subscribe to event notifications using two mechanisms: dynamic and configuration subscriptions.</t>
                    <t>Ability to subscribe to event notifications using two mechanisms: dynamic and configuration subscriptions.</t>
                    <t>Ability to negotiate acceptable subscription parameters.</t>                    
                    <t>Ability to filter the subset of notifications to be pushed with stream-specific semantics. </t>
                    <t>Ability to support multiple encodings for the notification.</t>
                    <t>Mechanism to communicate the notifications.</t>
                    <t>Ability to replay locally logged notifications.</t>                    
                    </list></t>
            <t>To support this functionality, NETCONF agents must implement the operations, configuration and operational state defined in <xref target="event-notifications"/>. In addition, they need to:</t>
                <t><list style="symbols">
                    <t>support multiple subscriptions over a single NETCONF session.</t>
                    <t>support a revised definition of the default NETCONF stream</t>
                    <t>be backwards compatible with RFC 5277 implementations.</t>
                </list></t>

            <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>
                
                <section title="Event Notifications">
                    <t>The following terms are defined in <xref target="event-notifications"/>:</t>
                    <t><list style= "symbols">                
                        <t>Event</t>  
                        <t>Event notification</t>
                        <t>Stream (also referred to as "event stream")</t>
                        <t>Subscriber</t>  
                        <t>Receiver</t>           
                        <t>Subscription</t>  
                        <t>Filter</t>  
                        <t>Dynamic subscription</t>
                        <t>Configured subscription</t> 
                    </list></t>
                </section>
                <section title="NETCONF">
                    <t>The following terms are defined in <xref target="RFC6241"/> :</t>
                    <t><list style= "symbols">     
                        <t>Operation</t>
                        <t>RPC: remote procedure call</t>
                    </list></t>
                </section>
                <section title="NETCONF Access Control">
                    <t>The following terms are defined in <xref target="RFC6536"/> :</t>
                    <t><list style= "symbols">     
                        <t>NACM: NETCONF Access Control Model</t>
                    </list></t>
                </section>                
            </section>

            <section title="Solution Overview">
                <t><xref target="event-notifications"/> defines mechanisms that provide an asynchronous message notification delivery service. This document discusses its realization on top of the NETCONF protocol <xref target="RFC6241"/>.</t>
                <t>The functionality to support is defined in <xref target="event-notifications"/>. It is formalized in a set of yang models. The mapping of yang constructs into NETCONF is described in <xref target="RFC6020"/>.</t>
                <t>Supporting <xref target="event-notifications"/> requires enhancements and modifications in NETCONF. The key enhacement is suporting multiple subscriptions on a NETCONF session. A key modification is the definition of the NETCONF stream</t>
                <t>These enhancements do not affect <xref target="RFC5277"/> clients that do not support <xref target="event-notifications"/>.</t>             
    
            </section>
        </section>
    
        <section title="Solution">  
            <t>In this section, we describe and exemplify how <xref target="event-notifications"/> must be supported over NETCONF.</t>
            <section title="Event Streams">
                <t>In the context of NETCONF, an event stream is a set of events available for subscription from a NETCONF server. It is out of the scope of this document to identify a) how streams are defined, b) how events are defined/generated, and c) how events are assigned to streams. </t>
                <t>The following is a high-level description of the flow of a notification. Note that it does not mandate and/or preclude an implementation. As events are raised, they are assigned to streams. An event may be assigned to multiple streams.  The event is distributed to subscribers and receivers based on the current subscriptions and access control.  Access control is needed because if any receiver of that subscription does not have permission to receive an event, then it never makes it into a notification, and processing of the event is completed for that subscription.</t>
            </section>
            
            <section title="Event Stream Discovery">
                <t>A NETCONF client can retrieve the list of available event streams from a NETCONF server using the &lt;get&gt; operation. The reply contains the elements defined in the YANG model under the container "/streams", which includes the stream identifier.</t>
                <t>The following example ilustrates 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">       
                    <artwork align="left">
&lt;rpc message-id="101" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;get&gt;
    &lt;filter type="subtree"&gt;
      &lt;streams 
       xmlns="urn:ietf:params:xml:ns:yang:ietf-event-notifications"/&gt;
      &lt;/filter&gt;
  &lt;/get&gt;
&lt;/rpc&gt;
                    </artwork>
                </figure>
                <t>The NETCONF server returns a list of event streams available for subscription. In this example, the list contains the NETCONF, SNMP, and syslog-critical streams.</t>
                <figure align="center" 
                        anchor="get-streams-resp" 
                        title="Get streams response">       
                    <artwork align="left">
&lt;rpc-reply message-id="101" 
        xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;data&gt;
    &lt;streams  
        xmlns="urn:ietf:params:xml:ns:yang:ietf-event-notifications"&gt;
      &lt;stream&gt;NETCONF&lt;/stream&gt;
      &lt;stream&gt;SNMP&lt;/stream&gt;
      &lt;stream&gt;syslog-critical&lt;/stream&gt;
      &lt;stream&gt;NETCONF&lt;/stream&gt;
      &lt;/streams&gt;
  &lt;/data&gt;
&lt;/rpc-reply&gt;
                    </artwork>
                </figure>

                
                <section title = "Backwards Compatibility">
                    <t>In order to maintain backwards compatibility, clients that only support <xref target="RFC5277"/> can retrieve the list of available event streams executing  a &lt;get&gt; operation against the container "/netconf/streams". </t>
                    <t>The following example ilustrates this mechanism.</t>
                    <figure align="center" anchor="get-streams-bc" title="Get streams (backwards compatibility)">       
                        <artwork align="left">
&lt;rpc message-id="101" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;get&gt;
    &lt;filter type="subtree"&gt;
      &lt;netconf 
            xmlns="urn:ietf:params:xml:ns:netmod:notification"&gt;
        &lt;streams/&gt;
      &lt;/netconf&gt;
    &lt;/filter&gt;
  &lt;/get&gt;
&lt;/rpc&gt;
                        </artwork>
                    </figure>
                    <t>The NETCONF server returns a list of event streams available for subscription. In this example, the list contains the NETCONF, SNMP, and syslog-critical streams.</t>
                    <figure align="center" anchor="get-streams-resp-bc" title="Get streams response (backwards compatibility)">       
                        <artwork align="left">
&lt;rpc-reply message-id="101" 
        xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;data&gt;
    &lt;netconf  
            xmlns="urn:ietf:params:xml:ns:netmod:notification"&gt;
      &lt;streams&gt;
        &lt;stream&gt;
          &lt;name&gt;
            NETCONF
          &lt;/name&gt;
          &lt;description&gt;
            default NETCONF event stream
          &lt;/description&gt;
          &lt;replaySupport&gt;
            true
          &lt;/replaySupport&gt;
          &lt;replayLogCreationTime&gt;
            2016-02-05T00:00:00Z
          &lt;/replayLogCreationTime&gt;
        &lt;/stream&gt;
        &lt;stream&gt;
          &lt;name&gt;
            SNMP
          &lt;/name&gt;
          &lt;description&gt;
            SNMP notifications
          &lt;/description&gt;
          &lt;replaySupport&gt;
            false
          &lt;/replaySupport&gt;
        &lt;/stream&gt;
        &lt;stream&gt;
          &lt;name&gt;
            syslog-critical
          &lt;/name&gt;
          &lt;description&gt;
            Critical and higher severity
          &lt;/description&gt;
          &lt;replaySupport&gt;
            true
          &lt;/replaySupport&gt;
          &lt;replayLogCreationTime&gt;
            2007-07-01T00:00:00Z
          &lt;/replayLogCreationTime&gt;
        &lt;/stream&gt;
      &lt;/streams&gt;
    &lt;/netconf&gt;
  &lt;/data&gt;
&lt;/rpc-reply&gt;
                        </artwork>
                    </figure>
                </section>
            </section>
            
            <section title="Default Event Stream">
                <t>A NETCONF server implementation supporting the notification capability MUST support the "NETCONF" notification event stream. This stream contains all NETCONF XML event notifications supported by the NETCONF server, except for those belonging only to streams that explicitly indicate that they must be excluded from the NETCONF stream. The exact string "NETCONF" is used during the advertisement of stream support during the &lt;get&gt; operation on &lt;streams&gt; and during the &lt;create-subscription&gt; and &lt;establish-subscription&gt; operations. </t>
            </section>
            
            <section title="Creating a Subscription">
                <t>The following illustrates the creation of a simple subscription.</t>
                <section title="Usage Example">
                    <t>The following demonstrates dynamically creating a subscription. This operation is fully defined in <xref target="RFC5277"/></t>
                    <figure align="center" anchor="simple-create-subs" title="Create subscription">       
                        <artwork align="left">
&lt;netconf:rpc message-id="101" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;create-subscription 
        xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"&gt;
  &lt;/create-subscription&gt;
&lt;/netconf:rpc&gt;
                        </artwork>
                    </figure>
                </section>
                
                <section title="Positive Response">
                    <t>If the NETCONF server can satisfy the request, the server sends an &lt;ok&gt; element.</t>
                    <figure align="center" anchor="positive-create-subs" title="Successful create subscription">       
                        <artwork align="left">
&lt;netconf:rpc netconf:message-id="102" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;create-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"&gt;
    &lt;filter netconf:type="xpath" 
                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')]"/&gt;
  &lt;/create-subscription&gt;
&lt;/netconf:rpc&gt;

&lt;rpc-reply message-id="102" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;ok/&gt;
&lt;/rpc-reply&gt;
                        </artwork>
                    </figure>                
                </section>
                
                <section title="Negative Response">
                    <t>If the request cannot be completed for any reason, an &lt;rpc-error&gt; element is included within the &lt;rpc-reply&gt;. Subscription requests can fail for several reasons including if a filter with invalid syntax is provided or if the name of a non-existent stream is provided. </t>
                    <t>If a stopTime is specified in a request without having specified a startTime, the following error is returned:</t>
                    <figure anchor="create-subs-negative-miss-element" title ="Create subscription missing an element">
                        <artwork align="left">
Tag: missing-element
Error-type: protocol
Severity: error
Error-info: &lt;bad-element&gt;: startTime
Description: An expected element is missing.
                        </artwork>
                    </figure>
                    <t>If the optional replay feature is requested but the NETCONF server does not support it, the following error is returned:</t>
                    <figure anchor="create-subs-negative-op-failed" title ="Create subscription pperation failed">
                        <artwork align="left">
Tag: operation-failed
Error-type: protocol
Severity: error
Error-info: none
Description: Request could not be completed because the
             requested operation failed for some reason 
             not covered by any other error condition.
                        </artwork>
                    </figure>
                    <t>If a stopTime is requested that is earlier than the specified startTime, the following error is returned:</t>
                    <figure anchor="create-subs-negative-bad-stopTime" title ="Create subscription incorrect stopTime">
                        <artwork align="left">
Tag: bad-element
Error-type: protocol
Severity: error
Error-info: &lt;bad-element&gt;: stopTime
Description: An element value is not correct; 
             e.g., wrong type, out of range, pattern mismatch.
                        </artwork>
                    </figure>
                    <t>If a startTime is requested that is later than the current time, the following error is returned:</t>
                    <figure anchor="create-subs-negative-bad-startTime" title ="Create subscription incorrect startTime">
                        <artwork align="left">
Tag: bad-element
Error-type: protocol
Severity: error
Error-info: &lt;bad-element&gt;: startTime
Description: An element value is not correct; 
             e.g., wrong type, out of range, pattern mismatch.
                        </artwork>
                    </figure>
                </section>                    
            </section>
            
            <section title="Establishing a Subscription" anchor="sec_establish_subs">
                <section title="Usage Example">
                    <t>The following illustrates the establishment of a simple subscription. </t>
                    <figure align="center" anchor="simple-establish-subs" title="Establish subscription">       
                        <artwork align="left">
&lt;netconf:rpc message-id="101" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;establish-subscription 
          xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
  &lt;/establish-subscription&gt;
&lt;/netconf:rpc&gt;
                        </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 align="left">
&lt;netconf:rpc netconf:message-id="102" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;establish-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    &lt;filter netconf:type="xpath" 
                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')]"/&gt;
  &lt;/establish-subscription&gt;
&lt;/netconf:rpc&gt;

&lt;rpc-reply message-id="102" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;subscription-result 
          xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    ok
  &lt;/subscription-result&gt;
  &lt;subscription-id 
          xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    52
  &lt;/subscription-id&gt;
&lt;/rpc-reply&gt;        
                        </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.</t>
                    <t>If the client has no authorization to establish the subscription, the &lt;subscription-result&gt; indicates an authorization error. For instance:</t>
                    <figure align="center" anchor="negative-establish-subs" title="Unsuccessful establish subscription">       
                        <artwork align="left">
&lt;netconf:rpc netconf:message-id="103" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;establish-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    &lt;stream&gt;foo&lt;/stream&gt;
  &lt;/establish-subscription&gt;
&lt;/netconf:rpc&gt;

&lt;rpc-reply message-id="103" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;subscription-result 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    error-data-not-authorized
  &lt;/subscription-result&gt;
&lt;/rpc-reply&gt;
                        </artwork>
                    </figure>                
                    <t>If the request is rejected because the server is not able to serve it, the server SHOULD include in the returned error what subscription parameters would have been accepted for the request when it was processed.  However, they are no guarantee that subsequent requests with those parameters for this client or others will be accepted. For instance, consider a subscription from <xref target="netconf-yang-push"/>, which augments the establish-subscription with some additional parameters, including "period". If the client requests a period the NETCONF server cannot serve, the exchange may be:</t>
                    <figure align="center" anchor="negotiate-establish-subs" title="Subscription establishment negotiation">       
                        <artwork align="left">
&lt;netconf:rpc message-id="101" 
         xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;establish-subscription 
            xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    &lt;stream&gt;push-update&lt;/stream&gt;
    &lt;filter netconf:type="xpath"
            xmlns:ex="http://example.com/sample-data/1.0"
            select="/ex:foo"/&gt;
    &lt;period xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0"&gt;
      500
    &lt;/period&gt;
    &lt;encoding&gt;encode-xml&lt;/encoding&gt;
  &lt;/establish-subscription&gt;
&lt;/netconf:rpc&gt;


&lt;rpc-reply message-id="101"
      xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;subscription-result 
        xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    error-insufficient-resources
  &lt;/subscription-result&gt;
  &lt;period 
        xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0"&gt;
    2000
  &lt;/period&gt;
&lt;/rpc-reply&gt;
                        </artwork>
                    </figure>                
                    <t>Subscription requests will fail if a filter with invalid syntax is provided or if the name of a non-existent stream is provided. </t>
                </section>  
                <section title="Multiple Subscriptions over a Single NETCONF Session">
                    <t>Note that <xref target="event-notifications"/> requires supporting multiple subscriptions over a single NETCONF session. In contrast, <xref target="RFC5277"/> mandated server to return an error when a create-subscription was sent while a subscription was active on that session. </t>
                </section>
                <section title="Message Flow Examples">
                    <figure anchor = "mess-flow-subs-establishment" title="Message flow for subscription establishment">
                        <artwork><![CDATA[
                               
+------------+                 +-----------+      
|   Client   |                 |   Server  |      
+------------+                 +-----------+      
      |                              |            
      |    Capability Exchange       |            
      |<---------------------------->|            
      |                              |            
      |                              |            
      |    Establish Subscription    |            
      |----------------------------->|            
      | RPC Reply: OK, subs-id = 22  |            
      |<-----------------------------|            
      |                              |            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      |                              |            
      |                              |            
]]>
                        </artwork>
                    </figure>
                    
                    <figure anchor = "mess-flow-subs-establishment-single-session" 
                            title="Message Flow for multiple subscription establishments over a single session">
                        <artwork><![CDATA[
                               
+------------+                 +-----------+      
|   Client   |                 |   Server  |      
+------------+                 +-----------+      
      |                              |            
      |    Capability Exchange       |            
      |<---------------------------->|            
      |                              |            
      |                              |            
      |    Establish Subscription    |            
      |----------------------------->|            
      | RPC Reply: OK, subs-id = 22  |            
      |<-----------------------------|            
      |                              |            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |    Establish Subscription    |            
      |----------------------------->|            
      | RPC Reply: OK, subs-id = 23  |            
      |<-----------------------------|            
      |                              |            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|    
      |  Notification (subs-id 23)   |            
      |<-----------------------------|            
      |                              |            
      |                              |                    
]]>
                        </artwork>
                    </figure>
                </section>
            </section>
            
            <section title="Modifying a Subscription">
                <section title="Usage Example">
                    <t>The following demonstrates modifying a subscription. Consider a subscription from <xref target="netconf-yang-push"/>, which augments the establish-subscription with some additional parameters, including "period". A subscription may be established as follows.</t>
                    
                    <figure align="center" anchor="simple-create-to-modify-subs" title="Establish subscription to be modified">       
                        <artwork align="left">
&lt;netconf:rpc message-id="101" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;establish-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    &lt;stream&gt;push-update&lt;/stream&gt;
    &lt;filter netconf:type="xpath" 
            xmlns:ex="http://example.com/sample-data/1.0" 
            select="/ex:foo"/&gt;
    &lt;period xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0"&gt;
      500
    &lt;/period&gt;
    &lt;encoding&gt;encode-xml&lt;/encoding&gt;
  &lt;/establish-subscription&gt;
&lt;/netconf:rpc&gt;

&lt;rpc-reply message-id="101" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;subscription-result 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    ok
  &lt;/subscription-result&gt;
  &lt;subscription-id 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    1922
  &lt;/subscription-id&gt;
&lt;/rpc-reply&gt;
                        </artwork>
                    </figure>
                    <t>The subscription may be modified with:</t>
                    <figure align="center" anchor="simple-modify-subs" title="Modify subscription">       
                        <artwork align="left">
&lt;netconf:rpc message-id="102" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;modify-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    &lt;subscription-id&gt;1922&lt;/subscription-id&gt;
    &lt;period&gt;1000&lt;/period&gt;
  &lt;/modify-subscription &gt;
&lt;/netconf:rpc&gt;

&lt;rpc-reply message-id="102" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;subscription-result 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    ok
  &lt;/subscription-result&gt;
  &lt;subscription-id 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    1922
  &lt;/subscription-id&gt;
&lt;/rpc-reply&gt;
                        </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-id, which would be redundant.</t>
                    <figure align="center" anchor="positive-modify-subs" title="Successful modify subscription">       
                        <artwork align="left">
&lt;netconf:rpc message-id="102" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;modify-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    &lt;subscription-id&gt;1922&lt;/subscription-id&gt;
    &lt;period 
              xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0"&gt;
      1000
    &lt;/period&gt;
  &lt;/modify-subscription &gt;
&lt;/netconf:rpc&gt;

&lt;rpc-reply message-id="102" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;subscription-result 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    ok
  &lt;/subscription-result&gt;
&lt;/rpc-reply&gt;
                        </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 to an establish-subscription request. For instance:</t>
                    <figure align="center" anchor="negative-modify-subs" title="Unsuccessful modify subscription">       
                        <artwork align="left">
&lt;netconf:rpc message-id="102" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;modify-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    &lt;subscription-id&gt;1922&lt;/subscription-id&gt;
    &lt;period xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0"&gt;
      100
    &lt;/period&gt;
  &lt;/modify-subscription&gt;
&lt;/netconf:rpc&gt;

&lt;rpc-reply message-id="102" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;subscription-result 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    error-insufficient-resources
  &lt;/subscription-result&gt;
  &lt;period&gt;500&lt;/period&gt;
&lt;/rpc-reply&gt;
                        </artwork>
                    </figure>                
                </section>   
                <section title="Message Flow Example">
                    <figure anchor = "mess-flow-subs-modification"
                            title="Message flow for subscription modification">
                        <artwork><![CDATA[
                               
+------------+                 +-----------+      
|   Client   |                 |   Server  |      
+------------+                 +-----------+      
      |                              |            
      |    Capability Exchange       |            
      |<---------------------------->|            
      |                              |            
      |                              |            
      |    Establish Subscription    |            
      |----------------------------->|            
      | RPC Reply: OK, subs-id = 22  |            
      |<-----------------------------|            
      |                              |            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |                              |            
      |                              |            
      |     Modify Subscription      |            
      |----------------------------->|            
      |                              |            
      |                              |            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      |                              |            
      |                              |            
]]>
                        </artwork>
                    </figure>
                </section>
            </section>
            
            
            
            <section title="Deleting a Subscription">
                <section title="Usage Example">
                    <t>The following demonstrates deleting a subscription.</t>
                    
                    <figure align="center" anchor="simple-delete-subs" title="Delete subscription">       
                        <artwork align="left">
&lt;netconf:rpc message-id="101" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;delete-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    &lt;subscription-id&gt;1922&lt;/subscription-id&gt;
  &lt;/delete-subscription&gt;
&lt;/netconf:rpc&gt;    
                        </artwork>
                    </figure>
                </section>
                
                <section title="Positive Response">
                    <t>If the NETCONF server can satisfy the request, the server sends an OK element. For example:</t>
                    <figure align="center" anchor="positive-delete-subs" title="Successful delete subscription">       
                        <artwork align="left">
&lt;netconf:rpc message-id="103" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;delete-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    &lt;subscription-id&gt;1922&lt;/subscription-id&gt;
  &lt;/delete-subscription&gt;
&lt;/netconf:rpc&gt;

&lt;rpc-reply message-id="103" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;ok/&gt;
&lt;/rpc-reply&gt;
                        </artwork>
                    </figure>                
                </section>
                
                <section title="Negative Response">
                    <t>If the NETCONF server cannot satisfy the request, the server sends an error-rpc element. For example:</t>
                    <figure align="center" anchor="negative-delete-subs" title="Unsuccessful delete subscription">       
                        <artwork align="left">
&lt;netconf:rpc message-id="103" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;delete-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
    &lt;subscription-id&gt;2017&lt;/subscription-id&gt;
  &lt;/delete-subscription&gt;
&lt;/netconf:rpc&gt;
                            
&lt;rpc-reply message-id="101" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;rpc-error&gt;
    &lt;error-type&gt;application&lt;/error-type&gt;
    &lt;error-tag&gt;invalid-value&lt;/error-tag&gt;
    &lt;error-severity&gt;error&lt;/error-severity&gt;
    &lt;error-path 
           xmlns:t="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
      /t:subscription-id
    &lt;/error-path&gt;
    &lt;error-message xml:lang="en"&gt;
      Subscription-id 2017 does not exist
    &lt;/error-message&gt;
  &lt;/rpc-error&gt;
&lt;/rpc-reply&gt;
                        </artwork>
                    </figure>                
                </section>      
                <section title="Message Flow Example">
                    <figure anchor="mess-flow-subs-deletion" 
                            title="Message flow for subscription deletion">
                        <artwork><![CDATA[
                               
+------------+                 +-----------+      
|   Client   |                 |   Server  |      
+------------+                 +-----------+      
      |                              |            
      |    Capability Exchange       |            
      |<---------------------------->|            
      |                              |            
      |                              |            
      |    Establish Subscription    |            
      |----------------------------->|            
      | RPC Reply: OK, subs-id = 22  |            
      |<-----------------------------|            
      |                              |            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |     Delete Subscription      |            
      |----------------------------->|            
      |                              |            
      |                              |            
      |                              |            
      |                              |            
]]>
                        </artwork>
                    </figure>
                </section>

            </section>
            
            <section title="Configured Subscriptions">
                <t>A configured subscription is a subscription installed via a configuration interface, and do not support negotiation.</t>                
                <t>Supporting configured subscriptions is optional and advertised during the capabilities exchange using the "configured-subscriptions" feature.</t> 
                <t>In this section, we present examples of how to manage configuration subscriptions using a NETCONF client.</t>
   
                <section title="Establishing a Configured Subscription" anchor="sec_establish_static_subs">
                    <t>Subscriptions are established using configuration operations against the top-level subtree subscription-config.</t>
                    <t>For example at subscription establishment, a NETCONF client may send:</t>
                    <figure align="center" anchor="establish-static-subs" title="Establish static subscription">       
                        <artwork align="left">
&lt;rpc message-id="101" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" 
       xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;edit-config&gt;
    &lt;target&gt;
      &lt;running/&gt;
    &lt;/target&gt;
    &lt;subscription-config 
            xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
      &lt;subscription&gt;
        &lt;subscription-id&gt;
          1922
        &lt;/subscription-id&gt;
        &lt;stream&gt;
          foo
        &lt;/stream&gt;
        &lt;receiver&gt;
          &lt;address&gt;
            1.2.3.4
          &lt;/address&gt;
          &lt;port&gt;
            1234
          &lt;/port&gt;
        &lt;/receiver&gt;
      &lt;/subscription&gt;
    &lt;/subscription-config&gt;
  &lt;/edit-config&gt;
&lt;/rpc&gt;
                        </artwork>
                    </figure>
                    <t>if the request is accepted, the server would reply:</t>
                    <figure align="center" anchor="success-establish-static-subs" title="Response to a successful static subscription establishment">       
                        <artwork align="left">
&lt;rpc-reply message-id="101" 
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;ok/&gt;
&lt;/rpc-reply&gt;
                        </artwork>
                    </figure>
                    <t>if the request is not accepted because the server cannot serve it, the server may reply:</t>
                    <figure align="center" anchor="failed-establish-static-subs" title="Response to a failed static subscription establishment">       
                        <artwork align="left">
&lt;rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;rpc-error&gt;
    &lt;error-type&gt;application&lt;/error-type&gt;
      &lt;error-tag&gt;resource-denied&lt;/error-tag&gt;
      &lt;error-severity&gt;error&lt;/error-severity&gt;
      &lt;error-message xml:lang="en"&gt;
        Temporarily the server cannot serve this 
        subscription due to the current workload.
    &lt;/error-message&gt;       
  &lt;/rpc-error&gt;
&lt;/rpc-reply&gt;
                        </artwork>
                    </figure>

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

]]>
                        </artwork>
                    </figure>
                </section>
                    
                </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 align="left">
&lt;rpc message-id="102" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" 
       xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;edit-config&gt;
    &lt;target&gt;
      &lt;running/&gt;
    &lt;/target&gt;
    &lt;subscription-config 
            xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
      &lt;subscription&gt;
        &lt;subscription-id&gt;
          1922
        &lt;/subscription-id&gt;
        &lt;stream&gt;
          foo
        &lt;/stream&gt;
        &lt;receiver&gt;
          &lt;address&gt;
            1.2.3.5
          &lt;/address&gt;
          &lt;port&gt;
            1234
          &lt;/port&gt;
        &lt;/receiver&gt;
      &lt;/subscription&gt;
    &lt;/subscription-config&gt;
  &lt;/edit-config&gt;
&lt;/rpc&gt;
                        </artwork>
                    </figure>
                    <t>if the request is accepted, the server would reply:</t>
                    <figure align="center" anchor="success-modify-configured-subs" title="Response to a successful configured subscription modification">       
                        <artwork align="left">
&lt;rpc-reply message-id="102" 
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;ok/&gt;
&lt;/rpc-reply&gt;
                        </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        |                |            |            
      |<---------------------------|                |            |  
      |                            |  Subscription  |            |            
      |                            |  Started       |            |   
      |                            |  (subs-id 22)  |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |            
      |                            |  Notification  |            | 
      |                            |  (subs-id 22)  |            |                       
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |            
      |                            |                |            |            
      |                            |                |            |            
      |        Edit-config         |                |            |            
      |--------------------------->|                |            |            
      |       RPC Reply: OK        |                |            |            
      |<---------------------------|                |            |            
      |                            |                |            |            
      |                            |                |            |            
      |                            |  Subscription  |            |            
      |                            |  Modified      |            |    
      |                            |  (subs-id 22)  |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |            
      |                            |  Notification  |            |            
      |                            |  (subs-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 align="left">
&lt;rpc message-id="103" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;edit-config&gt;
    &lt;target&gt;
      &lt;running/&gt;
    &lt;/target&gt;
    &lt;subscription-config 
        xmlns:xc="urn:ietf:params:xml:ns:netconf:notification:1.1"&gt;
      &lt;subscription xc:operation="delete"&gt;
        &lt;subscription-id&gt;
          1922
        &lt;/subscription-id&gt;
      &lt;/subscription&gt;
    &lt;/subscription-config&gt;
  &lt;/edit-config&gt;
&lt;/rpc&gt;

&lt;rpc-reply message-id="103" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;ok/&gt;
&lt;/rpc-reply&gt;

                        </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        |                |            |            
      |<---------------------------|                |            |            
      |                            |  Subscription  |            |            
      |                            |  Started       |            |       
      |                            |  (subs-id 22)  |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |
      |                            |  Notification  |            |
      |                            |  (subs-id 22)  |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |            
      |                            |                |            |
      |                            |                |            |
      |                            |                |            |
      |                            |                |            |  
      |                            |  Notification  |            |            
      |                            |  (subs-id 22)  |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |            
      |        Edit-config         |                |            |            
      |--------------------------->|                |            |            
      |       RPC Reply: OK        |                |            |            
      |<---------------------------|                |            |            
      |                            |                |            |            
      |                            |                |            |            
      |                            |  Subscription  |            |            
      |                            |  Terminated    |            |    
      |                            |  (subs-id 22)  |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |            
      |                            |                |            |            
      |                            |                |            |            
      |                            |                |            |            
]]>
                            </artwork>
                        </figure>
                    </section>

                </section>
            </section>
        
            <section title="Event (Data Plane) Notifications">
                <t>Once a subscription has been set up, the NETCONF server sends (asynchronously) the event notifications from the subscribed stream. We refer to these as data plane notifications. For dynamic subscriptions set up via RPC operations, event notifications are sent over the NETCONF session used to create or establish the subscription.  For static subscriptions, event notifications are sent over the specified connections.</t>
                <t>An event notification is sent to the receiver(s) when an event of interest (i.e., meeting the specified filtering criteria) has occurred.  An event notification is a complete and well-formed XML document.  Note that &lt;notification&gt; is not a Remote Procedure Call (RPC) method but rather the top-level element identifying the one-way message as a notification. Note that event notifications never trigger responses.</t>
                <t>The event notification always includes an &lt;eventTime&gt; element. It is the time the event was generated by the event source. This parameter is of type dateTime and compliant to <xref target="RFC3339"/>. Implementations must support time zones.</t>
                <t>The event notification also contains notification-specific tagged content, if any.  With the exception of &lt;eventTime&gt;, the content of the notification is beyond the scope of this document.</t>
                <t>For the encodings other than XML, notifications include an additional XML element so that the notification is a well-formed XML. The element is &lt;notification-contents-{encoding}&gt;, E.g., &lt;notification-contents-json&gt;. That element contains the notification contents in the desired encoding</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 a data plane notification">       
                    <artwork align="left">
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>
                
                <figure align="center" anchor="simple-data-plane-notif" title="Data plane notification">       
                    <artwork align="left">
&lt;notification 
       xmlns=" urn:ietf:params:xml:ns:netconf:notification:1.0"&gt;
  &lt;eventTime&gt;2007-09-01T10:00:00Z&lt;/eventTime&gt;
  &lt;link-failure xmlns="http://acme.example.com/system"&gt;
    &lt;if-name&gt;so-1/2/3.0&lt;/if-name&gt;
    &lt;if-admin-status&gt;up&lt;/if-admin-status&gt;
    &lt;if-oper-status&gt;down&lt;/if-oper-status&gt;
  &lt;/link-failure&gt;
&lt;/notification&gt;
                    </artwork>
                </figure>
                
                <t>The equivalent using JSON encoding would be</t>
                <figure align="center" anchor="simple-data-plane-notif-json" title="Data plane notification using JSON encoding">       
                    <artwork align="left">
&lt;notification 
       xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"&gt;
  &lt;eventTime&gt;2007-09-01T10:00:00Z&lt;/eventTime&gt;
  &lt;notification-contents-json&gt;
       {
          "acme-system:link-failure": {
            "if-name": "so-1/2/3.0",
            "if-admin-status": "up",
            "if-oper-status": "down "
          }
        }      
  &lt;/notification-contents-json&gt;
&lt;/notification&gt;
                    </artwork>
                </figure>
            </section>
        
            <section title="Control Plane Notifications">
                <t>In addition to data plane notifications, a server may send control plane notifications (defined in <xref target="event-notifications"/>) to indicate to receivers that an event related to the subscription management has occurred. Control plane notifications cannot be filtered out. Next we exemplify them using both XML, and JSON encondings for the data: </t>
                <section title="replayComplete">
                    <figure align="center" anchor="replayComplete-ctrl-plane-notif" 
                            title="replayComplete control plane notification">       
                        <artwork align="left">
&lt;notification 
       xmlns=" urn:ietf:params:xml:ns:netconf:notification:1.0"&gt;
  &lt;eventTime&gt;2007-09-01T10:00:00Z&lt;/eventTime&gt;
  &lt;replayComplete xmlns="urn:ietf:params:xml:ns:netmod:notification"/&gt;
&lt;/notification&gt;
                        </artwork>
                    </figure>

                    <t>The equivalent using JSON encoding would be:</t>
                    <figure align="center" anchor="replayComplete-ctrl-plane-notif-json" 
                            title="replayComplete control plane notification (JSON encoding)">       
                        <artwork align="left">
&lt;notification 
       xmlns=" urn:ietf:params:xml:ns:netconf:notification:1.0"&gt;
  &lt;eventTime&gt;2007-09-01T10:00:00Z&lt;/eventTime&gt;
  &lt;notification-contents-json&gt;
       {
          "netmod-notif:replayComplete": { }
        }      
  &lt;/notification-contents-json&gt;
&lt;/notification&gt;
                        </artwork>
                    </figure>
                    <section title="Message Flow Example">
                        <figure anchor = "mess-flow-replay-notif"
                                title="replayComplete notification">
                            <artwork><![CDATA[
                               
+------------+                 +-----------+      
|   Client   |                 |   Server  |      
+------------+                 +-----------+      
      |                              |            
      |    Capability Exchange       |            
      |<---------------------------->|            
      |                              |            
      |                              |            
      |    Establish Subscription    |            
      |----------------------------->|            
      | RPC Reply: OK, subs-id = 22  |            
      |<-----------------------------|            
      |                              |            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      | Replay Complete (subs-id 22) |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |                              |            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      |                              |            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |                              |            
]]>
                            </artwork>
                        </figure>
                    </section>

                </section>
                
                <section title="notificationComplete">
                    <figure align="center" anchor="notificationComplete-ctrl-plane-notif" 
                            title="notificationComplete control plane notification">       
                        <artwork align="left">
&lt;notification 
    xmlns=" urn:ietf:params:xml:ns:netconf:notification:1.0"&gt;
  &lt;eventTime&gt;2007-09-01T10:00:00Z&lt;/eventTime&gt;
  &lt;notificationComplete 
    xmlns="urn:ietf:params:xml:ns:netmod:notification"/&gt;
&lt;/notification&gt;
                        </artwork>
                    </figure>
                    <section title="Message Flow Example">
                        <figure anchor = "mess-flow-complete-notif"
                                title="notificationComplete notification">
                            <artwork><![CDATA[
                               
+------------+                 +-----------+      
|   Client   |                 |   Server  |      
+------------+                 +-----------+      
      |                              |            
      |    Capability Exchange       |            
      |<---------------------------->|            
      |                              |            
      |                              |            
      |    Establish Subscription    |            
      |----------------------------->|            
      | RPC Reply: OK, subs-id = 22  |            
      |<-----------------------------|            
      |                              |            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      | Replay Complete (subs-id 22) |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |                              |            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      |                              |            
      |  Notification (subs-id 22)   |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |                              |            
      |    Notification Complete     |            
      |        (subs-id 22)          |
      |<-----------------------------|            
      |                              |            
      |                              |            
      |                              |  
      |            RPC               |            
      |----------------------------->|            
      |          RPC Reply           |            
      |<-----------------------------|            
      |                              |            
      |                              |            
]]>
                            </artwork>
                        </figure>
                    </section>


                </section>
                
                <section title="subscription-started">
                    
                <figure align="center" anchor="subscription-started-ctrl-plane-notif" 
                            title="subscription-started control plane notification">       
                        <artwork align="left">
&lt;notification 
    xmlns=" urn:ietf:params:xml:ns:netconf:notification:1.0"&gt;
  &lt;eventTime&gt;2007-09-01T10:00:00Z&lt;/eventTime&gt;
  &lt;subscription-started 
        xmlns="urn:ietf:params:xml:ns:yang:ietf-event-notifications"/&gt;
    &lt;subscription-id&gt;52&lt;/subscription-id&gt;   
    &lt;filter netconf:type="xpath" 
               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')]"/&gt;
  &lt;/subscription-started/&gt;
&lt;/notification&gt;
                        </artwork>
                    </figure>

                    <t>The equivalent using JSON encoding would be:</t>
                    <figure align="center" anchor="subscription-started-ctrl-plane-notif-json" 
                        title="subscription-started  control plane notification (JSON encoding)">       
                        <artwork align="left">
&lt;notification 
       xmlns=" urn:ietf:params:xml:ns:netconf:notification:1.0"&gt;
  &lt;eventTime&gt;2007-09-01T10:00:00Z&lt;/eventTime&gt;
  &lt;notification-contents-json&gt;
       {
          "notif-bis:subscription-started": {
              "subscription-id" : 52
              ((Open Item: express filter in json))
          }
        }      
  &lt;/notification-contents-json&gt;
&lt;/notification&gt;
                        </artwork>
                    </figure>

                    
                </section>
                
                <section title="subscription-modified">
                    <figure align="center" 
                            anchor="subscription-modified-ctrl-plane-notif" 
                            title="subscription-modified control plane notification">       
                        <artwork align="left">
&lt;notification 
    xmlns=" urn:ietf:params:xml:ns:netconf:notification:1.0"&gt;
  &lt;eventTime&gt;2007-09-01T10:00:00Z&lt;/eventTime&gt;
  &lt;subscription-modified 
        xmlns="urn:ietf:params:xml:ns:yang:ietf-event-notifications"/&gt;
    &lt;subscription-id&gt;52&lt;/subscription-id&gt;   
    &lt;filter netconf:type="xpath" 
               xmlns:ex="http://example.com/event/1.0"
               select="/ex:event[ex:eventClass='fault']"/&gt;
  &lt;/subscription-modified/&gt;
&lt;/notification&gt;
                        </artwork>
                    </figure>
                </section>
                
                <section title="subscription-terminated">
                    <figure align="center" 
                            anchor="subscription-terminated-ctrl-plane-notif" 
                            title="subscription-terminated control plane notification">       
                        <artwork align="left">
&lt;notification 
    xmlns=" urn:ietf:params:xml:ns:netconf:notification:1.0"&gt;
  &lt;eventTime&gt;2007-09-01T10:00:00Z&lt;/eventTime&gt;
  &lt;subscription-terminated 
        xmlns="urn:ietf:params:xml:ns:yang:ietf-event-notifications"/&gt;
    &lt;subscription-id&gt;52&lt;/subscription-id&gt;   
    &lt;reason&gt;subscription-deleted&lt;/reason&gt;
  &lt;/subscription-terminated/&gt;
&lt;/notification&gt;
                        </artwork>
                    </figure>
                </section>
                
                <section title="subscription-suspended">
                    <figure 
                     align="center" 
                     anchor="subscription-suspended-ctrl-plane-notif"
                     title="subscription-suspended control plane notification">       
                        <artwork align="left">
&lt;notification 
    xmlns=" urn:ietf:params:xml:ns:netconf:notification:1.0"&gt;
  &lt;eventTime&gt;2007-09-01T10:00:00Z&lt;/eventTime&gt;
  &lt;subscription-suspended 
        xmlns="urn:ietf:params:xml:ns:yang:ietf-event-notifications"/&gt;
    &lt;subscription-id&gt;52&lt;/subscription-id&gt;   
    &lt;reason&gt;internal-error&lt;/reason&gt;
  &lt;/subscription-suspended/&gt;
&lt;/notification&gt;
                        </artwork>
                    </figure>
                </section>
                
                <section title="subscription-resumed">
                    <figure align="center" 
                        anchor="subscription-resumed-ctrl-plane-notif" 
                        title="subscription-resumed control plane notification">
                        <artwork align="left">
&lt;notification 
    xmlns=" urn:ietf:params:xml:ns:netconf:notification:1.0"&gt;
  &lt;eventTime&gt;2007-09-01T10:00:00Z&lt;/eventTime&gt;
  &lt;subscription-resumed 
        xmlns="urn:ietf:params:xml:ns:yang:ietf-event-notifications"/&gt;
    &lt;subscription-id&gt;52&lt;/subscription-id&gt;   
    &lt;reason&gt;internal-error&lt;/reason&gt;
  &lt;/subscription-resumed/&gt;
&lt;/notification&gt;
                        </artwork>
                    </figure>
                    <section title="Message Flow Examples">
                        <figure anchor = "mess-flow-suspeded-resumed-notif"
                                title="subscription-suspended and Resumed Notifications">
                            <artwork><![CDATA[
                               
+------------+                 +-----------+      
|   Client   |                 |   Server  |      
+------------+                 +-----------+      
      |                              |            
      |    Capability Exchange       |            
      |<---------------------------->|            
      |                              |            
      |                              |            
      |    Establish Subscription    |            
      |----------------------------->|            
      | RPC Reply: OK, subs-id = 22  |            
      |<-----------------------------|            
      |                              |            
      |        Notification          |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |        Notification          |            
      |<-----------------------------|            
      |        Notification          |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |   Subscription Suspended     |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |                              |            
      |    Subscription Resumed      |            
      |<-----------------------------|            
      |                              |            
      |                              |            
      |                              |            
      |                              |            
      |        Notification          |            
      |<-----------------------------|            
      |                              |            
      |                              |             
]]>
                            </artwork>
                        </figure>
                        <figure anchor = "mess-flow-suspeded-resumed-notif-configured"
                                title="subscription-suspended and subscription-resumed notifications (configured subscriptions)">
                            <artwork><![CDATA[
                               
+----------+                 +-----------+     +---------+  +---------+
|  Client  |                 |   Server  |     | Rcver A |  | Rcver B |       
+----------+                 +-----------+     +---------+  +---------+
      |                            |                |            |
      |    Capability Exchange     |                |            |            
      |<-------------------------->|                |            |            
      |                            |                |            |            
      |                            |                |            |            
      |        Edit-config         |                |            |            
      |--------------------------->|                |            |            
      |       RPC Reply: OK        |                |            |            
      |<---------------------------|                |            |            
      |                            |  Subscription  |            |            
      |                            |  Started       |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |
      |                            |  Notification  |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |            
      |                            |                |            |
      |                            |                |            |
      |                            |                |            |
      |                            |  Subscription  |            |            
      |                            |  Suspended     |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |
      |                            |                |            |
      |                            |                |            |
      |                            |                |            |
      |                            |                |            |
      |                            |  Subscription  |            |            
      |                            |  Resumed       |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |
      |                            |                |            |
      |                            |                |            |
      |                            |  Notification  |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |
      |                            |  Notification  |            |            
      |                            |--------------->|            |            
      |                            |---------------------------->|
      |                            |                |            |            
      |                            |                |            |            
      |                            |                |            |            
      |                            |                |            |                      
]]>
                            </artwork>
                        </figure>

                    </section>


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

        <section title="Backwards Compatibility">
            <section title="Capabilities">
                <t>Capabilities are advertised in messages sent by each peer during session establishment <xref target="RFC6241"/>. Servers supporting the features in this document must advertise both capabilities "urn:ietf:params:netconf:capability:notification:1.0"  and "urn:ietf:params:netconf:capability:notification:1.1".</t>
                <t>An example of a hello message by a server during session establishment would be:</t>
                <figure align="center" anchor="simple-hello" title="Hello message">       
                    <artwork align="left">
&lt;hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;capabilities&gt;
    &lt;capability&gt;
      urn:ietf:params:xml:ns:netconf:base:1.0
    &lt;/capability&gt;
    &lt;capability&gt;
      urn:ietf:params:netconf:capability:startup:1.0
    &lt;/capability&gt;
    &lt;capability&gt;
      urn:ietf:params:netconf:capability:notification:1.0
    &lt;/capability&gt;
    &lt;capability&gt;
      urn:ietf:params:netconf:capability:notification:1.1
    &lt;/capability&gt;
  &lt;/capabilities&gt;
  &lt;session-id&gt;4&lt;/session-id&gt;
&lt;/hello&gt;
                    </artwork>
                </figure>
                <t>Clients that only support <xref target="RFC5277"/> recognize capability "urn:ietf:params:netconf:capability:notification:1.0" and ignore capability "urn:ietf:params:netconf:capability:notification:1.1". This allows them interacting with the server as per [RFC5277]. Clients that support the features in this document recognize both capabilities. This allows them interacting with the server as per this document.</t>
            </section>
            <section title="Stream Discovery">
                <t>In order to maintain backwards compatibility, clients that only support <xref target="RFC5277"/> can retrieve the list of available event streams executing  a &lt;get&gt; operation against the container "/netconf/streams".</t>
            </section>
        </section>
        
        <section title="Security Considerations">
            <t>The security considerations from the base NETCONF document <xref target="RFC6241"/> also apply to the notification capability.</t>
            <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 NETCONF content involved.  When a &lt;get&gt; is received that refers to the content defined in this memo, clients should only be able to view the content for which they have sufficient privileges.  &lt;create-subscriptiont&gt; and &lt;establish-subscriptiont&gt; operations can be considered like deferred &lt;get&gt;, and the content that different users can access may vary. This different access is reflected in the &lt;notificationt&gt; that different users are able to subscribe to. </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;create-subscription&gt; requests, then these subscriptions accumulate and may use up system resources.  In such a situation, subscriptions can be terminated by terminating the suspect underlying NETCONF sessions using the &lt;kill-session&gt; operation. If the client uses &lt;establish-subscription&gt;, the server can also suspend or terminate subscriptions with per-subscription granularity.</t>
            <t>A subscription could be configured on another receiver's behalf, with the goal of flooding that receiver with updates.  One or more publishers could be used to overwhelm a receiver, which doesn't even support subscriptions.  Clients that do not want pushed data need only terminate or refuse any transport sessions from the publisher. In addition, 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>
            <t>Note that streams can define additional authorization requirements. For instance, in <xref target="netconf-yang-push"/> each of the elements in its data plane notifications must also go through access control.</t>
        </section>
        
        <section title = "Acknowledgments">
            <t>We wish to acknowledge the helpful contributions, comments, and suggestions that were received from: Andy Bierman, Yan Gang, 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.3339"?>
      <?rfc include="reference.RFC.5277"?>
      <?rfc include="reference.RFC.6020"?>
      <?rfc include="reference.RFC.6241"?>
      <?rfc include="reference.RFC.6536"?>
    </references>    

    <references title="Informative References">
      <reference anchor="netconf-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">
            <organization>Cisco Systems</organization>
          </author>

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

          </author>

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

          <author fullname="Ambika Prasad Tripathy" initials="A" surname="Tripathy">
             <organization>Cisco Systems</organization>
          </author>
      
          <author fullname="Einar Nilsen-Nygaard" initials="E"
            surname="Nilsen-Nygaard">
            <organization>Cisco Systems</organization>
         </author>
         <date day="23" month="February" year="2016"/>
        </front>
      </reference>
        

      <reference anchor="event-notifications"
                 target="https://datatracker.ietf.org/doc/draft-gonzalez-netconf-5277bis/">
        <front>
          <title>Subscribing to YANG-Defined Event Notifications</title>

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

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

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

          <author fullname="Einar Nilsen-Nygaard" initials="E" surname="Nilsen-Nygaard">
            <organization>Cisco Systems</organization>
          </author>
            
          <author fullname="Ambika Prasad Tripathy" initials="A" surname="Tripathy">
            <organization>Cisco Systems</organization>
          </author>
      
          <author fullname="Sharon Chisholm" initials="S" surname="Chisholm">
            <organization>Ciena</organization>
          </author>
            
          <author fullname="Hector Trevino" initials="H" surname="Trevino">
            <organization>Cisco Systems</organization>
          </author>
                        
          <date day="15" month="June" year="2016"/>
        </front>
      </reference>
        
    </references>
    <section title="Issues being worked and resolved">
      <t>(To be removed by RFC editor prior to publication)</t>

      <section title="Unresolved Issues">
        <t>NT1 - Support multiple create-subscriptions over a single NETCONF session? or only multiple establish-subscription? Recommend only establish-subscription anytime there may be more than one subscription, otherwise variations of supported RFCs and error states proliferate.</t>
        <t>NT2 - Configured subscription need to be refined in <xref target="event-notifications"/> and then adjust this document based on it. </t>
        <t>NT3 - Express filter in JSON should be documented.</t>
        </section>

      <section title="Agreement in principal ">
        <t>NT1 - When a list of requirements for secure transport is provided via a Configured Subscription, this list must be met via Netconf transport.  Specifics still are needed for draft on the "how".</t>
        <t>NT2 - Along with rfc5277bis, this draft to obsolete 5277</t>
        <t>NT3 - Stream discovery. Adopted mechanism in 5277-bis and include backwards comptability support.</t>
      </section>
    </section>
  </back>
</rfc>
