NETCONF A. Gonzalez Prieto
Internet-Draft A. Clemm
Intended status: Standards Track E. Voit
Expires: September 22, 2016 E. Nilsen-Nygaard
A. Tripathy
Cisco Systems
March 21, 2016

NETCONF Event Notifications
draft-gonzalez-netconf-5277bis-01

Abstract

This document defines capabilities and operations for providing asynchronous message notification delivery on top of the Network Configuration protocol (NETCONF). This notification delivery is an optional capability built on top of the base NETCONF definition. This document is eventually intended to obsolete RFC 5277.

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 http://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 September 22, 2016.

Copyright Notice

Copyright (c) 2016 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 (http://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

[RFC6241] can be conceptually partitioned into four layers:

      Layer                         Example
    +-------------+     +-------------------------------------------+
    |   Content   |     |     Configuration data                    |
    +-------------+     +-------------------------------------------+
          |                           |
    +-------------+     +-------------------------------------------+
    | Operations  |     |<get-config>, <edit-config>, <notification>|
    +-------------+     +-------------------------------------------+
          |                           |                       |
    +-------------+     +-----------------------------+       |
    |     RPC     |     |    <rpc>, <rpc-reply>       |       |
    +-------------+     +-----------------------------+       |
          |                           |                       |
    +-------------+     +-------------------------------------------+
    |  Transport  |     |   BEEP, SSH, SSL, console                 |
    |  Protocol   |     |                                           |
    +-------------+     +-------------------------------------------+
          

This document defines mechanisms that provide an asynchronous message notification delivery service for the NETCONF protocol [RFC6241]. This is an optional capability built on top of the base NETCONF definition. This document also defines the capabilities and operations necessary to establish, monitor, and support subscriptions into this notification delivery service.

1.1. Motivation

The motivation for this work is to enable the sending of asynchronous notification messages that are consistent with the data model (content) and security model used within a NETCONF implementation.

[RFC5277] defines a notification mechanism for NETCONF. However, there are various limitations:

The scope of the work aims at meeting the following operational needs:

1.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].

Event: Something that happens that may be of interest. (e.g., a configuration change, a fault, a change in status, crossing a threshold, or an external input to the system.)

Event notification: A message sent by a server to a receiver indicating that an event (of interest to the subscriber) has occurred. Events can trigger notifications if an interested party has subscribed to the stream(s) it belongs to.

Stream (also referred to as "event stream"): A continuous flow of event, status, state, or other information.

Subscriber: An entity able to request and negotiate a contract for the receipt of event notifications from a NETCONF server.

Receiver: A target to which a NETCONF server pushes event notifications. In many deployments, the receiver and subscriber will be the same entity.

Subscription: A contract between a subscriber and a NETCONF server, stipulating which information the receiver wishes to have pushed from the server without the need for further solicitation.

Filter: Evaluation criteria, which may be applied against a targeted set of objects/events in a subscription. Information traverses the filter only if specified filter criteria are met.

Dynamic subscription: A subscription agreed between subscriber and NETCONF server via create, establish, modify, and delete RPC control plane signaling messages.

Static subscription: A subscription installed via a configuration interface.

Operation: In this document, this term refers to NETCONF protocol operations [RFC6241] defined in support of NETCONF notifications.

NACM: NETCONF Access Control Model.

RPC: Remote Procedure Call.

1.3. Solution Overview

This document describes mechanisms for subscribing and receiving event notifications from a NETCONF server. This document enhances the capabilities of RFC 5277 while maintaining backwards capability with existing implementations. It is intended that a final version of this document might obsolete RFC 5277.

The enhancements over [RFC5277] include the ability to terminate subscriptions without terminating the client session, to modify existing subscriptions, and to have multiple subscriptions on a NETCONF session.

These enhancements do not affect [RFC5277] clients that do not support these particular subscription requirements.

