NETCONF                                               A. Gonzalez Prieto
Internet-Draft                                                    VMware
Intended status: Standards Track                                 E. Voit
Expires: May 3, August 12, 2018                                   Cisco Systems
                                                                A. Clemm
                                                                  Huawei
                                                       E. Nilsen-Nygaard
                                                             A. Tripathy
                                                           Cisco Systems
                                                        October 30, 2017
                                                        February 8, 2018

                NETCONF Support for Event Notifications
           draft-ietf-netconf-netconf-event-notifications-06
           draft-ietf-netconf-netconf-event-notifications-07

Abstract

   This document provides a NETCONF binding for
   [I-D.draft-ietf-netconf-subscribed-notifications].
   [I-D.draft-ietf-netconf-subscribed-notifications] and
   [I-D.ietf-netconf-yang-push].  Included are:

   o  Transport  transport mappings for subscription RPCs, state change
      notifications, and notification messages messages,
   o  Functionality which must be supported with NETCONF  functional requirements, and
   o  Examples in appendices  examples

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at https://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on May 3, August 12, 2018.

Copyright Notice

   Copyright (c) 2017 2018 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (https://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
   2.  Terminology . . . . . . . . . . . . . . . . . . . . . . . . .   3
   3.  Interleave Capability . . . . . . . . . . . . . . . . . . . .   3
   4.  Mandatory XML, stream and datastore support . . . . . . . . . . .   3
   5.  Transport connectivity  . . . . . . . . . . . . . . . . . . .   4   3
     5.1.  Dynamic Subscriptions . . . . . . . . . . . . . . . . . .   4   3
     5.2.  Configured Subscriptions  . . . . . . . . . . . . . . . .   4
   6.  Notification Messages . . . . . . . . . . . . . . . . . . . .   4
   7.  Security Considerations . . . . . . . . . . .  Dynamic Subscriptions and RPC Error Responses . . . . . . . .   4
   8.  Acknowledgments . . . .  Security Considerations . . . . . . . . . . . . . . . . . . .   5
   9.  References  . .  Acknowledgments . . . . . . . . . . . . . . . . . . . . . . .   5
     9.1.   6
   10. Normative References  . . . . . . . . . . . . . . . . . .   5
     9.2.  Informative References  . . . . . . . . . . . . . . . . .   6
   Appendix A.  Examples . . . . . . . . . . . . . . . . . . . . . .   6   7
     A.1.  Event Stream Discovery  . . . . . . . . . . . . . . . . .   6   7
     A.2.  Dynamic Subscriptions . . . . . . . . . . . . . . . . . .   7
     A.3.  Configured Subscriptions  . . . . . . . . . . . . . . . .  12  14
     A.4.  Subscription State Notifications  . . . . . . . . . . . .  17  19
   Appendix B.  Changes between revisions  . . . . . . . . . . . . .  19  21
     B.1.  v06 to v07  . . . . . . . . . . . . . . . . . . . . . . .  21
     B.2.  v05 to v06  . . . . . . . . . . . . . . . . . . . . . . .  19
     B.2.  21
     B.3.  v03 to v04  . . . . . . . . . . . . . . . . . . . . . . .  19
     B.3.  21
     B.4.  v01 to v03  . . . . . . . . . . . . . . . . . . . . . . .  20
     B.4.  22
     B.5.  v00 to v01  . . . . . . . . . . . . . . . . . . . . . . .  20  22
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .  20  22

1.  Introduction

   This document defines a binding for notification message delivery for
   [I-D.draft-ietf-netconf-subscribed-notifications] transported events streamed over the NETCONF
   protocol [RFC6241]. [RFC6241] as per
   [I-D.draft-ietf-netconf-subscribed-notifications].  In addition, as
   [I-D.ietf-netconf-yang-push] is itself built upon
   [I-D.draft-ietf-netconf-subscribed-notifications], this document
   enables a NETCONF client to maintain request and receive updates from a subset/extract of an actively
   changing YANG
   datastore located on a NETCONF server.

   This document is broken into two main parts.  The first contains
   normative requirements which are incremental to
   [I-D.draft-ietf-netconf-subscribed-notifications] when NETCONF
   transport is used.  The second are examples and are included as
   appendices.

2.  Terminology

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in RFC 2119 [RFC2119].

   The following terms are defined in
   [I-D.draft-ietf-netconf-subscribed-notifications]: notification
   message, stream, publisher, receiver, subscriber, subscription,
   configured subscription.

3.  Interleave Capability

   To support multiple subscriptions on a single session, a NETCONF
   publisher MUST support the :interleave capability as defined in
   [RFC5277].  Such support MUST be indicated by the following
   capability: "urn:ietf:params:netconf:capability:interleave:1.0".
   Advertisement of this capability along with support
   [I-D.draft-ietf-netconf-subscribed-notifications] will indicate that
   a NETCONF publisher is able to receive, process, and respond to
   NETCONF requests and
   [I-D.draft-ietf-netconf-subscribed-notifications] subscription
   operations on a session with active subscriptions.

4.  Mandatory XML, stream and datastore support

   A NETCONF publisher MUST support XML encoding of RPCs and
   Notifications.

   A NETCONF publisher supporting
   [I-D.draft-ietf-netconf-subscribed-notifications] MUST support the
   "NETCONF" event stream identified in that draft.

   A NETCONF publisher supporting [I-D.ietf-netconf-yang-push] MUST
   support the "running" operational state datastore as defined by
   [I.D.draft-ietf-netmod-revised-datastores].

5.  Transport connectivity

5.1.  Dynamic Subscriptions

   For dynamic subscriptions, if the NETCONF session involved with the
   "establish-subscription" terminates, the subscription MUST be
   deleted.

5.2.  Configured Subscriptions

   For a configured subscription, there is no guarantee a transport
   session is currently in place with each associated receiver(s).  So receiver.  In
   cases where a configured subscription has a receiver in the
   connecting state, state and the protocol configured as NETCONF, but no
   NETCONF transport session exists to that receiver, the publisher MUST be
   able to
   initiate a NETCONF transport session via NETCONF call home [RFC8071], section
   4.1 to that receiver.  Until NETCONF connectivity is established and
   a subscription-started state change notification is successfully
   sent, that receiver MUST remain in its a status of a
   "connecting". either "connecting" or
   "timeout".

   If the call home fails because the publisher receives receiver
   credentials which are subsequently declined as part per [RFC8071],
   Section 4.1, step S5 authentication, then that receiver MUST be
   assigned a "suspended" "timeout" status.

   If the call home fails to establish for any other reason, the
   publisher MAY leave MUST NOT progress the receiver in a "connecting" status, and retry to the call home at a future time.  Alternatively, "active" state.
   Additionally, the publisher MAY SHOULD place the receiver into a "suspended"
   "timeout" status after a predetermined number of either failed call
   home attempts. attempts or NETCONF sessions remotely terminated by the
   receiver.

   NETCONF Transport session connectivity SHOULD be verified via
   Section 4.1, step S7.

   Failure of

   If an active NETCONF session MUST reset is disconnected but the stop-time of a
   subscription has not been reached, the publisher MUST restart the
   call home process, process and return the receiver to "connecting". the "connecting" state.

6.  Notification Messages

   Notification messages transported over NETCONF will be identical in
   format and content to those encoded using one-way operations defined
   within [RFC5277], section 4.

7.  Security Considerations

   Notification messages (including state change notifications) are
   never sent before  Dynamic Subscriptions and RPC Error Responses

   Management of dynamic subscriptions occurs via RPCs as defined in
   [I-D.ietf-netconf-yang-push] and
   [I-D.draft-ietf-netconf-subscribed-notifications].  When an RPC error
   occurs, the NETCONF capabilities exchange has completed. RPC reply MUST include an "rpc-error" element per
   [RFC6241] with the error information populated as follows:

   o  "error-type" of "application".
   o  "error-tag" of "operation-failed".

   o  Optionally, an "error-severity" of "error" (this MAY but does not
      have to be included).
   o  "error-app-tag" with the value being a string that corresponds to
      an identity associated with the error, as defined in
      [I-D.draft-ietf-netconf-subscribed-notifications] section 2.4.6
      for general subscriptions, and [I-D.ietf-netconf-yang-push]
      Appendix A.1, for datastore (YANG-Push) subscriptions.  The tag to
      use depends on the RPC for which the error occurred.  Applicable
      are identities with a base identity of "establish-subscription-
      error" (for error responses to an establish-subscription request),
      "modify- subscription-error" (for error responses to a modify-
      subscription request), "delete-subscription-error" (for error
      responses to a delete-subscription request), "resynch-
      subscription-error" (for error responses to resynch-subscription
      request), or "kill- subscription-error" (for error responses to a
      kill-subscription request), respectively.
   o  In case of error responses to an establish-subscription or modify-
      subscription request: optionally, "error-info" containing XML-
      encoded data with hints regarding parameter settings that might
      lead to successful requests in the future, per yang-data
      definitions "establish-subscription-error-datastore" (for error
      responses to an establish-subscription request) or "modify-
      subscription-error-datastore (for error responses to a modify-
      subscription request), respectively.

      These yang-data that is included in "error-info" SHOULD NOT
      include the optional leaf "error-reason", as such a leaf would be
      redundant with the information that is already placed within the
      error-app-tag.

      In case of an rpc error as a result of a delete-subscription, or a
      kill-subscription, or a resynch-subscription request, no error-
      info needs to be included, as the subscription-id is the only RPC
      input parameter and no hints regarding RPC input parameters need
      to be provided.

   Note that "error-path" does not need to be included with the "rpc-
   error" element, as subscription errors are generally not associated
   with nodes in the datastore but with the choice of RPC input
   parameters.

