idnits 2.17.1 draft-ietf-netconf-restconf-notif-08.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 4 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 210 has weird spacing: '...ription res...' == Line 225 has weird spacing: '... stream esta...' == Line 228 has weird spacing: '...ription ret...' == Line 230 has weird spacing: '... stream modi...' -- The document date (October 4, 2018) is 2030 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: 'RFC7230' is defined on line 566, 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: April 7, 2019 Cisco Systems 6 A. Clemm 7 Huawei 8 A. Bierman 9 YumaWorks 10 October 4, 2018 12 RESTCONF Transport for Event Notifications 13 draft-ietf-netconf-restconf-notif-08 15 Abstract 17 This document defines a RESTCONF binding to the dynamic subscription 18 capability of both subscribed notifications and YANG-Push. 19 Subscriptions to publisher defined event streams or nodes/subtrees of 20 YANG Datastores is supported. 22 Status of This Memo 24 This Internet-Draft is submitted in full conformance with the 25 provisions of BCP 78 and BCP 79. 27 Internet-Drafts are working documents of the Internet Engineering 28 Task Force (IETF). Note that other groups may also distribute 29 working documents as Internet-Drafts. The list of current Internet- 30 Drafts is at https://datatracker.ietf.org/drafts/current/. 32 Internet-Drafts are draft documents valid for a maximum of six months 33 and may be updated, replaced, or obsoleted by other documents at any 34 time. It is inappropriate to use Internet-Drafts as reference 35 material or to cite them other than as "work in progress." 37 This Internet-Draft will expire on April 7, 2019. 39 Copyright Notice 41 Copyright (c) 2018 IETF Trust and the persons identified as the 42 document authors. All rights reserved. 44 This document is subject to BCP 78 and the IETF Trust's Legal 45 Provisions Relating to IETF Documents 46 (https://trustee.ietf.org/license-info) in effect on the date of 47 publication of this document. Please review these documents 48 carefully, as they describe your rights and restrictions with respect 49 to this document. Code Components extracted from this document must 50 include Simplified BSD License text as described in Section 4.e of 51 the Trust Legal Provisions and are provided without warranty as 52 described in the Simplified BSD License. 54 Table of Contents 56 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 57 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 58 3. Dynamic Subscriptions . . . . . . . . . . . . . . . . . . . . 3 59 3.1. Transport Connectivity . . . . . . . . . . . . . . . . . 4 60 3.2. Discovery . . . . . . . . . . . . . . . . . . . . . . . . 4 61 3.3. RESTCONF RPCs and HTTP Status Codes . . . . . . . . . . . 4 62 3.4. Call Flow for Server-Sent Events (SSE) . . . . . . . . . 6 63 4. QoS Treatment . . . . . . . . . . . . . . . . . . . . . . . . 8 64 5. Mandatory JSON and datastore support . . . . . . . . . . . . 8 65 6. Notification Messages . . . . . . . . . . . . . . . . . . . . 8 66 7. YANG Tree . . . . . . . . . . . . . . . . . . . . . . . . . . 8 67 8. YANG module . . . . . . . . . . . . . . . . . . . . . . . . . 9 68 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11 69 10. Security Considerations . . . . . . . . . . . . . . . . . . . 11 70 11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 12 71 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 12 72 12.1. Normative References . . . . . . . . . . . . . . . . . . 12 73 12.2. Informative References . . . . . . . . . . . . . . . . . 13 74 Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 14 75 A.1. Dynamic Subscriptions . . . . . . . . . . . . . . . . . . 14 76 A.1.1. Establishing Dynamic Subscriptions . . . . . . . . . 14 77 A.1.2. Modifying Dynamic Subscriptions . . . . . . . . . . . 17 78 A.1.3. Deleting Dynamic Subscriptions . . . . . . . . . . . 18 79 A.2. Subscription State Notifications . . . . . . . . . . . . 19 80 A.2.1. subscription-modified . . . . . . . . . . . . . . . . 19 81 A.2.2. subscription-completed, subscription-resumed, and 82 replay-complete . . . . . . . . . . . . . . . . . . . 20 83 A.2.3. subscription-terminated and subscription-suspended . 20 84 A.3. Filter Example . . . . . . . . . . . . . . . . . . . . . 21 85 Appendix B. Changes between revisions . . . . . . . . . . . . . 22 86 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 24 88 1. Introduction 90 Mechanisms to support event subscription and push are defined in 91 [I-D.draft-ietf-netconf-subscribed-notifications]. Enhancements to 92 [I-D.draft-ietf-netconf-subscribed-notifications] which enable YANG 93 datastore subscription and push are defined in 94 [I-D.ietf-netconf-yang-push]. This document provides a transport 95 specification for dynamic subscriptions over RESTCONF [RFC8040]. 96 Driving these requirements is [RFC7923]. 98 The streaming of notifications encapsulating the resulting 99 information push is done via the mechanism described in section 6.3 100 of [RFC8040]. 102 2. Terminology 104 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 105 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 106 document are to be interpreted as described in RFC 2119 [RFC2119]. 108 The following terms use the definitions from 109 [I-D.draft-ietf-netconf-subscribed-notifications]: dynamic 110 subscription, event stream, notification message, publisher, 111 receiver, subscriber, and subscription. 113 Other terms reused include datastore, which is defined in [RFC8342], 114 and HTTP2 stream which maps to the definition of "stream" within 115 [RFC7540], Section 2. 117 [ note to the RFC Editor - please replace XXXX within this document 118 with the number of this document ] 120 3. Dynamic Subscriptions 122 This section provides specifics on how to establish and maintain 123 dynamic subscriptions over RESTCONF [RFC8040]. Subscribing to event 124 streams is accomplished in this way via a RESTCONF POST into RPCs 125 defined within [I-D.draft-ietf-netconf-subscribed-notifications] 126 Section 2.4. YANG datastore subscription is accomplished via 127 augmentations to [I-D.draft-ietf-netconf-subscribed-notifications] as 128 described within [I-D.ietf-netconf-yang-push] Section 4.4. 130 As described in [RFC8040] Section 6.3, a GET needs to be made against 131 a specific URI on the publisher. Subscribers cannot pre-determine 132 the URI against which a subscription might exist on a publisher, as 133 the URI will only exist after the "establish-subscription" RPC has 134 been accepted. The subscription URI will be determined and sent as 135 part of the response to the "establish-subscription" RPC, and a 136 subsequent GET to this URI will be done in order to start the flow of 137 notification messages back to the subscriber. A subscription does 138 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. The POST for the "establish-subscription" RPC replaces the 141 GET request for the "location" leaf which is used in [RFC8040] to 142 obtain the URI. 144 3.1. Transport Connectivity 146 For a dynamic subscription, where an HTTP client session doesn't 147 already exist, a new client session is initiated from the subscriber. 149 As stated in Section 2.1 of [RFC8040], a subscriber MUST establish 150 the HTTP session over TLS [RFC5246] in order to secure the content in 151 transit. 153 Without the involvement of additional protocols, HTTP sessions by 154 themselves do not allow for a quick recognition of when the 155 communication path has been lost with the publisher. Where quick 156 recognition of the loss of a publisher is required, a subscriber 157 SHOULD use a TLS heartbeat [RFC6520], just from receiver to 158 publisher, to track HTTP session continuity. Loss of the heartbeat 159 MUST result in any subscription related TCP sessions between those 160 endpoints being torn down. A subscriber can then attempt to re- 161 establish. 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 [RFC6520] 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 resynch-subscription resynch-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 o In case of error responses to an "establish-subscription" or 218 "modify-subscription" request there is the option of including an 219 "error-info" node. This node may contain hints for parameter 220 settings that might lead to successful RPC requests in the future. 221 Following are 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 "resynch-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" does not need to be included with the "rpc- 245 error" element, as subscription errors are generally not associated 246 with nodes in the datastore but with the choice of RPC input 247 parameters. 249 3.4. Call Flow for Server-Sent Events (SSE) 251 The call flow is defined in Figure 1. The logical connections 252 denoted by (a) and (b) can be a TCP connection or an HTTP2 stream. 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 8. 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 A publisher MUST terminate a subscription in the following cases: 317 o Receipt of a "delete-subscription" or a "kill-subscription" RPC 318 for that subscription. 320 o Loss of TLS heartbeat 322 A publisher MAY terminate a subscription at any time as stated in 323 [I-D.draft-ietf-netconf-subscribed-notifications] Section 1.3 325 4. QoS Treatment 327 To meet subscription quality of service promises, the publisher MUST 328 take any existing subscription "dscp" and apply it to the DSCP 329 marking in the IP header. 331 In addition, where HTTP2 transport is available to a notification 332 message queued for transport to a receiver, the publisher MUST: 334 o take any existing subscription "priority" and copy it into the 335 HTTP2 stream priority, and 337 o take any existing subscription "dependency" and map the HTTP2 338 stream for the parent subscription into the HTTP2 stream 339 dependency. 341 5. Mandatory JSON and datastore support 343 A publisher supporting [I-D.ietf-netconf-yang-push] MUST support the 344 "operational" datastore as defined by [RFC8342]. 346 The "encode-json" feature of 347 [I-D.draft-ietf-netconf-subscribed-notifications] is mandatory to 348 support. This indicates that JSON is a valid encoding for RPCs, 349 state change notifications, and subscribed content. 351 6. Notification Messages 353 Notification messages transported over HTTP will be encoded using 354 one-way operation schema defined within [RFC5277], section 4. 356 7. YANG Tree 358 The YANG model defined in Section 8 has one leaf augmented into four 359 places of [I-D.draft-ietf-netconf-subscribed-notifications], plus two 360 identities. As the resulting full tree is large, it will only be 361 inserted at later stages of this document. 363 8. YANG module 365 This module references 366 [I-D.draft-ietf-netconf-subscribed-notifications]. 368 file "ietf-restconf-subscribed-notifications@2018-10-03.yang" 369 module ietf-restconf-subscribed-notifications { 370 yang-version 1.1; 371 namespace 372 "urn:ietf:params:xml:ns:yang:ietf-restconf-subscribed-notifications"; 374 prefix rsn; 376 import ietf-subscribed-notifications { 377 prefix sn; 378 } 379 import ietf-inet-types { 380 prefix inet; 381 } 383 organization "IETF NETCONF (Network Configuration) Working Group"; 384 contact 385 "WG Web: 386 WG List: 388 Editor: Eric Voit 389 391 Editor: Alexander Clemm 392 394 Editor: Reshad Rahman 395 "; 397 description 398 "Defines RESTCONF as a supported transport for subscribed 399 event notifications. 401 Copyright (c) 2018 IETF Trust and the persons identified as authors 402 of the code. All rights reserved. 404 Redistribution and use in source and binary forms, with or without 405 modification, is permitted pursuant to, and subject to the license 406 terms contained in, the Simplified BSD License set forth in Section 407 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents 408 (https://trustee.ietf.org/license-info). 410 This version of this YANG module is part of RFC XXXX; see the RFC 411 itself for full legal notices."; 413 revision 2018-10-03 { 414 description 415 "Initial version"; 416 reference 417 "RFC XXXX: RESTCONF Transport for Event Notifications"; 418 } 420 identity restconf { 421 base sn:transport; 422 description 423 "RESTCONF is used as transport for notification messages and state 424 change notifications."; 425 } 427 grouping uri { 428 description 429 "Provides a reusable description of a URI."; 430 leaf uri { 431 type inet:uri; 432 config false; 433 description 434 "Location of a subscription specific URI on the publisher."; 435 } 436 } 438 augment "/sn:establish-subscription/sn:output" { 439 description 440 "This augmentation allows RESTCONF specific parameters for a 441 response to a publisher's subscription request."; 442 uses uri; 443 } 445 augment "/sn:subscriptions/sn:subscription" { 446 description 447 "This augmentation allows RESTCONF specific parameters to be 448 exposed for a subscription."; 449 uses uri; 450 } 452 augment "/sn:subscription-modified" { 453 description 454 "This augmentation allows RESTCONF specific parameters to be included 455 part of the notification that a subscription has been modified."; 456 uses uri; 457 } 459 } 460 462 9. IANA Considerations 464 This document registers the following namespace URI in the "IETF XML 465 Registry" [RFC3688]: 467 URI: urn:ietf:params:xml:ns:yang:ietf-restconf-subscribed- 468 notifications 469 Registrant Contact: The IESG. 470 XML: N/A; the requested URI is an XML namespace. 472 This document registers the following YANG module in the "YANG Module 473 Names" registry [RFC6020]: 475 Name: ietf-restconf-subscribed-notifications 476 Namespace: urn:ietf:params:xml:ns:yang:ietf-restconf-subscribed- 477 notifications 478 Prefix: rsn 479 Reference: RFC XXXX: RESTCONF Transport for Event Notifications 481 10. Security Considerations 483 The YANG module specified in this document defines a schema for data 484 that is designed to be accessed via network management transports 485 such as NETCONF [RFC6241] or RESTCONF [RFC8040]. The lowest NETCONF 486 layer is the secure transport layer, and the mandatory-to-implement 487 secure transport is Secure Shell (SSH) [RFC6242]. The lowest 488 RESTCONF layer is HTTPS, and the mandatory-to-implement secure 489 transport is TLS [RFC5246]. 491 The one new data node introduced in this YANG module may be 492 considered sensitive or vulnerable in some network environments. It 493 is thus important to control read access (e.g., via get, get-config, 494 or notification) to this data nodes. These are the subtrees and data 495 nodes and their sensitivity/vulnerability: 497 Container: "/subscriptions" 499 o "uri": leaf will show where subscribed resources might be located 500 on a publisher. Access control must be set so that only someone 501 with proper access permissions, and perhaps even HTTP session has 502 the ability to access this resource. 504 11. Acknowledgments 506 We wish to acknowledge the helpful contributions, comments, and 507 suggestions that were received from: Ambika Prasad Tripathy, Alberto 508 Gonzalez Prieto, Susan Hares, Tim Jenkins, Balazs Lengyel, Kent 509 Watsen, Michael Scharf, Guangying Zheng and Martin Bjorklund. 511 12. References 513 12.1. Normative References 515 [I-D.draft-ietf-netconf-subscribed-notifications] 516 Voit, E., Clemm, A., Gonzalez Prieto, A., Tripathy, A., 517 and E. Nilsen-Nygaard, "Custom Subscription to Event 518 Streams", draft-ietf-netconf-subscribed-notifications-13 519 (work in progress), April 2018. 521 [I-D.ietf-netconf-yang-push] 522 Clemm, A., Voit, E., Gonzalez Prieto, A., Prasad Tripathy, 523 A., Nilsen-Nygaard, E., Bierman, A., and B. Lengyel, 524 "Subscribing to YANG datastore push updates", March 2017, 525 . 528 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 529 Requirement Levels", BCP 14, RFC 2119, 530 DOI 10.17487/RFC2119, March 1997, 531 . 533 [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, 534 DOI 10.17487/RFC3688, January 2004, 535 . 537 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 538 (TLS) Protocol Version 1.2", RFC 5246, 539 DOI 10.17487/RFC5246, August 2008, 540 . 542 [RFC5277] Chisholm, S. and H. Trevino, "NETCONF Event 543 Notifications", RFC 5277, DOI 10.17487/RFC5277, July 2008, 544 . 546 [RFC6020] Bjorklund, M., Ed., "YANG - A Data Modeling Language for 547 the Network Configuration Protocol (NETCONF)", RFC 6020, 548 DOI 10.17487/RFC6020, October 2010, 549 . 551 [RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., 552 and A. Bierman, Ed., "Network Configuration Protocol 553 (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011, 554 . 556 [RFC6242] Wasserman, M., "Using the NETCONF Protocol over Secure 557 Shell (SSH)", RFC 6242, DOI 10.17487/RFC6242, June 2011, 558 . 560 [RFC6520] Seggelmann, R., Tuexen, M., and M. Williams, "Transport 561 Layer Security (TLS) and Datagram Transport Layer Security 562 (DTLS) Heartbeat Extension", RFC 6520, 563 DOI 10.17487/RFC6520, February 2012, 564 . 566 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 567 Protocol (HTTP/1.1): Message Syntax and Routing", 568 RFC 7230, DOI 10.17487/RFC7230, June 2014, 569 . 571 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 572 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 573 DOI 10.17487/RFC7540, May 2015, 574 . 576 [RFC8040] Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF 577 Protocol", RFC 8040, DOI 10.17487/RFC8040, January 2017, 578 . 580 [RFC8342] Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K., 581 and R. Wilton, "Network Management Datastore Architecture 582 (NMDA)", RFC 8342, DOI 10.17487/RFC8342, March 2018, 583 . 585 [W3C-20150203] 586 "Server-Sent Events, World Wide Web Consortium CR CR- 587 eventsource-20121211", February 2015, 588 . 590 12.2. Informative References 592 [I-D.draft-ietf-netconf-netconf-event-notifications] 593 Clemm, Alexander., Voit, Eric., Gonzalez Prieto, Alberto., 594 Nilsen-Nygaard, E., and A. Tripathy, "NETCONF support for 595 event notifications", May 2018, 596 . 599 [I-D.draft-ietf-netconf-nmda-restconf] 600 Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K., 601 and R. Wilton, "RESTCONF Extensions to Support the Network 602 Management Datastore Architecture", April 2018, 603 . 606 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 607 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 608 DOI 10.17487/RFC7231, June 2014, 609 . 611 [RFC7923] Voit, E., Clemm, A., and A. Gonzalez Prieto, "Requirements 612 for Subscription to YANG Datastores", RFC 7923, 613 DOI 10.17487/RFC7923, June 2016, 614 . 616 [RFC8347] Liu, X., Ed., Kyparlis, A., Parikh, R., Lindem, A., and M. 617 Zhang, "A YANG Data Model for the Virtual Router 618 Redundancy Protocol (VRRP)", RFC 8347, 619 DOI 10.17487/RFC8347, March 2018, 620 . 622 [XPATH] Clark, J. and S. DeRose, "XML Path Language (XPath) 623 Version 1.0", November 1999, 624 . 626 Appendix A. Examples 628 This section is non-normative. To allow easy comparison, this 629 section mirrors the functional examples shown with NETCONF over XML 630 within [I-D.draft-ietf-netconf-netconf-event-notifications]. In 631 addition, HTTP2 vs HTTP1.1 headers are not shown as the contents of 632 the JSON encoded objects are identical within. 634 A.1. Dynamic Subscriptions 636 A.1.1. Establishing Dynamic Subscriptions 638 The following figure shows two successful "establish-subscription" 639 RPC requests as per 640 [I-D.draft-ietf-netconf-subscribed-notifications]. The first request 641 is given a subscription identifier of 22, the second, an identifier 642 of 23. 644 +------------+ +-----------+ 645 | Subscriber | | Publisher | 646 +------------+ +-----------+ 647 | | 648 |establish-subscription | 649 |------------------------------>| (a) 650 | HTTP 200 OK, id#22, URI#1 | 651 |<------------------------------| (b) 652 |GET (URI#1) | 653 |------------------------------>| (c) 654 | HTTP 200 OK,notif-mesg (id#22)| 655 |<------------------------------| 656 | | 657 | | 658 |establish-subscription | 659 |------------------------------>| 660 | HTTP 200 OK, id#23, URI#2| 661 |<------------------------------| 662 |GET (URI#2) | 663 |------------------------------>| 664 | | 665 | | 666 | notif-mesg (id#22)| 667 |<------------------------------| 668 | HTTP 200 OK,notif-mesg (id#23)| 669 |<------------------------------| 670 | | 672 Figure 2: Multiple subscriptions over RESTCONF/HTTP 674 To provide examples of the information being transported, example 675 messages for interactions in Figure 2 are detailed below: 677 POST /restconf/operations/subscriptions:establish-subscription 679 { 680 "ietf-subscribed-notifications:input": { 681 "stream": "NETCONF", 682 "stream-xpath-filter": "/ds:foo/", 683 "dscp": "10" 684 } 685 } 687 Figure 3: establish-subscription request (a) 689 As publisher was able to fully satisfy the request, the publisher 690 sends the subscription identifier of the accepted subscription, and 691 the URI: 693 HTTP status code - 200 695 { 696 "id": "22", 697 "uri": "/subscriptions/22" 698 } 700 Figure 4: establish-subscription success (b) 702 Upon receipt of the successful response, the subscriber does a GET 703 the provided URI to start the flow of notification messages. When 704 the publisher receives this, the subscription is moved to the active 705 state (c). 707 GET /restconf/operations/subscriptions/22 709 Figure 5: establish-subscription subsequent POST 711 While not shown in Figure 2, if the publisher had not been able to 712 fully satisfy the request, or subscriber has no authorization to 713 establish the subscription, the publisher would have sent an RPC 714 error response. For instance, if the "dscp" value of 10 asserted by 715 the subscriber in Figure 3 proved unacceptable, the publisher may 716 have returned: 718 HTTP status code - 406 720 { "ietf-restconf:errors" : { 721 "error" : [ 722 { 723 "error-type": "application", 724 "error-tag": "operation-failed", 725 "error-severity": "error", 726 "error-app-tag": 727 "ietf-subscribed-notifications:dscp-unavailable" 728 } 729 ] 730 } 731 } 733 Figure 6: an unsuccessful establish subscription 735 The subscriber can use this information in future attempts to 736 establish a subscription. 738 A.1.2. Modifying Dynamic Subscriptions 740 An existing subscription may be modified. The following exchange 741 shows a negotiation of such a modification via several exchanges 742 between a subscriber and a publisher. This negotiation consists of a 743 failed RPC modification request/response, followed by a successful 744 one. 746 +------------+ +-----------+ 747 | Subscriber | | Publisher | 748 +------------+ +-----------+ 749 | | 750 | notification message (id#23)| 751 |<-----------------------------| 752 | | 753 |modify-subscription (id#23) | 754 |----------------------------->| (d) 755 | HTTP 406 error (with hint)| 756 |<-----------------------------| (e) 757 | | 758 |modify-subscription (id#23) | 759 |----------------------------->| 760 | HTTP 200 OK | 761 |<-----------------------------| 762 | | 763 | notif-mesg (id#23)| 764 |<-----------------------------| 765 | | 767 Figure 7: Interaction model for successful subscription modification 769 If the subscription being modified in Figure 7 is a datastore 770 subscription as per [I-D.ietf-netconf-yang-push], the modification 771 request made in (d) may look like that shown in Figure 8. As can be 772 seen, the modifications being attempted are the application of a new 773 xpath filter as well as the setting of a new periodic time interval. 775 POST /restconf/operations/subscriptions:modify-subscription 777 { 778 "ietf-subscribed-notifications:input": { 779 "id": "23", 780 "ietf-yang-push:datastore-xpath-filter": "/ds:foo/ds:bar", 781 "ietf-yang-push:periodic": { 782 "ietf-yang-push:period": "500" 783 } 784 } 785 } 787 Figure 8: Subscription modification request (c) 789 If the publisher can satisfy both changes, the publisher sends a 790 positive result for the RPC. If the publisher cannot satisfy either 791 of the proposed changes, the publisher sends an RPC error response 792 (e). The following is an example RPC error response for (e) which 793 includes a hint. This hint is an alternative time period value which 794 might have resulted in a successful modification: 796 HTTP status code - 406 798 { "ietf-restconf:errors" : { 799 "error" : [ 800 "error-type": "application", 801 "error-tag": "operation-failed", 802 "error-severity": "error", 803 "error-app-tag": "ietf-yang-push:period-unsupported", 804 "error-info": { 805 "ietf-yang-push": 806 "modify-subscription-datastore-error-info": { 807 "period-hint": "3000" 808 } 809 } 810 ] 811 } 812 } 814 Figure 9: Modify subscription failure with Hint (e) 816 A.1.3. Deleting Dynamic Subscriptions 818 The following demonstrates deleting a subscription. This 819 subscription may have been to either a stream or a datastore. 821 POST /restconf/operations/subscriptions:delete-subscription 823 { 824 "delete-subscription": { 825 "id": "22" 826 } 827 } 829 Figure 10: Delete subscription 831 If the publisher can satisfy the request, the publisher replies with 832 success to the RPC request. 834 If the publisher cannot satisfy the request, the publisher sends an 835 error-rpc element indicating the modification didn't work. Figure 11 836 shows a valid response for existing valid subscription identifier, 837 but that subscription identifier was created on a different transport 838 session: 840 HTTP status code - 406 842 { 843 "ietf-restconf:errors" : { 844 "error" : [ 845 "error-type": "application", 846 "error-tag": "operation-failed", 847 "error-severity": "error", 848 "error-app-tag": 849 "ietf-subscribed-notifications:no-such-subscription" 850 ] 851 } 852 } 854 Figure 11: Unsuccessful delete subscription 856 A.2. Subscription State Notifications 858 A publisher will send subscription state notifications according to 859 the definitions within 860 [I-D.draft-ietf-netconf-subscribed-notifications]). 862 A.2.1. subscription-modified 864 A "subscription-modified" encoded in JSON would look like: 866 { 867 "ietf-restconf:notification" : { 868 "eventTime": "2007-09-01T10:00:00Z", 869 "ietf-subscribed-notifications:subscription-modified": { 870 "id": "39", 871 "transport": "RESTCONF", 872 "stream-xpath-filter": "/ex:foo", 873 "stream": { 874 "ietf-netconf-subscribed-notifications" : "NETCONF" 875 } 876 } 877 } 878 } 880 Figure 12: subscription-modified subscription state notification 882 A.2.2. subscription-completed, subscription-resumed, and replay- 883 complete 885 A "subscription-completed" would look like: 887 { 888 "ietf-restconf:notification" : { 889 "eventTime": "2007-09-01T10:00:00Z", 890 "ietf-subscribed-notifications:subscription-completed": { 891 "id": "39", 892 } 893 } 894 } 896 Figure 13: subscription-completed notification in JSON 898 The "subscription-resumed" and "replay-complete" are virtually 899 identical, with "subscription-completed" simply being replaced by 900 "subscription-resumed" and "replay-complete". 902 A.2.3. subscription-terminated and subscription-suspended 904 A "subscription-terminated" would look like: 906 { 907 "ietf-restconf:notification" : { 908 "eventTime": "2007-09-01T10:00:00Z", 909 "ietf-subscribed-notifications:subscription-terminated": { 910 "id": "39", 911 "error-id": "suspension-timeout" 912 } 913 } 914 } 916 Figure 14: subscription-terminated subscription state notification 918 The "subscription-suspended" is virtually identical, with 919 "subscription-terminated" simply being replaced by "subscription- 920 suspended". 922 A.3. Filter Example 924 This section provides an example which illustrate the method of 925 filtering event record contents. The example is based on the YANG 926 notification "vrrp-protocol-error-event" as defined per the ietf- 927 vrrp.yang module within [RFC8347]. Event records based on this 928 specification which are generated by the publisher might appear as: 930 data: { 931 data: "ietf-restconf:notification" : { 932 data: "eventTime" : "2018-09-14T08:22:33.44Z", 933 data: "ietf-vrrp:vrrp-protocol-error-event" : { 934 data: "protocol-error-reason" : "checksum-error" 935 data: } 936 data: } 937 data: } 939 Figure 15: RFC 8347 (VRRP) - Example Notification 941 Suppose a subscriber wanted to establish a subscription which only 942 passes instances of event records where there is a "checksum-error" 943 as part of a VRRP protocol event. Also assume the publisher places 944 such event records into the NETCONF stream. To get a continuous 945 series of matching event records, the subscriber might request the 946 application of an XPath filter against the NETCONF stream. An 947 "establish-subscription" RPC to meet this objective might be: 949 POST /restconf/operations/subscriptions:establish-subscription 950 { 951 "ietf-subscribed-notifications:input": { 952 "stream": "NETCONF", 953 "stream-xpath-filter": "/ietf-vrrp:vrrp-protocol-error-event[protocol-error-reason='checksum-error']/", 954 } 955 } 957 Figure 16: Establishing a subscription error reason via XPATH 959 For more examples of xpath filters, see [XPATH]. 961 Suppose the "establish-subscription" in Figure 16 was accepted. And 962 suppose later a subscriber decided they wanted to broaden this 963 subscription cover to all VRRP protocol events (i.e., not just those 964 with a "checksum error"). The subscriber might attempt to modify the 965 subscription in a way which replaces the XPath filter with a subtree 966 filter which sends all VRRP protocol events to a subscriber. Such a 967 "modify-subscription" RPC might look like: 969 POST /restconf/operations/subscriptions:modify-subscription 970 { 971 "ietf-subscribed-notifications:input": { 972 "stream": "NETCONF", 973 "stream-subtree-filter": "/ietf-vrrp:vrrp-protocol-error-event/", 974 } 975 } 977 Figure 17 979 For more examples of subtree filters, see [RFC6241], section 6.4. 981 Appendix B. Changes between revisions 983 (To be removed by RFC editor prior to publication) 985 v07 - v08 987 o Aligned with RESTCONF mechanism. 989 o YANG model: removed augment of subscription-started, added 990 restconf transport. 992 o Tweaked Appendix A.1 to match draft-ietf-netconf-netconf-event- 993 notifications-13. 995 o Added Appendix A.3 for filter example. 997 v06 - v07 999 o Removed configured subscriptions. 1001 o Subscription identifier renamed to id. 1003 v05 - v06 1005 o JSON examples updated by Reshad. 1007 v04 - v05 1009 o Error mechanisms updated to match embedded RESTCONF mechanisms 1011 o Restructured format and sections of document. 1013 o Added a YANG data model for HTTP specific parameters. 1015 o Mirrored the examples from the NETCONF transport draft to allow 1016 easy comparison. 1018 v03 - v04 1020 o Draft not fully synched to new version of subscribed-notifications 1021 yet. 1023 o References updated 1025 v02 - v03 1027 o Event notification reframed to notification message. 1029 o Tweaks to wording/capitalization/format. 1031 v01 - v02 1033 o Removed sections now redundant with 1034 [I-D.draft-ietf-netconf-subscribed-notifications] and 1035 [I-D.ietf-netconf-yang-push] such as: mechanisms for subscription 1036 maintenance, terminology definitions, stream discovery. 1038 o 3rd party subscriptions are out-of-scope. 1040 o SSE only used with RESTCONF and HTTP1.1 dynamic subscriptions 1042 o Timeframes for event tagging are self-defined. 1044 o Clean-up of wording, references to terminology, section numbers. 1046 v00 - v01 1048 o Removed the ability for more than one subscription to go to a 1049 single HTTP2 stream. 1051 o Updated call flows. Extensively. 1053 o SSE only used with RESTCONF and HTTP1.1 dynamic subscriptions 1055 o HTTP is not used to determine that a receiver has gone silent and 1056 is not Receiving Event Notifications 1058 o Many clean-ups of wording and terminology 1060 Authors' Addresses 1062 Eric Voit 1063 Cisco Systems 1065 Email: evoit@cisco.com 1067 Reshad Rahman 1068 Cisco Systems 1070 Email: rrahman@cisco.com 1072 Einar Nilsen-Nygaard 1073 Cisco Systems 1075 Email: einarnn@cisco.com 1077 Alexander Clemm 1078 Huawei 1080 Email: ludwig@clemm.org 1082 Andy Bierman 1083 YumaWorks 1085 Email: andy@yumaworks.com