The solution supports subscribing to event notifications using two mechanisms.

  1. Dynamic subscriptions, where a NETCONF client initiates a subscription negotiation with a NETCONF server. Here a client initiates a negotiation by issuing a subscription request. If the agent wants to serve this request, it will accept it, and then start pushing event notifications as negotiated. If the agent does not wish to serve it as requested, it may respond with subscription parameters, which it would have accepted.
  2. Static subscriptions, which is an optional mechanism that enables managing subscriptions via a configuration interface so that a NETCONF agent sends event notifications to given receiver(s).

Some key characteristics of static and dynamic subscriptions include:

Note that there is no mixing-and-matching of RPC and configuration operations. Specifically, a static subscription cannot be modified or deleted using RPC. Similarly, a subscription created via RPC cannot be modified through configuration operations.

The NETCONF agent may decide to terminate a dynamic subscription at any time. Similarly the NETCONF agent may decide to temporarily suspend the sending of event notifications for either static or dynamic subscriptions. Such termination or suspension may be driven by the agent running out of resources to serve the subscription, or by internal errors on the server.

2. Solution

2.1. Event Streams

An event stream is a set of events available for subscription from a NETCONF server. It is out of the scope of this document to identify a) how streams are defined, b) how events are defined/generated, and c) how events are assigned to streams.

The following is a high-level description of the flow of a notification. Note that it does not mandate and/or preclude an implementation. As events are raised, they are assigned to streams. An event may be assigned to multiple streams. The event is distributed to subscribers and receivers based on the current subscriptions and access control. Access control is needed because if any receiver of that subscription does not have permission to receive an event, then it never makes it into a notification, and processing of the event is completed for that subscription.

2.2. Event Stream Discovery

A NETCONF client can retrieve the list of available event streams from a NETCONF server using the <get> operation. The reply contains the elements defined in the YANG model under the container /netconf/streams, which includes the name and description of the streams.

The following example shows retrieving the list of available event stream list using the <get> operation.

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

Figure 1: Get streams

The NETCONF server returns a list of event streams available for subscription. In this example, the list contains the NETCONF, SNMP, and syslog-critical streams.

<rpc-reply message-id="101" 
        xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <data>
        <netconf  
               xmlns="urn:ietf:params:xml:ns:netmod:notification">
            <streams>
                <stream>
                    <name>
                        NETCONF
                    </name>
                    <description>
                        default NETCONF event stream
                    </description>
                    <replaySupport>
                        true
                    </replaySupport>
                    <replayLogCreationTime>
                        2016-02-05T00:00:00Z
                    </replayLogCreationTime>
                </stream>
                <stream>
                    <name>
                        SNMP
                    </name>
                    <description>
                        SNMP notifications
                    </description>
                    <replaySupport>
                        false
                    </replaySupport>
                </stream>
                <stream>
                    <name>
                        syslog-critical
                    </name>
                    <description>
                        Critical and higher severity
                    </description>
                    <replaySupport>
                        true
                    </replaySupport>
                    <replayLogCreationTime>
                        2007-07-01T00:00:00Z
                    </replayLogCreationTime>
                </stream>
           </streams>
        </netconf>
    </data>
</rpc-reply>
                    

Figure 2: Get streams response

2.3. Default Event Stream

A NETCONF server implementation supporting the notification capability MUST support the "NETCONF" notification event stream. This stream contains all NETCONF XML event notifications supported by the NETCONF server, except for those belonging only to streams that explicitly indicate that they must be excluded from the NETCONF stream. The exact string "NETCONF" is used during the advertisement of stream support during the <get> operation on <streams> and during the <create-subscription> and <establish-subscription> operations.

2.4. Data Model Trees for Event Notifications

The YANG data models for event notifications are depicted in the following sections.

2.4.1. Data Model Tree for RFC5277 (netconf namespace)