8.  Security Considerations

   Notification messages (including state change notifications) are
   never sent before the NETCONF capabilities exchange has completed.

   If a malicious or buggy NETCONF subscriber sends a number of
   "establish-subscription" requests, then these subscriptions
   accumulate and may use up system resources.  In such a situation,
   subscriptions MAY be terminated by terminating the suspect underlying NETCONF sessions.
   session.  The publisher MAY also suspend or terminate a subset of the
   active subscriptions on the that NETCONF session.

   The NETCONF Authorization Control Model [RFC6536] SHOULD be used to
   control and restrict authorization of subscription configuration.

8.

9.  Acknowledgments

   We wish to acknowledge the helpful contributions, comments, and
   suggestions that were received from: Andy Bierman, Yan Gang, Sharon
   Chisholm, Hector Trevino, Peipei Guo, Susan Hares, Tim Jenkins,
   Balazs Lengyel, Kent Watsen, and Guangying Zheng.

9.  References

9.1.

10.  Normative References

   [I-D.draft-ietf-netconf-subscribed-notifications]
              Voit, E., Clemm, A., Gonzalez Prieto, A., Tripathy, A.,
              and E. Nilsen-Nygaard, "Custom Subscription to Event
              Streams", draft-ietf-netconf-subscribed-notifications-06 draft-ietf-netconf-subscribed-notifications-10
              (work in progress), October 2017. January 2018.

   [I-D.ietf-netconf-yang-push]
              Clemm, Alexander., Voit, Eric., Gonzalez Prieto, Alberto.,
              Tripathy, A., Nilsen-Nygaard, E., Bierman, A., and B.
              Lengyel, "YANG Datastore Subscription", October 2017, February 2018,
              <https://datatracker.ietf.org/doc/
              draft-ietf-netconf-yang-push/>.

   [I.D.draft-ietf-netmod-revised-datastores]
              Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K.,
              and R. Wilton, "Network Management Datastore
              Architecture", draft-ietf-netmod-revised-datastores-04 draft-ietf-netmod-revised-datastores-10
              (work in progress), August 2017. January 2018.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997,
              <https://www.rfc-editor.org/info/rfc2119>.

   [RFC5277]  Chisholm, S. and H. Trevino, "NETCONF Event
              Notifications", RFC 5277, DOI 10.17487/RFC5277, July 2008,
              <https://www.rfc-editor.org/info/rfc5277>.

   [RFC6241]  Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed.,
              and A. Bierman, Ed., "Network Configuration Protocol
              (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011,
              <https://www.rfc-editor.org/info/rfc6241>.

   [RFC6536]  Bierman, A. and M. Bjorklund, "Network Configuration
              Protocol (NETCONF) Access Control Model", RFC 6536,
              DOI 10.17487/RFC6536, March 2012,
              <https://www.rfc-editor.org/info/rfc6536>.

   [RFC8071]  Watsen, K., "NETCONF Call Home and RESTCONF Call Home",
              RFC 8071, DOI 10.17487/RFC8071, February 2017,
              <https://www.rfc-editor.org/info/rfc8071>.

9.2.  Informative References

   [I.D.draft-ietf-netconf-notification-messages]
              Voit, Eric., Clemm, Alexander., Bierman, A., and T.
              Jenkins, "YANG Notification Headers and Bundles",
              September 2017, <https://datatracker.ietf.org/doc/
              draft-ietf-netconf-notification-messages>.

Appendix A.  Examples

A.1.  Event Stream Discovery

   As defined in [I-D.draft-ietf-netconf-subscribed-notifications] an
   event stream exposes a continuous set of events available for
   subscription.  A NETCONF client can retrieve the list of available
   event streams from a NETCONF publisher using the "get" operation
   against the top-level container "/streams" defined in
   [I-D.draft-ietf-netconf-subscribed-notifications].  Any reply will
   include the stream identities supported on the NETCONF publisher
   which may be available to that client.

   The following example illustrates the retrieval of the list of
   available event streams using the "get" operation.

<rpc message-id="101"
  xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <get>
    <filter type="subtree">
      <streams
     xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications"/>
    </filter>
  </get>
</rpc>

                       Figure 1: Get streams request

   After such a request, the NETCONF publisher returns a list of event
   streams available.  In the example reply below, the list contains
   just the NETCONF stream.

<rpc-reply message-id="101"
  xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <data>
    <streams
      xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
      <name>NETCONF</name>
    </streams>
  </data>
</rpc-reply>

                      Figure 2: Get streams response

A.2.  Dynamic Subscriptions

   The dynamic subscription RPCs and interactions operation are defined
   in [I-D.draft-ietf-netconf-subscribed-notifications] and enhanced in
   [I-D.ietf-netconf-yang-push].
A.2.1.  Establishing Dynamic Subscriptions

   An example

   The following figure shows two successful "establish-subscription"
   RPC requests as per
   [I-D.draft-ietf-netconf-subscribed-notifications].  The first request
   is given a subscription identifier of 22, the second, an identifier
   of 23.

      +------------+                 +-----------+
      | Subscriber |                 | Publisher |
      +------------+                 +-----------+
            |                              |
            |    Capability Exchange       |
            |<---------------------------->|
            |                              |
            |                              |
            |    establish-subscription interactions    |
            |----------------------------->|  (a)
            | RPC Reply: OK, id = 22       |
            |<-----------------------------|  (b)
            |                              |
            | notification message (for 22)|
            |<-----------------------------|
            |                              |
            |                              |
            |    establish-subscription    |
            |----------------------------->|
            | RPC Reply: OK, id = 23       |
            |<-----------------------------|
            |                              |
            |                              |
            | notification message (for 22)|
            |<-----------------------------|
            | notification message (for 23)|
            |<-----------------------------|
            |                              |

          Figure 2: Multiple subscriptions over a NETCONF
   transport session

   To provide examples of the information being transported, example
   messages for a sample subscription is described interactions (a) and (b) in Figure 2 are detailed below:

  <rpc netconf:message-id="102"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <establish-subscription
      xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
      <stream>
        <name>NETCONF</name>
        <xpath-filter xmlns:ex="http://example.com/events">
             /ex:foo
        </xpath-filter>
      </stream>
      <dscp>
         10
      </dscp>
    </establish-subscription>
  </rpc>

               Figure 3: establish-subscription over NETCONF

   If the request (a)

   As NETCONF publisher can was able to fully satisfy the request, request (a), the
   publisher sends
   a positive "subscription-result" element, and the subscription-id subscription identifier of the accepted subscription.
   subscription within message (b):

  <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-subscribed-notifications">
      ok
   </subscription-result>
    <identifier
      xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
      22
    </identifier>
  </rpc-reply>

               Figure 4: Successful establish-subscription success (b)

   If the NETCONF publisher cannot had not been able to fully satisfy the
   request, or subscriber has no authorization to establish the
   subscription, the publisher
   will send a negative "subscription-result" element. would have sent an RPC error response.
   For instance: instance, if the "dscp" value of 10 asserted by the subscriber in
   Figure 3 proved unacceptable, the publisher may have returned:

 <rpc-reply message-id="101" message-id="102"
   xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <subscription-result
   <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-app-tag>
     dscp-unavailable
    </error-app-tag>
    <error-info>
     <establish-subscription-error-datastore
      xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
      stream-unavailable
    </subscription-result>
      <dscp>
       100
      </dscp>
    </error-info>
   </rpc-error>
 </rpc-reply>

             Figure 5: Unsuccessful an unsuccessful establish subscription

   To get an idea of the interaction model, the

   The subscriber can use this information in future attempts to
   establish a subscription.

A.2.2.  Modifying Dynamic Subscriptions

   An existing subscription may be modified.  The following figure exchange
   shows
   two separate establish subscriptions a negotiation of such a modification via several exchanges
   between a subscriber and a publisher.  This negotiation consists of a
   failed RPC being made.  The first is
   given subscription id 22, the second, id 23. modification request/response, followed by a successful
   one.

      +------------+                 +-----------+
      | Subscriber |                 | Publisher |
      +------------+                 +-----------+
            |                              |
            |    Capability Exchange       |
            |<---------------------------->|
            |                              |
            | notification message (for 23)|
            |<-----------------------------|
            |                              |    Establish Subscription
            | modify-subscription (id = 23)|
            |----------------------------->|  (c)
            | RPC Reply: OK, id = 22       |
            |<-----------------------------|
            | error (with hint)        |
            | notification message (for 22)|
            |<-----------------------------|  (d)
            |                              |
            |                              |
            |    Establish Subscription    | modify-subscription (id = 23)|
            |----------------------------->|
            | RPC Reply: OK, id = 23 OK                |
            |<-----------------------------|
            |                              |
            |                              |
            | notification message (for 22)|
            |<-----------------------------|
            | notification message (for 23)|
            |<-----------------------------|
            |                              |

   Figure 6: Multiple Interaction model for successful subscription establishments over a single NETCONF
                                  session

   In modification

   If the example above, it subscription being modified in Figure 6 is important to note that the a datastore
   subscription
   ids of 22 and 23 are not included as per [I-D.ietf-netconf-yang-push], the modification
   request made in (c) may look like that shown in Figure 7.  As can be
   seen, the notification messages of
   [I-D.draft-ietf-netconf-subscribed-notifications].  However because
   [I-D.ietf-netconf-yang-push] has defined its own notifications,
   subscription identifiers modifications being attempted are available within those notification
   messages.  With the availability application of
   [I.D.draft-ietf-netconf-notification-messages], all notification
   messages will be able to transport a subscription identifier.

A.2.2.  Modifying Dynamic Subscriptions

   The following demonstrates modifying a dynamic subscription.
   Consider a subscription from [I-D.ietf-netconf-yang-push].  An
   established may have a new
   xpath filter applied.  The desired modification
   is as well as the application setting of a new filter. periodic time interval.

<rpc message-id="102" message-id="303"
  xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <modify-subscription
       xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications"
       xmlns:yp="urn:ietf:params:xml:ns:yang:ietf-yang-push">
    <yp:datastore>
      <yp:xpath-filter xmlns="http://example.com/datastore">
        /interfaces-state/interface/oper-status
      </yp:xpath-filter>
      <yp:periodic>
        <yp:period>500</yp:period>
      </yp:periodic>
    </yp:datastore>
    <identifier>
      22
      23
    </identifier>
  </modify-subscription>
</rpc>

              Figure 7: Subscription modification request (c)

   If the NETCONF publisher can satisfy the request, both changes, the publisher
   sends a positive "subscription-result".  This response is like that to an
   establish-subscription request, but without result for the subscription
   identifier.

 <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-subscribed-notifications">
      ok
   </subscription-result>
 </rpc-reply>

                 Figure 8: Successful modify-subscription RPC.  If the NETCONF publisher cannot
   satisfy the request, the publisher
   sends a negative "subscription-result" element.  Its contents and
   semantics match those from an establish-subscription request.

   To get an idea either of the interaction model, the following figure shows a
   successful RPC modification request to subscription with an
   identifier of 22.

      +------------+                 +-----------+
      | Subscriber |                 | Publisher |
      +------------+                 +-----------+
            |                              |
            | notification message         |
            |<-----------------------------|
            |                              |
            |     Modify Subscription      |
            |----------------------------->|
            | proposed changes, the publisher sends an RPC Reply: OK                |
            |<-----------------------------|
            |                              |
            | notification message         |
            |<-----------------------------|
            |                              |

   Figure 9: Interaction model
   error response (d).  The following is an example RPC error response
   for (d) which includes a hint.  This hint is an alternative time
   period value which might have resulted in a successful modification:

   <rpc-reply message-id="303"
     xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <rpc-error>
       <error-type>application</error-type>
       <error-tag>operation-failed</error-tag>
       <error-severity>error</error-severity>
       <error-app-tag>
           period-unsupported
       </error-message>
       <error-info
          xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push">
          <modify-subscription-error-datastore>
            <period-hint>
                3000
            </period-hint>
          </modify-subscription-error-datastore>
       </error-info>
     </rpc-error>
   </rpc-reply>

            Figure 8: Modify subscription modification failure with Hint (d)

A.2.3.  Deleting Dynamic Subscriptions

   The following demonstrates deleting a subscription.

  <rpc message-id="103"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <delete-subscription
      xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
      <identifier>22</identifier>
    </delete-subscription>
  </rpc>

                       Figure 10: 9: Delete subscription

   If the NETCONF publisher can satisfy the request, the publisher sends
   an OK element.  For example:

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

                 Figure 11: Successful delete subscription
   replies with success to the RPC request.

   If the NETCONF publisher cannot satisfy the request, the publisher
   sends an error-rpc element indicating the modification didn't work.
   One way this could happen is if an
   Figure 10 shows a valid response for existing valid subscription
   identifier was given,
   identifier, but that subscription identifier was created on a
   different NETCONF transport session:

   <rpc-reply message-id="103"
     xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <rpc-error>
       <error-type>application</error-type>
    <error-tag>invalid-value</error-tag>
       <error-tag>operation-failed</error-tag>
       <error-severity>error</error-severity>
    <error-path
   xmlns:sn="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
      sn:identifier
    </error-path>
    <error-message xml:lang="en">
       <error-app-tag>
           no-such-subscription
    </error-message>
       </error-app-tag>
     </rpc-error>
   </rpc-reply>

                Figure 12: 10: Unsuccessful delete subscription

A.3.  Configured Subscriptions

   Configured subscriptions may be established, modified, and deleted
   using configuration operations against the top-level subtree of
   [I-D.draft-ietf-netconf-subscribed-notifications] or
   [I-D.ietf-netconf-yang-push].

   In this section, we present examples of how to manage the
   configuration subscriptions using a NETCONF client.  Key differences
   from dynamic subscriptions over NETCONF is that subscription
   lifetimes are decoupled from NETCONF sessions.

A.3.1.  Creating Configured Subscriptions

   For subscription creation, a NETCONF client may send:

<rpc message-id="201"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
    xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>
    <subscription-config
    <subscriptions
      xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
      <subscription>
        <identifier>22</identifier>
        <encoding>encode-xml</encoding>
        <stream>
          <name>NETCONF</name>
          <receiver>
            <address>1.2.3.4</address>
            <port>1234</port>
          </receiver>
        </stream>
      </subscription>
    </subscription-config>
    </subscriptions>
  </edit-config>
</rpc>

                Figure 13: 11: Create a configured subscription

   If the request is accepted, the publisher would reply:

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

      Figure 14: Response to a successful configuration subscription
                               establishment will indicate this.  If the
   request is not accepted because the publisher cannot serve it, no
   configuration is changed.  In this case the publisher may reply:

      <rpc-reply message-id="201"
                 xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
          <rpc-error>
              <error-type>application</error-type>
              <error-tag>resource-denied</error-tag>
              <error-severity>error</error-severity>
              <error-message xml:lang="en">
                  Temporarily the publisher cannot serve this
                  subscription due to the current workload.
              </error-message>
          </rpc-error>
      </rpc-reply>

   Figure 15: 12: Response to a failed configured subscription establishment

   After a subscription has been created, NETCONF connectivity to each
   receiver's IP address and port will be established if it does not
   already exist.  This will be accomplished via [RFC8071].

   To get an idea of the interaction model, the

   The following figure shows a the interaction model for the successful configuration based
   creation of a configured subscription.

    +----------+                 +-----------+     +---------+
    |Config Ops|                 | Publisher |     | 1.2.3.4 |
    +----------+                 +-----------+     +---------+
         |                            |                |
         |    Capability Exchange     |                |
         |<-------------------------->|                |
         |                            |                |
         |                            |                |
         |        Edit-config         |                |
         |--------------------------->|                |
         |       RPC Reply: OK        |                |
         |<---------------------------|                |
         |                            |   Call Home    |
         |                            |<-------------->|
         |                            |                |
         |                            |  Subscription  subscription- |
         |                            |  Started  started       |
         |                            |--------------->|
         |                            |                |
         |                            |  notification  |
         |                            |  message       |
         |                            |--------------->|

         Figure 16: 13: Interaction model for configured subscription
                               establishment

A.3.2.  Modifying Configured Subscriptions

   Configured subscriptions can be modified using configuration
   operations against the top-level subtree subscription-config. container "/subscriptions".

   For example, the subscription established in the previous section
   could be modified as follows, here a adding a second receiver:

   <rpc message-id="202"
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
          xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
     <edit-config>
       <target>
         <running/>
       </target>
       <subscription-config
       <subscriptions
      xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
         <subscription>
           <identifier>
             1922
           </identifier>
           <receiver>
             <address>
               1.2.3.5
             </address>
             <port>
               1234
             </port>
           </receiver>
         </subscription>
       </subscription-config>
       </subscriptions>
     </edit-config>
   </rpc>

                 Figure 17: 14: Modify configured subscription

   If the request is accepted, the publisher would reply:

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

       Figure 18: A successful configured subscription modification

   And will indicate success.  The
   result is that the previous interaction model would described in Figure 13 may be
   extended as follows.

 +----------+                 +-----------+     +---------+  +---------+
 |Config Ops|                 | Publisher |     | 1.2.3.4 |  | 1.2.3.5 |
 +----------+                 +-----------+     +---------+  +---------+
       |                            |                |            |
       |                            |                |            |
       |                            |  notification  |            |
       |                            |  message       |            |
       |                            |--------------->|            |
       |                            |                |            |
       |        Edit-config         |                |            |
       |--------------------------->|                |            |
       |       RPC Reply: OK        |                |            |
       |<---------------------------|                |            |
       |                            |   Call Home    |            |
       |                            |<--------------------------->|  subscription- |            |  Subscription  |
       |                            |                            |  Started  started       |            |
       |                            |---------------------------->|
       |                            |                |            |
       |                            |  notification  |            |
       |                            |  message       |            |
       |                            |--------------->|            |
       |                            |---------------------------->|
       |                            |                |            |

   Figure 19: 15: Interaction model for configured subscription modification

   Note in the above that in the specific example above, modifying a
   configured subscription actually resulted in subscription-started "subscription-started"
   notification.  If  And because of an existing NETCONF session, no
   additional call home was needed.  Also note that if the edit of the
   configuration had also added a impacted the filter, a separate modify-subscription
   would have gone to been required for the original receiver.

A.3.3.  Deleting Configured Subscriptions

   Configured subscriptions can be deleted using configuration
   operations against the top-level subtree subscription-config. container "/subscriptions".
   Deleting the subscription above would result in the following flow
   impacting all active receivers.

 +----------+                 +-----------+     +---------+  +---------+
 |Config Ops|                 | Publisher |     | 1.2.3.4 |  | 1.2.3.5 |
 +----------+                 +-----------+     +---------+  +---------+
       |                            |                |            |
       |                            |  notification  |            |
       |                            |  message       |            |
       |                            |--------------->|            |
       |                            |---------------------------->|
       |                            |                |            |
       |        Edit-config         |                |            |
       |--------------------------->|                |            |
       |       RPC Reply: OK        |                |            |
       |<---------------------------|                |            |
       |                            |  Subscription  subscription- |            |
       |                            |  Terminated  terminated    |            |
       |                            |--------------->|            |
       |                            |---------------------------->|
       |                            |                |            |

     Figure 20: 16: Interaction model for configured subscription deletion

A.4.  Subscription State Notifications

   A publisher will send subscription state notifications according to
   the definitions within
   [I-D.draft-ietf-netconf-subscribed-notifications]).

