<?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-yang-push-10" ipr="pre5378Trust200902">

  <front>
    <title abbrev="YANG-Push">Subscribing to YANG datastore push updates</title>

    <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="Alberto Gonzalez Prieto" initials="A." surname="Gonzalez Prieto">
      <organization>VMware</organization>
      <address>
        <email>agonzalezpri@vmware.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="Einar Nilsen-Nygaard" initials="E." surname="Nilsen-Nygaard">
      <organization>Cisco Systems</organization>

      <address>
        <email>einarnn@cisco.com</email>
      </address>
    </author>

	<author fullname="Andy Bierman" initials="A." surname="Bierman">
      <organization>YumaWorks</organization>

      <address>
         <email>andy@yumaworks.com</email>
      </address>
    </author>
	
	<author fullname="Balazs Lengyel" initials="B." surname="Lengyel">
      <organization>Ericsson</organization>

      <address>
        <email>balazs.lengyel@ericsson.com</email>
      </address>
    </author>
	
    <date day="2" month="October" year="2017"/>

	<area>Operations &amp; Management</area>

    <workgroup>NETCONF</workgroup>

    <keyword>Draft</keyword>
	
    <abstract>
      <t>Providing rapid visibility into changes made on YANG configuration and operational objects enables new capabilities such as remote mirroring of configuration and operational state.   Via the mechanism described in this document, subscriber applications may request a continuous, customized stream of updates from a YANG datastore.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
	  
      <t>Traditional approaches to remote visibility have been built on polling.  With polling, data is periodically requested and retrieved by a client from a server to stay up-to-date. However, there are issues associated with polling-based management:
        <list style="symbols">
		
		  <t>Polling incurs significant latency.  This latency prohibits many application types.</t>

          <t>Polling cycles may be missed, requests may be delayed or get lost, often when the network is under stress and the need for the data is the greatest.</t>

          <t>Polling requests may undergo slight fluctuations, resulting in intervals of different lengths.  The resulting data is difficult to calibrate and compare.</t>

		  <t>For applications that monitor for changes, many remote polling cycles place ultimately fruitless load on the network, devices, and applications.</t>
		  
        </list>
	  </t>
	  
	  <t>A more effective alternative to polling is for an application to receive automatic and continuous updates from a targeted subset of a datastore. Accordingly, there is a need for a service that allows applications to subscribe to updates from a YANG datastore and that enables the publisher to push and in effect stream those updates. The requirements for such a service have been documented in <xref target="RFC7923"/>. </t>
	  
      <t>This document defines a corresponding solution that is built on top of "Custom Subscription to Event Notifications" <xref target="subscribe"/>.  Supplementing that work are YANG data model augmentations, extended RPCs, and new datastore specific update notifications.  Transport options for <xref target="subscribe"/> will work seamlessly with this solution. </t>
	  
    </section>

    <section title="Definitions and Acronyms">
	
	  <t>The terms below supplement those defined in <xref target="subscribe"/>. </t>
	  
      <t>Data node: An instance of management information in a YANG datastore.</t>

	  <t>Data node update: A data item containing the current value/property of a Data node at the time the data node update was created.</t>

      <t>Datastore: A conceptual store of instantiated management information, with individual data items represented by data nodes which are arranged in hierarchical manner.</t>

      <t>Data subtree: An instantiated data node and the data nodes that are hierarchically contained within it.</t>
	  
	  <t>Notification message: A transport encapsulated update record(s) and/or event notification(s) intended to be sent to a receiver.</t>
      
      <t>Update notification message: A notification message that contains an update record.  </t>
	  
	  <t>Update record: A representation data node update(s) resulting from the application of a filter for a subscription. An update record will include the value/property of one or more data nodes at a point in time. It may contain the update type for each data node (e.g., add, change, delete).  Also included may be metadata/headers such as a subscription-id.</t>

      <t>Update trigger: A mechanism that determines when an update record needs to be generated. </t>
	  
      <t>YANG-Push: The subscription and push mechanism for YANG datastores that is specified in this document.</t>
	  
    </section>
    <section title="Solution Overview">
      <t>This document specifies a solution for a push update subscription service.  
      This solution supports the dynamic as well as configured subscriptions to information updates from YANG datastores. 
      Subscriptions specify when update notification messages should be sent and what data to include in update records.  
      YANG objects are subsequently pushed from the publisher to the receiver per the terms of the subscription.</t>

      <section title="Event Subscription Model">
        <t>YANG-push subscriptions are defined using a data model that is itself defined in YANG.  
        This model enhances the event subscription model defined in <xref target="subscribe"/> 
        with capabilities that allow subscribers to subscribe to data node updates, 
        specifically to specify the triggers defining when to generate update records as well as what to include in an update record.  
        Key enhancements include:</t>
		 
		<t><list style="symbols">
  		    <t>Specification of selection filters which identify targeted YANG data nodes and/or subtrees within a datastore for which updates are to be pushed.</t> 
          
			<t>An encoding (using anydata) for the contents of periodic and on-change push updates.</t>
            
            <t>Specification of update policies contain conditions which trigger the generation and pushing of new update records.  There are two types of triggers for subscriptions: periodic and on-change.  
			<list style="symbols">
                <t>For periodic subscriptions, the trigger is specified by two parameters that define when updates are to be pushed. These parameters are the period interval with which to report updates, and an anchor time which can be used to calculate at which point in time updates need to be assembled and sent.</t>

                <t>For on-change subscriptions, a trigger occurs whenever a change in the subscribed information is detected. Included are additional parameters such as: 
				  <list style="symbols">
                    <t>Dampening period: In an on-change subscription, the first change that is detected results in an update to be sent immediately.  However, sending successive updates whenever further changes are detected might result in quick exhaustion of resources in case of very rapid changes.  In order to protect against that, a dampening period is used to specify the interval which must pass before successive update records for the same subscription are generated.  The dampening period collectively applies to the set of all data nodes of a single subscription.  This means that when there is a change to a subscribed object, an update record containing that object is created either immediately when no dampening period is already in effect, or at the end of a dampening period. </t>

                    <t>Change type: This parameter can be used to reduce the types of datastore changes for which updates are sent (e.g., you might only send when an object is created or deleted, but not when an object value changes).</t>

                    <t>No Synch on start: defines whether or not a complete push-update of all subscribed data will be sent at the beginning of a subscription.  Such early synchronization establishes the frame of reference for subsequent updates.</t>
                  </list>
				</t>
			</list>
            </t>

			         
		</list></t> 
      </section>

      <section title="Negotiation of Subscription Policies"> 
	  
		<t>A dynamic subscription request SHOULD be declined if a publisher's assessment is that it may be unable to provide update records meeting the terms of the request.  In this case, a subscriber may quickly follow up with a new subscription request using different parameters. </t>

		<t>Random guessing at different parameters by a subscriber is to be discouraged.  Therefore, in order to minimize the number of subscription iterations between subscriber and publisher, 
        dynamic subscriptions SHOULD support a simple negotiation between subscribers and publishers for subscription parameters. 
        This negotiation is in the form of a no-success response to a failed establish or modify subscription request.  
        The no-success message SHOULD include in the returned error response information that, when considered, increases the likelihood of success for subsequent requests.  
        However, there are no guarantees that subsequent requests for this subscriber will be accepted.</t>
		
		<t><xref target="subscribe"/> contains several negotiable subscription parameters.  Additional yang-push negotiation information defined in this specification includes hints at acceptable time intervals, size estimates for the number or objects which would be returned from a filter, and the location of an error in a provided filter.</t>

      </section>

      <section anchor="on-change" title="On-Change Considerations">
        <t>
		On-change subscriptions allow subscribers to subscribe to updates whenever changes to targeted objects occur. As such, on-change subscriptions are particularly effective for data that changes infrequently, yet for which applications need to be quickly notified  whenever a change does occur with minimal delay.
		</t>
        <t>
		On-change subscriptions tend to be more difficult to implement than periodic subscriptions. 
        Accordingly, on-change subscriptions may not be supported by all implementations or for every object.  
        </t>
        <t> 
        Whether or not to accept or reject on-change subscription requests when the scope of the subscription contains objects for which on-change is not supported is up to the publisher implementation. A publisher MAY accept an on-change subscription even when the scope of the subscription contains objects for which on-change is not supported.  In that case, updates are sent only for those objects within the scope that do support on-change updates whereas other objects are excluded from update records, whether or not their values actually change.  In order for a subscriber to determine whether objects support on-change subscriptions, objects are marked accordingly on a publisher.  Accordingly, when subscribing, it is the responsibility of the subscriber to ensure it is aware of which objects support on-change and which do not. For more on how objects are so marked, see <xref target="on-change-notifiable"/>. 
        </t>
        <t>
        Alternatively, a publisher MAY decide to simply reject an on-change subscription in case the scope of the subscription contains objects for which on-change is not supported. In case of a configured subscription, the subscription MAY be  suspended.  
		</t>
        <t>
		To avoid flooding receivers with repeated updates for subscriptions containing fast-changing objects, or objects with oscillating values, an on-change subscription allows for the definition of a dampening period. Once an update record for a given object is generated, no other updates for this particular subscription will be created until the end of the dampening period. Values sent at the end of the dampening period are the current values of all changed objects which are current at the time the dampening period expires.  Changed objects include those which were deleted or newly created during that dampening period.  If an object has returned to its original value (or even has been created and then deleted) during the dampening-period, the last change will still be sent.  This will indicate churn is occurring on that object.
		</t>
        <t>
        In cases where a subscriber wants to have separate dampening periods for different objects, multiple subscriptions with different objects in a selection filter can be created.  
        </t>  
        <t>
		On-change subscriptions can be refined to let users subscribe only to certain types of changes. For example, a subscriber might only want object creations and deletions, but not modifications of object values.  
		</t>
		
      </section>
      
      <section anchor="promise-theory" title="Promise-Theory Considerations">
        <t>
        A subscription to updates from a YANG datastore is intended to obviate the need for polling.  However, in order to do so, it is critical that subscribers can rely on the subscription and have confidence that they will indeed receive the subscribed updates without having to worry updates being silently dropped.  In other words, a subscription constitutes a promise on the side of the publisher to provide the receivers with updates per the terms of the subscription.  
        </t>
        <t>
		Now, there are many reasons why a publisher may at some point no longer be able to fulfill the terms of the subscription, even if the subscription had been entered into with good faith.  For example, the volume of data objects may be larger than anticipated, the interval may prove too short to send full updates in rapid succession, or an internal problem may prevent objects from being collected.  If for some reason the publisher of a subscription is not able to keep its promise, receivers MUST be notified immediately and reliably. The publisher MAY also suspend the subscription.    
        </t>
        <t>
        A publisher SHOULD reject a request for a subscription if it is unlikely that the publisher will be able fulfill the terms of that subscription request. In such cases, it is preferable to have a subscriber request a less resource intensive subscription than to deal with frequently degraded behavior.   
        </t>
      </section>

      <section title="Data Encodings">
        <t>A publisher MUST support XML encoding and MAY support other encodings such as JSON encoding. </t>

        <section title="Periodic Subscriptions">
          <t>In a periodic subscription, the data included as part of an
          update corresponds to data that could have been simply retrieved
          using a get operation and is encoded in the same way. XML encoding
          rules for data nodes are defined in <xref target="RFC7950"/>. JSON
          encoding rules are defined in <xref target="RFC7951"/>.</t>
        </section>

        <section title="On-Change Subscriptions">
          <t>In an on-change subscription, updates need to indicate not only values of changed data nodes but also the types of changes that occurred since the last update.  Therefore encoding rules for data in on-change updates will follow YANG-patch operation as specified in <xref target="RFC8072"/>.  The YANG-patch will describe what needs to be applied to the earlier state reported by the preceding 
          update, to result in the now-current state. Note that contrary to <xref target="RFC8072"/>, objects encapsulated are not restricted to configuration objects only. </t>

        </section>
      </section>

      <section title="Datastore Selection Filters">
        <t>Subscription policy specifies both the selection filters and the datastores against which these selection filters will be applied.  The result is the push of information necessary to remotely maintain an extract of the publisher's datastore.</t>  
        
        <t>Only a single selection filter can be applied to a subscription at a time.  The following selection filter types are included in the yang-push data model, and may be applied against a datastore:</t> 
		
        <t><list style="symbols">
            <t>subtree: A subtree selection filter identifies one or more subtrees. When specified, updates will only come from the data nodes of selected YANG subtree(s). The syntax and semantics correspond to that specified for <xref target="RFC6241"/> section 6.</t>

            <t>xpath: An xpath selection filter is an XPath expression which may be meaningfully applied to a datastore. It is the results of this expression which will be pushed. </t>
        </list></t> 		
		
        <t>
		These filters are intended to be used as selectors that define which objects are within the scope of a subscription.  Filters are not intended to be used to filter objects based on a non-key property. Supporting non-key property filtering so would have a number of implications that would result in significant complexity. While it is possible to define extensions in the future that will support selection filtering based on values, this is not supported in this version of yang-push and a publisher MAY reject a subscription request that contains a filter for object values.
        </t>        
       
		<t>Xpath itself provides powerful filtering constructs, and care must be used in filter definition.  As an example, consider an xpath filter with a boolean result; such a result will not provide an easily interpretable subset of a datastore. Beyond the boolean example, it is quite possible to define an xpath filter where results are easy for an application to mis-interpret. Consider an xpath filter which only passes a datastore object when an interface is up. It is up to the receiver to understand implications of the presence or absence of objects in each update. </t>
		
		<t>It is not expected that implementations will support comprehensive filter syntax and boundless complexity. It will be up to implementations to describe what is viable, but the goal is to provide equivalent capabilities to what is available with a GET.  Implementations MUST reject dynamic subscriptions or suspend configured subscriptions if they include filters which are unsupportable on a platform.</t>
      </section>

      <section title="Streaming Updates">
        <t>Contrary to traditional data retrieval requests, datastore subscription enables an unbounded series of update records to be streamed over time. Two generic notifications for update records have been defined for this: "push-update" and "push-change-update". </t>

        <t>A push-update notification defines a complete, filtered update of the datastore per the terms of a subscription.  This type of notification is used for continuous updates of periodic subscriptions.  A push-update notification can also be used for the on-change subscriptions in two cases.  First it will be used as the initial push-update if there is a need to synchronize the receiver at the start of a new subscription.  It also MAY be sent if the publisher later chooses to resynch an on-change subscription.  The push-update record contains a data snippet that contains an instantiated subtree with the subscribed contents.  The content of the update record is equivalent to the contents that would be obtained had the same data been explicitly retrieved using e.g., a NETCONF "get" operation, with the same filters applied.</t>

        <t>A push-change-update notification is the most common type of update for on-change subscriptions. 
        The update record in this case contains a data snippet that indicates the set of changes that data nodes have undergone since the last notification of YANG objects. 
        In other words, this indicates which data nodes have been created, deleted, or have had changes to their values.  
        In cases where multiple changes have occurred and the object has not been deleted, the object's most current value is reported.  (In other words, for each object, only one change is reported, not its entire history.  Doing so would defeat the purpose of the dampening period.)</t>

        <t>These new push-update or push-change-update are encoded and placed within notification messages, and ultimately queued for egress over the specified transport.  </t>
		
		<t>The following is an example of an XML encoded notification message over NETCONF transport as per <xref target="netconf-notif"/>.</t>

        <figure align="center" anchor="push-example" title="Push example">
          <artwork align="left"><![CDATA[ 
     <notification
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
        <eventTime>2015-03-09T19:14:56Z</eventTime>
        <push-update 
            xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
          <subscription-id>1011</subscription-id>
          <time-of-update>2015-03-09T19:14:55.233Z</time-of-update>
          <datastore-contents>
             <foo>
                <bar>some_string</bar>
             </foo>
          </datastore-contents>
        </push-update>
     </notification>
          ]]></artwork>
        </figure>

        <t>The following is an example of an on-change notification. It
        contains an update for subscription 89, including a new value for a
        leaf called beta, which is a child of a top-level container called
        alpha:</t>

        <figure align="center" anchor="push-example-on-change"
                title="Push example for on change">
          <artwork align="left"><![CDATA[ 
     <notification
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
        <eventTime>2015-03-09T19:14:56Z</eventTime>
        <push-change-update xmlns=
            "urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
          <subscription-id>89</subscription-id>
          <time-of-update>2015-03-09T19:14:55.233Z</time-of-update>
          <datastore-changes>
            <alpha xmlns="http://example.com/sample-data/1.0" >
              <beta>1500</beta>
            </alpha>
          </datastore-changes>
        </push-change-update>
     </notification>
          ]]></artwork>
        </figure>

        <t>The equivalent update when requesting json encoding:</t>

        <figure align="center" anchor="push-example-on-change-json"
                title="Push example for on change with JSON">
          <artwork align="left"><![CDATA[ 
     <notification
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
        <eventTime>2015-03-09T19:14:56Z</eventTime>
        <push-change-update xmlns=
            "urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
          <subscription-id>89</subscription-id>
          <time-of-update>2015-03-09T19:14:55.233Z</time-of-update>
          <datastore-changes>
            {
             "ietf-yang-patch:yang-patch": {
             "patch-id": [
               null
             ],
             "edit": [
               {
                   "edit-id": "edit1",
                   "operation": "merge",
                   "target": "/alpha/beta",
                   "value": {
                       "beta": 1500
                   }
               }
             ]
            } 
          }  
          </datastore-changes>
        </push-change-update>
     </notification>
          ]]></artwork>
        </figure>

        <t>When the beta leaf is deleted, the publisher may send</t>

        <figure align="center" anchor="push-example-on-change-2"
                title="2nd push example for on change update">
          <artwork align="left"><![CDATA[ 
     <notification
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
        <eventTime>2015-03-09T19:14:56Z</eventTime>
        <push-change-update xmlns=
            "urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
          <subscription-id>89</subscription-id>
          <time-of-update>2015-03-09T19:14:55.233Z</time-of-update>
          <datastore-changes-xml>
            <alpha xmlns="http://example.com/sample-data/1.0" >
              <beta urn:ietf:params:xml:ns:netconf:base:1.0:
                  operation="delete"/>
            </alpha>
          </datastore-changes-xml>
        </push-change-update>
     </notification>
          ]]></artwork>
        </figure>
      </section>

      <section title="Subscription Management">
        <t>The RPCs defined within <xref target="subscribe"/> have been enhanced to support YANG datastore subscription negotiation.  Included in these enhancements are error codes which can indicate why a datastore subscription attempt has failed.</t>

        <t>A datastore subscription can be rejected for multiple reasons.  This includes a too large subtree request, or the inability of the publisher push update records as frequently as requested. In such cases, no subscription is established. Instead, the subscription-result with the failure reason is returned as part of the RPC response. As part of this response, a set of alternative subscription parameters MAY be returned that would likely have resulted in acceptance of the subscription request.  The subscriber may consider these as part of future subscription attempts.</t>

        <t>For instance, for the following request:</t>

          <figure align="center" anchor="establish-subscription"
                  title="Establish-Subscription example">
            <artwork align="left"><![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>
	    <source>operational</source>
	    <subtree-filter netconf:type="xpath"
            xmlns:ex="http://example.com/sample-data/1.0"
            select="/ex:foo"/>
	  </datastore>
      <period>500</period>
      <encoding>encode-xml</encoding>
   </establish-subscription>
</netconf:rpc>
]]></artwork>
          </figure>

          <t>the publisher might return:</t>

          <figure align="center"
                  anchor="establish-subscription-error-response"
                  title="Error response example">
            <artwork align="left"><![CDATA[ 
<rpc-reply message-id="101" 
     xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
   <subscription-result 
     xmlns="http://urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
     error-insufficient-resources
   </subscription-result>
   <period>2000</period>
</rpc-reply>
]]></artwork>
          </figure>
		  
		  <t>As can be seen above the rejected subscription does not result in the generation of an rpc-reply with an rpc-error element. YANG-push specific errors and negotiation hints part are returned as part of normal RPC operations.</t>
      </section>

      
      <section anchor="Authorization" title="Receiver Authorization">
          <t>A receiver of subscription data MUST only be sent updates for which they have proper authorization.  A publisher MUST ensure that no non-authorized data is included in push updates.  To do so, it needs to apply all corresponding checks applicable at the time of a specific pushed update and if necessary silently remove any non-authorized data from subtrees. This enables YANG data pushed based on subscriptions to be authorized equivalently to a regular data retrieval (get) operation.</t>
		  
		  <t>A publisher MAY allow subscriptions which select non-existent or access-protected data. Such a capability permits a receiver the ability to monitor the entire lifecyle of the data. In this case, all push-updates must be sent empty, and no push-change-updates will be sent until the data becomes visible for a receiver.</t>		     
          <t>A publisher MAY alternatively choose not to allow subscriptions which select non-existent or access-protected data. Such a capability enables the publisher to avoid having to perform filtering of authorized content on each update. Relevant scenarios here include: 
		  
		    <list style="symbols">
		      <t>the rejecting of a subscription request to access-protected objects,</t>  
			  <t>the suspension of a subscription where new access-controlled objects are selected mid-subscription for which the receiver does not have the necessary authorization, or</t> 
			  <t>the authorization privileges of a receiver change over the course of the subscription.</t>
		  
		    </list>
		  
		  In all these cases, the error identity "data-unavailable" SHOULD be returned.  This reduces the possibility of access permission leakage.</t>

          <t>The contextual authorization model for data in YANG datastores is the NETCONF Access Control Model <xref target="RFC6536bis"/>, Section 3.2.4.  A clarification to this is that each of the individual nodes in a resulting update record MUST also have applied access control to resulting pushed messages. This includes validating that read access is ok for any nodes newly selected since the last update record for each receiver.</t>  
		  
		  <figure align="center" anchor="access-control-push-update"
                  title="Access control for push updates">
            <artwork align="left"><![CDATA[          
                       +-------------+      +-------------------+
  push-update / -->    |  data node  |  yes |                   |  
  push-change-update   |   access    | ---> | add data node     |
                       |  allowed?   |      | to update message |
                       +-------------+      +-------------------+
          ]]></artwork>
          </figure>
		  
		  <t>If read access into previously accessible nodes has been lost due to a receiver permissions change, this SHOULD be reported as node 'delete' operations for on-change subscriptions. If not capable of handling such receiver permission changes with such a 'delete', publisher implementations MUST force dynamic subscription re-establishment or configured subscription re-initialization so that appropriate filtering is installed.</t>
  
        </section>

		<section title="On-change Notifiable YANG objects" anchor="on-change-notifiable">
			<t>In some cases, a publisher supporting on-change notifications may not be able to push updates for some object types on-change.  Reasons for this might be that the value of the data node changes frequently (e.g., <xref target="RFC7223"/>'s in-octets counter), that small object changes are frequent and meaningless (e.g., a temperature gauge changing 0.1 degrees), or that the implementation is not capable of on-change notification for a particular object.</t>
			
			<t>Support for on-change notification is usually specific to the individual YANG model and/or implementation so it is possible to define in design time. System integrators need this information (without reading any data from a live node).</t>

			<t>The default assumption is that no data nodes support on-change notification. Schema nodes and subtrees that support on-change notifications MUST be marked by accordingly with the YANG extension "notifiable-on-change".  This extension is defined in the data model below.</t>
			      
			<t>When an on-change subscription is established, data-nodes are automatically excluded unless they are marked with notifiable-on-change as true.  
            This also means that authorization checks SHALL NOT be performed on them. A subscriber can identify which nodes may be included in on-change updates by retrieving the data nodes in the subscription's scope and checking for which notifiable-on-change is marked as true.</t>
			
			<t>In theory, adding notifiable-on-change markings can be done within corresponding YANG models.  But a more extensible way to avoid having to modify existing module definitions is to add notifiable-on-change markings within separate module deviations. This means that when a YANG model designer wants to add a notifiable-on-change marking to nodes of an existing module without modifying the 
            module definitions, a new module is introduced that contains deviation statements which add "notifiable-on-change" statements as applicable.  </t>
			
			<figure align="center" anchor="deviation-example" title="Deviation Example">
              <artwork align="left"><![CDATA[
 deviation /sys:system/sys:system-time {
   deviate add {
      yp:notifiable-on-change false;
   }
 }
]]>           </artwork>
            </figure>
		
        </section>
		
      <section title="Other Considerations">
        <section title="Robustness and reliability">
          <t>Particularly in the case of on-change push updates, it is important that push updates do not get lost or, in case the loss of an update 
          is unavoidable, that the receiver is notified accordingly.</t>

          <t>Update messages for a single subscription MAY NOT be resequenced.</t>

          <t>It is conceivable that under certain circumstances, a publisher will recognize that it is unable to include within an update record the full set of objects desired per the terms of a subscription.  In this case, the publisher MUST take one or more of the following actions.
		  
			<list style="symbols">
				<t>A publisher MUST set the updates-not-sent flag on any update record which is known to be missing information.</t>
			
				<t>It MAY choose to suspend a subscription as per <xref target="subscribe"/>.</t>  

				<t>When resuming an on-change subscription, the publisher SHOULD generate a complete patch from the previous update record.  If this is not possible and the synch-on-start option is configured, then the full datastore contents MAY be sent via a push-update instead (effectively replacing the previous contents).  If neither of these are possible, then an updates-not-sent flag MUST be included on the next push-change-update.</t> 
			</list>
		  </t>
		  <t>Note: It is perfectly acceptable to have a series of push-change-updates (and even push updates) serially queued at the transport layer awaiting transmission.  It is not required to merge pending update messages. I.e., the dampening period applies to update record creation, not transmission.</t>
        </section>

        <section title="Publisher capacity">

          <t>It is far preferable to decline a subscription request than to accept such a request when it cannot be met.</t>

          <t>Whether or not a subscription can be supported will be determined by a combination of several factors such as the subscription trigger (on-change or periodic), the period in which to report changes (1 second periods will consume more resources than 1 hour periods), the amount of data in the subtree that is being subscribed to, and the number and combination of other subscriptions that are concurrently being serviced.</t>
		  
        </section>

      </section>
    </section>
    <section title="A YANG data model for management of datastore push subscriptions">
      <section title="Overview">
        <t>The YANG data model for datastore push subscriptions is depicted in the following figure. Following YANG tree convention in the depiction, brackets enclose list keys, "rw" means configuration, "ro" operational state data, "?" designates optional nodes, "*" designates nodes that can have multiple instances. Parentheses with a name in the middle enclose choice and case nodes. New YANG objects defined here (i.e., beyond those from <xref target="subscribe"/>) are identified with "yp". </t>

        <figure align="center" anchor="model-structure"
                title="Model structure">
          <artwork align="left"><![CDATA[
module: ietf-subscribed-notifications
    +--ro streams
    |  +--ro stream* [name]
    |     +--ro name                        stream
    |     +--ro description                 string
    |     +--ro replay-support?             empty {replay}?
    |     +--ro replay-log-creation-time?   yang:date-and-time {replay}?
    |     +--ro replay-log-aged-time?       yang:date-and-time {replay}?
    +--rw filters
    |  +--rw event-filter* [identifier]
    |  |  +--rw identifier        filter-id
    |  |  +--rw (filter-spec)?
    |  |     +--:(subtree-filter)
    |  |     |  +--rw subtree-filter?
    |  |     +--:(xpath-filter)
    |  |        +--rw xpath-filter?     yang:xpath1.0
    |  +--rw yp:selection-filter* [identifier]
    |     +--rw yp:identifier        sn:filter-id
    |     +--rw (yp:filter-spec)?
    |        +--:(yp:subtree-filter)
    |        |  +--rw yp:subtree-filter?
    |        +--:(yp:xpath-filter)
    |           +--rw yp:xpath-filter?     yang:xpath1.0
    +--rw subscription-config {configured-subscriptions}?
    |  +--rw subscription* [identifier]
    |     +--rw identifier                 subscription-id
    |     +--rw encoding?                  encoding
    |     +--rw (target)
    |     |  +--:(stream)
    |     |  |  +--rw (event-filter)?
    |     |  |  |  +--:(by-reference)
    |     |  |  |  |  +--rw event-filter-ref           event-filter-ref
    |     |  |  |  +--:(within-subscription)
    |     |  |  |     +--rw (filter-spec)?
    |     |  |  |        +--:(subtree-filter)
    |     |  |  |        |  +--rw subtree-filter?
    |     |  |  |        +--:(xpath-filter)
    |     |  |  |           +--rw xpath-filter?            yang:xpath1.0
    |     |  |  +--rw stream                     stream
    |     |  |  +--rw replay-start-time?    yang:date-and-time {replay}?
    |     |  +--:(yp:datastore)
    |     |     +--rw yp:source                  identityref
    |     |     +--rw (yp:selected-content)?
    |     |        +--:(yp:by-reference)
    |     |        |  +--rw yp:selection-filter-ref selection-filter-ref
    |     |        +--:(yp:within-subscription)
    |     |           +--rw (yp:filter-spec)?
    |     |              +--:(yp:subtree-filter)
    |     |              |  +--rw yp:subtree-filter?
    |     |              +--:(yp:xpath-filter)
    |     |                 +--rw yp:xpath-filter?         yang:xpath1.0
    |     +--rw stop-time?                 yang:date-and-time
    |     +--rw receivers
    |     |  +--rw receiver* [address port]
    |     |     +--rw address     inet:host
    |     |     +--rw port        inet:port-number
    |     |     +--rw protocol?   transport-protocol
    |     +--rw (notification-origin)?
    |     |  +--:(interface-originated)
    |     |  |  +--rw source-interface?          if:interface-ref
    |     |  +--:(address-originated)
    |     |     +--rw source-vrf?                string
    |     |     +--rw source-address?            inet:ip-address-no-zone
    |     +--rw (yp:update-trigger)?
    |     |  +--:(yp:periodic)
    |     |  |  +--rw yp:period                  yang:timeticks
    |     |  |  +--rw yp:anchor-time?            yang:date-and-time
    |     |  +--:(yp:on-change) {on-change}?
    |     |     +--rw yp:dampening-period        yang:timeticks
    |     |     +--rw yp:no-synch-on-start?      empty
    |     |     +--rw yp:excluded-change*        change-type
    |     +--rw yp:dscp?                   inet:dscp
    |     +--rw yp:weighting?              uint8
    |     +--rw yp:dependency?             sn:subscription-id
    +--ro subscriptions
       +--ro subscription* [identifier]
          +--ro identifier                 subscription-id
          +--ro configured-subscription?   
          |                            empty {configured-subscriptions}?
          +--ro encoding?                  encoding
          +--ro (target)
          |  +--:(stream)
          |  |  +--ro (event-filter)?
          |  |  |  +--:(by-reference)
          |  |  |  |  +--ro event-filter-ref           event-filter-ref
          |  |  |  +--:(within-subscription)
          |  |  |     +--ro (filter-spec)?
          |  |  |        +--:(subtree-filter)
          |  |  |        |  +--ro subtree-filter?
          |  |  |        +--:(xpath-filter)
          |  |  |           +--ro xpath-filter?            yang:xpath1.0
          |  |  +--ro stream                     stream
          |  |  +--ro replay-start-time?    yang:date-and-time {replay}?
          |  +--:(yp:datastore)
          |     +--ro yp:source                  identityref
          |     +--ro (yp:selected-content)?
          |        +--:(yp:by-reference)
          |        |  +--ro yp:selection-filter-ref selection-filter-ref
          |        +--:(yp:within-subscription)
          |           +--ro (yp:filter-spec)?
          |              +--:(yp:subtree-filter)
          |              |  +--ro yp:subtree-filter?
          |              +--:(yp:xpath-filter)
          |                 +--ro yp:xpath-filter?         yang:xpath1.0
          +--ro stop-time?                 yang:date-and-time
          +--ro (notification-origin)?
          |  +--:(interface-originated)
          |  |  +--ro source-interface?          if:interface-ref
          |  +--:(address-originated)
          |     +--ro source-vrf?                string
          |     +--ro source-address?            inet:ip-address-no-zone
          +--ro receivers
          |  +--ro receiver* [address port]
          |     +--ro address                   inet:host
          |     +--ro port                      inet:port-number
          |     +--ro protocol?                 transport-protocol
          |     +--ro pushed-notifications?     yang:counter64
          |     +--ro excluded-notifications?   yang:counter64
          |     +--ro status                    subscription-status
          +--ro (yp:update-trigger)?
          |  +--:(yp:periodic)
          |  |  +--ro yp:period                  yang:timeticks
          |  |  +--ro yp:anchor-time?            yang:date-and-time
          |  +--:(yp:on-change) {on-change}?
          |     +--ro yp:dampening-period        yang:timeticks
          |     +--ro yp:no-synch-on-start?      empty
          |     +--ro yp:excluded-change*        change-type
          +--ro yp:dscp?                   inet:dscp
          +--ro yp:weighting?              uint8
          +--ro yp:dependency?             sn:subscription-id

  rpcs:
    +---x establish-subscription
    |  +---w input
    |  |  +---w encoding?                  encoding
    |  |  +---w (target)
    |  |  |  +--:(stream)
    |  |  |  |  +---w (event-filter)?
    |  |  |  |  |  +--:(by-reference)
    |  |  |  |  |  |  +---w event-filter-ref           event-filter-ref
    |  |  |  |  |  +--:(within-subscription)
    |  |  |  |  |     +---w (filter-spec)?
    |  |  |  |  |        +--:(subtree-filter)
    |  |  |  |  |        |  +---w subtree-filter?
    |  |  |  |  |        +--:(xpath-filter)
    |  |  |  |  |           +---w xpath-filter?            yang:xpath1.0
    |  |  |  |  +---w stream                     stream
    |  |  |  |  +---w replay-start-time?    yang:date-and-time {replay}?
    |  |  |  +--:(yp:datastore)
    |  |  |     +---w yp:source                  identityref
    |  |  |     +---w (yp:selected-content)?
    |  |  |        +--:(yp:by-reference)
    |  |  |        |  +---w yp:selection-filter-ref selection-filter-ref
    |  |  |        +--:(yp:within-subscription)
    |  |  |           +---w (yp:filter-spec)?
    |  |  |              +--:(yp:subtree-filter)
    |  |  |              |  +---w yp:subtree-filter?
    |  |  |              +--:(yp:xpath-filter)
    |  |  |                 +---w yp:xpath-filter?         yang:xpath1.0
    |  |  +---w stop-time?                 yang:date-and-time
    |  |  +---w (yp:update-trigger)?
    |  |  |  +--:(yp:periodic)
    |  |  |  |  +---w yp:period                  yang:timeticks
    |  |  |  |  +---w yp:anchor-time?            yang:date-and-time
    |  |  |  +--:(yp:on-change) {on-change}?
    |  |  |     +---w yp:dampening-period        yang:timeticks
    |  |  |     +---w yp:no-synch-on-start?      empty
    |  |  |     +---w yp:excluded-change*        change-type
    |  |  +---w yp:dscp?                   inet:dscp
    |  |  +---w yp:weighting?              uint8
    |  |  +---w yp:dependency?             sn:subscription-id
    |  +--ro output
    |     +--ro subscription-result         subscription-result
    |     +--ro (result)?
    |        +--:(no-success)
    |        |  +--ro filter-failure?             string
    |        |  +--ro replay-start-time-hint?     yang:date-and-time
    |        |  +--ro yp:period-hint?             yang:timeticks
    |        |  +--ro yp:error-path?              string
    |        |  +--ro yp:object-count-estimate?   uint32
    |        |  +--ro yp:object-count-limit?      uint32
    |        |  +--ro yp:kilobytes-estimate?      uint32
    |        |  +--ro yp:kilobytes-limit?         uint32
    |        +--:(success)
    |           +--ro identifier                  subscription-id
    +---x modify-subscription
    |  +---w input
    |  |  +---w identifier?                subscription-id
    |  |  +---w (target)
    |  |  |  +--:(stream)
    |  |  |  |  +---w (event-filter)?
    |  |  |  |     +--:(by-reference)
    |  |  |  |     |  +---w event-filter-ref           event-filter-ref
    |  |  |  |     +--:(within-subscription)
    |  |  |  |        +---w (filter-spec)?
    |  |  |  |           +--:(subtree-filter)
    |  |  |  |           |  +---w subtree-filter?
    |  |  |  |           +--:(xpath-filter)
    |  |  |  |              +---w xpath-filter?            yang:xpath1.0
    |  |  |  +--:(yp:datastore)
    |  |  |     +---w (yp:selected-content)?
    |  |  |        +--:(yp:by-reference)
    |  |  |        |  +---w yp:selection-filter-ref selection-filter-ref
    |  |  |        +--:(yp:within-subscription)
    |  |  |           +---w (yp:filter-spec)?
    |  |  |              +--:(yp:subtree-filter)
    |  |  |              |  +---w yp:subtree-filter?
    |  |  |              +--:(yp:xpath-filter)
    |  |  |                 +---w yp:xpath-filter?         yang:xpath1.0
    |  |  +---w stop-time?                 yang:date-and-time
    |  |  +---w (yp:update-trigger)?
    |  |     +--:(yp:periodic)
    |  |     |  +---w yp:period                  yang:timeticks
    |  |     |  +---w yp:anchor-time?            yang:date-and-time
    |  |     +--:(yp:on-change) {on-change}?
    |  |        +---w yp:dampening-period        yang:timeticks
    |  +--ro output
    |     +--ro subscription-result         subscription-result
    |     +--ro (result)?
    |        +--:(no-success)
    |           +--ro filter-failure?             string
    |           +--ro yp:period-hint?             yang:timeticks
    |           +--ro yp:error-path?              string
    |           +--ro yp:object-count-estimate?   uint32
    |           +--ro yp:object-count-limit?      uint32
    |           +--ro yp:kilobytes-estimate?      uint32
    |           +--ro yp:kilobytes-limit?         uint32
    +---x delete-subscription
    |  +---w input
    |  |  +---w identifier    subscription-id
    |  +--ro output
    |     +--ro subscription-result    subscription-result
    +---x kill-subscription
       +---w input
       |  +---w identifier    subscription-id
       +--ro output
          +--ro subscription-result    subscription-result

  notifications:
    +---n replay-completed
    |  +--ro identifier    subscription-id
    +---n subscription-completed
    |  +--ro identifier    subscription-id
    +---n subscription-started
    |  +--ro identifier                 subscription-id
    |  +--ro encoding?                  encoding
    |  +--ro (target)
    |  |  +--:(stream)
    |  |  |  +--ro (event-filter)?
    |  |  |  |  +--:(by-reference)
    |  |  |  |  |  +--ro event-filter-ref           event-filter-ref
    |  |  |  |  +--:(within-subscription)
    |  |  |  |     +--ro (filter-spec)?
    |  |  |  |        +--:(subtree-filter)
    |  |  |  |        |  +--ro subtree-filter?
    |  |  |  |        +--:(xpath-filter)
    |  |  |  |           +--ro xpath-filter?              yang:xpath1.0
    |  |  |  +--ro stream                     stream
    |  |  |  +--ro replay-start-time?       yang:date-and-time {replay}?
    |  |  +--:(yp:datastore)
    |  |     +--ro yp:source                  identityref
    |  |     +--ro (yp:selected-content)?
    |  |        +--:(yp:by-reference)
    |  |        |  +--ro yp:selection-filter-ref    selection-filter-ref
    |  |        +--:(yp:within-subscription)
    |  |           +--ro (yp:filter-spec)?
    |  |              +--:(yp:subtree-filter)
    |  |              |  +--ro yp:subtree-filter?
    |  |              +--:(yp:xpath-filter)
    |  |                 +--ro yp:xpath-filter?           yang:xpath1.0
    |  +--ro stop-time?                 yang:date-and-time
    |  +--ro (yp:update-trigger)?
    |  |  +--:(yp:periodic)
    |  |  |  +--ro yp:period                  yang:timeticks
    |  |  |  +--ro yp:anchor-time?            yang:date-and-time
    |  |  +--:(yp:on-change) {on-change}?
    |  |     +--ro yp:dampening-period        yang:timeticks
    |  |     +--ro yp:no-synch-on-start?      empty
    |  |     +--ro yp:excluded-change*        change-type
    |  +--ro yp:dscp?                   inet:dscp
    |  +--ro yp:weighting?              uint8
    |  +--ro yp:dependency?             sn:subscription-id
    +---n subscription-resumed
    |  +--ro identifier    subscription-id
    +---n subscription-modified
    |  +--ro identifier                 subscription-id
    |  +--ro encoding?                  encoding
    |  +--ro (target)
    |  |  +--:(stream)
    |  |  |  +--ro (event-filter)?
    |  |  |  |  +--:(by-reference)
    |  |  |  |  |  +--ro event-filter-ref           event-filter-ref
    |  |  |  |  +--:(within-subscription)
    |  |  |  |     +--ro (filter-spec)?
    |  |  |  |        +--:(subtree-filter)
    |  |  |  |        |  +--ro subtree-filter?
    |  |  |  |        +--:(xpath-filter)
    |  |  |  |           +--ro xpath-filter?              yang:xpath1.0
    |  |  |  +--ro stream                     stream
    |  |  |  +--ro replay-start-time?       yang:date-and-time {replay}?
    |  |  +--:(yp:datastore)
    |  |     +--ro yp:source                  identityref
    |  |     +--ro (yp:selected-content)?
    |  |        +--:(yp:by-reference)
    |  |        |  +--ro yp:selection-filter-ref    selection-filter-ref
    |  |        +--:(yp:within-subscription)
    |  |           +--ro (yp:filter-spec)?
    |  |              +--:(yp:subtree-filter)
    |  |              |  +--ro yp:subtree-filter?
    |  |              +--:(yp:xpath-filter)
    |  |                 +--ro yp:xpath-filter?           yang:xpath1.0
    |  +--ro stop-time?                 yang:date-and-time
    |  +--ro (yp:update-trigger)?
    |  |  +--:(yp:periodic)
    |  |  |  +--ro yp:period                  yang:timeticks
    |  |  |  +--ro yp:anchor-time?            yang:date-and-time
    |  |  +--:(yp:on-change) {on-change}?
    |  |     +--ro yp:dampening-period        yang:timeticks
    |  |     +--ro yp:no-synch-on-start?      empty
    |  |     +--ro yp:excluded-change*        change-type
    |  +--ro yp:dscp?                   inet:dscp
    |  +--ro yp:weighting?              uint8
    |  +--ro yp:dependency?             sn:subscription-id
    +---n subscription-terminated
    |  +--ro identifier        subscription-id
    |  +--ro error-id          subscription-errors
    |  +--ro filter-failure?   string
    +---n subscription-suspended
       +--ro identifier        subscription-id
       +--ro error-id          subscription-errors
       +--ro filter-failure?   string

module: ietf-yang-push

  rpcs:
    +---x resynch-subscription {on-change}?
       +---w input
       |  +---w identifier    sn:subscription-id
       +--ro output
          +--ro subscription-result    sn:subscription-result

  notifications:
    +---n push-update
    |  +--ro subscription-id?      sn:subscription-id
    |  +--ro time-of-update?       yang:date-and-time
    |  +--ro updates-not-sent?     empty
    |  +--ro datastore-contents?
    +---n push-change-update {on-change}?
       +--ro subscription-id?     sn:subscription-id
       +--ro time-of-update?      yang:date-and-time
       +--ro updates-not-sent?    empty
       +--ro datastore-changes?


]]>        </artwork>
        </figure>

        <t>Selected components of the model are summarized below.</t>
      </section>

      <section title="Subscription configuration">
        <t>Both configured and dynamic subscriptions are represented within the list subscription.  But only configured subscriptions are listed within list subscription-config.  In both lists, each subscription has own list elements. New and enhanced parameters extending the basic subscription data model in <xref target="subscribe"/> include: 
		<list style="symbols">
		    <t>The targeted datastore from which the selection is being made.  The potential datastores include those from <xref target="revised-datastores"/>.  A platform may also choose to support a custom datastore.</t>
			
            <t>A selection filter identifying yang nodes of interest within a datastore. Filter contents are specified via a reference to an existing filter, or via an in-line definition for only that subscription.  Referenced filters allows an implementation to avoid evaluating filter acceptability during a dynamic subscription request. The case statement differentiates the options.</t>

            <t>For periodic subscriptions, triggered updates will occur at the boundaries of a specified time interval.  These boundaries many be calculated from the periodic parameters:
			<list style="symbols">
				<t>a "period" which defines duration between period push updates. </t>

				<t>an "anchor-time"; update intervals always fall on the points in time that are a multiple of a period from an anchor time.  If anchor time is not provided, then the anchor time MUST be set with the creation time of the initial update record.</t>
			</list></t>
					
			<t>For on-change subscriptions, assuming the dampening period has completed, triggering occurs whenever a change in the subscribed information is detected. On-change subscriptions have more complex semantics that is guided by its own set of parameters:
			<list style="symbols">
				<t>a "dampening-period" specifies the interval that must pass before a successive update for the subscription is sent. If no dampening period is in effect, the update is sent immediately. If a subsequent change is detected, another update is only sent once the dampening period has passed for this subscription. </t> 
				<t>an "excluded-change" flag which allows restriction of the types of changes for which updates should be sent (e.g., only add to an update record on object creation).</t>
				<t> a "no-synch-on-start" flag which specifies whether a complete update with all the subscribed data is to be sent at the beginning of a subscription.</t>
			</list>
			</t>
 
            <t>Optional QoS parameters to indicate the treatment of a subscription relative to other traffic between publisher and receiver.  These include:
			<list style="symbols">
				<t>A "dscp" QoS marking which MUST be stamped on notification messages to differentiate network QoS behavior.</t>
				<t>A "weighting" so that bandwidth proportional to this weighting can be allocated to this subscription relative to other subscriptions destined for that receiver.</t>
				<t>a "dependency" upon another subscription. Notification messages MUST NOT be sent prior to other notification messages containing update record(s) for the referenced subscription.</t>
			</list>
			</t>
	        <t>A subscription's weighting MUST work identically to stream dependency weighting as described within RFC 7540, section 5.3.2.</t>
	        <t>A subscription's dependency MUST work identically to stream dependency as described within RFC 7540, sections 5.3.1, 5.3.3, and 5.3.4.  If a dependency is attempted via an RPC, but the referenced subscription does not exist, the dependency will be removed.</t>
        </list> 
		</t>
      </section>

      <section title="YANG Notifications">
        <section title="State Change Notifications">
			<t>Subscription state notifications and mechanism are reused from <xref target="subscribe"/>. Some have been augmented to include the YANG datastore specific objects.</t>

        </section>
		
        <section title="Notifications for Subscribed Content">
		
		    <t>Along with the subscribed content, there are other objects which might be part of a push-update or push-change-update</t>
			
			<t>A subscription-id MUST be transported along with the subscribed contents.  An <xref target="RFC5277"/>  Section 4 one-way notification MAY be used for encoding updates.  Where it is, the relevant subscription-id MUST be encoded as the first element within each push-update or push-change-update.  This allows a receiver to differentiate which subscription resulted in a particular push.  </t>
			
			<t>A "time-of-update" which represents the time an update record snapshot was generated.  A receiver MAY assume that a publisher's objects have these pushed values at this point in time.</t>
	
			<t>An "updates-not-sent" flag is set, which indicates that the update record is incomplete. If the application detects an informational discontinuity in either notification, the notification MUST include a flag "updates-not-sent". This flag which indicates that not all changes which have occurred since the last update are actually included with this update.  In other words, the publisher has failed to fulfill its full subscription obligations. (For example a datastore missed a window in providing objects to a publisher process.) To facilitate re-synchronization of on-change subscriptions, a publisher MAY subsequently send a push-update containing a full selection snapshot of subscribed data.</t>
			
			<t></t>
        </section>
      </section>

      <section title="YANG RPCs">
        <t>YANG-Push subscriptions are established, modified, and deleted using RPCs augmented from <xref target="subscribe"/>.</t>

        <section title="Establish-subscription RPC">
          <t>The subscriber sends an establish-subscription RPC with the parameters in section 3.1. An example might look like:</t>

          <figure align="center" anchor="establish-subscription-rpc"
                  title="Establish-subscription RPC">
            <artwork align="left"><![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>
	    <source>operational</source>
	    <selection-filter netconf:type="xpath"
            xmlns:ex="http://example.com/sample-data/1.0"
            select="/ex:foo"/>
	  </datastore>
      <period>500</period>
      <encoding>encode-xml</encoding>
   </establish-subscription>
</netconf:rpc>          
    ]]></artwork>
          </figure>

          <t>The publisher MUST respond explicitly positively (i.e., subscription accepted) or negatively (i.e., subscription rejected) to the request. Positive responses include the subscription-id of the accepted subscription. In that case a publisher MAY respond:</t>

          <figure align="center"
                  anchor="establish-subscription-positive-reply"
                  title="Establish-subscription positive RPC response">
            <artwork align="left"><![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"> 
       ok
    </subscription-result>
    <subscription-id 
         xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0"> 
       52
    </subscription-id>
</rpc-reply>
    ]]></artwork>
          </figure>

          <t>A subscription can be rejected for multiple reasons, including the lack of authorization to establish a subscription, the lack of read authorization on the requested data node, or the inability of the publisher to provide a stream with the requested semantics.</t>

          <t>When the requester is not authorized to read the requested data node, the returned information indicates the node is unavailable. For instance, if the above request was unauthorized to read node "ex:foo" the publisher may return:</t>

          <figure align="center"
                  anchor="establish-subscription-access-denied-reply"
                  title="Establish-subscription access denied response">
            <artwork align="left"><![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"> 
       subtree-unavailable
    </subscription-result>
    <filter-failure 
          xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
       /ex:foo
    </filter-failure>
</rpc-reply>
       ]]></artwork>
          </figure>

          <t>If a request is rejected because the publisher is not able to serve it, the publisher SHOULD include in the returned error what subscription parameters would have been accepted for the request. However, there are no guarantee that subsequent requests using this info will in fact be accepted.</t>

          <t>For example, for the following request:</t>

          <figure align="center" anchor="establish-subscription-request-2"
                  title="Establish-subscription request example 2">
            <artwork align="left"><![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>
	    <source>running</source>
        <selection-filter netconf:type="xpath"
            xmlns:ex="http://example.com/sample-data/1.0"
            select="/ex:foo"/>
	  </datastore>
      <dampening-period>10</dampening-period>
      <encoding>encode-xml</encoding>
   </establish-subscription>
</netconf:rpc>
          ]]></artwork>
          </figure>

          <t>a publisher that cannot serve on-change updates but periodic updates might return the following:</t>

          <figure align="center"
                  anchor="establish-subscription-error-response-2"
                  title="Establish-subscription error response example 2">
            <artwork align="left"><![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"> 
       period-unsupported
    </subscription-result>
    <period-hint>100</period-hint>
</rpc-reply>
             ]]></artwork>
          </figure>
        </section>

        <section title="Modify-subscription RPC">
          <t>The subscriber MAY invoke the modify-subscription RPC for a subscription it previously established. The subscriber will include newly desired values in the modify-subscription RPC. Parameters not included MUST remain unmodified. Below is an example where a subscriber attempts to modify the period of a subscription.</t>

          <figure align="center" anchor="modify-subscription-request"
                  title="Modify subscription request">
            <artwork align="left"><![CDATA[
<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">
      <datastore>
        <selection-filter netconf:type="xpath"
            xmlns:ex="http://example.com/sample-data/1.0"
            select="/ex:bar"/>
	  </datastore>
      <subscription-id>
         1011
      </subscription-id>
      <period>250</period>
   </modify-subscription>
</netconf:rpc>
    ]]></artwork>
          </figure>

          <t>The publisher MUST respond explicitly positively or negatively to the request. A response to a successful modification might look like:</t>

          <figure align="center" anchor="modify-subscription-response"
                  title="Modify subscription response">
            <artwork align="left"><![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>

          <t>If the subscription modification is rejected, the publisher MUST send a response like it does for an establish-subscription and maintain the subscription as it was before the modification request. Responses MAY include hints. A subscription MAY be modified multiple times.</t>

          <t>A configured subscription cannot be modified using modify-subscription RPC. Instead, the configuration needs to be edited as needed.</t>
        </section>

        <section title="Delete-subscription RPC">
          <t>To stop receiving updates from a subscription and effectively delete a subscription that had previously been established using an establish-subscription RPC, a subscriber can send a delete-subscription RPC, which takes as only input the subscription-id. </t>

          <t>Configured subscriptions cannot be deleted via RPC, but have to be removed from the configuration.  This RPC is identical to the RPC from <xref target="subscribe"/>.</t>
        </section>

		<section title="Resynch-subscription RPC">
		    <t>This RPC is only applicable only for on-change subscriptions previously been established using an establish-subscription RPC.  On receipt, a publisher must either reply 'ok' and quickly follow with a push-update, or send an appropriate error such as on-change-synch-unsupported. For example: </t>
			
			<figure align="center" title="Resynch subscription">
            <artwork align="left"><![CDATA[
<netconf:rpc message-id="103"
   xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
   <resynch-subscription
         xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
      <subscription-id>
         1011
      </subscription-id>
   </resynch-subscription>
</netconf:rpc>
  
<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="YANG Module Synchronization" anchor="Synchronization">
			<t>To make subscription requests, the subscriber needs to know the YANG module library available on the publisher.  The YANG 1.0 module library information is sent by a NETCONF server in the NETCONF 'hello' message.  For YANG 1.1 modules and all modules used with the RESTCONF <xref target="RFC8040"/> protocol, this information is provided by the YANG Library module (ietf-yang-library.yang from <xref target="RFC7895"/>. This YANG library information is important for the receiver to reproduce the set of object definitions used within the publisher. </t>
		
			<t>The YANG library includes a module list with the name, revision, enabled features, and applied deviations for each YANG module implemented by the publisher. The receiver is expected to know the YANG library information before starting a subscription. The "/modules-state/module-set-id" leaf in the "ietf-yang-library" module can be used to cache the YANG library information.</t>
		
			<t>The set of modules, revisions, features, and deviations can change at run-time (if supported by the publisher implementation). In this case, the receiver needs to be informed of module changes before data nodes from changed modules can be processed correctly. The YANG library provides a simple "yang-library-change" notification that informs the subscriber that the library has changed. The receiver then needs to re-read the entire YANG library data for the replicated publisher in order to detect the specific YANG library changes. The "ietf-netconf-notifications" module defined in <xref target="RFC6470"/> contains a "netconf-capability-change" notification that can identify specific module changes. For example, the module URI capability of a newly loaded module will be listed in the "added-capability" leaf-list, and the module URI capability of an removed module will be listed in the "deleted-capability" leaf-list.</t>
			
		</section>	  
      </section>
	
	</section>
    <section title="YANG module" anchor="YANG-module" >

      <t><figure>
          <artwork><![CDATA[
<CODE BEGINS>; file "ietf-yang-push.yang"
module ietf-yang-push {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-yang-push";
  prefix yp;

  import ietf-inet-types {
    prefix inet;
  }
  import ietf-yang-types {
    prefix yang;
  }
  import ietf-subscribed-notifications {
    prefix sn;
  }
  import ietf-datastores {
    prefix ds;
  } 
  
  organization "IETF";
  contact
    "WG Web:   <http://tools.ietf.org/wg/netconf/>
     WG List:  <mailto:netconf@ietf.org>

     Editor:   Alexander Clemm
               <mailto:ludwig@clemm.org>
     
     Editor:   Eric Voit
               <mailto:evoit@cisco.com>

     Editor:   Alberto Gonzalez Prieto
               <mailto:agonzalezpri@vmware.com>
               
     Editor:   Ambika Prasad Tripathy
               <mailto:ambtripa@cisco.com>
               
     Editor:   Einar Nilsen-Nygaard
               <mailto:einarnn@cisco.com>
               
     Editor:   Andy Bierman
               <mailto:andy@yumaworks.com>
     
     Editor:   Balazs Lengyel
               <mailto:balazs.lengyel@ericsson.com>";
               
  description
    "This module contains conceptual YANG specifications
     for YANG push.";

  revision 2017-10-02 {
    description
      "Initial revision.";
    reference 
      "YANG Datastore Push, draft-ietf-netconf-yang-push-09";
  }

 /*
  * EXTENSIONS
  */
  
  extension notifiable-on-change {
    argument "value";
    description
      "Indicates whether changes to the data node are reportable in
      on-change subscriptions.

      The statement MUST only be a substatement of the leaf, leaf-list,
      container, list, anyxml, anydata  statements. Zero or One
      notifiable-on-change statement is allowed per parent statement. 
      NO substatements are allowed.

      The argument is a boolean value indicating whether on-change
      notifications are supported. If notifiable-on-change is not
      specified, the default is the same as the parent data node's
      value. For top level data nodes the default value is false.";
  }

 /*
  * FEATURES
  */
    
  feature on-change {
    description
      "This feature indicates that on-change triggered subscriptions 
       are supported.";
  }

 /*
  * IDENTITIES
  */
  
  /* Error type identities for datastore subscription  */
  identity period-unsupported {
    base sn:error;
    description 
      "Requested time period is too short. This can be for both 
       periodic and on-change dampening.";
  }
  
  identity qos-unsupported {
    base sn:error;
    description 
      "Subscription QoS parameters not supported on this platform.";
  }
  
  identity dscp-unavailable {
    base sn:error;
    description 
      "Requested DSCP marking not allocatable.";
  }
  
  identity on-change-unsupported {
    base sn:error;
    description 
      "On-change not supported.";
  }
  
  identity on-change-synch-unsupported {
    base sn:error;
    description 
      "On-change synch-on-start and resynchonization not supported.";
  }
  
  identity reference-mismatch {
    base sn:error;
    description 
      "Mismatch in filter key and referenced yang subtree.";
  }
   
  identity data-unavailable {
    base sn:error;
    description 
      "Referenced yang node or subtree doesn't exist, or read 
       access is not permitted.";
  }
  
  identity datatree-size {
    base sn:error;
    description 
      "Resulting periodic or on-change push updates may exceed a size 
      limit during normal conditions.";
  }
  
  identity synchronization-datatree-size {
    base sn:error;
    description 
      "The resulting Synch-on-start or resynchronization would push a 
      datatree which exceeds size limit for a one-time update.";
  }
  
  /* Datastore identities */

  identity custom-datastore {
    base ds:datastore;
    description
      "A datastore with boundaries not defined within 
       draft-ietf-netmod-revised-datastores";
  }

  
  /*
   * TYPE DEFINITIONS
   */
   
  typedef change-type {
    type enumeration {
      enum "create" {
        description
          "Create a new data resource if it does not already exist.  If
          it already exists, replace.";
      }
      enum "delete" {
        description
          "Delete a data resource if it already exists. If it does not
          exists, take no action.";
      }
      enum "insert" {
        description
          "Insert a new user-ordered data resource";
      }
      enum "merge" {
        description
          "merge the edit value with the target data resource; create 
          if it does not already exist";
      }
      enum "move" {
        description
          "Reorder the target data resource";
      }
      enum "replace" {
        description
          "Replace the target data resource with the edit value";
      }
      enum "remove" {
        description
          "Remove a data resource if it already exists ";
      }
    }
    description
      "Specifies different types of datastore changes.";
    reference 
      "RFC 8072 section 2.5, with a delta that it is ok to receive 
      ability create on an existing node, or receive a delete on a 
      missing node.";
  }

  typedef selection-filter-ref {
    type leafref {
      path "/sn:filters/yp:selection-filter/yp:identifier";
    }
    description
      "This type is used to reference a selection filter.";
  }

  /*
   * GROUP DEFINITIONS
   */

  grouping datastore-criteria {
    description
      "A grouping to define criteria for which selected objects from  
       a targeted datastore should be included in push updates.";
    leaf source {
       type identityref {
         base ds:datastore;
       }
       mandatory true;
       description
         "Datastore from which to retrieve data.";
    }
    uses selection-filter-objects;
  }
  
  grouping selection-filter-types {
    description
      "This grouping defines a selector for objects from a
       datastore.";
    choice filter-spec {
      description
        "The content filter specification for this request.";
      anydata subtree-filter {
        description
          "This parameter identifies the portions of the
           target datastore to retrieve.";
        reference "RFC 6241, Section 6.";
      }
      leaf xpath-filter {
        type yang:xpath1.0;
        description
          "This parameter contains an XPath expression identifying the 
          portions of the target datastore to retrieve.";
        reference "http://www.w3.org/TR/1999/REC-xpath-19991116";
      }
    }   
  }

  grouping selection-filter-objects {
    description
      "This grouping defines a selector for objects from a 
       datastore."; 
    choice selected-content {
      description
        "The source of the selection filter applied to the subscription.
        This will come either referenced from a global list, or be 
        provided within the subscription itself.";
      case by-reference {
        description
          "Incorporate a filter that has been configured separately.";
        leaf selection-filter-ref {
          type selection-filter-ref;
          mandatory true;
          description
            "References an existing selection filter which is to be 
             applied to the subscription.";
        }
      }
      case within-subscription {
        description
          "Local definition allows a filter to have the same lifecycle  
          as the subscription.";
        uses selection-filter-types;
        
      }
    }
  }    
   
  grouping update-policy-modifiable {
    description
      "This grouping describes the datastore specific subscription 
       conditions that can be changed during the lifetime of the
       subscription.";
    choice update-trigger {
      description
        "Defines necessary conditions for sending an event to
         the subscriber.";
      case periodic {
        description
          "The agent is requested to notify periodically the current 
           values of the datastore as defined by the selection filter.";
        leaf period {
          type yang:timeticks;
          mandatory true;
          description
            "Duration of time which should occur between periodic 
             push updates.  Where the anchor-time is 
             available, the push will include the objects and their 
             values which exist at an exact multiple of timeticks 
             aligning to this start-time anchor.";
        }
        leaf anchor-time {
          type yang:date-and-time;
          description
            "Designates a timestamp before or after which a series of 
             periodic push updates are determined. The next update will 
             take place at a whole multiple interval from the anchor 
             time.  For example, for an anchor time is set for the top 
             of a particular minute and a period interval of a minute, 
             updates will be sent at the top of every minute this 
             subscription is active.";
        }
      }
      case on-change {
        if-feature "on-change";
        description
          "The agent is requested to notify changes in values in the 
           datastore subset as defined by a selection filter.";
        leaf dampening-period {
          type yang:timeticks;
          mandatory true;
          description
            "The shortest time duration which is allowed between the 
            creation of independent yang object update messages.  
            Effectively this is the amount of time that needs to have 
            passed since the last update.  Zero indicates no delay.";
        }
      }
    }
  }

  grouping update-policy {
    description
      "This grouping describes the datastore specific subscription 
       conditions of a subscription.";
    uses update-policy-modifiable {
      augment "update-trigger/on-change" {
        description
          "Includes objects not modifiable once subscription is 
           established.";
        leaf no-synch-on-start {
          type empty;
          description
            "This leaf acts as a flag that determines behavior at the
             start of the subscription.  When present, synchronization 
             of state at the beginning of the subscription is outside 
             the scope of the subscription. Only updates about changes 
             that are observed from the start time, i.e. only push-
             change-update notifications are sent. When absent (default
             behavior), in order to facilitate a receiver's 
             synchronization, a full update is sent when the 
             subscription starts using a push-update notification, just
             like in the case of a periodic subscription.  After that,
             push-change-update notifications only are sent unless the 
             Publisher chooses to resynch the subscription again.";
        }
        leaf-list excluded-change {
          type change-type;
          description
            "Use to restrict which changes trigger an update.
             For example, if modify is excluded, only creation and
             deletion of objects is reported.";
        }
      }
    }
  }
  
  grouping update-qos {
    description
      "This grouping describes Quality of Service information
       concerning a subscription.  This information is passed to lower
       layers for transport prioritization and treatment";
    leaf dscp {
      type inet:dscp;
      default "0";
      description
        "The push update's IP packet transport priority. This is made 
         visible across network hops to receiver. The transport 
         priority is shared for all receivers of a given subscription.";
    }
    leaf weighting {
      type uint8 {
         range "0 .. 255";
      }
      description
        "Relative weighting for a subscription. Allows an underlying 
         transport layer perform informed load balance allocations 
         between various subscriptions";
      reference 
        "RFC-7540, section 5.3.2";
    }
    leaf dependency {
      type sn:subscription-id;
      description
        "Provides the Subscription ID of a parent subscription which 
         has absolute priority should that parent have push updates
         ready to egress the publisher. In other words, there should be
         no streaming of objects from the current subscription if   
         the parent has something ready to push.";
      reference 
        "RFC-7540, section 5.3.1";
    }
  }

  grouping update-error-hints {
    description 
      "Allow return additional negotiation hints that apply
       specifically to push updates."; 
    leaf period-hint { 
      type yang:timeticks;
      description
        "Returned when the requested time period is too short. This 
         hint can assert an viable period for both periodic push  
         cadence and on-change dampening.";
    }
    leaf error-path { 
      type string;
      description
        "Reference to a YANG path which is associated with the error 
         being returned.";
    }
    leaf object-count-estimate { 
      type uint32;
      description
        "If there are too many objects which could potentially be 
         returned by the selection filter, this identifies the estimate 
         of the number of objects which the filter would potentially 
         pass.";
    }
    leaf object-count-limit { 
      type uint32;
      description
        "If there are too many objects which could be returned by the 
         selection filter, this identifies the upper limit of the 
         publisher's ability to service for this subscription.";
    }
    leaf kilobytes-estimate { 
      type uint32;
      description
        "If the returned information could be beyond the capacity of  
         the publisher, this would identify the data size which could 
         result from this selection filter.";
    }
    leaf kilobytes-limit { 
      type uint32;
      description
        "If the returned information would be beyond the capacity of 
         the publisher, this identifies the upper limit of the 
         publisher's ability to service for this subscription.";
    }
  }  

  /*
   * RPCs
   */
 
   rpc resynch-subscription {
    if-feature "on-change";
    description
      "This RPC allows a subscriber of an active on-change 
       subscription to request a full push of objects in there current 
       state. A successful result would be the set of YANG objects 
       equivalent to a Get using the existing selection criteria. This 
       request may only come from the same subscriber using the 
       establish-subscription RPC.";
    input {
      leaf identifier {
        type sn:subscription-id;
        mandatory true;
        description
          "Identifier of the subscription that is to be resynched.";
      }
    }
    output {
      leaf subscription-result {
        type sn:subscription-result;
        mandatory true;
        description
          "Indicates whether the request for the subscription resynch
          has been accepted, or why it has been denied.";
      }
    }
  }

  /*
   * DATA NODES
   */
  
  augment "/sn:establish-subscription/sn:input" {
    description 
      "This augmentation adds additional subscription parameters that 
      apply specifically to datastore updates to RPC input.";
    uses update-policy;
    uses update-qos;
  }
  augment "/sn:establish-subscription/sn:input/sn:target" {
    description
      "This augmentation adds the datastore as a valid parameter object
      for the subscription to RPC input.  This provides a target for 
      the filter.";
    case datastore {
       uses datastore-criteria;
    }
  } 
  augment "/sn:establish-subscription/sn:output/"+
    "sn:result/sn:no-success" {
    description
      "This augmentation adds datastore specific error info 
      and hints to RPC output.";
    uses update-error-hints;
  } 
  augment "/sn:modify-subscription/sn:input" {
    description 
      "This augmentation adds additional subscription parameters
       specific to datastore updates.";
    uses update-policy-modifiable;
  }
  augment "/sn:modify-subscription/sn:input/sn:target" {
    description
      "This augmentation adds the datastore as a valid parameter object
      for the subscription to RPC input.  This provides a target for 
      the filter.";
    case datastore {
       uses selection-filter-objects;
    }
  }
  augment "/sn:modify-subscription/sn:output/"+
    "sn:result/sn:no-success" {
    description
      "This augmentation adds push datastore error info and hints to 
      RPC output.";
    uses update-error-hints;
  }
  
  notification push-update {
    description
      "This notification contains a push update, containing data 
       subscribed to via a subscription. This notification is sent for 
       periodic updates, for a periodic subscription.  It can also be 
       used for synchronization updates of an on-change subscription. 
       This notification shall only be sent to receivers of a 
       subscription; it does not constitute a general-purpose
       notification.";
    leaf subscription-id {
      type sn:subscription-id;
      description
        "This references the subscription which drove the notification
         to be sent.";
    }
    leaf time-of-update {
      type yang:date-and-time;
      description
        "This leaf identifies the generation time of the datastore
         selection within a push-update.";
    }
    leaf updates-not-sent {
      type empty;
      description
        "This is a flag which indicates that not all data nodes 
         subscribed to are included with this update. In other words, 
         the publisher has failed to fulfill its full subscription 
         obligations. The result is intermittent loss of 
         synchronization of data at the receiver.";
    }
    anydata datastore-contents {
      description
        "This contains the updated data.  It constitutes a snapshot 
         at the time-of-update of the set of data that has been 
         subscribed to.  The format and syntax of the data 
         corresponds to the format and syntax of data that would be 
         returned in a corresponding get operation with the same 
         selection filter parameters applied.";
    }        
  }
  
  notification push-change-update {
    if-feature "on-change";
    description
      "This notification contains an on-change push update. This 
       notification shall only be sent to the receivers of a 
       subscription; it does not constitute a general-purpose
       notification.";
    leaf subscription-id {
      type sn:subscription-id;
      description
        "This references the subscription which drove the notification
         to be sent.";
    }
    leaf time-of-update {
      type yang:date-and-time;
      description
        "This leaf identifies the generation time of the datastore 
         changes extract.  If a dampening-period was in effect before 
         the notification was generated, this may not be the time any of
         the datastore-changes were actually made.";
    }
    leaf updates-not-sent {
      type empty;
      description
        "This is a flag which indicates that not all changes which
         have occurred since the last update are included with this 
         update.  In other words, the publisher has failed to 
         fulfill its full subscription obligations, for example in 
         cases where it was not able to keep up with a change burst.";
    }
    anydata datastore-changes {
      description
        "This contains an incremental set of datastore changes needed 
         to update a remote datastore starting at the time of the        
         previous update, per the terms of the subscription.  Changes 
         are encoded analogous to the syntax of a corresponding yang-
         patch operation, i.e. a yang-patch operation applied to the 
         YANG datastore implied by the previous update to result in the
         current state.";
      reference 
        "RFC 8072 section 2.5, with a delta that it is ok to receive 
         ability create on an existing node, or receive a delete on a 
         missing node.";
    }
  }

  augment "/sn:subscription-started" {
    description
      "This augmentation adds many yang datastore specific objects to 
       the notification that a subscription has started.";
    uses update-policy;
    uses update-qos;
  }
  augment "/sn:subscription-started/sn:target" {
    description
      "This augmentation allows the datastore to be included as part 
       of the notification that a subscription has started.";
    case datastore {
       uses datastore-criteria;
    }
  }
  augment "/sn:filters" {
    description
      "This augmentation allows the datastore to be included as part
       of the selection filtering criteria for a subscription.";
    list selection-filter {
      key "identifier";
      description
        "A list of pre-positioned filters that can be applied
         to datastore subscriptions.";
      leaf identifier {
        type sn:filter-id;
        description
          "An identifier to differentiate between selection filters.";
      }
      uses selection-filter-types;
    }
  }
  augment "/sn:subscription-modified" {
    description
      "This augmentation adds many yang datastore specific objects to 
       the notification that a subscription has been modified.";
    uses update-policy;
    uses update-qos;
  }
  augment "/sn:subscription-modified/sn:target" {
    description
      "This augmentation allows the datastore to be included as part 
      of the notification that a subscription has been modified.";
    case datastore {
       uses datastore-criteria;
    }
  }
  augment "/sn:subscription-config/sn:subscription" {
    description
      "This augmentation adds many yang datastore specific objects 
      which can be configured as opposed to established via RPC.";
    uses update-policy;
    uses update-qos;
  }
  augment "/sn:subscription-config/sn:subscription/sn:target" {
    description
      "This augmentation adds the datastore to the selection filtering 
      criteria for a subscription.";
    case datastore {
       uses datastore-criteria;
    }
  }
  augment "/sn:subscriptions/sn:subscription" {
    yp:notifiable-on-change true;
    description
      "This augmentation adds many datastore specific objects to a 
       subscription.";
    uses update-policy;
    uses update-qos;
  }
  augment "/sn:subscriptions/sn:subscription/sn:target" {
    description
      "This augmentation allows the datastore to be included as part 
      of the selection filtering criteria for a subscription.";
    case datastore {
       uses datastore-criteria;
    }
  } 

/* YANG Parser Pyang crashing on syntax below, due to fixed bug
         https://github.com/mbj4668/pyang/issues/300 
         
  deviation "/sn:subscriptions/sn:subscription/sn:receivers/"
             + "sn:receiver/sn:pushed-notifications" {
    deviate add {
      yp:notifiable-on-change false;
    }
  }
  deviation "/sn:subscriptions/sn:subscription/sn:receivers/"
             + "sn:receiver/sn:excluded-notifications" {
    deviate add {
      yp:notifiable-on-change false;
    }
  }
YANG Parser Pyang crashing on syntax above */
}  


<CODE ENDS> ]]>

</artwork>
        </figure></t>
    </section>
 <section title="IANA Considerations">
    <t>
    This document registers the following namespace URI in the "IETF XML
    Registry" <xref target="RFC3688"/>:
    </t>

   <t>
   URI:  urn:ietf:params:xml:ns:yang:ietf-yang-push
   <vspace/>
   Registrant Contact: The IESG.
   <vspace/>
   XML: N/A; the requested URI is an XML namespace.
   </t>
   
   <t>
   This document registers the following YANG module in the "YANG
   Module Names" registry <xref target="RFC6020"/>:
   </t>
   <t>
   Name:         ietf-yang-push
   <vspace/>
   Namespace:    urn:ietf:params:xml:ns:yang:ietf-yang-push 
   <vspace/>
   Prefix:       yp
   <vspace/>
   Reference:    draft-ietf-netconf-yang-push-08.txt (RFC form) 
   </t>
   </section>
    <section title="Security Considerations">

	  <t> All security considerations from <xref target="subscribe"/> are relevant for datastores.  In addition there are specific security considerations for receivers defined in <xref target="Authorization"/> </t>
	
	  <t>If the access control permissions on subscribed YANG nodes change during the lifecycle of a subscription, a publisher MUST either transparently conform to the new access control permissions, or must terminate or restart the subscriptions so that new access control permissions are re-established. </t>
	  
	  <t>The NETCONF Authorization Control Model SHOULD be used to restrict the delivery of YANG nodes for which the receiver has no access.</t>
	  
    </section>
    <section title="Acknowledgments">
        <t>For their valuable comments, discussions, and feedback, we wish to acknowledge Tim Jenkins, Kent Watsen, Susan Hares, Yang Geng, Peipei Guo, Michael Scharf, Sharon Chisholm, and Guangying Zheng.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.3688"?>
      <?rfc include="reference.RFC.6020"?>
      <?rfc include="reference.RFC.6470"?>
	  <?rfc include="reference.RFC.7895"?>
	  <?rfc include="reference.RFC.7950"?>
	  <?rfc include="reference.RFC.7951"?>
	  <?rfc include="reference.RFC.8072"?>
	  
	  <reference anchor="RFC6536bis">
        <front>
          <title>Network Configuration Protocol (NETCONF) Access Control Model</title>
			<author fullname="Andy Bierman" initials="A" surname="Bierman"></author>
			<author fullname="Martin Bjorklund" initials="M" surname="Bjorklund"></author>
          <date month="September" year="2017"/>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-ietf-netconf-rfc6536bis-05"/>
        <format target="https://tools.ietf.org/html/draft-ietf-netconf-rfc6536bis-05"
                type="TXT"/>
      </reference>
	  
      <reference anchor="subscribe">
        <front>
          <title>Custom Subscription to Event Notifications</title>
		  <author fullname="Eric Voit" initials="E" surname="Voit">
            <organization/>
          </author>
		  <author fullname="Alexander Clemm" initials="A" surname="Clemm">
            <organization/>
          </author>
          <author fullname="Alberto Gonzalez Prieto" initials="A"
                  surname="Gonzalez Prieto">
            <organization/>
          </author>
          <author fullname="Ambika Prasad Tripathy" initials="A"
                  surname="Tripathy">
            <organization/>
          </author>
          <author fullname="Einar Nilsen-Nygaard" initials="E"
                  surname="Nilsen-Nygaard">
            <organization/>
          </author>
          <date month="September" year="2017"/>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-ietf-netconf-subscribed-notifications-04"/>
        <format target="https://datatracker.ietf.org/doc/draft-ietf-netconf-subscribed-notifications/"
                type="TXT"/>
      </reference>
	  
	  <reference anchor="revised-datastores">
        <front>
          <title>Network Management Datastore Architecture</title>
		  <author fullname="M. Bjorklund" initials="M" surname="Bjorklund">
            <organization/>
          </author>
		  <author fullname="J. Schoenwaelder" initials="J" surname="Schoenwaelder">
            <organization/>
          </author>
          <author fullname="P. Shafer" initials="P" surname="Shafer">
            <organization/>
          </author>
          <author fullname="K. Watsen" initials="K" surname="Watsen">
            <organization/>
          </author>
          <author fullname="R. Wilton" initials="R"  surname="Wilton">
            <organization/>
          </author>
          <date month="August" year="2017"/>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-ietf-netmod-revised-datastores-04"/>
        <format target="https://tools.ietf.org/html/draft-ietf-netmod-revised-datastores-04"
                type="TXT"/>
      </reference>
	  
	  
    </references>

    <references title="Informative References">
	
	  <?rfc include="reference.RFC.5277"?>
	  <?rfc include="reference.RFC.6241"?>
	  <?rfc include="reference.RFC.7223"?>
      <?rfc include="reference.RFC.7923"?>
	  <?rfc include="reference.RFC.8040"?>

      <reference anchor="netconf-notif">
        <front>
          <title>NETCONF Support for Event Notifications</title>
          <author fullname="Alberto Gonzalez Prieto" initials="A" surname="Gonzalez Prieto"> </author>
		  <author fullname="Alexander Clemm" initials="A" surname="Clemm"></author>	 
		  <author fullname="Eric Voit" initials="E" surname="Voit"></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>
        <format target="https://datatracker.ietf.org/doc/draft-ietf-netconf-netconf-event-notifications/"
                type="TXT"/>
      </reference>
	  
    </references>
	
    
	<section title="Changes between revisions">
        <t>(To be removed by RFC editor prior to publication)</t>

		<t>v09 - v10 
        <list style="symbols">
          <t>Returned to the explicit filter subtyping of v00-v05</t>
		  <t>identityref to ds:datastore made explicit</t>
		  <t>Returned ability to modify a selection filter via RPC.</t>
        </list>
        </t>
		
		<t>v08 - v09 
        <list style="symbols">
          <t>Minor tweaks cleaning up text, removing appendicies, and making reference to revised-datastores.</t>
		  <t>Subscription-id optional in push updates, except when encoded in RFC5277, Section 4 one-way notification.</t>
		  <t>Finished adding the text descibing the resynch subscription RPC.</t>
		  <t>Removed relationships to other drafts and future technology appendicies as this work is being explored elsewhere.</t>
		  <t>Deferred the multi-line card issue to new drafts</t>
		  <t>Simplified the NACM interactions.</t>
        </list>
        </t>
		
        <t>v07 - v08
        <list style="symbols">
          <t>Updated YANG models with minor tweaks to accommodate changes of ietf-subscribed-notifications.</t>
        </list>
        </t>
		
		<t>v06 - v07
        <list style="symbols">
            <t>Clarifying text tweaks.</t>
            <t>Clarification that filters act as selectors for subscribed data nodes; support for value filters not included but possible as a future extension</t>
			<t>Filters don't have to be matched to existing YANG objects</t>          
        </list></t>
		
		<t>v05 - v06
        <list style="symbols">
            <t>Security considerations updated.</t>
			<t>Base YANG model in [subscribe] updated as part of move to identities, YANG augmentations in this doc matched up</t>
			<t>Terms refined and text updates throughout</t>
			<t>Appendix talking about relationship to other drafts added.</t>
			<t>Datastore replaces stream</t>
			<t>Definitions of filters improved</t>
        </list></t>
	  
		<t>v04 to v05 
        <list style="symbols">
			<t>Referenced based subscription document changed to Subscribed Notifications from 5277bis.</t>
			<t>Getting operational data from filters</t>
			<t>Extension notifiable-on-change added</t>
			<t>New appendix on potential futures.  Moved text into there from several drafts.</t>
			<t>Subscription configuration section now just includes changed parameters from Subscribed Notifications</t>
			<t>Subscription monitoring moved into Subscribed Notifications</t>
			<t>New error and hint mechanisms included in text and in the yang model.</t>
			<t>Updated examples based on the error definitions</t>
			<t>Groupings updated for consistency</t>
			<t>Text updates throughout</t>
        </list></t>
        <t>v03 to v04 
        <list style="symbols">
			<t>Updates-not-sent flag added</t>
			<t>Not notifiable extension added</t>
			<t>Dampening period is for whole subscription, not single objects</t>
			<t>Moved start/stop into rfc5277bis</t>
			<t>Client and Server changed to subscriber, publisher, and receiver</t>
			<t>Anchor time for periodic</t>
			<t>Message format for synchronization (i.e. synch-on-start)</t>
			<t>Material moved into 5277bis</t>
			<t>QoS parameters supported, by not allowed to be modified by RPC</t>
			<t>Text updates throughout</t>
        </list></t>
    </section>
  </back> 
</rfc>