module: ietf-5277-netconf
rpcs:
   +---x create-subscription    
      +--ro input     
         +--ro stream?      string
         +--ro (filter-type)?
         |  +--:(rfc5277)
         |     +--ro filter       
         +--ro startTime?   yang:date-and-time
         +--ro stopTime?    yang:date-and-time
                        

2.4.2. Data Model Tree for RFC5277 (netmod namespace)

module: ietf-5277-netmod
   +--rw netconf
      +--rw streams
         +--rw stream* [name]
            +--rw name                     string
            +--rw description              string
            +--rw replaySupport            boolean
            +--rw replayLogCreationTime    yang:date-and-time
            +--rw replayLogAgedTime        yang:date-and-time
notifications:
   +---n replayComplete          
   +---n notificationComplete    
                        

2.4.3. Data Model for RFC5277-bis Extensions

                
module: ietf-event-notifications
   +--rw filters
   |  +--rw filter* [filter-id]
   |     +--rw filter-id    filter-id
   |     +--rw (filter-type)?
   |        +--:(rfc5277)
   |           +--rw filter       
   +--rw subscription-config {configured-subscriptions}?
   |  +--rw subscription* [subscription-id]
   |     +--rw subscription-id     subscription-id
   |     +--rw stream?             string
   |     +--rw (filter-type)?
   |     |  +--:(rfc5277)
   |     |  |  +--rw filter              
   |     |  +--:(by-reference)
   |     |     +--rw filter-ref?         filter-ref
   |     +--rw startTime?          yang:date-and-time
   |     +--rw stopTime?           yang:date-and-time
   |     +--rw encoding?           encoding
   |     +--rw receivers
   |     |  +--rw receiver* [address]
   |     |     +--rw address     inet:host
   |     |     +--rw port        inet:port-number
   |     |     +--rw protocol?   transport-protocol
   |     +--rw (push-source)?
   |        +--:(interface-originated)
   |        |  +--rw source-interface?   if:interface-ref
   |        +--:(address-originated)
   |           +--rw source-vrf?         uint32
   |           +--rw source-address      inet:ip-address-no-zone
   +--ro subscriptions
      +--ro subscriptions* [subscription-id]
         +--ro subscription-id            subscription-id
         +--ro (subscription-type)?
         |  +--:(via-configuration)
         |  |  +--ro configured-subscription?   
                               empty {configured-subscriptions}?
         |  +--:(created-via-RPC)
         |     +--ro created-subscription?      empty
         +--ro subscription-status?       identityref
         +--ro stream?                    string
         +--ro (filter-type)?
         |  +--:(rfc5277)
         |  |  +--ro filter                     
         |  +--:(by-reference)
         |     +--ro filter-ref?                filter-ref
         +--ro startTime?                 yang:date-and-time
         +--ro stopTime?                  yang:date-and-time
         +--ro encoding?                  encoding
         +--ro receivers
         |  +--ro receiver* [address]
         |     +--ro address     inet:host
         |     +--ro port        inet:port-number
         |     +--ro protocol?   transport-protocol
         +--ro (push-source)?
            +--:(interface-originated)
            |  +--ro source-interface?       if:interface-ref
            +--:(address-originated)
               +--ro source-vrf?             uint32
               +--ro source-address          inet:ip-address-no-zone
augment /netmod-notif:replayComplete:
   +--ro subscription-id?   subscription-id
augment /netmod-notif:notificationComplete:
   +--ro subscription-id?   subscription-id
augment /netmod-notif:netconf/netmod-notif:streams:
   +--rw exclude-from-NETCONF-stream?   empty