A.4.1.  subscription-started and subscription-modified

   A subscription-started "subscription-started" over NETCONF encoded in XML would look like:

 <notification
   xmlns=" urn:ietf:params:xml:ns:netconf:notification:1.0">
   <eventTime>2007-09-01T10:00:00Z</eventTime>
   <subscription-started
     xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications"/>
     <identifier>39</identifier>
     <encoding>encode-xml</encoding>
     <stream>
       <name>NETCONF</name>
       <xpath-filter xmlns:ex="http://example.com/events">
            /ex:foo
       </xpath-filter>
     </stream>
   </subscription-started/>
   </subscription-started>
 </notification>

      Figure 21: 17: subscription-started subscription state notification

   The subscription-modified "subscription-modified" is identical, identical to Figure 17, with just the
   word "started" being replaced by "modified".

A.4.2.  subscription-completed, subscription-resumed, and replay-
        complete

   A subscription-completed "subscription-completed" would look like:

  <notification
    xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
    <eventTime>2007-09-01T10:00:00Z</eventTime>
    <subscription-completed
      xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
      <identifier>39</identifier>
    </subscription-completed>
  </notification>

           Figure 22: 18: subscription-completed notification in XML

   The subscription-resumed "subscription-resumed" and replay-complete "replay-complete" are virtually
   identical, with "subscription-completed" simply being replaced by "subscription-
   resumed"
   "subscription-resumed" and "replay-complete" in both encodings.

