idnits 2.17.1 draft-ietf-netconf-restconf-notif-14.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 : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 211 has weird spacing: '...pported inva...' == Line 214 has weird spacing: '...ription inva...' == Line 224 has weird spacing: '...ribable inval...' == Line 227 has weird spacing: '...pported opera...' == Line 243 has weird spacing: '...ription estab...' == (3 more instances...) -- The document date (June 10, 2019) is 1781 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) == Outdated reference: A later version (-26) exists of draft-ietf-netconf-subscribed-notifications-21 == Outdated reference: A later version (-25) exists of draft-ietf-netconf-yang-push-20 ** 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: 1 error (**), 0 flaws (~~), 9 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: December 12, 2019 Cisco Systems 6 A. Clemm 7 Huawei 8 A. Bierman 9 YumaWorks 10 June 10, 2019 12 Dynamic subscription to YANG Events and Datastores over RESTCONF 13 draft-ietf-netconf-restconf-notif-14 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 December 12, 2019. 37 Copyright Notice 39 Copyright (c) 2019 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 . . . . . . . . . . . . 7 61 4. QoS Treatment . . . . . . . . . . . . . . . . . . . . . . . . 9 62 5. Notification Messages . . . . . . . . . . . . . . . . . . . . 10 63 6. YANG Tree . . . . . . . . . . . . . . . . . . . . . . . . . . 10 64 7. YANG module . . . . . . . . . . . . . . . . . . . . . . . . . 10 65 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 12 66 9. Security Considerations . . . . . . . . . . . . . . . . . . . 12 67 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 13 68 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 13 69 11.1. Normative References . . . . . . . . . . . . . . . . . . 13 70 11.2. Informative References . . . . . . . . . . . . . . . . . 15 71 Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 16 72 A.1. Dynamic Subscriptions . . . . . . . . . . . . . . . . . . 16 73 A.1.1. Establishing Dynamic Subscriptions . . . . . . . . . 16 74 A.1.2. Modifying Dynamic Subscriptions . . . . . . . . . . . 19 75 A.1.3. Deleting Dynamic Subscriptions . . . . . . . . . . . 21 76 A.2. Subscription State Notifications . . . . . . . . . . . . 21 77 A.2.1. subscription-modified . . . . . . . . . . . . . . . . 22 78 A.2.2. subscription-completed, subscription-resumed, and 79 replay-complete . . . . . . . . . . . . . . . . . . . 22 80 A.2.3. subscription-terminated and subscription-suspended . 22 81 A.3. Filter Example . . . . . . . . . . . . . . . . . . . . . 23 82 Appendix B. Changes between revisions . . . . . . . . . . . . . 24 83 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 27 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 Requirements for these mechanisms are captured in [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", "NOT RECOMMENDED", "MAY", and 103 "OPTIONAL" in this document are to be interpreted as described in BCP 104 14 [RFC2119] [RFC8174] when, and only when, they appear in all 105 capitals, as shown here. 107 The following terms use the definitions from 108 [I-D.draft-ietf-netconf-subscribed-notifications]: dynamic 109 subscription, event stream, notification message, publisher, 110 receiver, subscriber, and subscription. 112 Other terms reused include datastore, which is defined in [RFC8342], 113 and HTTP2 stream which maps to the definition of "stream" within 114 [RFC7540], Section 2. 116 [ note to the RFC Editor - please replace XXXX within this document 117 with the number of this document ] 119 3. Dynamic Subscriptions 121 This section provides specifics on how to establish and maintain 122 dynamic subscriptions over RESTCONF [RFC8040]. Subscribing to event 123 streams is accomplished in this way via RPCs defined within 124 [I-D.draft-ietf-netconf-subscribed-notifications] Section 2.4. The 125 RPCs are done via RESTCONF POSTs. YANG datastore subscription is 126 accomplished via augmentations to 127 [I-D.draft-ietf-netconf-subscribed-notifications] as described within 128 [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. Therefore, the POST for the "establish-subscription" 135 RPC replaces the GET request for the "location" leaf which is used in 136 [RFC8040] to obtain the URI. The subscription URI will be determined 137 and sent as part of the response to the "establish-subscription" RPC, 138 and a subsequent GET to this URI will be done in order to start the 139 flow of notification messages back to the subscriber. A subscription 140 does not move to the active state as per Section 2.4.1. of 141 [I-D.draft-ietf-netconf-subscribed-notifications] until the GET is 142 received. 144 3.1. Transport Connectivity 146 For a dynamic subscription, where a RESTCONF session doesn't already 147 exist, a new RESTCONF 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 [RFC8446] 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 subscriber to 158 publisher, to track HTTP session continuity. 160 Loss of the heartbeat MUST result in any subscription related TCP 161 sessions between those endpoints being torn down. A subscriber can 162 then attempt to re-establish the dynamic subscription by using the 163 procedure described in Section 3.4. 165 3.2. Discovery 167 Subscribers can learn what event streams a RESTCONF server supports 168 by querying the "streams" container of ietf-subscribed- 169 notification.yang in 170 [I-D.draft-ietf-netconf-subscribed-notifications]. Support for the 171 "streams" container of ietf-restconf-monitoring.yang in [RFC8040] is 172 not required. In the case when the RESTCONF binding specified by 173 this document is used to convey the "streams" container from ietf- 174 restconf-monitoring.yang (i.e., that feature is supported), any event 175 streams contained therein are also expected to be present in the 176 "streams" container of ietf-restconf-monitoring.yang. 178 Subscribers can learn what datastores a RESTCONF server supports by 179 following Section 2 of [I-D.draft-ietf-netconf-nmda-restconf]. 181 3.3. RESTCONF RPCs and HTTP Status Codes 183 Specific HTTP responses codes as defined in [RFC7231] section 6 will 184 indicate the result of RESTCONF RPC requests with the publisher. An 185 HTTP status code of 200 is the proper response to any successful RPC 186 defined within [I-D.draft-ietf-netconf-subscribed-notifications] or 187 [I-D.ietf-netconf-yang-push]. 189 If a publisher fails to serve the RPC request for one of the reasons 190 indicated in [I-D.draft-ietf-netconf-subscribed-notifications] 191 Section 2.4.6 or [I-D.ietf-netconf-yang-push] Appendix A, this will 192 be indicated by an appropriate error code, as shown below, 193 transported in the HTTP response. 195 When an HTTP error code is returned, the RPC reply MUST include an 196 "rpc-error" element per [RFC8040] Section 7.1 with the following 197 parameter values: 199 o an "error-type" node of "application". 201 o an "error-tag" node with the value being a string that corresponds 202 to an identity associated with the error. This "error-tag" will 203 come from one of two places. Either it will correspond to the 204 error identities within 205 [I-D.draft-ietf-netconf-subscribed-notifications] section 2.4.6 206 for general subscription errors: 208 error identity uses error-tag HTTP Code 209 ---------------------- -------------- --------- 210 dscp-unavailable invalid-value 400 211 encoding-unsupported invalid-value 400 212 filter-unsupported invalid-value 400 213 insufficient-resources resource-denied 409 214 no-such-subscription invalid-value 404 215 replay-unsupported operation-not-supported 501 217 Or this "error-tag" will correspond to the error identities within 218 [I-D.ietf-netconf-yang-push] Appendix A.1 for subscription errors 219 specific to YANG datastores: 221 error identity uses error-tag HTTP Code 222 ---------------------- -------------- --------- 223 cant-exclude operation-not-supported 501 224 datastore-not-subscribable invalid-value 400 225 no-such-subscription-resync invalid-value 404 226 on-change-unsupported operation-not-supported 501 227 on-change-sync-unsupported operation-not-supported 501 228 period-unsupported invalid-value 400 229 update-too-big too-big 400 230 sync-too-big too-big 400 231 unchanging-selection operation-failed 500 233 o an "error-app-tag" node with the value being a string that 234 corresponds to an identity associated with the error, as defined 235 in [I-D.draft-ietf-netconf-subscribed-notifications] section 2.4.6 236 for general subscriptions, and [I-D.ietf-netconf-yang-push] 237 Appendix A.1, for datastore subscriptions. The tag to use depends 238 on the RPC for which the error occurred. Viable errors for 239 different RPCs are as follows: 241 RPC select an identity with a base 242 ---------------------- ------------------------------ 243 establish-subscription establish-subscription-error 244 modify-subscription modify-subscription-error 245 delete-subscription delete-subscription-error 246 kill-subscription delete-subscription-error 247 resync-subscription resync-subscription-error 249 Each error identity will be inserted as the "error-app-tag" using 250 JSON encoding following the form :. An 251 example of such a valid encoding would be "ietf-subscribed- 252 notifications:no-such-subscription". 254 In case of error responses to an "establish-subscription" or "modify- 255 subscription" request there is the option of including an "error- 256 info" node. This node may contain hints for parameter settings that 257 might lead to successful RPC requests in the future. Following are 258 the yang-data structures which may be returned: 260 establish-subscription returns hints in yang-data structure 261 ---------------------- ------------------------------------ 262 target: event stream establish-subscription-stream-error-info 263 target: datastore establish-subscription-datastore-error-info 265 modify-subscription returns hints in yang-data structure 266 ---------------------- ------------------------------------ 267 target: event stream modify-subscription-stream-error-info 268 target: datastore modify-subscription-datastore-error-info 270 The yang-data included within "error-info" SHOULD NOT include the 271 optional leaf "reason", as such a leaf would be redundant 272 with information that is already placed within the 273 "error-app-tag". 275 In case of an rpc error as a result of a "delete-subscription", a 276 "kill-subscription", or a "resync-subscription" request, no 277 "error-info" needs to be included, as the "subscription-id" is 278 the only RPC input parameter and no hints regarding this RPC input 279 parameters need to be provided. 281 Note that "error-path" [RFC8040] does not need to be included with 282 the "rpc-error" element, as subscription errors are generally 283 associated with the choice of RPC input parameters. 285 3.4. Call Flow for Server-Sent Events 287 The call flow for Server-Sent Events (SSE) is defined in Figure 1. 288 The logical connections denoted by (a) and (b) can be a TCP 289 connection or an HTTP2 stream (multiple HTTP2 streams can be carried 290 in one TCP connection). Requests to 291 [I-D.draft-ietf-netconf-subscribed-notifications] or 292 [I-D.ietf-netconf-yang-push] augmented RPCs are sent on a connection 293 indicated by (a). A successful "establish-subscription" will result 294 in an RPC response returned with both a subscription identifier which 295 uniquely identifies a subscription, as well as a URI which uniquely 296 identifies the location of subscription on the publisher (b). This 297 URI is defined via the "uri" leaf the Data Model in Section 7. 299 An HTTP GET is then sent on a separate logical connection (b) to the 300 URI on the publisher. This signals the publisher to initiate the 301 flow of notification messages which are sent in SSE [W3C-20150203] as 302 a response to the GET. There can not be 2 or more simultaneous GET 303 requests on a subscription URI: any GET request received while there 304 is a current GET request on the same URI MUST be rejected with HTTP 305 error code 409. 307 As described in [RFC8040] Section 6.4, RESTCONF servers SHOULD NOT 308 send the "event" or "id" fields in the SSE event notifications. 310 +--------------+ +--------------+ 311 | Subscriber | | Publisher | 312 | | | | 313 | Logical | | Logical | 314 | Connection | | Connection | 315 | (a) (b) | | (a) (b) | 316 +--------------+ +--------------+ 317 | RESTCONF POST (RPC:establish-subscription) | 318 |--------------------------------------------->| 319 | HTTP 200 OK (ID,URI)| 320 |<---------------------------------------------| 321 | |HTTP GET (URI) | 322 | |--------------------------------------------->| 323 | | HTTP 200 OK| 324 | |<---------------------------------------------| 325 | | SSE (notif-message)| 326 | |<---------------------------------------------| 327 | RESTCONF POST (RPC:modify-subscription) | | 328 |--------------------------------------------->| | 329 | | HTTP 200 OK| | 330 |<---------------------------------------------| | 331 | | SSE (subscription-modified)| 332 | |<------------------------------------------(c)| 333 | | SSE (notif-message)| 334 | |<---------------------------------------------| 335 | RESTCONF POST (RPC:delete-subscription) | | 336 |--------------------------------------------->| | 337 | | HTTP 200 OK| | 338 |<---------------------------------------------| | 339 | | | | 340 | | | | 341 (a) (b) (a) (b) 343 Figure 1: Dynamic with server-sent events 345 Additional requirements for dynamic subscriptions over SSE include: 347 o All subscription state notifications from a publisher MUST be 348 returned in a separate SSE message used by the subscription to 349 which the state change refers. 351 o Subscription RPCs MUST NOT use the connection currently providing 352 notification messages for that subscription. 354 o In addition to an RPC response for a "modify-subscription" RPC 355 traveling over (a), a "subscription-modified" state change 356 notification MUST be sent within (b). This allows the receiver to 357 know exactly when, within the stream of events, the new terms of 358 the subscription have been applied to the notification messages. 359 See arrow (c). 361 o In addition to any required access permissions (e.g., NACM), RPCs 362 modify-subscription, resync-subscription and delete-subscription 363 SHOULD only be allowed by the same RESTCONF username [RFC8040] 364 which invoked establish-subscription. Such a restriction 365 generally serves to preserve users' privacy, but exceptions might 366 be made for administrators that may need to modify or delete other 367 users' subscriptions. 369 o The kill-subscription RPC can be invoked by any RESTCONF username 370 with the required administrative permissions. 372 A publisher MUST terminate a subscription in the following cases: 374 o Receipt of a "delete-subscription" or a "kill-subscription" RPC 375 for that subscription. 377 o Loss of TLS heartbeat 379 A publisher MAY terminate a subscription at any time as stated in 380 [I-D.draft-ietf-netconf-subscribed-notifications] Section 1.3 382 4. QoS Treatment 384 Qos treatment for event streams is described in 385 [I-D.draft-ietf-netconf-subscribed-notifications] Section 2.3. In 386 addition, where HTTP2 transport is available to a notification 387 message queued for transport to a receiver, the publisher MUST: 389 o take the "weighting" leaf node in 390 [I-D.draft-ietf-netconf-subscribed-notifications], and copy it 391 into the HTTP2 stream weight, [RFC7540] section 5.3, and 393 o take any existing subscription "dependency", as specified by the 394 "dependency" leaf node in 395 [I-D.draft-ietf-netconf-subscribed-notifications], and use the 396 HTTP2 stream for the parent subscription as the HTTP2 stream 397 dependency, [RFC7540] section 5.3.1, of the dependent 398 subscription. 400 o set the exclusive flag, [RFC7540] section 5.3.1, to 0. 402 For dynamic subscriptions with the same DSCP value to a specific 403 publisher, it is recommended that the subscriber sends all URI GET 404 requests on a common HTTP2 session. Conversely, a subscriber can not 405 use a common HTTP2 session for subscriptions with different DSCP 406 values. 408 5. Notification Messages 410 Notification messages transported over RESTCONF will be encoded 411 according to [RFC8040], section 6.4. 413 6. YANG Tree 415 The YANG model defined in Section 7 has one leaf augmented into three 416 places of [I-D.draft-ietf-netconf-subscribed-notifications]. 418 module: ietf-restconf-subscribed-notifications 419 augment /sn:establish-subscription/sn:output: 420 +--ro uri? inet:uri 421 augment /sn:subscriptions/sn:subscription: 422 +--ro uri? inet:uri 423 augment /sn:subscription-modified: 424 +--ro uri? inet:uri 426 7. YANG module 428 This module references 429 [I-D.draft-ietf-netconf-subscribed-notifications]. 431 file 432 "ietf-restconf-subscribed-notifications@2019-01-11.yang" 433 module ietf-restconf-subscribed-notifications { 434 yang-version 1.1; 435 namespace 436 "urn:ietf:params:xml:ns:yang:" + 437 "ietf-restconf-subscribed-notifications"; 439 prefix rsn; 441 import ietf-subscribed-notifications { 442 prefix sn; 443 } 444 import ietf-inet-types { 445 prefix inet; 446 } 448 organization "IETF NETCONF (Network Configuration) Working Group"; 449 contact 450 "WG Web: 451 WG List: 452 Editor: Eric Voit 453 455 Editor: Alexander Clemm 456 458 Editor: Reshad Rahman 459 "; 461 description 462 "Defines RESTCONF as a supported transport for subscribed 463 event notifications. 465 Copyright (c) 2019 IETF Trust and the persons identified as authors 466 of the code. All rights reserved. 468 Redistribution and use in source and binary forms, with or without 469 modification, is permitted pursuant to, and subject to the license 470 terms contained in, the Simplified BSD License set forth in Section 471 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents 472 (https://trustee.ietf.org/license-info). 474 This version of this YANG module is part of RFC XXXX; see the RFC 475 itself for full legal notices."; 477 revision 2019-01-11 { 478 description 479 "Initial version"; 480 reference 481 "RFC XXXX: RESTCONF Transport for Event Notifications"; 482 } 484 grouping uri { 485 description 486 "Provides a reusable description of a URI."; 487 leaf uri { 488 type inet:uri; 489 config false; 490 description 491 "Location of a subscription specific URI on the publisher."; 492 } 493 } 495 augment "/sn:establish-subscription/sn:output" { 496 description 497 "This augmentation allows RESTCONF specific parameters for a 498 response to a publisher's subscription request."; 499 uses uri; 501 } 503 augment "/sn:subscriptions/sn:subscription" { 504 description 505 "This augmentation allows RESTCONF specific parameters to be 506 exposed for a subscription."; 507 uses uri; 508 } 510 augment "/sn:subscription-modified" { 511 description 512 "This augmentation allows RESTCONF specific parameters to be 513 included as part of the notification that a subscription has been 514 modified."; 515 uses uri; 516 } 517 } 518 520 8. IANA Considerations 522 This document registers the following namespace URI in the "IETF XML 523 Registry" [RFC3688]: 525 URI: urn:ietf:params:xml:ns:yang:ietf-restconf-subscribed- 526 notifications 527 Registrant Contact: The IESG. 528 XML: N/A; the requested URI is an XML namespace. 530 This document registers the following YANG module in the "YANG Module 531 Names" registry [RFC6020]: 533 Name: ietf-restconf-subscribed-notifications 534 Namespace: urn:ietf:params:xml:ns:yang:ietf-restconf-subscribed- 535 notifications 536 Prefix: rsn 537 Reference: RFC XXXX: RESTCONF Transport for Event Notifications 539 9. Security Considerations 541 The YANG module specified in this document defines a schema for data 542 that is designed to be accessed via network management transports 543 such as NETCONF [RFC6241] or RESTCONF [RFC8040]. The lowest NETCONF 544 layer is the secure transport layer, and the mandatory-to-implement 545 secure transport is Secure Shell (SSH) [RFC6242]. The lowest 546 RESTCONF layer is HTTPS, and the mandatory-to-implement secure 547 transport is TLS [RFC8446]. 549 The one new data node introduced in this YANG module may be 550 considered sensitive or vulnerable in some network environments. It 551 is thus important to control read access (e.g., via get, get-config, 552 or notification) to this data nodes. These are the subtrees and data 553 nodes and their sensitivity/vulnerability: 555 Container: "/subscriptions" 557 o "uri": leaf will show where subscribed resources might be located 558 on a publisher. Access control must be set so that only someone 559 with proper access permissions, i.e., the same RESTCONF [RFC8040] 560 user credentials which invoked the corresponding "establish- 561 subscription", has the ability to access this resource. 563 The subscription URI is implementation specific and is encrypted via 564 the use of TLS. Therefore, even if an attacker succeeds in guessing 565 the subscription URI, a RESTCONF username [RFC8040] with the required 566 administrative permissions must be used to be able to access or 567 modify that subscription. It is recommended that the subscription 568 URI values not be easily predictable. 570 The access permission considerations for the RPCs modify- 571 subscription, resync-subscription, delete-subscription and kill- 572 subscription are described in Section 3.4. 574 If a buggy or compromised RESTCONF subscriber sends a number of 575 "establish-subscription" requests, then these subscriptions 576 accumulate and may use up system resources. In such a situation, the 577 publisher MAY also suspend or terminate a subset of the active 578 subscriptions from that RESTCONF subscriber in order to reclaim 579 resources and preserve normal operation for the other subscriptions. 581 10. Acknowledgments 583 We wish to acknowledge the helpful contributions, comments, and 584 suggestions that were received from: Ambika Prasad Tripathy, Alberto 585 Gonzalez Prieto, Susan Hares, Tim Jenkins, Balazs Lengyel, Kent 586 Watsen, Michael Scharf, Guangying Zheng, Martin Bjorklund, Qin Wu and 587 Robert Wilton. 589 11. References 591 11.1. Normative References 593 [I-D.draft-ietf-netconf-subscribed-notifications] 594 Voit, E., Clemm, A., Gonzalez Prieto, A., Tripathy, A., 595 and E. Nilsen-Nygaard, "Custom Subscription to Event 596 Streams", draft-ietf-netconf-subscribed-notifications-21 597 (work in progress), January 2019. 599 [I-D.ietf-netconf-yang-push] 600 Clemm, A., Voit, E., Gonzalez Prieto, A., Prasad Tripathy, 601 A., Nilsen-Nygaard, E., Bierman, A., and B. Lengyel, 602 "Subscribing to YANG datastore push updates", draft-ietf- 603 netconf-yang-push-20 (work in progress), October 2018, 604 . 607 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 608 Requirement Levels", BCP 14, RFC 2119, 609 DOI 10.17487/RFC2119, March 1997, 610 . 612 [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, 613 DOI 10.17487/RFC3688, January 2004, 614 . 616 [RFC6020] Bjorklund, M., Ed., "YANG - A Data Modeling Language for 617 the Network Configuration Protocol (NETCONF)", RFC 6020, 618 DOI 10.17487/RFC6020, October 2010, 619 . 621 [RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., 622 and A. Bierman, Ed., "Network Configuration Protocol 623 (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011, 624 . 626 [RFC6242] Wasserman, M., "Using the NETCONF Protocol over Secure 627 Shell (SSH)", RFC 6242, DOI 10.17487/RFC6242, June 2011, 628 . 630 [RFC6520] Seggelmann, R., Tuexen, M., and M. Williams, "Transport 631 Layer Security (TLS) and Datagram Transport Layer Security 632 (DTLS) Heartbeat Extension", RFC 6520, 633 DOI 10.17487/RFC6520, February 2012, 634 . 636 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 637 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 638 DOI 10.17487/RFC7540, May 2015, 639 . 641 [RFC8040] Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF 642 Protocol", RFC 8040, DOI 10.17487/RFC8040, January 2017, 643 . 645 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 646 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 647 May 2017, . 649 [RFC8342] Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K., 650 and R. Wilton, "Network Management Datastore Architecture 651 (NMDA)", RFC 8342, DOI 10.17487/RFC8342, March 2018, 652 . 654 [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol 655 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 656 . 658 [W3C-20150203] 659 Hickson, I., "Server-Sent Events, World Wide Web 660 Consortium CR CR-eventsource-20121211", February 2015, 661 . 663 11.2. Informative References 665 [I-D.draft-ietf-netconf-netconf-event-notifications] 666 Clemm, Alexander., Voit, Eric., Gonzalez Prieto, Alberto., 667 Nilsen-Nygaard, E., and A. Tripathy, "NETCONF support for 668 event notifications", May 2018, 669 . 672 [I-D.draft-ietf-netconf-nmda-restconf] 673 Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K., 674 and R. Wilton, "RESTCONF Extensions to Support the Network 675 Management Datastore Architecture", April 2018, 676 . 679 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 680 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 681 DOI 10.17487/RFC7231, June 2014, 682 . 684 [RFC7923] Voit, E., Clemm, A., and A. Gonzalez Prieto, "Requirements 685 for Subscription to YANG Datastores", RFC 7923, 686 DOI 10.17487/RFC7923, June 2016, 687 . 689 [RFC7951] Lhotka, L., "JSON Encoding of Data Modeled with YANG", 690 RFC 7951, DOI 10.17487/RFC7951, August 2016, 691 . 693 [RFC8347] Liu, X., Ed., Kyparlis, A., Parikh, R., Lindem, A., and M. 694 Zhang, "A YANG Data Model for the Virtual Router 695 Redundancy Protocol (VRRP)", RFC 8347, 696 DOI 10.17487/RFC8347, March 2018, 697 . 699 [XPATH] Clark, J. and S. DeRose, "XML Path Language (XPath) 700 Version 1.0", November 1999, 701 . 703 Appendix A. Examples 705 This section is non-normative. To allow easy comparison, this 706 section mirrors the functional examples shown with NETCONF over XML 707 within [I-D.draft-ietf-netconf-netconf-event-notifications]. In 708 addition, HTTP2 vs HTTP1.1 headers are not shown as the contents of 709 the JSON encoded objects are identical within. 711 The subscription URI values used in the examples in this section are 712 purely illustrative, and are not indicative of the expected usage 713 which is described in Section 9. 715 The DSCP values are only for example purposes and are all indicated 716 in decimal since the encoding is JSON [RFC7951]. 718 A.1. Dynamic Subscriptions 720 A.1.1. Establishing Dynamic Subscriptions 722 The following figure shows two successful "establish-subscription" 723 RPC requests as per 724 [I-D.draft-ietf-netconf-subscribed-notifications]. The first request 725 is given a subscription identifier of 22, the second, an identifier 726 of 23. 728 +------------+ +-----------+ 729 | Subscriber | | Publisher | 730 +------------+ +-----------+ 731 | | 732 |establish-subscription | 733 |------------------------------>| (a) 734 | HTTP 200 OK, id#22, URI#1 | 735 |<------------------------------| (b) 736 |GET (URI#1) | 737 |------------------------------>| (c) 738 | HTTP 200 OK,notif-mesg (id#22)| 739 |<------------------------------| 740 | | 741 | | 742 |establish-subscription | 743 |------------------------------>| 744 | HTTP 200 OK, id#23, URI#2| 745 |<------------------------------| 746 |GET (URI#2) | 747 |------------------------------>| 748 | | 749 | | 750 | notif-mesg (id#22)| 751 |<------------------------------| 752 | HTTP 200 OK,notif-mesg (id#23)| 753 |<------------------------------| 754 | | 756 Figure 2: Multiple subscriptions over RESTCONF/HTTP 758 To provide examples of the information being transported, example 759 messages for interactions in Figure 2 are detailed below: 761 POST /restconf/operations 762 /ietf-subscribed-notifications:establish-subscription 764 { 765 "ietf-subscribed-notifications:input": { 766 "stream-xpath-filter": "/example-module:foo/", 767 "stream": "NETCONF", 768 "dscp": 10 769 } 770 } 772 Figure 3: establish-subscription request (a) 774 As publisher was able to fully satisfy the request, the publisher 775 sends the subscription identifier of the accepted subscription, and 776 the URI: 778 HTTP status code - 200 780 { 781 "id": 22, 782 "uri": "https://example.com/restconf/subscriptions/22" 783 } 785 Figure 4: establish-subscription success (b) 787 Upon receipt of the successful response, the subscriber does a GET 788 the provided URI to start the flow of notification messages. When 789 the publisher receives this, the subscription is moved to the active 790 state (c). 792 GET /restconf/subscriptions/22 794 Figure 5: establish-subscription subsequent POST 796 While not shown in Figure 2, if the publisher had not been able to 797 fully satisfy the request, or subscriber has no authorization to 798 establish the subscription, the publisher would have sent an RPC 799 error response. For instance, if the "dscp" value of 10 asserted by 800 the subscriber in Figure 3 proved unacceptable, the publisher may 801 have returned: 803 HTTP status code - 400 805 { "ietf-restconf:errors" : { 806 "error" : [ 807 { 808 "error-type": "application", 809 "error-tag": "invalid-value", 810 "error-severity": "error", 811 "error-app-tag": 812 "ietf-subscribed-notifications:dscp-unavailable" 813 } 814 ] 815 } 816 } 818 Figure 6: an unsuccessful establish subscription 820 The subscriber can use this information in future attempts to 821 establish a subscription. 823 A.1.2. Modifying Dynamic Subscriptions 825 An existing subscription may be modified. The following exchange 826 shows a negotiation of such a modification via several exchanges 827 between a subscriber and a publisher. This negotiation consists of a 828 failed RPC modification request/response, followed by a successful 829 one. 831 +------------+ +-----------+ 832 | Subscriber | | Publisher | 833 +------------+ +-----------+ 834 | | 835 | notification message (id#23)| 836 |<-----------------------------| 837 | | 838 |modify-subscription (id#23) | 839 |----------------------------->| (d) 840 | HTTP 400 error (with hint)| 841 |<-----------------------------| (e) 842 | | 843 |modify-subscription (id#23) | 844 |----------------------------->| 845 | HTTP 200 OK | 846 |<-----------------------------| 847 | | 848 | notif-mesg (id#23)| 849 |<-----------------------------| 850 | | 852 Figure 7: Interaction model for successful subscription modification 854 If the subscription being modified in Figure 7 is a datastore 855 subscription as per [I-D.ietf-netconf-yang-push], the modification 856 request made in (d) may look like that shown in Figure 8. As can be 857 seen, the modifications being attempted are the application of a new 858 xpath filter as well as the setting of a new periodic time interval. 860 POST /restconf/operations 861 /ietf-subscribed-notifications:modify-subscription 863 { 864 "ietf-subscribed-notifications:input": { 865 "id": 23, 866 "ietf-yang-push:datastore-xpath-filter": 867 "/example-module:foo/example-module:bar", 868 "ietf-yang-push:periodic": { 869 "ietf-yang-push:period": 500 870 } 871 } 872 } 874 Figure 8: Subscription modification request (c) 876 If the publisher can satisfy both changes, the publisher sends a 877 positive result for the RPC. If the publisher cannot satisfy either 878 of the proposed changes, the publisher sends an RPC error response 879 (e). The following is an example RPC error response for (e) which 880 includes a hint. This hint is an alternative time period value which 881 might have resulted in a successful modification: 883 HTTP status code - 400 885 { "ietf-restconf:errors" : { 886 "error" : [ 887 "error-type": "application", 888 "error-tag": "invalid-value", 889 "error-severity": "error", 890 "error-app-tag": "ietf-yang-push:period-unsupported", 891 "error-info": { 892 "ietf-yang-push": 893 "modify-subscription-datastore-error-info": { 894 "period-hint": 3000 895 } 896 } 897 ] 898 } 899 } 901 Figure 9: Modify subscription failure with Hint (e) 903 A.1.3. Deleting Dynamic Subscriptions 905 The following demonstrates deleting a subscription. This 906 subscription may have been to either a stream or a datastore. 908 POST /restconf/operations 909 /ietf-subscribed-notifications:delete-subscription 911 { 912 "delete-subscription": { 913 "id": "22" 914 } 915 } 917 Figure 10: Delete subscription 919 If the publisher can satisfy the request, the publisher replies with 920 success to the RPC request. 922 If the publisher cannot satisfy the request, the publisher sends an 923 error-rpc element indicating the modification didn't work. Figure 11 924 shows a valid response for existing valid subscription identifier, 925 but that subscription identifier was created on a different transport 926 session: 928 HTTP status code - 404 930 { 931 "ietf-restconf:errors" : { 932 "error" : [ 933 "error-type": "application", 934 "error-tag": "invalid-value", 935 "error-severity": "error", 936 "error-app-tag": 937 "ietf-subscribed-notifications:no-such-subscription" 938 ] 939 } 940 } 942 Figure 11: Unsuccessful delete subscription 944 A.2. Subscription State Notifications 946 A publisher will send subscription state notifications according to 947 the definitions within 948 [I-D.draft-ietf-netconf-subscribed-notifications]). 950 A.2.1. subscription-modified 952 A "subscription-modified" encoded in JSON would look like: 954 { 955 "ietf-restconf:notification" : { 956 "eventTime": "2007-09-01T10:00:00Z", 957 "ietf-subscribed-notifications:subscription-modified": { 958 "id": 39, 959 "uri": "https://example.com/restconf/subscriptions/22" 960 "stream-xpath-filter": "/example-module:foo", 961 "stream": { 962 "ietf-netconf-subscribed-notifications" : "NETCONF" 963 } 964 } 965 } 966 } 968 Figure 12: subscription-modified subscription state notification 970 A.2.2. subscription-completed, subscription-resumed, and replay- 971 complete 973 A "subscription-completed" would look like: 975 { 976 "ietf-restconf:notification" : { 977 "eventTime": "2007-09-01T10:00:00Z", 978 "ietf-subscribed-notifications:subscription-completed": { 979 "id": 39, 980 } 981 } 982 } 984 Figure 13: subscription-completed notification in JSON 986 The "subscription-resumed" and "replay-complete" are virtually 987 identical, with "subscription-completed" simply being replaced by 988 "subscription-resumed" and "replay-complete". 990 A.2.3. subscription-terminated and subscription-suspended 992 A "subscription-terminated" would look like: 994 { 995 "ietf-restconf:notification" : { 996 "eventTime": "2007-09-01T10:00:00Z", 997 "ietf-subscribed-notifications:subscription-terminated": { 998 "id": 39, 999 "error-id": "suspension-timeout" 1000 } 1001 } 1002 } 1004 Figure 14: subscription-terminated subscription state notification 1006 The "subscription-suspended" is virtually identical, with 1007 "subscription-terminated" simply being replaced by "subscription- 1008 suspended". 1010 A.3. Filter Example 1012 This section provides an example which illustrate the method of 1013 filtering event record contents. The example is based on the YANG 1014 notification "vrrp-protocol-error-event" as defined per the ietf- 1015 vrrp.yang module within [RFC8347]. Event records based on this 1016 specification which are generated by the publisher might appear as: 1018 data: { 1019 data: "ietf-restconf:notification" : { 1020 data: "eventTime" : "2018-09-14T08:22:33.44Z", 1021 data: "ietf-vrrp:vrrp-protocol-error-event" : { 1022 data: "protocol-error-reason" : "checksum-error" 1023 data: } 1024 data: } 1025 data: } 1027 Figure 15: RFC 8347 (VRRP) - Example Notification 1029 Suppose a subscriber wanted to establish a subscription which only 1030 passes instances of event records where there is a "checksum-error" 1031 as part of a VRRP protocol event. Also assume the publisher places 1032 such event records into the NETCONF stream. To get a continuous 1033 series of matching event records, the subscriber might request the 1034 application of an XPath filter against the NETCONF stream. An 1035 "establish-subscription" RPC to meet this objective might be: 1037 POST /restconf/operations 1038 /ietf-subscribed-notifications:establish-subscription 1039 { 1040 "ietf-subscribed-notifications:input": { 1041 "stream": "NETCONF", 1042 "stream-xpath-filter": 1043 "/ietf-vrrp:vrrp-protocol-error-event[ 1044 protocol-error-reason='checksum-error']/", 1045 } 1046 } 1048 Figure 16: Establishing a subscription error reason via XPath 1050 For more examples of XPath filters, see [XPATH]. 1052 Suppose the "establish-subscription" in Figure 16 was accepted. And 1053 suppose later a subscriber decided they wanted to broaden this 1054 subscription cover to all VRRP protocol events (i.e., not just those 1055 with a "checksum error"). The subscriber might attempt to modify the 1056 subscription in a way which replaces the XPath filter with a subtree 1057 filter which sends all VRRP protocol events to a subscriber. Such a 1058 "modify-subscription" RPC might look like: 1060 POST /restconf/operations 1061 /ietf-subscribed-notifications:modify-subscription 1062 { 1063 "ietf-subscribed-notifications:input": { 1064 "stream": "NETCONF", 1065 "stream-subtree-filter": { 1066 "/ietf-vrrp:vrrp-protocol-error-event" : {} 1067 } 1068 } 1069 } 1071 Figure 17 1073 For more examples of subtree filters, see [RFC6241], section 6.4. 1075 Appendix B. Changes between revisions 1077 (To be removed by RFC editor prior to publication) 1079 v13 - v14 1081 o Addressed review comments from IESG. 1083 v12 - v13 1084 o Enhanced "error-tag" values based on SN review. 1086 v11 - v12 1088 o Added text in 3.2 for expected behavior when ietf-restconf- 1089 monitoring.yang is also supported. 1091 o Added section 2 to the reference to draft-ietf-netconf-nmda- 1092 restconf. 1094 o Replaced kill-subscription-error by delete-subscription-error in 1095 section 3.3. 1097 o Clarified vertical lines (a) and (b) in Figure 1 of section 3.4 1099 o Section 3.4, 3rd bullet after Figure 1, replaced "must" with 1100 "MUST". 1102 o Modified text in section 3.4 regarding access to RPCs modify- 1103 subscription, resync-subscription, delete-subscription and kill- 1104 subscription. 1106 o Section 4, first bullet for HTTP2: replaced dscp and priority with 1107 weighting and weight. 1109 o Section 6, added YANG tree diagram and fixed description of the 1110 module. 1112 o Section 7, fixed indentation of module description statement. 1114 o Section 7, in YANG module changed year in copyright statement to 1115 2019. 1117 o Section 8, added text on how server protects access to the 1118 subscription URI. 1120 o Fixed outdated references and removed unused references. 1122 o Fixed the instances of line too long. 1124 o Fixed example in Figure 3. 1126 v10 - v11 1128 o Per Kent's request, added name attribute to artwork which need to 1129 be extracted 1131 v09 - v10 1132 o Fixed typo for resync. 1134 o Added text wrt RPC permissions and RESTCONF username. 1136 v08 - v09 1138 o Addressed comments received during WGLC. 1140 v07 - v08 1142 o Aligned with RESTCONF mechanism. 1144 o YANG model: removed augment of subscription-started, added 1145 restconf transport. 1147 o Tweaked Appendix A.1 to match draft-ietf-netconf-netconf-event- 1148 notifications-13. 1150 o Added Appendix A.3 for filter example. 1152 v06 - v07 1154 o Removed configured subscriptions. 1156 o Subscription identifier renamed to id. 1158 v05 - v06 1160 o JSON examples updated by Reshad. 1162 v04 - v05 1164 o Error mechanisms updated to match embedded RESTCONF mechanisms 1166 o Restructured format and sections of document. 1168 o Added a YANG data model for HTTP specific parameters. 1170 o Mirrored the examples from the NETCONF transport draft to allow 1171 easy comparison. 1173 v03 - v04 1175 o Draft not fully synched to new version of subscribed-notifications 1176 yet. 1178 o References updated 1179 v02 - v03 1181 o Event notification reframed to notification message. 1183 o Tweaks to wording/capitalization/format. 1185 v01 - v02 1187 o Removed sections now redundant with 1188 [I-D.draft-ietf-netconf-subscribed-notifications] and 1189 [I-D.ietf-netconf-yang-push] such as: mechanisms for subscription 1190 maintenance, terminology definitions, stream discovery. 1192 o 3rd party subscriptions are out-of-scope. 1194 o SSE only used with RESTCONF and HTTP1.1 dynamic subscriptions 1196 o Timeframes for event tagging are self-defined. 1198 o Clean-up of wording, references to terminology, section numbers. 1200 v00 - v01 1202 o Removed the ability for more than one subscription to go to a 1203 single HTTP2 stream. 1205 o Updated call flows. Extensively. 1207 o SSE only used with RESTCONF and HTTP1.1 dynamic subscriptions 1209 o HTTP is not used to determine that a receiver has gone silent and 1210 is not Receiving Event Notifications 1212 o Many clean-ups of wording and terminology 1214 Authors' Addresses 1216 Eric Voit 1217 Cisco Systems 1219 Email: evoit@cisco.com 1221 Reshad Rahman 1222 Cisco Systems 1224 Email: rrahman@cisco.com 1225 Einar Nilsen-Nygaard 1226 Cisco Systems 1228 Email: einarnn@cisco.com 1230 Alexander Clemm 1231 Huawei 1233 Email: ludwig@clemm.org 1235 Andy Bierman 1236 YumaWorks 1238 Email: andy@yumaworks.com