rpcs:
   +---x establish-subscription    
   |  +--ro input     
   |  |  +--ro stream?       string
   |  |  +--ro (filter-type)?
   |  |  |  +--:(rfc5277)
   |  |  |  |  +--ro filter        
   |  |  |  +--:(by-reference)
   |  |  |     +--ro filter-ref?   filter-ref
   |  |  +--ro startTime?    yang:date-and-time
   |  |  +--ro stopTime?     yang:date-and-time
   |  |  +--ro encoding?     encoding
   |  +--ro output    
   |     +--ro subscription-result    subscription-result
   |     +--ro (result)?
   |        +--:(success)
   |        |  +--ro subscription-id        subscription-id
   |        +--:(no-success)
   |           +--ro stream?                string
   |           +--ro (filter-type)?
   |           |  +--:(rfc5277)
   |           |  |  +--ro filter                 
   |           |  +--:(by-reference)
   |           |     +--ro filter-ref?            filter-ref
   |           +--ro startTime?             yang:date-and-time
   |           +--ro stopTime?              yang:date-and-time
   |           +--ro encoding?              encoding
   +---x modify-subscription       
   |  +--ro input     
   |  |  +--ro subscription-id?   subscription-id
   |  |  +--ro stream?            string
   |  |  +--ro (filter-type)?
   |  |  |  +--:(rfc5277)
   |  |  |  |  +--ro filter             
   |  |  |  +--:(by-reference)
   |  |  |     +--ro filter-ref?        filter-ref
   |  |  +--ro startTime?         yang:date-and-time
   |  |  +--ro stopTime?          yang:date-and-time
   |  |  +--ro encoding?          encoding
   |  +--ro output    
   |     +--ro subscription-result    subscription-result
   |     +--ro stream?                string
   |     +--ro (filter-type)?
   |     |  +--:(rfc5277)
   |     |  |  +--ro filter                 
   |     |  +--:(by-reference)
   |     |     +--ro filter-ref?            filter-ref
   |     +--ro startTime?             yang:date-and-time
   |     +--ro stopTime?              yang:date-and-time
   |     +--ro encoding?              encoding
   +---x delete-subscription       
      +--ro input     
         +--ro subscription-id?   subscription-id
notifications:
   +---n subscription-started         
   |  +--ro subscription-id    subscription-id
   |  +--ro stream?            string
   |  +--ro (filter-type)?
   |  |  +--:(rfc5277)
   |  |  |  +--ro filter             
   |  |  +--:(by-reference)
   |  |     +--ro filter-ref?        filter-ref
   |  +--ro startTime?         yang:date-and-time
   |  +--ro stopTime?          yang:date-and-time
   |  +--ro encoding?          encoding
   +---n subscription-suspended       
   |  +--ro subscription-id    subscription-id
   |  +--ro reason?            subscription-susp-reason
   +---n subscription-resumed         
   |  +--ro subscription-id    subscription-id
   +---n subscription-modified        
   |  +--ro subscription-id    subscription-id
   |  +--ro stream?            string
   |  +--ro (filter-type)?
   |  |  +--:(rfc5277)
   |  |  |  +--ro filter             
   |  |  +--:(by-reference)
   |  |     +--ro filter-ref?        filter-ref
   |  +--ro startTime?         yang:date-and-time
   |  +--ro stopTime?          yang:date-and-time
   |  +--ro encoding?          encoding
   +---n subscription-terminated      
   |  +--ro subscription-id    subscription-id
   |  +--ro reason?            subscription-term-reason
   +---n added-to-subscription        
   |  +--ro subscription-id    subscription-id
   |  +--ro stream?            string
   |  +--ro (filter-type)?
   |  |  +--:(rfc5277)
   |  |  |  +--ro filter             
   |  |  +--:(by-reference)
   |  |     +--ro filter-ref?        filter-ref
   |  +--ro startTime?         yang:date-and-time
   |  +--ro stopTime?          yang:date-and-time
   |  +--ro encoding?          encoding
   +---n removed-from-subscription    
      +--ro subscription-id    subscription-id
                        

2.5. Creating a Subscription

This operation is fully defined in [RFC5277]. It allows a subscriber to request the creation of a dynamic subscription. If successful, the subscription remains in effect for the duration of the NETCONF session.