A.4.3.  subscription-terminated and subscription-suspended

   A subscription-terminated "subscription-terminated" would look like:

  <notification
    xmlns=" urn:ietf:params:xml:ns:netconf:notification:1.0">
    xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
    <eventTime>2007-09-01T10:00:00Z</eventTime>
    <subscription-terminated
      xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
      <identifier>39</identifier>
      <error-id>
         unsupportable-volume
         suspension-timeout
      </error-id>
    </subscription-terminated>
  </notification>

    Figure 23: 19: subscription-terminated subscription state notification

   The subscription-suspended "subscription-suspended" is virtually identical, with
   "subscription-terminated" simply being replaced by "subscription-
   suspended".

Appendix B.  Changes between revisions

   (To be removed by RFC editor prior to publication)

B.1.  v06 to v07

   o  XML encoding and operational datastore mandatory.
   o  Error mechanisms and examples updated.

B.2.  v05 to v06

   o  Moved examples to appendices
   o  All examples rewritten based on namespace learnings
   o  Normative text consolidated in front
   o  Removed all mention of JSON
   o  Call home process detailed
   o  Note: this is a major revision attempting to cover those comments
      received from two week review.

B.2.

B.3.  v03 to v04

   o  Added additional detail to "configured subscriptions"
   o  Added interleave capability
   o  Adjusted terminology to that in draft-ietf-netconf-subscribed-
      notifications
   o  Corrected namespaces in examples

B.3.

B.4.  v01 to v03

   o  Text simplifications throughout
   o  v02 had no meaningful changes

B.4.

B.5.  v00 to v01

   o  Added Call Home in solution for configured subscriptions.
   o  Clarified support for multiple subscription on a single session.
      No need to support multiple create-subscription.
   o  Added mapping between terminology in yang-push and [RFC6241] (the
      one followed in this document).
   o  Editorial improvements.

Authors' Addresses

   Alberto Gonzalez Prieto
   VMware

   Email: agonzalezpri@vmware.com

   Eric Voit
   Cisco Systems

   Email: evoit@cisco.com

   Alexander Clemm
   Huawei

   Email: ludwig@clemm.org

   Einar Nilsen-Nygaard
   Cisco Systems

   Email: einarnn@cisco.com

   Ambika Prasad Tripathy
   Cisco Systems

   Email: ambtripa@cisco.com