RFC 8650: Dynamic Subscription to YANG Events and Datastores over RESTCONF
- E. Voit,
- R. Rahman,
- E. Nilsen-Nygaard,
- A. Clemm,
- A. Bierman
Abstract
This document provides a RESTCONF binding to the dynamic subscription capability of both subscribed notifications and YANG-Push.¶
Status of This Memo
This is an Internet Standards Track document.¶
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841.¶
Information about the current status of this document, any
errata, and how to provide feedback on it may be obtained at
https://
Copyright Notice
Copyright (c) 2019 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(https://
1. Introduction
Mechanisms to support event subscription and YANG-Push are defined in [RFC8639]. Enhancements to [RFC8639] that enable YANG datastore subscription and YANG-Push are defined in [RFC8641]. This document provides a transport specification for dynamic subscriptions over RESTCONF [RFC8040]. Requirements for these mechanisms are captured in [RFC7923].¶
The streaming of notifications that encapsulate the resulting information push is done via the mechanism described in Section 6.3 of [RFC8040].¶
2. Terminology
The 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 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
The following terms use the definitions from [RFC8639]: dynamic subscription, event stream, notification message, publisher, receiver, subscriber, and subscription.¶
Other terms reused include datastore, which is defined in [RFC8342], and HTTP/2 stream, which maps to the definition of "stream" within [RFC7540], Section 2.¶
3. Dynamic Subscriptions
This section provides specifics on how to establish and maintain dynamic subscriptions over RESTCONF [RFC8040]. Subscribing to event streams is accomplished in this way via RPCs defined within [RFC8639], Section 2.4. The RPCs are done via RESTCONF POSTs. YANG datastore subscription is accomplished via augmentations to [RFC8639] as described within [RFC8641], Section 4.4.¶
As described in Section 6.3 of [RFC8040], a GET needs to be performed on a
specific URI on the publisher. Subscribers cannot predetermine the URI
against which a subscription might exist on a publisher, as the URI will
only exist after the "establish
3.1. Transport Connectivity
For a dynamic subscription, when a RESTCONF session doesn't already exist, a new RESTCONF session is initiated from the subscriber.¶
As stated in Section 2.1 of [RFC8040], a subscriber MUST establish the HTTP session over TLS [RFC8446] in order to secure the content in transit.¶
Without the involvement of additional protocols, HTTP sessions by themselves do not support quick recognition of the loss of the communication path to the publisher. Where quick recognition of the loss of a publisher is required, a subscriber SHOULD use a TLS heartbeat [RFC6520], just from subscriber to publisher, to track HTTP session continuity.¶
Loss of the heartbeat MUST result in the teardown
of any subscription
3.2. Discovery
Subscribers can learn which event streams a RESTCONF server supports by querying the "streams" container of ietf
Subscribers can learn which datastores a RESTCONF server supports by following Section 2 of [RFC8527].¶
3.3. RESTCONF RPCs and HTTP Status Codes
Specific HTTP response codes as defined in Section 6 of [RFC7231] will indicate the result of RESTCONF RPC requests with the publisher. An HTTP status code of 200 is the proper response to any successful RPC defined within [RFC8639] or [RFC8641].¶
If a publisher fails to serve the RPC request for one of the reasons indicated in Section 2.4.6 of [RFC8639] or Appendix A of [RFC8641], this will be indicated by an appropriate error code, as shown below, transported in the HTTP response.¶
When an HTTP error code is returned, the RPC reply MUST include an <rpc-error> element per Section 7.1 of [RFC8040] with the following parameter values:¶
Each error identity will be inserted as the "error-app-tag" using JSON encoding following the form <modulename>
In the case of error responses to an "establish
The yang-data included within "error-info" SHOULD NOT include the
optional leaf "reason", as such a leaf would be redundant
with information that is already placed within the
"error
In case of an <rpc-error> as a result of a "delete
Note that "error-path" [RFC8040] does not need to be included with the <rpc-error> element, as subscription errors are generally associated with the choice of RPC input parameters.¶
3.4. Call Flow for Server-Sent Events
The call flow for Server-Sent Events (SSE) is defined in Figure 1. The logical connections denoted
by (a) and (b) can be a TCP connection or an HTTP/2 stream (if HTTP/2
is used, multiple HTTP/2 streams can be carried in one TCP
connection). Requests to RPCs as defined in [RFC8639] or [RFC8641] are
sent on a connection indicated by (a). A successful
"establish
An HTTP GET is then sent on a separate logical connection (b) to the URI on the publisher. This signals the publisher to initiate the flow of notification messages that are sent in SSE [W3C-20150203] as a response to the GET. There cannot be two or more simultaneous GET requests on a subscription URI: any GET request received while there is a current GET request on the same URI MUST be rejected with HTTP error code 409.¶
As described in Section 6.4 of [RFC8040], RESTCONF servers SHOULD NOT send the "event" or "id" fields in the SSE event notifications.¶
Additional requirements for dynamic subscriptions over SSE include:¶
A publisher MUST terminate a subscription in the following cases:¶
A publisher MAY terminate a subscription at any time as stated in Section 1.3 of [RFC8639].¶
4. QoS Treatment
Qos treatment for event streams is described in Section 2.3 of [RFC8639]. In addition, if HTTP/2 is used, the publisher MUST:¶
For dynamic subscriptions with the same Differentiated Services Code Point (DSCP) value to a specific publisher, it is recommended that the subscriber sends all URI GET requests on a common HTTP/2 session (if HTTP/2 is used). Conversely, a subscriber cannot use a common HTTP/2 session for subscriptions with different DSCP values.¶
5. Notification Messages
Notification messages transported over RESTCONF will be encoded according to [RFC8040], Section 6.4.¶
6. YANG Tree
The YANG module defined in Section 7 has one leaf that augments three nodes of [RFC8639].¶
8. IANA Considerations
This document registers the following namespace URI in the "ns" subregistry of the "IETF XML Registry" [RFC3688]:¶
- URI:
- urn
:ietf :params :xml :ns :yang :ietf -restconf -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 [RFC6020]:¶
9. Security Considerations
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 [RFC6241] or RESTCONF [RFC8040]. The lowest NETCONF layer is the secure transport layer, and the mandatory
The Network Configuration Access Control Model (NACM) [RFC8341] provides the means to restrict access for particular NETCONF or RESTCONF users to a preconfigured subset of all available NETCONF or RESTCONF protocol operations and content.¶
The one new data node introduced 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 this data node. These are the subtrees and data nodes and their sensitivity
Container: "
The subscription URI is implementation specific and is encrypted via the use of TLS. Therefore, even if an attacker succeeds in guessing the subscription URI, a RESTCONF username [RFC8040] with the required administrative permissions must be used to be able to access or modify that subscription. It is recommended that the subscription URI values not be easily predictable.¶
The access permission considerations for the RPCs "modify
If a buggy or compromised RESTCONF subscriber sends a number of "establish
10. References
10.1. Normative References
- [RFC2119]
-
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10
.17487 , , <https:///RFC2119 www >..rfc -editor .org /info /rfc2119 - [RFC3688]
-
Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, DOI 10
.17487 , , <https:///RFC3688 www >..rfc -editor .org /info /rfc3688 - [RFC6020]
-
Bjorklund, M., Ed., "YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)", RFC 6020, DOI 10
.17487 , , <https:///RFC6020 www >..rfc -editor .org /info /rfc6020 - [RFC6241]
-
Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., and A. Bierman, Ed., "Network Configuration Protocol (NETCONF)", RFC 6241, DOI 10
.17487 , , <https:///RFC6241 www >..rfc -editor .org /info /rfc6241 - [RFC6242]
-
Wasserman, M., "Using the NETCONF Protocol over Secure Shell (SSH)", RFC 6242, DOI 10
.17487 , , <https:///RFC6242 www >..rfc -editor .org /info /rfc6242 - [RFC6520]
-
Seggelmann, R., Tuexen, M., and M. Williams, "Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS) Heartbeat Extension", RFC 6520, DOI 10
.17487 , , <https:///RFC6520 www >..rfc -editor .org /info /rfc6520 - [RFC7540]
-
Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext Transfer Protocol Version 2 (HTTP/2)", RFC 7540, DOI 10
.17487 , , <https:///RFC7540 www >..rfc -editor .org /info /rfc7540 - [RFC8040]
-
Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF Protocol", RFC 8040, DOI 10
.17487 , , <https:///RFC8040 www >..rfc -editor .org /info /rfc8040 - [RFC8174]
-
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10
.17487 , , <https:///RFC8174 www >..rfc -editor .org /info /rfc8174 - [RFC8341]
-
Bierman, A. and M. Bjorklund, "Network Configuration Access Control Model", STD 91, RFC 8341, DOI 10
.17487 , , <https:///RFC8341 www >..rfc -editor .org /info /rfc8341 - [RFC8342]
-
Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K., and R. Wilton, "Network Management Datastore Architecture (NMDA)", RFC 8342, DOI 10
.17487 , , <https:///RFC8342 www >..rfc -editor .org /info /rfc8342 - [RFC8446]
-
Rescorla, E., "The Transport Layer Security (TLS) Protocol Version 1.3", RFC 8446, DOI 10
.17487 , , <https:///RFC8446 www >..rfc -editor .org /info /rfc8446 - [RFC8639]
-
Voit, E., Clemm, A., Gonzalez Prieto, A., Nilsen-Nygaard, E., and A. Tripathy, "Subscription to YANG Notifications", RFC 8639, DOI 10
.17487 , , <https:///RFC8639 www >..rfc -editor .org /info /rfc8639 - [RFC8641]
-
Clemm, A. and E. Voit, "Subscription to YANG Notifications for Datastore Updates", RFC 8641, DOI 10
.17487 , , <https:///RFC8641 www >..rfc -editor .org /info /rfc8641 - [W3C-20150203]
-
Hickson, I., "Server-Sent Events", W3C Recommendation, , <https://
www >. Latest version available at <https://.w3 .org /TR /2015 /REC -eventsource -20150203 / www >..w3 .org /TR /eventsource /
10.2. Informative References
- [RFC7231]
-
Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content", RFC 7231, DOI 10
.17487 , , <https:///RFC7231 www >..rfc -editor .org /info /rfc7231 - [RFC7923]
-
Voit, E., Clemm, A., and A. Gonzalez Prieto, "Requirements for Subscription to YANG Datastores", RFC 7923, DOI 10
.17487 , , <https:///RFC7923 www >..rfc -editor .org /info /rfc7923 - [RFC7951]
-
Lhotka, L., "JSON Encoding of Data Modeled with YANG", RFC 7951, DOI 10
.17487 , , <https:///RFC7951 www >..rfc -editor .org /info /rfc7951 - [RFC8347]
-
Liu, X., Ed., Kyparlis, A., Parikh, R., Lindem, A., and M. Zhang, "A YANG Data Model for the Virtual Router Redundancy Protocol (VRRP)", RFC 8347, DOI 10
.17487 , , <https:///RFC8347 www >..rfc -editor .org /info /rfc8347 - [RFC8527]
-
Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K., and R. Wilton, "RESTCONF Extensions to Support the Network Management Datastore Architecture", RFC 8527, DOI 10
.17487 , , <https:///RFC8527 www >..rfc -editor .org /info /rfc8527 - [RFC8640]
-
Voit, E., Clemm, A., Gonzalez Prieto, A., Nilsen-Nygaard, E., and A. Tripathy, "Dynamic Subscription to YANG Events and Datastores over NETCONF", RFC 8640, DOI 10
.17487 , , <https:///RFC8640 www >..rfc -editor .org /info /rfc8640 - [XPATH]
-
Clark, J. and S. DeRose, "XML Path Language (XPath) Version 1.0", W3C Recommendation, , <http://
www >. Latest version available at <https://.w3 .org /TR /1999 /REC -xpath -19991116 www >..w3 .org /TR /xpath /
Appendix A. Examples
This section is non-normative. To allow easy comparison, this section mirrors the functional examples shown with NETCONF over XML within [RFC8640]. In addition, HTTP/2 vs HTTP/1.1 headers are not shown as the contents of the JSON encoded objects are identical within.¶
The subscription URI values used in the examples in this section are purely illustrative, and are not indicative of the expected usage that is described in Section 9.¶
The DSCP values are only for example purposes and are all indicated in decimal since the encoding is JSON [RFC7951].¶
A.1. Dynamic Subscriptions
A.1.1. Establishing Dynamic Subscriptions
The following figure shows two successful
"establish
To provide examples of the information being transported, example messages for interactions in Figure 2 are detailed below:¶
As the publisher was able to fully satisfy the request, the publisher sends the subscription identifier of the accepted subscription and the URI:¶
Upon receipt of the successful response, the subscriber does a GET to the provided URI to start the flow of notification messages. When the publisher receives this, the subscription is moved to the active state (c).¶
While not shown in Figure 2, if the publisher had not been able to fully satisfy the request, or the subscriber has no authorization to establish the subscription, the publisher would have sent an RPC error response. For instance, if the "dscp" value of 10 asserted by the subscriber in Figure 3 proved unacceptable, the publisher may have returned:¶
The subscriber can use this information in future attempts to establish a subscription.¶
A.1.2. Modifying Dynamic Subscriptions
An existing subscription may be modified. The following exchange shows a negotiation of such a modification via several exchanges between a subscriber and a publisher. This negotiation consists of a failed RPC modification request
If the subscription being modified in Figure 7 is a datastore subscription as per [RFC8641], the modification request made in (d) may look like that shown in Figure 8. As can be seen, the modifications being attempted are the application of a new XML Path Language (XPath) filter as well as the setting of a new periodic time interval.¶
If the publisher can satisfy both changes, the publisher sends a positive result for the RPC. If the publisher cannot satisfy either of the proposed changes, the publisher sends an RPC error response (e). The following is an example RPC error response for (e) that includes a hint. This hint is an alternative time period value that might have resulted in a successful modification:¶
A.1.3. Deleting Dynamic Subscriptions
The following demonstrates deleting a subscription. This subscription may have been to either a stream or a datastore.¶
If the publisher can satisfy the request, the publisher replies with success to the RPC request.¶
If the publisher cannot satisfy the request, the publisher sends an <rpc-error> element indicating the modification didn't work. Figure 11 shows a valid response for an existing valid subscription identifier, but that subscription identifier was created on a different transport session:¶
A.2. Subscription State Notifications
A publisher will send subscription state notifications according to the definitions within [RFC8639].¶
A.2.1. "subscription-modified"
A "subscription
A.2.2. "subscription-completed", "subscription-resumed", and "replay-completed"
A "subscription
The "subscription
A.2.3. "subscription-terminated" and "subscription-suspended"
A "subscription
The "subscription
A.3. Filter Example
This section provides an example that illustrates the method of filtering event record contents. The example is based on the YANG notification "vrrp
Suppose a subscriber wanted to establish a subscription that only passes instances of event records where there is a "checksum
For more examples of XPath filters, see [XPATH].¶
Suppose the "establish
For more examples of subtree filters, see [RFC6241], Section 6.4.¶
Acknowledgments
We wish to acknowledge the helpful contributions, comments, and suggestions that were received from Ambika Prasad Tripathy, Alberto Gonzalez Prieto, Susan Hares, Tim Jenkins, Balazs Lengyel, Kent Watsen, Michael Scharf, Guangying Zheng, Martin Bjorklund, Qin Wu, and Robert Wilton.¶