Subscription to YANG Event NotificationsCisco Systemsevoit@cisco.comHuaweiludwig@clemm.orgMicrosoftalberto.gonzalez@microsoft.comCisco Systemseinarnn@cisco.comCisco Systemsambtripa@cisco.com
Operations & Management
NETCONFDraftThis document defines a YANG data model and associated mechanisms enabling subscriber-specific subscriptions to a publisher's event streams. Applying these elements allows a subscriber to request for and receive a continuous, custom feed of publisher generated information.This document defines a YANG data model and associated mechanisms enabling subscriber-specific subscriptions to a publisher's event streams. Effectively this enables a 'subscribe then publish' capability where the customized information needs and access permissions of each target receiver are understood by the publisher before subscribed event records are marshaled and pushed. The receiver then gets a continuous, custom feed of publisher generated information.While the functionality defined in this document is transport-agnostic, transports like NETCONF or RESTCONF can be used to configure or dynamically signal subscriptions, and there are bindings defined for subscribed event record delivery for NETCONF within , and for HTTP2 or HTTP1.1 within .The YANG model in this document conforms to the Network Management Datastore Architecture defined in .Various limitations in are discussed in . Resolving these issues is the primary motivation for this work. Key capabilities supported by this document include:multiple subscriptions on a single transport sessionsupport for dynamic and configured subscriptionsmodification of an existing subscription in progressper-subscription operational countersnegotiation of subscription parameters (through the use of hints returned as part of declined subscription requests)subscription state change notifications (e.g., publisher driven suspension, parameter modification)independence from transportThe key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 when, and only when, they appear in all capitals, as shown here.Client: defined in .Configuration: defined in .Configuration datastore: defined in .Configured subscription: A subscription installed via configuration into a configuration datastore.Dynamic subscription: A subscription created dynamically by a subscriber via a remote procedure call.Event: An occurrence of something that may be of interest. Examples include a configuration change, a fault, a change in status, crossing a threshold, or an external input to the system.Event occurrence time: a timestamp matching the time an originating process identified as when an event happened.Event record: A set of information detailing an event.Event stream: A continuous, chronologically ordered set of events aggregated under some context.Event stream filter: Evaluation criteria which may be applied against event records within an event stream. Event records pass the filter when specified criteria are met.Notification message: Information intended for a receiver indicating that one or more events have occurred.Publisher: An entity responsible for streaming notification messages per the terms of a subscription.Receiver: A target to which a publisher pushes subscribed event records. For dynamic subscriptions, the receiver and subscriber are the same entity.Subscriber: A client able to request and negotiate a contract for the generation and push of event records from a publisher. For dynamic subscriptions, the receiver and subscriber are the same entity.Subscription: A contract with a publisher, stipulating which information one or more receivers wish to have pushed from the publisher without the need for further solicitation.All YANG tree diagrams used in this document follow the notation defined in .This document describes a transport agnostic mechanism for subscribing to and receiving content from an event stream within a publisher. This mechanism is through the use of a subscription.Two types of subscriptions are supported:Dynamic subscriptions, where a subscriber initiates a subscription negotiation with a publisher via an RPC. If the publisher is able to serve this request, it accepts it, and then starts pushing notification messages back to the subscriber. If the publisher is not able to serve it as requested, then an error response is returned. This response MAY include hints at subscription parameters that, had they been present, may have enabled the dynamic subscription request to be accepted.Configured subscriptions, which allow the management of subscriptions via a configuration so that a publisher can send notification messages to a receiver. Support for configured subscriptions is optional, with its availability advertised via a YANG feature.Additional characteristics differentiating configured from dynamic subscriptions include:The lifetime of a dynamic subscription is bound by the transport session used to establish it. For connection-oriented stateful transports like NETCONF, the loss of the transport session will result in the immediate termination of any associated dynamic subscriptions. For connectionless or stateless transports like HTTP, a lack of receipt acknowledgment of a sequential set of notification messages and/or keep-alives can be used to trigger a termination of a dynamic subscription. Contrast this to the lifetime of a configured subscription. This lifetime is driven by relevant configuration being present within the publisher's applied configuration. Being tied to configuration operations implies configured subscriptions can be configured to persist across reboots, and implies a configured subscription can persist even when its publisher is fully disconnected from any network.Configured subscriptions can be modified by any configuration client with write permission on the configuration of the subscription. Dynamic subscriptions can only be modified via an RPC request made by the original subscriber, or a change to configuration data referenced by the subscription.Note that there is no mixing-and-matching of dynamic and configured operations on a single subscription. Specifically, a configured subscription cannot be modified or deleted using RPCs defined in this document. Also note that transport specific transport drafts based on this specification MUST detail the life cycles of both dynamic and configured subscriptions.A publisher MAY terminate a dynamic subscription at any time. Similarly, it MAY decide to temporarily suspend the sending of notification messages for any dynamic subscription, or for one or more receivers of a configured subscription. Such termination or suspension is driven by internal considerations of the publisher.This document is intended to provide a superset of the subscription capabilities initially defined within . Especially when extending an existing implementation, it is important to understand what has been reused and what has been replaced. Key relationships between these two documents include:
this document defines a transport independent capability, is specific to NETCONF.the data model in this document is used instead of the data model in Section 3.4 of for the new operations.the RPC operations in this draft replace the operation "create-subscription" defined in , section 4.the <notification> message of , Section 4 is used.the included contents of the "NETCONF" event stream are identical between this document and .a publisher MAY implement both the Notification Management Schema and RPCs defined in and this new document concurrently.unlike , this document enables a single transport session to intermix notification messages and RPCs for different subscriptions.Per the overview provided in , this section details the overall context, state machines, and subsystems which may be assembled to allow the subscription of events from a publisher.An event stream is a named entity on a publisher which exposes a continuously updating set of YANG encoded event records. An event record is an intantiation of a "notification" YANG statement. If the "notification" is defined as a child to a data node, the intantiation includes the hierarchy of nodes that identifies the data node in the datastore (see Section 7.16.2 of ). Each event stream is available for subscription. It is out of the scope of this document to identify a) how event streams are defined (other than the NETCONF stream), b) how event records are defined/generated, and c) how event records are assigned to event streams.There is only one reserved event stream name within this document: "NETCONF". The "NETCONF" event stream contains all NETCONF event record information supported by the publisher, except where an event record has explicitly been excluded from the stream. Beyond the "NETCONF" stream, implementations MAY define additional event streams.As YANG encoded event records are created by a system, they may be assigned to one or more streams. The event record is distributed to a subscription's receiver(s) where: (1) a subscription includes the identified stream, and (2) subscription filtering does not exclude the event record from that receiver.Access control permissions may be used to silently exclude event records from within an event stream for which the receiver has no read access. As an example of how this might be accomplished, see section 3.4.6. Note that per of this document, subscription state change notifications are never filtered out.If no access control permissions are in place for event records on an event stream, then a receiver MUST be allowed access to all the event records. If subscriber permissions change during the lifecycle of a subscription and event stream access is no longer permitted, then the subscription MUST be terminated.Event records MUST NOT be delivered to a receiver in a different order than they were placed onto an event stream.This document defines an extensible filtering mechanism. The filter itself is a boolean test which is placed on the content of an event record. A 'false' filtering result causes the event message to be excluded from delivery to a receiver. A filter never results in information being stripped from within an event record prior to that event record being encapsulated within a notification message. The two optional event stream filtering syntaxes supported are and subtree .If no event stream filter is provided within a subscription, all event records on an event stream are to be sent.This document provide for several QoS parameters. These parameters indicate the treatment of a subscription relative to other traffic between publisher and receiver. Included are:
A "dscp" marking to differentiate prioritization of notification messages during network transit.A "weighting" so that bandwidth proportional to this weighting can be allocated to this subscription relative to other subscriptions.a "dependency" upon another subscription. If the publisher supports the "dscp" feature, then a subscription with a "dscp" leaf MUST result in a corresponding DSCP marking being placed within the IP header of any resulting notification messages and subscription state change notifications.For the "weighting" parameter, when concurrently dequeuing notification messages from multiple subscriptions to a receiver, the publisher MUST allocate bandwidth to each subscription proportionally to the weights assigned to those subscriptions. "Weighting" is an optional capability of the publisher; support for it is identified via the "qos" feature.If a subscription has the "dependency" parameter set, then any buffered notification messages containing event records selected by the parent subscription MUST be dequeued prior to the notification messages of the dependent subscription. If notification messages have dependencies on each other, the notification message queued the longest MUST go first. If a "dependency" included within an RPC references a subscription which does not exist or is no longer accessible to that subscriber, that "dependency" MUST be silently removed. "Dependency" is an optional capability of the publisher; support for it is identified via the "qos" feature.Dynamic subscriptions are managed via protocol operations (in the form of , Section 7.14 RPCs) made against targets located within the publisher. These RPCs have been designed extensibly so that they may be augmented for subscription targets beyond event streams. For examples of such augmentations, see the RPC augmentations within 's YANG model.Below is the publisher's state machine for a dynamic subscription. Each state is shown in its own box. It is important to note that such a subscription doesn't exist at the publisher until an "establish-subscription" RPC is accepted. The mere request by a subscriber to establish a subscription is insufficient for that subscription to be externally visible. Start and end states are depicted to reflect subscription creation and deletion events.Of interest in this state machine are the following:
Successful "establish-subscription" or "modify-subscription" RPCs put the subscription into the active state.Failed "modify-subscription" RPCs will leave the subscription in its previous state, with no visible change to any streaming updates.A "delete-subscription" or "kill-subscription" RPC will end the subscription, as will the reaching of a "stop-time".A publisher may choose to suspend a subscription when there is insufficient CPU or bandwidth available to service the subscription. This is notified to a subscriber with a "subscription-suspended" subscription state change notification.A suspended subscription may be modified by the subscriber (for example in an attempt to use fewer resources). Successful modification returns the subscription to the active state.Even without a "modify-subscription" request, a publisher may return a subscription to the active state should the resource constraints become sufficient again. This is announced to the subscriber via the "subscription-resumed" subscription state change notification.The "establish-subscription" RPC allows a subscriber to request the creation of a subscription.The input parameters of the operation are:
A "stream" name which identifies the targeted event stream against which the subscription is applied.An event stream filter which may reduce the set of event records pushed.Where the transport used by the RPC supports multiple encodings, an optional "encoding" for the event records pushed. If no "encoding" is included, the encoding of the RPC MUST be used.An optional "stop-time" for the subscription. If no "stop-time" is present, notification messages will continue to be sent until the subscription is terminated.An optional "replay-start-time" for the subscription. The "replay-start-time" MUST be in the past and indicates that the subscription is requesting a replay of previously generated information from the event stream. For more on replay, see . Where there is no "replay-start-time", the subscription starts immediately.If the publisher can satisfy the "establish-subscription" request, it replies with an identifier for the subscription, and then immediately starts streaming notification messages.Below is a tree diagram for "establish-subscription". All objects contained in this tree are described within the included YANG model within .A publisher MAY reject the "establish-subscription" RPC for many reasons as described in . The contents of the resulting RPC error response MAY include details on input parameters which if considered in a subsequent "establish-subscription" RPC, may result in a successful subscription establishment. Any such hints MUST be transported within a yang-data "establish-subscription-stream-error-info" container included within the RPC error response.Replay provides the ability to establish a subscription which is also capable of passing recently generated event records. In other words, as the subscription initializes itself, it sends any event records within the target event stream which meet the filter criteria, which have an event time which is after the "replay-start-time", and which have an event time before the "stop-time" should this "stop-time" exist. The end of these historical event records is identified via a "replay-completed" subscription state change notification. Any event records generated since the subscription establishment may then follow. For a particular subscription, all event records will be delivered in the order they are placed into the event stream.Replay is an optional feature which is dependent on an event stream supporting some form of logging. This document puts no restrictions on the size or form of the log, where it resides within the publisher, or when event record entries in the log are purged.The inclusion of a "replay-start-time" within an "establish-subscription" RPC indicates a replay request. If the "replay-start-time" contains a value that is earlier than what a publisher's retained history supports, then if the subscription is accepted, the actual publisher's revised start time MUST be set in the returned "replay-start-time-revision" object.A "stop-time" parameter may be included in a replay subscription. For a replay subscription, the "stop-time" MAY be earlier than the current time, but MUST be later than the "replay-start-time".If the given "replay-start-time" is later than the time marked within any event records retained within the replay buffer, then the publisher MUST send a "replay-completed" notification immediately after a successful establish-subscription RPC response.If an event stream supports replay, the "replay-support" leaf is present in the "/streams/stream" list entry for the event stream. An event stream that does support replay is not expected to have an unlimited supply of saved notifications available to accommodate any given replay request. To assess the timeframe available for replay, subscribers can read the leafs "replay-log-creation-time" and "replay-log-aged-time". See for the YANG tree, and for the YANG model describing these elements. The actual size of the replay log at any given time is a publisher specific matter. Control parameters for the replay log are outside the scope of this document.The "modify-subscription" operation permits changing the terms of an existing dynamic subscription. Dynamic subscriptions can be modified any number of times. Dynamic subscriptions can only be modified via this RPC using a transport session connecting to the subscriber. If the publisher accepts the requested modifications, it acknowledges success to the subscriber, then immediately starts sending event records based on the new terms.Subscriptions created by configuration cannot be modified via this RPC. However configuration may be used to modify objects referenced by the subscription (such as a referenced filter).Below is a tree diagram for "modify-subscription". All objects contained in this tree are described within the included YANG model within .If the publisher accepts the requested modifications on a currently suspended subscription, the subscription will immediately be resumed (i.e., the modified subscription is returned to the active state.) The publisher MAY immediately suspend this newly modified subscription through the "subscription-suspended" notification before any event records are sent.If the publisher rejects the RPC request, the subscription remains as prior to the request. That is, the request has no impact whatsoever. Rejection of the RPC for any reason is indicated by via RPC error as described in . The contents of such a rejected RPC MAY include hints on inputs which (if considered) may result in a successfully modified subscription. These hints MUST be transported within a yang-data "modify-subscription-stream-error-info" container inserted into the RPC error response.Below is a tree diagram for "modify-subscription-RPC-yang-data". All objects contained in this tree are described within the included YANG model within .The "delete-subscription" operation permits canceling an existing subscription. If the publisher accepts the request, and the publisher has indicated success, the publisher MUST NOT send any more notification messages for this subscription.Below is a tree diagram for "delete-subscription". All objects contained in this tree are described within the included YANG model within .Dynamic subscriptions can only be deleted via this RPC using a transport session connecting to the subscriber. Configured subscriptions cannot be deleted using RPCs.The "kill-subscription" operation permits an operator to end a dynamic subscription which is not associated with the transport session used for the RPC. A publisher MUST terminate any dynamic subscription identified by the "id" parameter in the RPC request, if such a subscription exists.Configured subscriptions cannot be killed using this RPC. Instead, configured subscriptions are deleted as part of regular configuration operations. Publishers MUST reject any RPC attempt to kill a configured subscription.Below is a tree diagram for "kill-subscription". All objects contained in this tree are described within the included YANG model within .Whenever an RPC is unsuccessful, the publisher returns relevant information as part of the RPC error response. Transport level error processing MUST be done before RPC error processing described in this section. In all cases, RPC error information returned will use existing transport layer RPC structures, such as those seen with NETCONF in Appendix A, or with RESTCONF in Section 7.1. These structures MUST be able to encode subscription specific errors identified below and defined within this document's YANG model. As a result of this mixture, how subscription errors are encoded within an RPC error response is transport dependent. Following are valid errors which can occur for each RPC:To see a NETCONF based example of an error response from above, see , Figure 10.There is one final set of transport independent RPC error elements included in the YANG model. These are three yang-data structures which enable the publisher to provide to the receiver that error information which does not fit into existing transport layer RPC structures. These three yang-data structures are:
"establish-subscription-stream-error-info": This MUST be returned with the leaf "reason" populated if an RPC error reason has not been placed elsewhere within the transport portion of a failed "establish-subscription" RPC response. This MUST be sent if hints on how to overcome the RPC error are included."modify-subscription-stream-error-info": This MUST be returned with the leaf "reason" populated if an RPC error reason has not been placed elsewhere within the transport portion of a failed "modify-subscription" RPC response. This MUST be sent if hints on how to overcome the RPC error are included."delete-subscription-error-info": This MUST be returned with the leaf "reason" populated if an RPC error reason has not been placed elsewhere within the transport portion of a failed "delete-subscription" or "kill-subscription" RPC response.A configured subscription is a subscription installed via configuration. Configured subscriptions may be modified by any configuration client with the proper permissions. Subscriptions can be modified or terminated via configuration at any point of their lifetime. Multiple configured subscriptions MUST be supportable over a single transport session.Configured subscriptions have several characteristics distinguishing them from dynamic subscriptions:
persistence across publisher reboots,persistence even when transport is unavailable, andan ability to send notification messages to more than one receiver (note that receivers are unaware of the existence of any other receivers.)On the publisher, supporting configured subscriptions is optional and advertised using the "configured" feature. On a receiver of a configured subscription, support for dynamic subscriptions is optional except where replaying missed event records is required.In addition to the subscription parameters available to dynamic subscriptions described in , the following additional parameters are also available to configured subscriptions:
A "transport" which identifies the transport protocol to use to connect with all subscription receivers.One or more receivers, each intended as the destination for event records. Note that each individual receiver is identifiable by its "name".Optional parameters to identify where traffic should egress a publisher:
A "source-interface" which identifies the egress interface to use from the publisher. Publisher support for this is optional and advertised using the "interface-designation" feature.A "source-address" address, which identifies the IP address to stamp on notification messages destined for the receiver.A "source-vrf" which identifies the VRF on which to reach receivers. This VRF is a network instance as defined within . Publisher support for VRFs is optional and advertised using the "supports-vrf" feature.
If none of the above parameters are set, notification messages MUST egress the publisher's default interface.A tree diagram describing these parameters is shown in within . All parameters are described within the YANG model in .Below is the state machine for a configured subscription on the publisher. This state machine describes the three states (valid, invalid, and concluded), as well as the transitions between these states. Start and end states are depicted to reflect configured subscription creation and deletion events. The creation or modification of a configured subscription initiates an evaluation by the publisher to determine if the subscription is in valid or invalid states. The publisher uses its own criteria in making this determination. If in the valid state, the subscription becomes operational. See (1) in the diagram below.A subscription in the valid state may move to the invalid state in one of two ways. First, it may be modified in a way which fails a re-evaluation. See (2) in the diagram. Second, the publisher might determine that the subscription is no longer supportable. This could be for reasons of an unexpected but sustained increase in an event stream's event records, degraded CPU capacity, a more complex referenced filter, or other higher priority subscriptions which have usurped resources. See (3) in the diagram. No matter the case, a "subscription-terminated" notification is sent to any receivers in an active or suspended state. A subscription in the valid state may also transition to the concluded state via (5) if a configured stop time has been reached. In this case, a "subscription-concluded" notification is sent to any receivers in active or suspended states. Finally, a subscription may be deleted by configuration (4).When a subscription is in the valid state, a publisher will attempt to connect with all receivers of a configured subscription and deliver notification messages. Below is the state machine for each receiver of a configured subscription. This receiver state machine is fully contained within the state machine of the configured subscription, and is only relevant when the configured subscription is in the valid state.When a configured subscription first moves to the valid state, the "state" leaf of each receiver is initialized to the connecting state. If transport connectivity is not available to any receiver and there are any notification messages to deliver, a transport session is established (e.g., through ). Individual receivers are moved to the active state when a "subscription-started" subscription state change notification is successfully passed to that receiver (a). Event records are only sent to active receivers. Receivers of a configured subscription remain active if both transport connectivity can be verified to the receiver, and event records are not being dropped due to a publisher buffer overflow. The result is that a receiver will remain active on the publisher as long as events aren't being lost, or the receiver cannot be reached. In addition, a configured subscription's receiver MUST be moved to the connecting state if the receiver is reset via the "reset" action (b), (c). For more on reset, see . If transport connectivity cannot be achieved while in the connecting state, the receiver MAY be moved to the disconnected state.A configured subscription's receiver MUST be moved to the suspended state if there is transport connectivity between the publisher and receiver, but notification messages are failing to be delivered due to publisher buffer overflow, or notification messages are not able to be generated for that receiver due to insufficient CPU (d). This is indicated to the receiver by the "subscription-suspended" subscription state change notification.A configured subscription receiver MUST be returned to the active state from the suspended state when notification messages are able to be generated, bandwidth is sufficient to handle the notification messages, and a receiver has successfully been sent a "subscription-resumed" or "subscription-modified" subscription state change notification (e). The choice as to which of these two subscription state change notifications is sent is determined by whether the subscription was modified during the period of suspension.Modification of a configured subscription is possible at any time. A "subscription-modified" subscription state change notification will be sent to all active receivers, immediately followed by notification messages conforming to the new parameters. Suspended receivers will also be informed of the modification. However this notification will await the end of the suspension for that receiver (e).The mechanisms described above are mirrored in the RPCs and notifications within the document. It should be noted that these RPCs and notifications have been designed to be extensible and allow subscriptions into targets other than event streams. For instance, the YANG module defined in Section 5 of augments "/sn:modify-subscription/sn:input/sn:target".Configured subscriptions are established using configuration operations against the top-level "subscriptions" subtree.Because there is no explicit association with an existing transport session, configuration operations MUST include additional parameters beyond those of dynamic subscriptions. These parameters identify each receiver, how to connect with that receiver, and possibly whether the notification messages need to come from a specific egress interface on the publisher. Receiver specific transport connectivity parameters MUST be configured via transport specific augmentations to this specification. See for details.After a subscription is successfully established, the publisher immediately sends a "subscription-started" subscription state change notification to each receiver. It is quite possible that upon configuration, reboot, or even steady-state operations, a transport session may not be currently available to the receiver. In this case, when there is something to transport for an active subscription, transport specific call-home operations will be used to establish the connection. When transport connectivity is available, notification messages may then be pushed.With active configured subscriptions, it is allowable to buffer event records even after a "subscription-started" has been sent. However if events are lost (rather than just delayed) due to replay buffer overflow, a new "subscription-started" must be sent. This new "subscription-started" indicates an event record discontinuity.To see an example of subscription creation using configuration operations over NETCONF, see Appendix A of .Configured subscriptions can be modified using configuration operations against the top-level "subscriptions" subtree.If the modification involves adding receivers, added receivers are placed in the connecting state. If a receiver is removed, the subscription state change notification "subscription-terminated" is sent to that receiver if that receiver is active or suspended.If the modification involves changing the policies for the subscription, the publisher sends to currently active receivers a "subscription-modified" notification. For any suspended receivers, a "subscription-modified" notification will be delayed until the receiver is resumed. (Note: in this case, the "subscription-modified" notification informs the receiver that the subscription has been resumed, so no additional "subscription-resumed" need be sent. Also note that if multiple modifications have occurred during the suspension, only the "subscription-modified" notification describing the latest one need be sent to the receiver.)Subscriptions can be deleted through configuration against the top-level "subscriptions" subtree.Immediately after a subscription is successfully deleted, the publisher sends to all receivers of that subscription a subscription state change notification stating the subscription has ended (i.e., "subscription-terminated").It is possible that a configured subscription to a receiver needs to be reset. This is accomplished via the "reset" action within the YANG model at "/subscriptions/subscription/receivers/receiver/reset". This action may be useful in cases where a publisher has timed out trying to reach a receiver. When such a reset occurs, a transport session will be initiated if necessary, and a new "subscription-started" notification will be sent. This action does not have any effect on transport connectivity if the needed connectivity already exists.It is possible to do replay on a configured subscription. This is supported via the configuration of the "configured-replay" object on the subscription. The setting of this object enables the streaming of the buffered event records for the subscribed event stream. All buffered event records which have been retained since the last publisher restart will be sent to each configured receiver.Replay of events records created since restart is useful. It allows event records generated before transport connectivity establishment to be passed to a receiver. Setting the restart time as the earliest configured replay time precludes possibility of resending of event records logged prior to publisher restart. It also ensures the same records will be sent to each configured receiver, regardless of the speed of transport connectivity establishment to each receiver. Finally, establishing restart as the earliest potential time for event records to be included within notification messages, a well-understood timeframe for replay is defined.As a result, when any configured subscription receivers become active, buffered event records will be sent immediately after the "subscription-started" notification. If the publisher knows the last event record sent to a receiver, and the publisher has not rebooted, the next event record on the event stream which meets filtering criteria will be the leading event record sent. Otherwise, the leading event record will be the first event record meeting filtering criteria subsequent to the latest of three different times: the "replay-log-creation-time", "replay-log-aged-time", or the most recent publisher boot time. The "replay-log-creation-time" and "replay-log-aged-time" are discussed in . The most recent publisher boot time ensures that duplicate event records are not replayed from a previous time the publisher was booted.It is quite possible that a receiver might want to retrieve event records from an event stream prior to the latest boot. If such records exist where there is a configured replay, the publisher MUST send the time of the event record immediately preceding the "replay-start-time" within the "replay-previous-event-time" leaf. Through the existence of the "replay-previous-event-time", the receiver will know that earlier events prior to reboot exist. In addition, if the subscriber was previously receiving event records with the same subscription "id", the receiver can determine if there was a timegap where records generated on the publisher were not successully received. And with this information, the receiver may choose to dynamically subscribe to retrieve any event records placed into the event stream before the most recent boot time.All other replay functionality remains the same as with dynamic subscriptions as described in .This specification is transport independent. However supporting a configured subscription will often require the establishment of transport connectivity. And the parameters used for this transport connectivity establishment are transport specific. As a result, the YANG model defined within is not able to directly define and expose these transport parameters.It is necessary for an implementation to support the connection establishment process. To support this function, the YANG model does include a node where transport specific parameters for a particular receiver may be augmented. This node is "/subscriptions/subscription/receivers/receiver". By augmenting transport parameters from this node, system developers are able to incorporate the YANG objects necessary to support the transport connectivity establishment process.The result of this is the following requirement. A publisher supporting the feature "configured" MUST also support least one YANG model which augments transport connectivity parameters on "/subscriptions/subscription/receivers/receiver". For an example of such an augmentation, see .Whether dynamic or configured, once a subscription has been set up, the publisher streams event records via notification messages per the terms of the subscription. For dynamic subscriptions, notification messages are sent over the session used to establish the subscription. For configured subscriptions, notification messages are sent over the connections specified by the transport and each receiver of a configured subscription.A notification message is sent to a receiver when an event record is not blocked by either the specified filter criteria or receiver permissions. This notification message MUST include an "eventTime" object as defined per Section 4. This "eventTime" MUST be at the top level of YANG structured event record.The following example within section 7.16.3 is an example of a compliant message:When a dynamic subscription has been started or modified, with "establish-subscription" or "modify-subscription" respectively, event records matching the newly applied filter criteria MUST NOT be sent until after the RPC reply has been sent.When a configured subscription has been started or modified, event records matching the newly applied filter criteria MUST NOT be sent until after the "subscription-started" or "subscription-modified" notifications has been sent, respectively.In addition to sending event records to receivers, a publisher MUST also send subscription state change notifications when events related to subscription management have occurred.subscription state change notifications are unlike other notifications in that they are never included in any event stream. Instead, they are inserted (as defined in this section) within the sequence of notification messages sent to a particular receiver. subscription state change notifications cannot be filtered out, they cannot be stored in replay buffers, and they are delivered only to impacted receivers of a subscription. The identification of subscription state change notifications is easy to separate from other notification messages through the use of the YANG extension "subscription-state-notif". This extension tags a notification as a subscription state change notification. The complete set of subscription state change notifications is described in the following subsections.This notification indicates that a configured subscription has started, and event records may be sent. Included in this subscription state change notification are all the parameters of the subscription, except for the receiver(s) transport connection information and origin information indicating where notification messages will egress the publisher. Note that if a referenced filter from the "filters" container has been used within the subscription, the notification still provides the contents of that referenced filter under the "within-subscription" subtree.Note that for dynamic subscriptions, no "subscription-started" notifications are ever sent.Below is a tree diagram for "subscription-started". All objects contained in this tree are described within the included YANG model within .This notification indicates that a subscription has been modified by configuration operations. It is delivered directly after the last event records processed using the previous subscription parameters, and before any event records processed after the modification. Below is a tree diagram for "subscription-modified". All objects contained in this tree are described within the included YANG model within .A publisher most often sends this notification directly after the modification of any configuration parameters impacting a configured subscription. But it may also be sent at two other times:
Where a configured subscription has been modified during the suspension of a receiver, the notification will be delayed until the receiver's suspension is lifted. In this situation, the notification indicates that the subscription has been both modified and resumed.A "subscription-modified" subscription state change notification MUST be sent if the contents of the filter identified by the subscription's "stream-filter-ref" leaf has changed. This state change notification is to be sent for a filter change impacting any active receiver of a configured or dynamic subscription.This notification indicates that no further event records for this subscription should be expected from the publisher. A publisher may terminate the sending event records to a receiver for the following reasons:
Configuration which removes a configured subscription, or a "kill-subscription" RPC which ends a dynamic subscription. These are identified via the reason "no-such-subscription".A referenced filter is no longer accessible. This is identified by "filter-unavailable".The event stream referenced by a subscription is no longer accessible by the receiver. This is identified by "stream-unavailable".A suspended subscription has exceeded some timeout. This is identified by "suspension-timeout".Each of the reasons above correspond one-to-one with a "reason" identityref specified within the YANG model.Below is a tree diagram for "subscription-terminated". All objects contained in this tree are described within the included YANG model within .Note: this subscription state change notification MUST be sent to a dynamic subscription's receiver when the subscription ends unexpectedly. The cases when this might happen are when a "kill-subscription" RPC is successful, or when some other event not including the reaching the subscription's "stop-time" results in a publisher choosing to end the subscription. This notification indicates that a publisher has suspended the sending of event records to a receiver, and also indicates the possible loss of events. Suspension happens when capacity constraints stop a publisher from serving a valid subscription. The two conditions where is this possible are:
"insufficient-resources" when a publisher is unable to produce the requested event stream of notification messages, and"unsupportable-volume" when the bandwidth needed to get generated notification messages to a receiver exceeds a threshold. These conditions are encoded within the "reason" object. No further notification will be sent until the subscription resumes or is terminated. Below is a tree diagram for "subscription-suspended". All objects contained in this tree are described within the included YANG model within .This notification indicates that a previously suspended subscription has been resumed under the unmodified terms previously in place. Subscribed event records generated after the issuance of this subscription state change notification may now be sent.Below is the tree diagram for "subscription-resumed". All objects contained in this tree are described within the included YANG model within .This notification indicates that a subscription that includes a "stop-time" has successfully finished passing event records upon the reaching of that time.Below is a tree diagram for "subscription-completed". All objects contained in this tree are described within the included YANG model within .This notification indicates that all of the event records prior to the current time have been passed to a receiver. It is sent before any notification message containing an event record with a timestamp later than (1) the "stop-time" or (2) the subscription's start time.If a subscription contains no "stop-time", or has a "stop-time" that has not been reached, then after the "replay-completed" notification has been sent, additional event records will be sent in sequence as they arise naturally on the publisher.Below is a tree diagram for "replay-completed". All objects contained in this tree are described within the included YANG model within .In the operational state datastore, the container "subscriptions" maintains the state of all dynamic subscriptions, as well as all configured subscriptions. Using datastore retrieval operations, or subscribing to the "subscriptions" container allows the state of subscriptions and their connectivity to receivers to be monitored.Each subscription in the operational state datastore is represented as a list element. Included in this list are event counters for each receiver, the state of each receiver, as well as the subscription parameters currently in effect. The appearance of the leaf "configured-subscription-state" indicates that a particular subscription came into being via configuration. This leaf also indicates if the current state of that subscription is valid, invalid, and concluded.To understand the flow of event records within a subscription, there are two counters available for each receiver. The first counter is "sent-event-records" which shows the quantity of events actually identified for sending to a receiver. The second counter is "excluded-event-records" which shows event records not sent to receiver. "excluded-event-records" shows the combined results of both access control and per-subscription filtering. For configured subscriptions, counters are reset whenever the subscription is evaluated to valid (see (1) in ).Dynamic subscriptions are removed from the operational state datastore once they expire (reaching stop-time) or when they are terminated. While many subscription objects are shown as configurable, dynamic subscriptions are only included within the operational state datastore and as a result are not configurable.Publishers supporting this document MUST indicate support of the YANG model "ietf-subscribed-notifications" within the YANG library of the publisher. In addition if supported, the optional features "encode-xml", "encode-json", "configured" "supports-vrf", "qos", "xpath", "subtree", "interface-designation", "dscp", and "replay" MUST be indicated.This section contains tree diagrams for nodes defined in . For tree diagrams of subscription state change notifications, see . For the tree diagrams for the RPCs, see .A publisher maintains a list of available event streams as operational data. This list contains both standardized and vendor-specific event streams. This enables subscribers to discover what streams a publisher supports.Above is a tree diagram for the "streams" container. All objects contained in this tree are described within the included YANG model within .The "filters" container maintains a list of all subscription filters that persist outside the life-cycle of a single subscription. This enables pre-defined filters which may be referenced by more than one subscription.Above is a tree diagram for the filters container. All objects contained in this tree are described within the included YANG model within .The "subscriptions" container maintains a list of all subscriptions on a publisher, both configured and dynamic. It can be used to retrieve information about the subscriptions which a publisher is serving.Above is a tree diagram for the subscriptions container. All objects contained in this tree are described within the included YANG model within .This module imports typedefs from , , and , and it references , , , , and .[ note to the RFC Editor - please replace XXXX within this YANG model with the number of this document, and XXXY with the number of ][ note to the RFC Editor - please replace the two dates within the YANG module with the date of publication ]
This document registers the following namespace URI in the "IETF XML
Registry" :
URI: urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications
Registrant Contact: The IESG.
XML: N/A; the requested URI is an XML namespace.
This document registers the following YANG module in the "YANG
Module Names" registry :
Name: ietf-subscribed-notifications
Namespace: urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications
Prefix: sn
Reference: draft-ietf-netconf-ietf-subscribed-notifications-11.txt
(RFC form)
To support deployments including both configured and dynamic subscriptions, it is recommended to split the subscription "id" domain into static and dynamic halves. That way it eliminates the possibility of collisions if the configured subscriptions attempt to set a subscription-id which might have already been dynamically allocated. A best practice is to use lower half the "id" object's integer space when that "id" is assigned by an external entity (such as with a configured subscription). This leaves the upper half of subscription integer space available to be dynamically assigned by the publisher.If a subscription is unable to marshal a series of filtered event records into transmittable notification messages, the receiver should be suspended with the reason "unsupportable-volume".For configured subscriptions, operations are against the set of receivers using the subscription "id" as a handle for that set. But for streaming updates, subscription state change notifications are local to a receiver. In this specification it is the case that receivers get no information from the publisher about the existence of other receivers. But if a network operator wants to let the receivers correlate results, it is useful to use the subscription "id" across the receivers to allow that correlation.For configured replay subscriptions, the receiver is protected from duplicated events being pushed after a publisher is rebooted. However it is possible that a receiver might want to acquire event records which failed to be delivered just prior to the reboot. Delivering these event records be accomplished by leveraging the "eventTime" from the last event record received prior to the receipt of a "subscription-started" subscription state change notification. With this "eventTime" and the "replay-start-time" from the "subscription-started" notification, an independent dynamic subscription can be established which retrieves any event records which may have been generated but not sent to the receiver. This section provides requirements for any subscribed notification transport supporting the solution presented in this document.The transport selected by the subscriber to reach the publisher MUST be able to support multiple "establish-subscription" requests made within the same transport session.For both configured and dynamic subscriptions the publisher MUST authenticate a receiver via some transport level mechanism before sending any event records for which they are authorized to see. In addition, the receiver MUST authenticate the publisher at the transport level. The result is mutual authentication between the two.A secure transport is highly recommended and the publisher MUST ensure that the receiver has sufficient authorization to perform the function they are requesting against the specific subset of content involved.A specific transport specification built upon this document may or may not choose to require the use of the same logical channel for the RPCs and the event records. However the event records and the subscription state change notifications MUST be sent on the same transport session to ensure the properly ordered delivery.Additional transport requirements will be dictated by the choice of transport used with a subscription. For an example of such requirements with NETCONF transport, see .The YANG module specified in this document defines a schema for data that is designed to be accessed via network management transports such as NETCONF or RESTCONF . The lowest NETCONF layer is the secure transport layer, and the mandatory-to-implement secure transport is Secure Shell (SSH) . The lowest RESTCONF layer is HTTPS, and the mandatory-to-implement secure transport is TLS .The NETCONF Access Control Model (NACM) provides the means to restrict access for particular NETCONF or RESTCONF users to a preconfigured subset of all available NETCONF or RESTCONF operations and content.One subscription "id" can be used for two or more receivers of the same configured subscription. But due to the possibility of different access control permissions per receiver, it cannot be assumed that each receiver is getting identical updates.With configured subscriptions, one or more publishers could be used to overwhelm a receiver. Notification messages SHOULD NOT be sent to any receiver which does not support this specification. Receivers that do not want notification messages need only terminate or refuse any transport sessions from the publisher.When a receiver of a configured subscription gets a new "subscription-started" message for a known subscription where it is already consuming events, the receiver SHOULD retrieve any event records generated since the last event record was received. This can be accomplish by establishing a separate dynamic replay subscription with the same filtering criteria with the publisher, assuming the publisher supports the "replay" feature.For dynamic subscriptions, implementations need to protect against malicious or buggy subscribers which may send a large number "establish-subscription" requests, thereby using up system resources. To cover this possibility operators SHOULD monitor for such cases and, if discovered, take remedial action to limit the resources used, such as suspending or terminating a subset of the subscriptions or, if the underlying transport is session based, terminate the underlying transport session.There are a number of data nodes defined in this YANG module that are writable/creatable/deletable (i.e., config true, which is the default). These data nodes may be considered sensitive or vulnerable in some network environments. Write operations (e.g., edit-config) to these data nodes without proper protection can have a negative effect on network operations. These are the subtrees and data nodes where there is a specific sensitivity/vulnerability:Container: "/filters""stream-subtree-filter": updating a filter could increase the computational complexity of all referencing subscriptions."stream-xpath-filter": updating a filter could increase the computational complexity of all referencing subscriptions.Container: "/subscriptions"The following considerations are only relevant for configuration operations made upon configured subscriptions:"configured-replay": can be used to send a large number of event records to a receiver."dependency": can be used to force important traffic to be queued behind less important updates."dscp": if unvalidated, can result in the sending of traffic with a higher priority marking than warranted."id": can overwrite an existing subscription, perhaps one configured by another entity."name": adding a new key entry can be used to attempt to send traffic to an unwilling receiver."replay-start-time": can be used to push very large logs, wasting resources."source-address": the configured address might not be able to reach a desired receiver."source-interface": the configured interface might not be able to reach a desired receiver."source-vrf": can place a subscription into a virtual network where receivers are not entitled to view the subscribed content."stop-time": could be used to terminate content at an inopportune time."stream": could set a subscription to an event stream containing no content permitted for the targeted receivers."stream-filter-name": could be set to a filter which is irrelevant to the event stream."stream-subtree-filter": a complex filter can increase the computational resources for this subscription."stream-xpath-filter": a complex filter can increase the computational resources for this subscription."weighting": placing a large weight can overwhelm the dequeuing of other subscriptions. Some of the readable data nodes in this YANG module may be considered sensitive or vulnerable in some network environments. It is thus important to control read access (e.g., via get, get-config, or notification) to these data nodes. These are the subtrees and data nodes and their sensitivity/vulnerability:Container: "/streams""name": if access control is not properly configured, can expose system internals to those who should have no access to this information."replay-support": if access control is not properly configured, can expose logs to those who should have no access.Container: "/subscriptions""excluded-event-records": leaf can provide information about filtered event records. A network operator should have permissions to know about such filtering."subscription": different operational teams might have a desire to set varying subsets of subscriptions. Access control should be designed to permit read access to just the allowed set.Some of the RPC operations in this YANG module may be considered sensitive or vulnerable in some network environments. It is thus important to control access to these operations. These are the operations and their sensitivity/vulnerability:RPC: allIf a malicious or buggy subscriber sends an unexpectedly large number of RPCs, the result might be an excessive use of system resources on the publisher just to determine that these subscriptions should be declined. In such a situation, subscription interactions MAY be terminated by terminating the transport session.RPC: "delete-subscription"No special considerations.RPC: "establish-subscription"Subscriptions could overload a publisher's resources. For this reason, publishers MUST ensure that they have sufficient resources to fulfill this request or otherwise reject the request. RPC: "kill-subscription"The "kill-subscription" RPC MUST be secured so that only connections with administrative rights are able to invoke this RPC.RPC: "modify-subscription"Subscriptions could overload a publisher's resources. For this reason, publishers MUST ensure that they have sufficient resources to fulfill this request or otherwise reject the request. For their valuable comments, discussions, and feedback, we wish to acknowledge Andy Bierman, Tim Jenkins, Martin Bjorklund, Kent Watsen, Balazs Lengyel, Robert Wilton, Sharon Chisholm, Hector Trevino, Susan Hares, Michael Scharf, and Guangying Zheng.
XML Path Language (XPath) Version 1.0YANG Network InstancesYANG Datastore SubscriptionNETCONF support for event notificationsRestconf and HTTP transport for event notificationsThis appendix provides a non-normative example of how the YANG model defined in may be enhanced to incorporate the configuration parameters needed to support the transport connectivity process. In this example, connectivity via an imaginary transport type of "foo" is explored. For more on the overall need, see .The YANG model defined in this section contains two main elements. First is a transport identity "foo". This transport identity allows a configuration agent to define "foo" as the selected type of transport for a subscription. Second is a YANG case augmentation "foo" which is made to the "/subscriptions/subscription/receivers/receiver" node of . Within this augmentation are the transport configuration parameters "address" and "port" which are necessary to make the connect to the receiver.This example YANG model for transport "foo" will not be seen in a real world deployment. For a real world deployment supporting an actual transport technology, a similar YANG model must be defined.(To be removed by RFC editor prior to publication)v18 - v19
XPath-stream-filter YANG object definition updated based on NETMOD discussions.v17 - v18
Transport optional in YANG model.Modify subscription must come from the originator of the subscription. (Text got dropped somewhere previously.)Title change.v16 - v17
YANG renaming: Subscription identifier renamed to id. Counters renamed. Filters id made into name.Text tweaks.v15 - v16
Mandatory empty case "transport" removed.Appendix case turned from "netconf" to "foo".v14 - v15
Text tweaks.Mandatory empty case "transport" added for transport parameters. This includes a new section and an appendix explaining it.v13 - v14
Removed the 'address' leaf.Replay is now of type 'empty' for configured.v12 - v13
Tweaks from Kent's commentsReferenced in YANG model updated per Tom Petch's commentsAdded leaf replay-previous-event-timeRenamed the event counters, downshifted the subscription statesv11 - v12
Tweaks from Kent's, Tim's, and Martin's commentsClarified dscp text, and made its own featureYANG model tweaks alphabetizing, features.v10 - v11
access control filtering of events in streams included to match RFC5277 behaviorsecurity considerations updated based on YANG template.dependency QoS made non-normative on HTTP2 QoStree diagrams referenced for each figure using themreference numbers placed into state machine figuresbroke configured replay into its own sectionmany tweaks updates based on LC and YANG doctor reviewstrees and YANG model reconciled were deltas existednew feature for interface originated.dscp removed from the qos featureYANG model updated in a way which collapses groups only used once so that they are part of the 'subscriptions' container.alternative encodings only allowed for transports which support them.v09 - v10
Typos and tweaksv08 - v09
NMDA model supported. Non NMDA version at https://github.com/netconf-wg/rfc5277bis/Error mechanism revamped to match to embedded implementations.Explicitly identified error codes relevant to each RPC/Notificationv07 - v08
Split YANG trees to separate document subsections.Clarified configured state machine based on Balazs comments, and moved it into the configured subscription subsections.Normative reference to Network Instance model for VRFOne transport for all receivers of configured subscriptions.QoS section moved in from yang-pushv06 - v07
Clarification on state machine for configured subscriptions.v05 - v06
Made changes proposed by Martin, Kent, and others on the list. Most significant of these are stream returned to string (with the SYSLOG identity removed), intro section on 5277 relationship, an identity set moved to an enumeration, clean up of definitions/terminology, state machine proposed for configured subscriptions with a clean-up of subscription state options.JSON and XML become features. Also Xpath and subtree filtering become featuresTerminology updates with event records, and refinement of filters to just event stream filters.Encoding refined in establish-subscription so it takes the RPC's encoding as the default.Namespaces in examples fixed.v04 - v05
Returned to the explicit filter subtyping of v00stream object changed to 'name' from 'stream'Cleaned up examplesClarified that JSON support needs notification-messages draft.v03 - v04Moved back to the use of RFC5277 one-way notifications and encodings.v03 - v04Replay updatedv02 - v03RPCs and Notification support is identified by the Notification 2.0 capability.Updates to filtering identities and textNew error type for unsupportable volume of updatesText tweaks.v01 - v02Subscription status moved under receiver.v00 - v01Security considerations updatedIntro rewrite, as well as scattered text changesAdded Appendix A, to help match this to related drafts in progressUpdated filtering definitions, and filter types in yang file, and moved to identities for filter typesAdded Syslog as an event streamHTTP2 moved in from YANG-Push as a transport optionReplay made an optional feature for events. Won't apply to datastoresEnabled notification timestamp to have different formats.Two error codes added.v01 5277bis - v00 subscribed notificationsKill subscription RPC added.Renamed from 5277bis to Subscribed Notifications.Changed the notification capabilities version from 1.1 to 2.0.Extracted create-subscription and other elements of RFC5277.Error conditions added, and made specific in return codes.Simplified yang model structure for removal of 'basic' grouping.Added a grouping for items which cannot be statically configured.Operational counters per receiver.Subscription-id and filter-id renamed to identifierSection for replay added. Replay now cannot be configured.Control plane notification renamed to subscription state change notificationSource address: Source-vrf changed to string, default address option addedIn yang model: 'info' changed to 'policy'Scattered text clarificationsv00 - v01 of 5277bisYANG Model changes. New groupings for subscription info to allow restriction of what is changeable via RPC. Removed notifications for adding and removing receivers of configured subscriptions.Expanded/renamed definitions from event server to publisher, and client to subscriber as applicable. Updated the definitions to include and expand on RFC 5277.Removal of redundancy with other draftsMany other clean-ups of wording and terminology