This operation is included in the document for supporting backwards compatibility with [RFC5277] clients. New clients are expected not to use this operation, but establish subscriptions as defined in Section 2.6

2.5.1. Parameters

The input parameters of the operation are:

stream: An optional parameter that indicates which stream of events is of interest. If not present, events in the default NETCONF stream will be sent.

filter: An optional parameter that indicates which subset of all possible events is of interest. The format of this parameter is the same as that of the filter parameter in the NETCONF protocol operations. If not present, all events not precluded by other parameters will be sent.

startTime: An optional parameter used to trigger the replay feature and indicate that the replay should start at the time specified. If startTime is not present, this is not a replay subscription. It is not valid to specify start times that are later than the current time. If the startTime specified is earlier than the log can support, the replay will begin with the earliest available notification. Implementations must support time zones.

stopTime: An optional parameter used with the optional replay feature to indicate the newest notifications of interest. If stopTime is not present, the notifications will continue until the subscription is terminated. Must be used with and be later than startTime. Implementations must support time zones.

2.5.2. Usage Example

The following demonstrates dynamically creating a simple subscription.

<netconf:rpc message-id="101" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
    <create-subscription 
        xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
    </create-subscription>
</netconf:rpc>
                        

Figure 3: Create subscription

2.5.3. Positive Response

If the NETCONF server can satisfy the request, the server sends an <ok> element.

<netconf:rpc netconf:message-id="102" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
    <create-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
        <filter netconf:type="xpath" 
                xmlns:ex="http://example.com/event/1.0"
             select="/ex:event[ex:eventClass='fault' and 
                      (ex:severity='minor' or ex:severity='major'
                       or ex:severity='critical')]"/>
    </create-subscription>
</netconf:rpc>

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

Figure 4: Successful create subscription

2.5.4. Negative Response

If the request cannot be completed for any reason, an <rpc-error> element is included within the <rpc-reply>. Subscription requests can fail for several reasons including if a filter with invalid syntax is provided or if the name of a non-existent stream is provided.

If a stopTime is specified in a request without having specified a startTime, the following error is returned:

Tag: missing-element
Error-type: protocol
Severity: error
Error-info: <bad-element>: startTime
Description: An expected element is missing.
                        

If the optional replay feature is requested but the NETCONF server does not support it, the following error is returned:

Tag: operation-failed
Error-type: protocol
Severity: error
Error-info: none
Description: Request could not be completed because the
             requested operation failed for some reason 
             not covered by any other error condition.
                        

If a stopTime is requested that is earlier than the specified startTime, the following error is returned:

Tag: bad-element
Error-type: protocol
Severity: error
Error-info: <bad-element>: stopTime
Description: An element value is not correct; 
             e.g., wrong type, out of range, pattern mismatch.
                        

If a startTime is requested that is later than the current time, the following error is returned:

Tag: bad-element
Error-type: protocol
Severity: error
Error-info: <bad-element>: startTime
Description: An element value is not correct; 
             e.g., wrong type, out of range, pattern mismatch.
                        

2.6. Establishing a Subscription

This operation is an evolution of the create subscription operation. It allows a subscriber to request the creation of a subscription both via RPC and configuration operations. When invoking the RPC, establish-subscription permits negotiating the subscription terms, changing them dynamically and enabling multiple subscriptions overs a single NETCONF session (if interleaving [RFC6241] is supported), and canceling subscriptions without terminating the NETCONF session.

2.6.1. Parameters

The input parameters of the operation are those of create subscription plus:

filter-ref: filters that have been previously (and separately) configured can be referenced by a subscription. This mechanism enables the reuse of filters.

encoding: by default, updates are encoded using XML. Other encodings may be supported, such as JSON.

2.6.2. Usage Example

The following demonstrates establishing a simple subscription.

<netconf:rpc message-id="101" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
    <establish-subscription 
            xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1">
    </establish-subscription>
</netconf:rpc>
                        

