idnits 2.17.1 draft-ietf-netconf-restconf-notif-10.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There are 10 instances of too long lines in the document, the longest one being 37 characters in excess of 72. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 206 has weird spacing: '...ription estab...' == Line 225 has weird spacing: '... stream esta...' == Line 228 has weird spacing: '...ription ret...' == Line 230 has weird spacing: '... stream modi...' -- The document date (November 4, 2018) is 1971 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Unused Reference: 'RFC5277' is defined on line 535, but no explicit reference was found in the text == Unused Reference: 'RFC7230' is defined on line 559, but no explicit reference was found in the text == Outdated reference: A later version (-26) exists of draft-ietf-netconf-subscribed-notifications-13 ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 7230 (Obsoleted by RFC 9110, RFC 9112) ** Obsolete normative reference: RFC 7540 (Obsoleted by RFC 9113) -- Possible downref: Non-RFC (?) normative reference: ref. 'W3C-20150203' -- Obsolete informational reference (is this intentional?): RFC 7231 (Obsoleted by RFC 9110) Summary: 4 errors (**), 0 flaws (~~), 8 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 NETCONF E. Voit 3 Internet-Draft R. Rahman 4 Intended status: Standards Track E. Nilsen-Nygaard 5 Expires: May 8, 2019 Cisco Systems 6 A. Clemm 7 Huawei 8 A. Bierman 9 YumaWorks 10 November 4, 2018 12 Dynamic subscription to YANG Events and Datastores over RESTCONF 13 draft-ietf-netconf-restconf-notif-10 15 Abstract 17 This document provides a RESTCONF binding to the dynamic subscription 18 capability of both subscribed notifications and YANG-Push. 20 Status of This Memo 22 This Internet-Draft is submitted in full conformance with the 23 provisions of BCP 78 and BCP 79. 25 Internet-Drafts are working documents of the Internet Engineering 26 Task Force (IETF). Note that other groups may also distribute 27 working documents as Internet-Drafts. The list of current Internet- 28 Drafts is at https://datatracker.ietf.org/drafts/current/. 30 Internet-Drafts are draft documents valid for a maximum of six months 31 and may be updated, replaced, or obsoleted by other documents at any 32 time. It is inappropriate to use Internet-Drafts as reference 33 material or to cite them other than as "work in progress." 35 This Internet-Draft will expire on May 8, 2019. 37 Copyright Notice 39 Copyright (c) 2018 IETF Trust and the persons identified as the 40 document authors. All rights reserved. 42 This document is subject to BCP 78 and the IETF Trust's Legal 43 Provisions Relating to IETF Documents 44 (https://trustee.ietf.org/license-info) in effect on the date of 45 publication of this document. Please review these documents 46 carefully, as they describe your rights and restrictions with respect 47 to this document. Code Components extracted from this document must 48 include Simplified BSD License text as described in Section 4.e of 49 the Trust Legal Provisions and are provided without warranty as 50 described in the Simplified BSD License. 52 Table of Contents 54 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 55 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 56 3. Dynamic Subscriptions . . . . . . . . . . . . . . . . . . . . 3 57 3.1. Transport Connectivity . . . . . . . . . . . . . . . . . 4 58 3.2. Discovery . . . . . . . . . . . . . . . . . . . . . . . . 4 59 3.3. RESTCONF RPCs and HTTP Status Codes . . . . . . . . . . . 4 60 3.4. Call Flow for Server-Sent Events (SSE) . . . . . . . . . 6 61 4. QoS Treatment . . . . . . . . . . . . . . . . . . . . . . . . 8 62 5. Notification Messages . . . . . . . . . . . . . . . . . . . . 8 63 6. YANG Tree . . . . . . . . . . . . . . . . . . . . . . . . . . 8 64 7. YANG module . . . . . . . . . . . . . . . . . . . . . . . . . 9 65 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10 66 9. Security Considerations . . . . . . . . . . . . . . . . . . . 11 67 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 11 68 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 12 69 11.1. Normative References . . . . . . . . . . . . . . . . . . 12 70 11.2. Informative References . . . . . . . . . . . . . . . . . 13 71 Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 14 72 A.1. Dynamic Subscriptions . . . . . . . . . . . . . . . . . . 14 73 A.1.1. Establishing Dynamic Subscriptions . . . . . . . . . 14 74 A.1.2. Modifying Dynamic Subscriptions . . . . . . . . . . . 17 75 A.1.3. Deleting Dynamic Subscriptions . . . . . . . . . . . 18 76 A.2. Subscription State Notifications . . . . . . . . . . . . 19 77 A.2.1. subscription-modified . . . . . . . . . . . . . . . . 19 78 A.2.2. subscription-completed, subscription-resumed, and 79 replay-complete . . . . . . . . . . . . . . . . . . . 20 80 A.2.3. subscription-terminated and subscription-suspended . 20 81 A.3. Filter Example . . . . . . . . . . . . . . . . . . . . . 21 82 Appendix B. Changes between revisions . . . . . . . . . . . . . 22 83 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 24 85 1. Introduction 87 Mechanisms to support event subscription and push are defined in 88 [I-D.draft-ietf-netconf-subscribed-notifications]. Enhancements to 89 [I-D.draft-ietf-netconf-subscribed-notifications] which enable YANG 90 datastore subscription and push are defined in 91 [I-D.ietf-netconf-yang-push]. This document provides a transport 92 specification for dynamic subscriptions over RESTCONF [RFC8040]. 93 Driving these requirements is [RFC7923]. 95 The streaming of notifications encapsulating the resulting 96 information push is done via the mechanism described in section 6.3 97 of [RFC8040]. 99 2. Terminology 101 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 102 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 103 document are to be interpreted as described in RFC 2119 [RFC2119]. 105 The following terms use the definitions from 106 [I-D.draft-ietf-netconf-subscribed-notifications]: dynamic 107 subscription, event stream, notification message, publisher, 108 receiver, subscriber, and subscription. 110 Other terms reused include datastore, which is defined in [RFC8342], 111 and HTTP2 stream which maps to the definition of "stream" within 112 [RFC7540], Section 2. 114 [ note to the RFC Editor - please replace XXXX within this document 115 with the number of this document ] 117 3. Dynamic Subscriptions 119 This section provides specifics on how to establish and maintain 120 dynamic subscriptions over RESTCONF [RFC8040]. Subscribing to event 121 streams is accomplished in this way via RPCs defined within 122 [I-D.draft-ietf-netconf-subscribed-notifications] Section 2.4, the 123 RPCs are done via RESTCONF POSTs. YANG datastore subscription is 124 accomplished via augmentations to 125 [I-D.draft-ietf-netconf-subscribed-notifications] as described within 126 [I-D.ietf-netconf-yang-push] Section 4.4. 128 As described in [RFC8040] Section 6.3, a GET needs to be made against 129 a specific URI on the publisher. Subscribers cannot pre-determine 130 the URI against which a subscription might exist on a publisher, as 131 the URI will only exist after the "establish-subscription" RPC has 132 been accepted. Therefore, the POST for the "establish-subscription" 133 RPC replaces the GET request for the "location" leaf which is used in 134 [RFC8040] to obtain the URI. The subscription URI will be determined 135 and sent as part of the response to the "establish-subscription" RPC, 136 and a subsequent GET to this URI will be done in order to start the 137 flow of notification messages back to the subscriber. A subscription 138 does not move to the active state as per Section 2.4.1. of 139 [I-D.draft-ietf-netconf-subscribed-notifications] until the GET is 140 received. 142 3.1. Transport Connectivity 144 For a dynamic subscription, where a RESTCONF session doesn't already 145 exist, a new RESTCONF session is initiated from the subscriber. 147 As stated in Section 2.1 of [RFC8040], a subscriber MUST establish 148 the HTTP session over TLS [RFC5246] in order to secure the content in 149 transit. 151 Without the involvement of additional protocols, HTTP sessions by 152 themselves do not allow for a quick recognition of when the 153 communication path has been lost with the publisher. Where quick 154 recognition of the loss of a publisher is required, a subscriber 155 SHOULD use a TLS heartbeat [RFC6520], just from receiver to 156 publisher, to track HTTP session continuity. 158 Loss of the heartbeat MUST result in any subscription related TCP 159 sessions between those endpoints being torn down. A subscriber can 160 then attempt to re-establish the dynamic subscription by using the 161 procedure described in Section 3. 163 3.2. Discovery 165 Subscribers can learn what event streams a RESTCONF server supports 166 by querying the "streams" container of ietf-subscribed- 167 notification.yang in 168 [I-D.draft-ietf-netconf-subscribed-notifications]. Support for the 169 "streams" container of ietf-restconf-monitoring.yang in [RFC8040] is 170 not required. 172 Subscribers can learn what datastores a RESTCONF server supports by 173 following [I-D.draft-ietf-netconf-nmda-restconf]. 175 3.3. RESTCONF RPCs and HTTP Status Codes 177 Specific HTTP responses codes as defined in [RFC7231] section 6 will 178 indicate the result of RESTCONF RPC requests with publisher. An HTTP 179 status code of 200 is the proper response to any successful RPC 180 defined within [I-D.draft-ietf-netconf-subscribed-notifications] or 181 [I-D.ietf-netconf-yang-push]. 183 If a publisher fails to serve the RPC request for one of the reasons 184 indicated in [I-D.draft-ietf-netconf-subscribed-notifications] 185 Section 2.4.6 or [I-D.ietf-netconf-yang-push] Appendix A, this will 186 be indicated by "406" status code transported in the HTTP response. 188 When a "406" status code is returned, the RPC reply MUST include an 189 "rpc-error" element per [RFC8040] Section 7.1 with the following 190 parameter values: 192 o an "error-type" node of "application". 194 o an "error-tag" node of "operation-failed". 196 o an "error-app-tag" node with the value being a string that 197 corresponds to an identity associated with the error, as defined 198 in [I-D.draft-ietf-netconf-subscribed-notifications] section 2.4.6 199 for general subscriptions, and [I-D.ietf-netconf-yang-push] 200 Appendix A.1, for datastore subscriptions. The tag to use depends 201 on the RPC for which the error occurred. Viable errors for 202 different RPCs are as follows: 204 RPC select an identity with a base 205 ---------------------- ------------------------------ 206 establish-subscription establish-subscription-error 207 modify-subscription modify-subscription-error 208 delete-subscription delete-subscription-error 209 kill-subscription kill-subscription-error 210 resync-subscription resync-subscription-error 212 Each error identity will be inserted as the "error-app-tag" using 213 JSON encoding following the form :. An 214 example of such as valid encoding would be "ietf-subscribed- 215 notifications:no-such-subscription". 217 In case of error responses to an "establish-subscription" or "modify- 218 subscription" request there is the option of including an "error- 219 info" node. This node may contain hints for parameter settings that 220 might lead to successful RPC requests in the future. Following are 221 the yang-data structures which may be returned: 223 establish-subscription returns hints in yang-data structure 224 ---------------------- ------------------------------------ 225 target: event stream establish-subscription-stream-error-info 226 target: datastore establish-subscription-datastore-error-info 228 modify-subscription returns hints in yang-data structure 229 ---------------------- ------------------------------------ 230 target: event stream modify-subscription-stream-error-info 231 target: datastore modify-subscription-datastore-error-info 233 The yang-data included within "error-info" SHOULD NOT include the 234 optional leaf "error-reason", as such a leaf would be redundant 235 with information that is already placed within the 236 "error-app-tag". 238 In case of an rpc error as a result of a "delete-subscription", a 239 "kill-subscription", or a "resync-subscription" request, no 240 "error-info" needs to be included, as the "subscription-id" is 241 the only RPC input parameter and no hints regarding this RPC input 242 parameters need to be provided. 244 Note that "error-path" [RFC8040] does not need to be included with 245 the "rpc-error" element, as subscription errors are generally 246 associated with the choice of RPC input parameters. 248 3.4. Call Flow for Server-Sent Events (SSE) 250 The call flow is defined in Figure 1. The logical connections 251 denoted by (a) and (b) can be a TCP connection or an HTTP2 stream 252 (multiple HTTP2 streams can be carried in one TCP connection). 253 Requests to [I-D.draft-ietf-netconf-subscribed-notifications] or 254 [I-D.ietf-netconf-yang-push] augmented RPCs are sent on a connection 255 indicated by (a). A successful "establish-subscription" will result 256 in an RPC response returned with both a subscription identifier which 257 uniquely identifies a subscription, as well as a URI which uniquely 258 identifies the location of subscription on the publisher (b). This 259 URI is defined via the "uri" leaf the Data Model in Section 7. 261 An HTTP GET is then sent on a separate logical connection (b) to the 262 URI on the publisher. This initiates the publisher to initiate the 263 flow of notification messages which are sent in SSE [W3C-20150203] as 264 a response to the GET. 266 +--------------+ +--------------+ 267 | Subscriber | | Publisher | 268 | | | | 269 | Logical | | Logical | 270 | Connection | | Connection | 271 | (a) (b) | | (a) (b) | 272 +--------------+ +--------------+ 273 | RESTCONF POST (RPC:establish-subscription) | 274 |--------------------------------------------->| 275 | HTTP 200 OK (ID,URI)| 276 |<---------------------------------------------| 277 | |HTTP GET (URI) | 278 | |--------------------------------------------->| 279 | | HTTP 200 OK| 280 | |<---------------------------------------------| 281 | | SSE (notif-message)| 282 | |<---------------------------------------------| 283 | RESTCONF POST (RPC:modify-subscription) | | 284 |--------------------------------------------->| | 285 | | HTTP 200 OK| | 286 |<---------------------------------------------| | 287 | | SSE (subscription-modified)| 288 | |<------------------------------------------(c)| 289 | | SSE (notif-message)| 290 | |<---------------------------------------------| 291 | RESTCONF POST (RPC:delete-subscription) | | 292 |--------------------------------------------->| | 293 | | HTTP 200 OK| | 294 |<---------------------------------------------| | 295 | | | 296 | | 298 Figure 1: Dynamic with server-sent events 300 Additional requirements for dynamic subscriptions over SSE include: 302 o All subscription state notifications from a publisher MUST be 303 returned in a separate SSE message used by the subscription to 304 which the state change refers. 306 o Subscription RPCs MUST NOT use the connection currently providing 307 notification messages for that subscription. 309 o In addition to an RPC response for a "modify-subscription" RPC 310 traveling over (a), a "subscription-modified" state change 311 notification must be sent within (b). This allows the receiver to 312 know exactly when the new terms of the subscription have been 313 applied to the notification messages. See arrow (c). 315 o RPCs modify-subscription, resync-subscription and delete- 316 subscription can only be done by the same RESTCONF username 317 [RFC8040] who did the establish-subscription, or by a RESTCONF 318 username with the required administrative permissions. The latter 319 also has access to the kill-subscription RPC. 321 A publisher MUST terminate a subscription in the following cases: 323 o Receipt of a "delete-subscription" or a "kill-subscription" RPC 324 for that subscription. 326 o Loss of TLS heartbeat 328 A publisher MAY terminate a subscription at any time as stated in 329 [I-D.draft-ietf-netconf-subscribed-notifications] Section 1.3 331 4. QoS Treatment 333 To meet subscription quality of service promises, the publisher MUST 334 take any existing subscription "dscp" and apply it to the DSCP 335 marking in the IP header. 337 In addition, where HTTP2 transport is available to a notification 338 message queued for transport to a receiver, the publisher MUST: 340 o take any existing subscription "priority", as specified by the 341 "dscp" leaf node in 342 [I-D.draft-ietf-netconf-subscribed-notifications], and copy it 343 into the HTTP2 stream priority, [RFC7540] section 5.3, and 345 o take any existing subscription "dependency", as specified by the 346 "dependency" leaf node in 347 [I-D.draft-ietf-netconf-subscribed-notifications], and use the 348 HTTP2 stream for the parent subscription as the HTTP2 stream 349 dependency, [RFC7540] section 5.3.1, of the dependent 350 subscription. 352 5. Notification Messages 354 Notification messages transported over RESTCONF will be encoded 355 according to [RFC8040], section 6.4. 357 6. YANG Tree 359 The YANG model defined in Section 7 has one leaf augmented into four 360 places of [I-D.draft-ietf-netconf-subscribed-notifications], plus two 361 identities. As the resulting full tree is large, it will only be 362 inserted at later stages of this document. 364 7. YANG module 366 This module references 367 [I-D.draft-ietf-netconf-subscribed-notifications]. 369 file "ietf-restconf-subscribed-notifications@2018-10-19.yang" 370 module ietf-restconf-subscribed-notifications { 371 yang-version 1.1; 372 namespace 373 "urn:ietf:params:xml:ns:yang:ietf-restconf-subscribed-notifications"; 375 prefix rsn; 377 import ietf-subscribed-notifications { 378 prefix sn; 379 } 380 import ietf-inet-types { 381 prefix inet; 382 } 384 organization "IETF NETCONF (Network Configuration) Working Group"; 385 contact 386 "WG Web: 387 WG List: 389 Editor: Eric Voit 390 392 Editor: Alexander Clemm 393 395 Editor: Reshad Rahman 396 "; 398 description 399 "Defines RESTCONF as a supported transport for subscribed 400 event notifications. 402 Copyright (c) 2018 IETF Trust and the persons identified as authors 403 of the code. All rights reserved. 405 Redistribution and use in source and binary forms, with or without 406 modification, is permitted pursuant to, and subject to the license 407 terms contained in, the Simplified BSD License set forth in Section 408 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents 409 (https://trustee.ietf.org/license-info). 411 This version of this YANG module is part of RFC XXXX; see the RFC 412 itself for full legal notices."; 414 revision 2018-10-19 { 415 description 416 "Initial version"; 417 reference 418 "RFC XXXX: RESTCONF Transport for Event Notifications"; 419 } 421 grouping uri { 422 description 423 "Provides a reusable description of a URI."; 424 leaf uri { 425 type inet:uri; 426 config false; 427 description 428 "Location of a subscription specific URI on the publisher."; 429 } 430 } 432 augment "/sn:establish-subscription/sn:output" { 433 description 434 "This augmentation allows RESTCONF specific parameters for a 435 response to a publisher's subscription request."; 436 uses uri; 437 } 439 augment "/sn:subscriptions/sn:subscription" { 440 description 441 "This augmentation allows RESTCONF specific parameters to be 442 exposed for a subscription."; 443 uses uri; 444 } 446 augment "/sn:subscription-modified" { 447 description 448 "This augmentation allows RESTCONF specific parameters to be included 449 part of the notification that a subscription has been modified."; 450 uses uri; 451 } 452 } 453 455 8. IANA Considerations 457 This document registers the following namespace URI in the "IETF XML 458 Registry" [RFC3688]: 460 URI: urn:ietf:params:xml:ns:yang:ietf-restconf-subscribed- 461 notifications 462 Registrant Contact: The IESG. 463 XML: N/A; the requested URI is an XML namespace. 465 This document registers the following YANG module in the "YANG Module 466 Names" registry [RFC6020]: 468 Name: ietf-restconf-subscribed-notifications 469 Namespace: urn:ietf:params:xml:ns:yang:ietf-restconf-subscribed- 470 notifications 471 Prefix: rsn 472 Reference: RFC XXXX: RESTCONF Transport for Event Notifications 474 9. Security Considerations 476 The YANG module specified in this document defines a schema for data 477 that is designed to be accessed via network management transports 478 such as NETCONF [RFC6241] or RESTCONF [RFC8040]. The lowest NETCONF 479 layer is the secure transport layer, and the mandatory-to-implement 480 secure transport is Secure Shell (SSH) [RFC6242]. The lowest 481 RESTCONF layer is HTTPS, and the mandatory-to-implement secure 482 transport is TLS [RFC5246]. 484 The one new data node introduced in this YANG module may be 485 considered sensitive or vulnerable in some network environments. It 486 is thus important to control read access (e.g., via get, get-config, 487 or notification) to this data nodes. These are the subtrees and data 488 nodes and their sensitivity/vulnerability: 490 Container: "/subscriptions" 492 o "uri": leaf will show where subscribed resources might be located 493 on a publisher. Access control must be set so that only someone 494 with proper access permissions, and perhaps even HTTP session has 495 the ability to access this resource. 497 10. Acknowledgments 499 We wish to acknowledge the helpful contributions, comments, and 500 suggestions that were received from: Ambika Prasad Tripathy, Alberto 501 Gonzalez Prieto, Susan Hares, Tim Jenkins, Balazs Lengyel, Kent 502 Watsen, Michael Scharf, Guangying Zheng, Martin Bjorklund and Qin Wu. 504 11. References 506 11.1. Normative References 508 [I-D.draft-ietf-netconf-subscribed-notifications] 509 Voit, E., Clemm, A., Gonzalez Prieto, A., Tripathy, A., 510 and E. Nilsen-Nygaard, "Custom Subscription to Event 511 Streams", draft-ietf-netconf-subscribed-notifications-13 512 (work in progress), April 2018. 514 [I-D.ietf-netconf-yang-push] 515 Clemm, A., Voit, E., Gonzalez Prieto, A., Prasad Tripathy, 516 A., Nilsen-Nygaard, E., Bierman, A., and B. Lengyel, 517 "Subscribing to YANG datastore push updates", March 2017, 518 . 521 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 522 Requirement Levels", BCP 14, RFC 2119, 523 DOI 10.17487/RFC2119, March 1997, 524 . 526 [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, 527 DOI 10.17487/RFC3688, January 2004, 528 . 530 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 531 (TLS) Protocol Version 1.2", RFC 5246, 532 DOI 10.17487/RFC5246, August 2008, 533 . 535 [RFC5277] Chisholm, S. and H. Trevino, "NETCONF Event 536 Notifications", RFC 5277, DOI 10.17487/RFC5277, July 2008, 537 . 539 [RFC6020] Bjorklund, M., Ed., "YANG - A Data Modeling Language for 540 the Network Configuration Protocol (NETCONF)", RFC 6020, 541 DOI 10.17487/RFC6020, October 2010, 542 . 544 [RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., 545 and A. Bierman, Ed., "Network Configuration Protocol 546 (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011, 547 . 549 [RFC6242] Wasserman, M., "Using the NETCONF Protocol over Secure 550 Shell (SSH)", RFC 6242, DOI 10.17487/RFC6242, June 2011, 551 . 553 [RFC6520] Seggelmann, R., Tuexen, M., and M. Williams, "Transport 554 Layer Security (TLS) and Datagram Transport Layer Security 555 (DTLS) Heartbeat Extension", RFC 6520, 556 DOI 10.17487/RFC6520, February 2012, 557 . 559 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 560 Protocol (HTTP/1.1): Message Syntax and Routing", 561 RFC 7230, DOI 10.17487/RFC7230, June 2014, 562 . 564 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 565 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 566 DOI 10.17487/RFC7540, May 2015, 567 . 569 [RFC8040] Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF 570 Protocol", RFC 8040, DOI 10.17487/RFC8040, January 2017, 571 . 573 [RFC8342] Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K., 574 and R. Wilton, "Network Management Datastore Architecture 575 (NMDA)", RFC 8342, DOI 10.17487/RFC8342, March 2018, 576 . 578 [W3C-20150203] 579 "Server-Sent Events, World Wide Web Consortium CR CR- 580 eventsource-20121211", February 2015, 581 . 583 11.2. Informative References 585 [I-D.draft-ietf-netconf-netconf-event-notifications] 586 Clemm, Alexander., Voit, Eric., Gonzalez Prieto, Alberto., 587 Nilsen-Nygaard, E., and A. Tripathy, "NETCONF support for 588 event notifications", May 2018, 589 . 592 [I-D.draft-ietf-netconf-nmda-restconf] 593 Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K., 594 and R. Wilton, "RESTCONF Extensions to Support the Network 595 Management Datastore Architecture", April 2018, 596 . 599 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 600 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 601 DOI 10.17487/RFC7231, June 2014, 602 . 604 [RFC7923] Voit, E., Clemm, A., and A. Gonzalez Prieto, "Requirements 605 for Subscription to YANG Datastores", RFC 7923, 606 DOI 10.17487/RFC7923, June 2016, 607 . 609 [RFC8347] Liu, X., Ed., Kyparlis, A., Parikh, R., Lindem, A., and M. 610 Zhang, "A YANG Data Model for the Virtual Router 611 Redundancy Protocol (VRRP)", RFC 8347, 612 DOI 10.17487/RFC8347, March 2018, 613 . 615 [XPATH] Clark, J. and S. DeRose, "XML Path Language (XPath) 616 Version 1.0", November 1999, 617 . 619 Appendix A. Examples 621 This section is non-normative. To allow easy comparison, this 622 section mirrors the functional examples shown with NETCONF over XML 623 within [I-D.draft-ietf-netconf-netconf-event-notifications]. In 624 addition, HTTP2 vs HTTP1.1 headers are not shown as the contents of 625 the JSON encoded objects are identical within. 627 A.1. Dynamic Subscriptions 629 A.1.1. Establishing Dynamic Subscriptions 631 The following figure shows two successful "establish-subscription" 632 RPC requests as per 633 [I-D.draft-ietf-netconf-subscribed-notifications]. The first request 634 is given a subscription identifier of 22, the second, an identifier 635 of 23. 637 +------------+ +-----------+ 638 | Subscriber | | Publisher | 639 +------------+ +-----------+ 640 | | 641 |establish-subscription | 642 |------------------------------>| (a) 643 | HTTP 200 OK, id#22, URI#1 | 644 |<------------------------------| (b) 645 |GET (URI#1) | 646 |------------------------------>| (c) 647 | HTTP 200 OK,notif-mesg (id#22)| 648 |<------------------------------| 649 | | 650 | | 651 |establish-subscription | 652 |------------------------------>| 653 | HTTP 200 OK, id#23, URI#2| 654 |<------------------------------| 655 |GET (URI#2) | 656 |------------------------------>| 657 | | 658 | | 659 | notif-mesg (id#22)| 660 |<------------------------------| 661 | HTTP 200 OK,notif-mesg (id#23)| 662 |<------------------------------| 663 | | 665 Figure 2: Multiple subscriptions over RESTCONF/HTTP 667 To provide examples of the information being transported, example 668 messages for interactions in Figure 2 are detailed below: 670 POST /restconf/operations/ietf-subscribed-notifications:establish-subscription 672 { 673 "ietf-subscribed-notifications:input": { 674 "stream": "NETCONF", 675 "stream-xpath-filter": "/example-module:foo/", 676 "dscp": "10" 677 } 678 } 680 Figure 3: establish-subscription request (a) 682 As publisher was able to fully satisfy the request, the publisher 683 sends the subscription identifier of the accepted subscription, and 684 the URI: 686 HTTP status code - 200 688 { 689 "id": "22", 690 "uri": "https://example.com/restconf/subscriptions/22" 691 } 693 Figure 4: establish-subscription success (b) 695 Upon receipt of the successful response, the subscriber does a GET 696 the provided URI to start the flow of notification messages. When 697 the publisher receives this, the subscription is moved to the active 698 state (c). 700 GET /restconf/subscriptions/22 702 Figure 5: establish-subscription subsequent POST 704 While not shown in Figure 2, if the publisher had not been able to 705 fully satisfy the request, or subscriber has no authorization to 706 establish the subscription, the publisher would have sent an RPC 707 error response. For instance, if the "dscp" value of 10 asserted by 708 the subscriber in Figure 3 proved unacceptable, the publisher may 709 have returned: 711 HTTP status code - 406 713 { "ietf-restconf:errors" : { 714 "error" : [ 715 { 716 "error-type": "application", 717 "error-tag": "operation-failed", 718 "error-severity": "error", 719 "error-app-tag": 720 "ietf-subscribed-notifications:dscp-unavailable" 721 } 722 ] 723 } 724 } 726 Figure 6: an unsuccessful establish subscription 728 The subscriber can use this information in future attempts to 729 establish a subscription. 731 A.1.2. Modifying Dynamic Subscriptions 733 An existing subscription may be modified. The following exchange 734 shows a negotiation of such a modification via several exchanges 735 between a subscriber and a publisher. This negotiation consists of a 736 failed RPC modification request/response, followed by a successful 737 one. 739 +------------+ +-----------+ 740 | Subscriber | | Publisher | 741 +------------+ +-----------+ 742 | | 743 | notification message (id#23)| 744 |<-----------------------------| 745 | | 746 |modify-subscription (id#23) | 747 |----------------------------->| (d) 748 | HTTP 406 error (with hint)| 749 |<-----------------------------| (e) 750 | | 751 |modify-subscription (id#23) | 752 |----------------------------->| 753 | HTTP 200 OK | 754 |<-----------------------------| 755 | | 756 | notif-mesg (id#23)| 757 |<-----------------------------| 758 | | 760 Figure 7: Interaction model for successful subscription modification 762 If the subscription being modified in Figure 7 is a datastore 763 subscription as per [I-D.ietf-netconf-yang-push], the modification 764 request made in (d) may look like that shown in Figure 8. As can be 765 seen, the modifications being attempted are the application of a new 766 xpath filter as well as the setting of a new periodic time interval. 768 POST /restconf/operations/ietf-subscribed-notifications:modify-subscription 770 { 771 "ietf-subscribed-notifications:input": { 772 "id": "23", 773 "ietf-yang-push:datastore-xpath-filter": "/example-module:foo/example-module:bar", 774 "ietf-yang-push:periodic": { 775 "ietf-yang-push:period": "500" 776 } 777 } 778 } 780 Figure 8: Subscription modification request (c) 782 If the publisher can satisfy both changes, the publisher sends a 783 positive result for the RPC. If the publisher cannot satisfy either 784 of the proposed changes, the publisher sends an RPC error response 785 (e). The following is an example RPC error response for (e) which 786 includes a hint. This hint is an alternative time period value which 787 might have resulted in a successful modification: 789 HTTP status code - 406 791 { "ietf-restconf:errors" : { 792 "error" : [ 793 "error-type": "application", 794 "error-tag": "operation-failed", 795 "error-severity": "error", 796 "error-app-tag": "ietf-yang-push:period-unsupported", 797 "error-info": { 798 "ietf-yang-push": 799 "modify-subscription-datastore-error-info": { 800 "period-hint": "3000" 801 } 802 } 803 ] 804 } 805 } 807 Figure 9: Modify subscription failure with Hint (e) 809 A.1.3. Deleting Dynamic Subscriptions 811 The following demonstrates deleting a subscription. This 812 subscription may have been to either a stream or a datastore. 814 POST /restconf/operations/ietf-subscribed-notifications:delete-subscription 816 { 817 "delete-subscription": { 818 "id": "22" 819 } 820 } 822 Figure 10: Delete subscription 824 If the publisher can satisfy the request, the publisher replies with 825 success to the RPC request. 827 If the publisher cannot satisfy the request, the publisher sends an 828 error-rpc element indicating the modification didn't work. Figure 11 829 shows a valid response for existing valid subscription identifier, 830 but that subscription identifier was created on a different transport 831 session: 833 HTTP status code - 406 835 { 836 "ietf-restconf:errors" : { 837 "error" : [ 838 "error-type": "application", 839 "error-tag": "operation-failed", 840 "error-severity": "error", 841 "error-app-tag": 842 "ietf-subscribed-notifications:no-such-subscription" 843 ] 844 } 845 } 847 Figure 11: Unsuccessful delete subscription 849 A.2. Subscription State Notifications 851 A publisher will send subscription state notifications according to 852 the definitions within 853 [I-D.draft-ietf-netconf-subscribed-notifications]). 855 A.2.1. subscription-modified 857 A "subscription-modified" encoded in JSON would look like: 859 { 860 "ietf-restconf:notification" : { 861 "eventTime": "2007-09-01T10:00:00Z", 862 "ietf-subscribed-notifications:subscription-modified": { 863 "id": "39", 864 "uri": "https://example.com/restconf/subscriptions/22" 865 "stream-xpath-filter": "/example-module:foo", 866 "stream": { 867 "ietf-netconf-subscribed-notifications" : "NETCONF" 868 } 869 } 870 } 871 } 873 Figure 12: subscription-modified subscription state notification 875 A.2.2. subscription-completed, subscription-resumed, and replay- 876 complete 878 A "subscription-completed" would look like: 880 { 881 "ietf-restconf:notification" : { 882 "eventTime": "2007-09-01T10:00:00Z", 883 "ietf-subscribed-notifications:subscription-completed": { 884 "id": "39", 885 } 886 } 887 } 889 Figure 13: subscription-completed notification in JSON 891 The "subscription-resumed" and "replay-complete" are virtually 892 identical, with "subscription-completed" simply being replaced by 893 "subscription-resumed" and "replay-complete". 895 A.2.3. subscription-terminated and subscription-suspended 897 A "subscription-terminated" would look like: 899 { 900 "ietf-restconf:notification" : { 901 "eventTime": "2007-09-01T10:00:00Z", 902 "ietf-subscribed-notifications:subscription-terminated": { 903 "id": "39", 904 "error-id": "suspension-timeout" 905 } 906 } 907 } 909 Figure 14: subscription-terminated subscription state notification 911 The "subscription-suspended" is virtually identical, with 912 "subscription-terminated" simply being replaced by "subscription- 913 suspended". 915 A.3. Filter Example 917 This section provides an example which illustrate the method of 918 filtering event record contents. The example is based on the YANG 919 notification "vrrp-protocol-error-event" as defined per the ietf- 920 vrrp.yang module within [RFC8347]. Event records based on this 921 specification which are generated by the publisher might appear as: 923 data: { 924 data: "ietf-restconf:notification" : { 925 data: "eventTime" : "2018-09-14T08:22:33.44Z", 926 data: "ietf-vrrp:vrrp-protocol-error-event" : { 927 data: "protocol-error-reason" : "checksum-error" 928 data: } 929 data: } 930 data: } 932 Figure 15: RFC 8347 (VRRP) - Example Notification 934 Suppose a subscriber wanted to establish a subscription which only 935 passes instances of event records where there is a "checksum-error" 936 as part of a VRRP protocol event. Also assume the publisher places 937 such event records into the NETCONF stream. To get a continuous 938 series of matching event records, the subscriber might request the 939 application of an XPath filter against the NETCONF stream. An 940 "establish-subscription" RPC to meet this objective might be: 942 POST /restconf/operations/ietf-subscribed-notifications:establish-subscription 943 { 944 "ietf-subscribed-notifications:input": { 945 "stream": "NETCONF", 946 "stream-xpath-filter": "/ietf-vrrp:vrrp-protocol-error-event[protocol-error-reason='checksum-error']/", 947 } 948 } 950 Figure 16: Establishing a subscription error reason via XPath 952 For more examples of XPath filters, see [XPATH]. 954 Suppose the "establish-subscription" in Figure 16 was accepted. And 955 suppose later a subscriber decided they wanted to broaden this 956 subscription cover to all VRRP protocol events (i.e., not just those 957 with a "checksum error"). The subscriber might attempt to modify the 958 subscription in a way which replaces the XPath filter with a subtree 959 filter which sends all VRRP protocol events to a subscriber. Such a 960 "modify-subscription" RPC might look like: 962 POST /restconf/operations/ietf-subscribed-notifications:modify-subscription 963 { 964 "ietf-subscribed-notifications:input": { 965 "stream": "NETCONF", 966 "stream-subtree-filter": { 967 "/ietf-vrrp:vrrp-protocol-error-event" : {} 968 } 969 } 970 } 972 Figure 17 974 For more examples of subtree filters, see [RFC6241], section 6.4. 976 Appendix B. Changes between revisions 978 (To be removed by RFC editor prior to publication) 980 v09 - v10 982 o Fixed typo for resync. 984 o Added text wrt RPC permissions and RESTCONF username. 986 v08 - v09 988 o Addressed comments received during WGLC. 990 v07 - v08 992 o Aligned with RESTCONF mechanism. 994 o YANG model: removed augment of subscription-started, added 995 restconf transport. 997 o Tweaked Appendix A.1 to match draft-ietf-netconf-netconf-event- 998 notifications-13. 1000 o Added Appendix A.3 for filter example. 1002 v06 - v07 1004 o Removed configured subscriptions. 1006 o Subscription identifier renamed to id. 1008 v05 - v06 1010 o JSON examples updated by Reshad. 1012 v04 - v05 1014 o Error mechanisms updated to match embedded RESTCONF mechanisms 1016 o Restructured format and sections of document. 1018 o Added a YANG data model for HTTP specific parameters. 1020 o Mirrored the examples from the NETCONF transport draft to allow 1021 easy comparison. 1023 v03 - v04 1025 o Draft not fully synched to new version of subscribed-notifications 1026 yet. 1028 o References updated 1030 v02 - v03 1032 o Event notification reframed to notification message. 1034 o Tweaks to wording/capitalization/format. 1036 v01 - v02 1037 o Removed sections now redundant with 1038 [I-D.draft-ietf-netconf-subscribed-notifications] and 1039 [I-D.ietf-netconf-yang-push] such as: mechanisms for subscription 1040 maintenance, terminology definitions, stream discovery. 1042 o 3rd party subscriptions are out-of-scope. 1044 o SSE only used with RESTCONF and HTTP1.1 dynamic subscriptions 1046 o Timeframes for event tagging are self-defined. 1048 o Clean-up of wording, references to terminology, section numbers. 1050 v00 - v01 1052 o Removed the ability for more than one subscription to go to a 1053 single HTTP2 stream. 1055 o Updated call flows. Extensively. 1057 o SSE only used with RESTCONF and HTTP1.1 dynamic subscriptions 1059 o HTTP is not used to determine that a receiver has gone silent and 1060 is not Receiving Event Notifications 1062 o Many clean-ups of wording and terminology 1064 Authors' Addresses 1066 Eric Voit 1067 Cisco Systems 1069 Email: evoit@cisco.com 1071 Reshad Rahman 1072 Cisco Systems 1074 Email: rrahman@cisco.com 1076 Einar Nilsen-Nygaard 1077 Cisco Systems 1079 Email: einarnn@cisco.com 1080 Alexander Clemm 1081 Huawei 1083 Email: ludwig@clemm.org 1085 Andy Bierman 1086 YumaWorks 1088 Email: andy@yumaworks.com