Figure 5: Establish subscription

2.6.3. Positive Response

If the NETCONF server can satisfy the request, the server sends a positive <subscription-result> element, and the subscription-id of the accepted subscription.

<netconf:rpc netconf:message-id="102" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
    <establish-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1">
        <filter netconf:type="xpath" 
                xmlns:ex="http://example.com/event/1.0"
             select="/ex:event[ex:eventClass='fault' and 
                      (ex:severity='minor' or ex:severity='major'
                       or ex:severity='critical')]"/>
    </establish-subscription>
</netconf:rpc>

<rpc-reply message-id="102" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <subscription-result 
          xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1">
       ok
    </subscription-result>
    <subscription-id 
          xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1">
       52
    </subscription-id>
</rpc-reply>        
                        

Figure 6: Successful establish subscription

2.6.4. Negative Response

If the NETCONF server cannot satisfy the request, the server sends a negative <subscription-result> element.

If the client has no authorization to establish the subscription, the <subscription-result> indicates an authorization error. For instance:

<netconf:rpc netconf:message-id="103" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
    <establish-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1">
        <stream>foo</stream>
    </establish-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:netconf:notification:1.1">
        error-data-not-authorized
    </subscription-result>
</rpc-reply>
                        

Figure 7: Unsuccessful establish subscription

If the request is rejected because the server is not able to serve it, the server SHOULD include in the returned error what subscription parameters would have been accepted for the request when it was processed. However, they are no guarantee that subsequent requests with those parameters for this client or others will be accepted. For instance, consider a subscription from [netconf-yang-push], which augments the establish-subscription with some additional parameters, including "period". If the client requests a period the NETCONF server cannot serve, the exchange may be:

<netconf:rpc message-id="101" 
         xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
      <establish-subscription 
            xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1">
         <stream>push-update</stream>
         <filter netconf:type="xpath"
                  xmlns:ex="http://example.com/sample-data/1.0"
               select="/ex:foo"/>
         <period 
             xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
            500
         </period>
         <encoding>encode-xml</encoding>
      </establish-subscription>
</netconf:rpc>


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

Figure 8: Subscription establishment negotiation

Subscription requests will fail if a filter with invalid syntax is provided or if the name of a non-existent stream is provided.

2.7. Modifying a Subscription

This operation permits modifying the terms of a subscription previously established. Statically created subscriptions cannot be modified. Dynamic subscriptions can be modified one or multiple times. If the server accepts the request, it immediately starts sending events based on the new terms, completely ignoring the previous ones. If the server rejects the request, the subscription remains as prior to the request. That is, the request has no impact whatsoever. The contents of negative responses to modify-subscription requests are the same as in establish subscription requests.

Dynamic subscriptions established via RPC can only be modified (or deleted) via RPC using the same session used to establish it. Configuration-based (i.e., static) subscriptions cannot be modified (or deleted) using RPCs. Instead, configured subscriptions are modified (or deleted) as part of regular configuration operations. Servers MUST reject any attempts to modify (or delete) static subscriptions via RPC.

2.7.1. Parameters

The parameters to modify-subscription are those of establish-subscription plus a mandatory subscription-id.

2.7.2. Usage Example

The following demonstrates modifying a subscription. Consider a subscription from [netconf-yang-push], which augments the establish-subscription with some additional parameters, including "period". A subscription may be established as follows.

<netconf:rpc message-id="101" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
    <establish-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1">
        <stream>push-update</stream>
        <filter netconf:type="xpath" 
            xmlns:ex="http://example.com/sample-data/1.0" 
            select="/ex:foo"/>
        <period 
              xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0">
            500
        </period>
        <encoding>encode-xml</encoding>
    </establish-subscription>
</netconf:rpc>

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

Figure 9: Establish subscription to be modified

The subscription may be modified with:

<netconf:rpc message-id="102" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
    <modify-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1">
        <subscription-id>1922</subscription-id>
        <period>1000</period>
    </modify-subscription >
</netconf:rpc>

<rpc-reply message-id="102" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <subscription-result 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1">
        ok
    </subscription-result>
    <subscription-id 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1">
        1922
    </subscription-id>
</rpc-reply>
                        

Figure 10: Modify subscription

2.7.3. Positive Response

If the NETCONF server can satisfy the request, the server sends a positive <subscription-result> element. This response is like that to an establish-subscription request. but without the subscription-id, which would be redundant.

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

<rpc-reply message-id="102" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <subscription-result 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1">
        ok
    </subscription-result>
</rpc-reply>
                        

Figure 11: Successful modify subscription

2.7.4. Negative Response

If the NETCONF server cannot satisfy the request, the server sends a negative <subscription-result> element. Its contents and semantics are identical to those to an establish-subscription request. For instance:

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

<rpc-reply message-id="102" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <subscription-result 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1">
        error-insufficient-resources
    </subscription-result>
    <period>500</period>
</rpc-reply>
                        

Figure 12: Unsuccessful modify subscription

2.8. Deleting a Subscription

This operation permits canceling a subscription previously established. Created subscriptions cannot be explicitly deleted. If the server accepts the request, it immediately stops sending events for the subscription. If the server rejects the request, all subscriptions remain as prior to the request. That is, the request has no impact whatsoever. A request may be rejected because the provided subscription identifier is incorrect.

Subscriptions created via RPC can only be deleted via RPC using the same session used for establishment. Static subscriptions cannot be deleted using RPCs. Instead, configured subscriptions are deleted as part of regular configuration operations. Servers MUST reject any RPC attempt to delete static subscriptions.

2.8.1. Parameters

The only parameter to delete-subscription is the identifier of the subscription to delete.

2.8.2. Usage Example

The following demonstrates deleting a subscription.

<netconf:rpc message-id="101" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
    <delete-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1">
        <subscription-id>1922</subscription-id>
    </delete-subscription>
</netconf:rpc>    
                        

Figure 13: Delete subscription

2.8.3. Positive Response

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

<netconf:rpc message-id="103" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
    <delete-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1">
        <subscription-id>1922</subscription-id>
    </delete-subscription>
</netconf:rpc>

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

Figure 14: Successful delete subscription

2.8.4. Negative Response

If the NETCONF server cannot satisfy the request, the server sends an error-rpc element. For example:

<netconf:rpc message-id="103" 
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
    <delete-subscription 
           xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1">
        <subscription-id>2017</subscription-id>
    </delete-subscription>
</netconf:rpc>
                            
<rpc-reply message-id="101" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <rpc-error>
        <error-type>application</error-type>
        <error-tag>invalid-value</error-tag>
        <error-severity>error</error-severity>
        <error-path 
           xmlns:t="urn:ietf:params:xml:ns:netconf:notification:1.1">
          /t:subscription-id
        </error-path>
        <error-message xml:lang="en">
            Subscription-id 2017 does not exist
        </error-message>
    </rpc-error>
</rpc-reply>
                        

Figure 15: Unsuccessful delete subscription

2.9. Static Subscriptions

A static subscription is a subscription installed via a configuration interface.

Static subscriptions persist across reboots, and persist even when transport is unavailable. This also means static subscriptions do not support negotiation.

Static subscriptions can be modified by any configuration client with write rights on the configuration of the subscription. Subscriptions can be modified or terminated at any point of their lifetime.

Supporting static subscriptions is optional and advertised using the "configured-subscriptions" feature.

2.9.1. Creating a Static Subscription

Static subscriptions cannot be created via configuration operations. New clients should use the mechanisms described in Section 2.9.2 for establishing static subscriptions.

2.9.2. Establishing a Static Subscription

Subscriptions can be established using configuration operations against the top-level subtree subscription-config. There are two key differences between RPC and configuration operations for subscription establishment. Firstly, configuration operations do not support negotiation while RPCs do. Secondly, while RPCs mandate that the client establishing the subscription is the only receiver of the notifications, configuration operations permit specifying receivers independent of any tracked subscriber. Immediately after a subscription is successfully established, the server sends to the receivers a control-plane notification stating the subscription has been established (subscription-started).

Because there is no explicit association with an existing transport session, static configuration operations require additional parameters to indicate the receivers of the notifications and possibly the source of the notifications (i.e., a specific interface or server address).

For example at subscription establishment, a NETCONF client may send:

<rpc message-id="101" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" 
       xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
    <edit-config>
        <target>
            <running/>
        </target>
        <subscription-config 
            xmlns="urn:ietf:params:xml:ns:netconf:notification:1.1">
            <subscription>
                <subscription-id>
                    1922
                </subscription-id>
                <stream>
                    foo
                </stream>
                <receiver>
                    <address>
                        1.2.3.4
                    </address>
                    <port>
                        1234
                    </port>
                </receiver>
            </subscription>
        </subscription-config>
    </edit-config>
</rpc>
                        

Figure 16: Establish static subscription

if the request is accepted, the server would reply:

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

Figure 17: Response to a successful static subscription establishment

if the request is not accepted because the server cannot serve it, the server may reply:

<rpc-reply 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 server cannot serve this 
            subscription due to the current workload.
        </error-message>       
    </rpc-error>
</rpc-reply>
                        

Figure 18: Response to a failed static subscription establishment

2.9.3. Modifying a Static Subscription

Static subscriptions can be modified using configuration operations against the top-level subtree subscription-config.

Immediately after a subscription is successfully modified, the server sends to the existing receivers a control-plane notification stating the subscription has been modified (i.e., subscription-modified).

If the modification involved adding and/or removing receivers, those modified receivers are sent control-plane notifications, indicating they have been added (i.e, added-to-subscription, with the same contents as a modified-subscription) or removed (i.e., removed-from-subscription)

2.9.4. Deleting a Static Subscription

Subscriptions can be deleted using configuration operations against the top-level subtree subscription-config. For example:

<rpc message-id="101" 
       xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <edit-config>
        <target>
            <running/>
        </target>
        <subscription-config 
        xmlns:xc="urn:ietf:params:xml:ns:netconf:notification:1.1">
            <subscription xc:operation="delete">
                <subscription-id>
                    1922
                </subscription-id >
           </subscription>
        </subscription-config>
    </edit-config>
</rpc>

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

                        

Figure 19: Deleting a static subscription

Immediately after a subscription is successfully deleted, the server sends to the receivers a control-plane notification stating the subscription has been terminated (subscription-terminated).

2.10. Event (Data Plane) Notifications

Once a subscription has been set up, the NETCONF server sends (asynchronously) the event notifications from the subscribed stream. We refer to these as data plane notifications. For dynamic subscriptions set up via RPC operations, event notifications are sent over the NETCONF session used to create or establish the subscription. For static subscriptions, event notifications are sent over the specified connections.

An event notification is sent to the receiver(s) when an event of interest (i.e., meeting the specified filtering criteria) has occurred. An event notification is a complete and well-formed XML document. Note that <notification> is not a Remote Procedure Call (RPC) method but rather the top-level element identifying the one-way message as a notification. Note that event notifications never trigger responses.

The event notification always includes an <eventTime> element. It is the time the event was generated by the event source. This parameter is of type dateTime and compliant to [RFC3339]. Implementations must support time zones.

The event notification also contains notification-specific tagged content, if any. With the exception of <eventTime>, the content of the notification is beyond the scope of this document.

For the encodings other than XML, notifications include an additional XML element so that the notification is a well-formed XML. The element is <notification-contents-{encoding}>, E.g., <notification-contents-json>. That element contains the notification contents in the desired encoding

The following is an example of an event notification from [RFC6020]: