idnits 2.17.1 draft-ietf-netconf-restconf-notif-15.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 11, 2019) is 1779 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 13, 2019 Cisco Systems 6 A. Clemm 7 Huawei 8 A. Bierman 9 YumaWorks 10 June 11, 2019 12 Dynamic subscription to YANG Events and Datastores over RESTCONF 13 draft-ietf-netconf-restconf-notif-15 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 13, 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 (if HTTP2 is used, multiple HTTP2 290 streams can be carried 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 cannot be two 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, if HTTP2 is used, the publisher MUST: 388 o take the "weighting" leaf node in 389 [I-D.draft-ietf-netconf-subscribed-notifications], and copy it 390 into the HTTP2 stream weight, [RFC7540] section 5.3, and 392 o take any existing subscription "dependency", as specified by the 393 "dependency" leaf node in 394 [I-D.draft-ietf-netconf-subscribed-notifications], and use the 395 HTTP2 stream for the parent subscription as the HTTP2 stream 396 dependency, [RFC7540] section 5.3.1, of the dependent 397 subscription. 399 o set the exclusive flag, [RFC7540] section 5.3.1, to 0. 401 For dynamic subscriptions with the same DSCP value to a specific 402 publisher, it is recommended that the subscriber sends all URI GET 403 requests on a common HTTP2 session (if HTTP2 is used). Conversely, a 404 subscriber can not use a common HTTP2 session for subscriptions with 405 different DSCP values. 407 5. Notification Messages 409 Notification messages transported over RESTCONF will be encoded 410 according to [RFC8040], section 6.4. 412 6. YANG Tree 414 The YANG model defined in Section 7 has one leaf augmented into three 415 places of [I-D.draft-ietf-netconf-subscribed-notifications]. 417 module: ietf-restconf-subscribed-notifications 418 augment /sn:establish-subscription/sn:output: 419 +--ro uri? inet:uri 420 augment /sn:subscriptions/sn:subscription: 421 +--ro uri? inet:uri 422 augment /sn:subscription-modified: 423 +--ro uri? inet:uri 425 7. YANG module 427 This module references 428 [I-D.draft-ietf-netconf-subscribed-notifications]. 430 file 431 "ietf-restconf-subscribed-notifications@2019-01-11.yang" 432 module ietf-restconf-subscribed-notifications { 433 yang-version 1.1; 434 namespace 435 "urn:ietf:params:xml:ns:yang:" + 436 "ietf-restconf-subscribed-notifications"; 438 prefix rsn; 440 import ietf-subscribed-notifications { 441 prefix sn; 442 } 443 import ietf-inet-types { 444 prefix inet; 445 } 447 organization "IETF NETCONF (Network Configuration) Working Group"; 448 contact 449 "WG Web: 450 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; 500 } 502 augment "/sn:subscriptions/sn:subscription" { 503 description 504 "This augmentation allows RESTCONF specific parameters to be 505 exposed for a subscription."; 506 uses uri; 507 } 509 augment "/sn:subscription-modified" { 510 description 511 "This augmentation allows RESTCONF specific parameters to be 512 included as part of the notification that a subscription has been 513 modified."; 514 uses uri; 515 } 516 } 517 519 8. IANA Considerations 521 This document registers the following namespace URI in the "IETF XML 522 Registry" [RFC3688]: 524 URI: urn:ietf:params:xml:ns:yang:ietf-restconf-subscribed- 525 notifications 526 Registrant Contact: The IESG. 527 XML: N/A; the requested URI is an XML namespace. 529 This document registers the following YANG module in the "YANG Module 530 Names" registry [RFC6020]: 532 Name: ietf-restconf-subscribed-notifications 533 Namespace: urn:ietf:params:xml:ns:yang:ietf-restconf-subscribed- 534 notifications 535 Prefix: rsn 536 Reference: RFC XXXX: RESTCONF Transport for Event Notifications 538 9. Security Considerations 540 The YANG module specified in this document defines a schema for data 541 that is designed to be accessed via network management transports 542 such as NETCONF [RFC6241] or RESTCONF [RFC8040]. The lowest NETCONF 543 layer is the secure transport layer, and the mandatory-to-implement 544 secure transport is Secure Shell (SSH) [RFC6242]. The lowest 545 RESTCONF layer is HTTPS, and the mandatory-to-implement secure 546 transport is TLS [RFC8446]. 548 The one new data node introduced in this YANG module may be 549 considered sensitive or vulnerable in some network environments. It 550 is thus important to control read access (e.g., via get, get-config, 551 or notification) to this data nodes. These are the subtrees and data 552 nodes and their sensitivity/vulnerability: 554 Container: "/subscriptions" 556 o "uri": leaf will show where subscribed resources might be located 557 on a publisher. Access control must be set so that only someone 558 with proper access permissions, i.e., the same RESTCONF [RFC8040] 559 user credentials which invoked the corresponding "establish- 560 subscription", has the ability to access this resource. 562 The subscription URI is implementation specific and is encrypted via 563 the use of TLS. Therefore, even if an attacker succeeds in guessing 564 the subscription URI, a RESTCONF username [RFC8040] with the required 565 administrative permissions must be used to be able to access or 566 modify that subscription. It is recommended that the subscription 567 URI values not be easily predictable. 569 The access permission considerations for the RPCs modify- 570 subscription, resync-subscription, delete-subscription and kill- 571 subscription are described in Section 3.4. 573 If a buggy or compromised RESTCONF subscriber sends a number of 574 "establish-subscription" requests, then these subscriptions 575 accumulate and may use up system resources. In such a situation, the 576 publisher MAY also suspend or terminate a subset of the active 577 subscriptions from that RESTCONF subscriber in order to reclaim 578 resources and preserve normal operation for the other subscriptions. 580 10. Acknowledgments 582 We wish to acknowledge the helpful contributions, comments, and 583 suggestions that were received from: Ambika Prasad Tripathy, Alberto 584 Gonzalez Prieto, Susan Hares, Tim Jenkins, Balazs Lengyel, Kent 585 Watsen, Michael Scharf, Guangying Zheng, Martin Bjorklund, Qin Wu and 586 Robert Wilton. 588 11. References 590 11.1. Normative References 592 [I-D.draft-ietf-netconf-subscribed-notifications] 593 Voit, E., Clemm, A., Gonzalez Prieto, A., Tripathy, A., 594 and E. Nilsen-Nygaard, "Custom Subscription to Event 595 Streams", draft-ietf-netconf-subscribed-notifications-21 596 (work in progress), January 2019. 598 [I-D.ietf-netconf-yang-push] 599 Clemm, A., Voit, E., Gonzalez Prieto, A., Prasad Tripathy, 600 A., Nilsen-Nygaard, E., Bierman, A., and B. Lengyel, 601 "Subscribing to YANG datastore push updates", draft-ietf- 602 netconf-yang-push-20 (work in progress), October 2018, 603 . 606 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 607 Requirement Levels", BCP 14, RFC 2119, 608 DOI 10.17487/RFC2119, March 1997, 609 . 611 [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, 612 DOI 10.17487/RFC3688, January 2004, 613 . 615 [RFC6020] Bjorklund, M., Ed., "YANG - A Data Modeling Language for 616 the Network Configuration Protocol (NETCONF)", RFC 6020, 617 DOI 10.17487/RFC6020, October 2010, 618 . 620 [RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., 621 and A. Bierman, Ed., "Network Configuration Protocol 622 (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011, 623 . 625 [RFC6242] Wasserman, M., "Using the NETCONF Protocol over Secure 626 Shell (SSH)", RFC 6242, DOI 10.17487/RFC6242, June 2011, 627 . 629 [RFC6520] Seggelmann, R., Tuexen, M., and M. Williams, "Transport 630 Layer Security (TLS) and Datagram Transport Layer Security 631 (DTLS) Heartbeat Extension", RFC 6520, 632 DOI 10.17487/RFC6520, February 2012, 633 . 635 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 636 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 637 DOI 10.17487/RFC7540, May 2015, 638 . 640 [RFC8040] Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF 641 Protocol", RFC 8040, DOI 10.17487/RFC8040, January 2017, 642 . 644 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 645 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 646 May 2017, . 648 [RFC8342] Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K., 649 and R. Wilton, "Network Management Datastore Architecture 650 (NMDA)", RFC 8342, DOI 10.17487/RFC8342, March 2018, 651 . 653 [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol 654 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 655 . 657 [W3C-20150203] 658 Hickson, I., "Server-Sent Events, World Wide Web 659 Consortium CR CR-eventsource-20121211", February 2015, 660 . 662 11.2. Informative References 664 [I-D.draft-ietf-netconf-netconf-event-notifications] 665 Clemm, Alexander., Voit, Eric., Gonzalez Prieto, Alberto., 666 Nilsen-Nygaard, E., and A. Tripathy, "NETCONF support for 667 event notifications", May 2018, 668 . 671 [I-D.draft-ietf-netconf-nmda-restconf] 672 Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K., 673 and R. Wilton, "RESTCONF Extensions to Support the Network 674 Management Datastore Architecture", April 2018, 675 . 678 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 679 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 680 DOI 10.17487/RFC7231, June 2014, 681 . 683 [RFC7923] Voit, E., Clemm, A., and A. Gonzalez Prieto, "Requirements 684 for Subscription to YANG Datastores", RFC 7923, 685 DOI 10.17487/RFC7923, June 2016, 686 . 688 [RFC7951] Lhotka, L., "JSON Encoding of Data Modeled with YANG", 689 RFC 7951, DOI 10.17487/RFC7951, August 2016, 690 . 692 [RFC8347] Liu, X., Ed., Kyparlis, A., Parikh, R., Lindem, A., and M. 693 Zhang, "A YANG Data Model for the Virtual Router 694 Redundancy Protocol (VRRP)", RFC 8347, 695 DOI 10.17487/RFC8347, March 2018, 696 . 698 [XPATH] Clark, J. and S. DeRose, "XML Path Language (XPath) 699 Version 1.0", November 1999, 700 . 702 Appendix A. Examples 704 This section is non-normative. To allow easy comparison, this 705 section mirrors the functional examples shown with NETCONF over XML 706 within [I-D.draft-ietf-netconf-netconf-event-notifications]. In 707 addition, HTTP2 vs HTTP1.1 headers are not shown as the contents of 708 the JSON encoded objects are identical within. 710 The subscription URI values used in the examples in this section are 711 purely illustrative, and are not indicative of the expected usage 712 which is described in Section 9. 714 The DSCP values are only for example purposes and are all indicated 715 in decimal since the encoding is JSON [RFC7951]. 717 A.1. Dynamic Subscriptions 719 A.1.1. Establishing Dynamic Subscriptions 721 The following figure shows two successful "establish-subscription" 722 RPC requests as per 723 [I-D.draft-ietf-netconf-subscribed-notifications]. The first request 724 is given a subscription identifier of 22, the second, an identifier 725 of 23. 727 +------------+ +-----------+ 728 | Subscriber | | Publisher | 729 +------------+ +-----------+ 730 | | 731 |establish-subscription | 732 |------------------------------>| (a) 733 | HTTP 200 OK, id#22, URI#1 | 734 |<------------------------------| (b) 735 |GET (URI#1) | 736 |------------------------------>| (c) 737 | HTTP 200 OK,notif-mesg (id#22)| 738 |<------------------------------| 739 | | 740 | | 741 |establish-subscription | 742 |------------------------------>| 743 | HTTP 200 OK, id#23, URI#2| 744 |<------------------------------| 745 |GET (URI#2) | 746 |------------------------------>| 747 | | 748 | | 749 | notif-mesg (id#22)| 750 |<------------------------------| 751 | HTTP 200 OK,notif-mesg (id#23)| 752 |<------------------------------| 753 | | 755 Figure 2: Multiple subscriptions over RESTCONF/HTTP 757 To provide examples of the information being transported, example 758 messages for interactions in Figure 2 are detailed below: 760 POST /restconf/operations 761 /ietf-subscribed-notifications:establish-subscription 763 { 764 "ietf-subscribed-notifications:input": { 765 "stream-xpath-filter": "/example-module:foo/", 766 "stream": "NETCONF", 767 "dscp": 10 768 } 769 } 771 Figure 3: establish-subscription request (a) 773 As publisher was able to fully satisfy the request, the publisher 774 sends the subscription identifier of the accepted subscription, and 775 the URI: 777 HTTP status code - 200 779 { 780 "id": 22, 781 "uri": "https://example.com/restconf/subscriptions/22" 782 } 784 Figure 4: establish-subscription success (b) 786 Upon receipt of the successful response, the subscriber does a GET 787 the provided URI to start the flow of notification messages. When 788 the publisher receives this, the subscription is moved to the active 789 state (c). 791 GET /restconf/subscriptions/22 793 Figure 5: establish-subscription subsequent POST 795 While not shown in Figure 2, if the publisher had not been able to 796 fully satisfy the request, or subscriber has no authorization to 797 establish the subscription, the publisher would have sent an RPC 798 error response. For instance, if the "dscp" value of 10 asserted by 799 the subscriber in Figure 3 proved unacceptable, the publisher may 800 have returned: 802 HTTP status code - 400 804 { "ietf-restconf:errors" : { 805 "error" : [ 806 { 807 "error-type": "application", 808 "error-tag": "invalid-value", 809 "error-severity": "error", 810 "error-app-tag": 811 "ietf-subscribed-notifications:dscp-unavailable" 812 } 813 ] 814 } 815 } 817 Figure 6: an unsuccessful establish subscription 819 The subscriber can use this information in future attempts to 820 establish a subscription. 822 A.1.2. Modifying Dynamic Subscriptions 824 An existing subscription may be modified. The following exchange 825 shows a negotiation of such a modification via several exchanges 826 between a subscriber and a publisher. This negotiation consists of a 827 failed RPC modification request/response, followed by a successful 828 one. 830 +------------+ +-----------+ 831 | Subscriber | | Publisher | 832 +------------+ +-----------+ 833 | | 834 | notification message (id#23)| 835 |<-----------------------------| 836 | | 837 |modify-subscription (id#23) | 838 |----------------------------->| (d) 839 | HTTP 400 error (with hint)| 840 |<-----------------------------| (e) 841 | | 842 |modify-subscription (id#23) | 843 |----------------------------->| 844 | HTTP 200 OK | 845 |<-----------------------------| 846 | | 847 | notif-mesg (id#23)| 848 |<-----------------------------| 849 | | 851 Figure 7: Interaction model for successful subscription modification 853 If the subscription being modified in Figure 7 is a datastore 854 subscription as per [I-D.ietf-netconf-yang-push], the modification 855 request made in (d) may look like that shown in Figure 8. As can be 856 seen, the modifications being attempted are the application of a new 857 xpath filter as well as the setting of a new periodic time interval. 859 POST /restconf/operations 860 /ietf-subscribed-notifications:modify-subscription 862 { 863 "ietf-subscribed-notifications:input": { 864 "id": 23, 865 "ietf-yang-push:datastore-xpath-filter": 866 "/example-module:foo/example-module:bar", 867 "ietf-yang-push:periodic": { 868 "ietf-yang-push:period": 500 869 } 870 } 871 } 873 Figure 8: Subscription modification request (c) 875 If the publisher can satisfy both changes, the publisher sends a 876 positive result for the RPC. If the publisher cannot satisfy either 877 of the proposed changes, the publisher sends an RPC error response 878 (e). The following is an example RPC error response for (e) which 879 includes a hint. This hint is an alternative time period value which 880 might have resulted in a successful modification: 882 HTTP status code - 400 884 { "ietf-restconf:errors" : { 885 "error" : [ 886 "error-type": "application", 887 "error-tag": "invalid-value", 888 "error-severity": "error", 889 "error-app-tag": "ietf-yang-push:period-unsupported", 890 "error-info": { 891 "ietf-yang-push": 892 "modify-subscription-datastore-error-info": { 893 "period-hint": 3000 894 } 895 } 896 ] 897 } 898 } 900 Figure 9: Modify subscription failure with Hint (e) 902 A.1.3. Deleting Dynamic Subscriptions 904 The following demonstrates deleting a subscription. This 905 subscription may have been to either a stream or a datastore. 907 POST /restconf/operations 908 /ietf-subscribed-notifications:delete-subscription 910 { 911 "delete-subscription": { 912 "id": "22" 913 } 914 } 916 Figure 10: Delete subscription 918 If the publisher can satisfy the request, the publisher replies with 919 success to the RPC request. 921 If the publisher cannot satisfy the request, the publisher sends an 922 error-rpc element indicating the modification didn't work. Figure 11 923 shows a valid response for existing valid subscription identifier, 924 but that subscription identifier was created on a different transport 925 session: 927 HTTP status code - 404 929 { 930 "ietf-restconf:errors" : { 931 "error" : [ 932 "error-type": "application", 933 "error-tag": "invalid-value", 934 "error-severity": "error", 935 "error-app-tag": 936 "ietf-subscribed-notifications:no-such-subscription" 937 ] 938 } 939 } 941 Figure 11: Unsuccessful delete subscription 943 A.2. Subscription State Notifications 945 A publisher will send subscription state notifications according to 946 the definitions within 947 [I-D.draft-ietf-netconf-subscribed-notifications]). 949 A.2.1. subscription-modified 951 A "subscription-modified" encoded in JSON would look like: 953 { 954 "ietf-restconf:notification" : { 955 "eventTime": "2007-09-01T10:00:00Z", 956 "ietf-subscribed-notifications:subscription-modified": { 957 "id": 39, 958 "uri": "https://example.com/restconf/subscriptions/22" 959 "stream-xpath-filter": "/example-module:foo", 960 "stream": { 961 "ietf-netconf-subscribed-notifications" : "NETCONF" 962 } 963 } 964 } 965 } 967 Figure 12: subscription-modified subscription state notification 969 A.2.2. subscription-completed, subscription-resumed, and replay- 970 complete 972 A "subscription-completed" would look like: 974 { 975 "ietf-restconf:notification" : { 976 "eventTime": "2007-09-01T10:00:00Z", 977 "ietf-subscribed-notifications:subscription-completed": { 978 "id": 39, 979 } 980 } 981 } 983 Figure 13: subscription-completed notification in JSON 985 The "subscription-resumed" and "replay-complete" are virtually 986 identical, with "subscription-completed" simply being replaced by 987 "subscription-resumed" and "replay-complete". 989 A.2.3. subscription-terminated and subscription-suspended 991 A "subscription-terminated" would look like: 993 { 994 "ietf-restconf:notification" : { 995 "eventTime": "2007-09-01T10:00:00Z", 996 "ietf-subscribed-notifications:subscription-terminated": { 997 "id": 39, 998 "error-id": "suspension-timeout" 999 } 1000 } 1001 } 1003 Figure 14: subscription-terminated subscription state notification 1005 The "subscription-suspended" is virtually identical, with 1006 "subscription-terminated" simply being replaced by "subscription- 1007 suspended". 1009 A.3. Filter Example 1011 This section provides an example which illustrate the method of 1012 filtering event record contents. The example is based on the YANG 1013 notification "vrrp-protocol-error-event" as defined per the ietf- 1014 vrrp.yang module within [RFC8347]. Event records based on this 1015 specification which are generated by the publisher might appear as: 1017 data: { 1018 data: "ietf-restconf:notification" : { 1019 data: "eventTime" : "2018-09-14T08:22:33.44Z", 1020 data: "ietf-vrrp:vrrp-protocol-error-event" : { 1021 data: "protocol-error-reason" : "checksum-error" 1022 data: } 1023 data: } 1024 data: } 1026 Figure 15: RFC 8347 (VRRP) - Example Notification 1028 Suppose a subscriber wanted to establish a subscription which only 1029 passes instances of event records where there is a "checksum-error" 1030 as part of a VRRP protocol event. Also assume the publisher places 1031 such event records into the NETCONF stream. To get a continuous 1032 series of matching event records, the subscriber might request the 1033 application of an XPath filter against the NETCONF stream. An 1034 "establish-subscription" RPC to meet this objective might be: 1036 POST /restconf/operations 1037 /ietf-subscribed-notifications:establish-subscription 1038 { 1039 "ietf-subscribed-notifications:input": { 1040 "stream": "NETCONF", 1041 "stream-xpath-filter": 1042 "/ietf-vrrp:vrrp-protocol-error-event[ 1043 protocol-error-reason='checksum-error']/", 1044 } 1045 } 1047 Figure 16: Establishing a subscription error reason via XPath 1049 For more examples of XPath filters, see [XPATH]. 1051 Suppose the "establish-subscription" in Figure 16 was accepted. And 1052 suppose later a subscriber decided they wanted to broaden this 1053 subscription cover to all VRRP protocol events (i.e., not just those 1054 with a "checksum error"). The subscriber might attempt to modify the 1055 subscription in a way which replaces the XPath filter with a subtree 1056 filter which sends all VRRP protocol events to a subscriber. Such a 1057 "modify-subscription" RPC might look like: 1059 POST /restconf/operations 1060 /ietf-subscribed-notifications:modify-subscription 1061 { 1062 "ietf-subscribed-notifications:input": { 1063 "stream": "NETCONF", 1064 "stream-subtree-filter": { 1065 "/ietf-vrrp:vrrp-protocol-error-event" : {} 1066 } 1067 } 1068 } 1070 Figure 17 1072 For more examples of subtree filters, see [RFC6241], section 6.4. 1074 Appendix B. Changes between revisions 1076 (To be removed by RFC editor prior to publication) 1078 v14 - v15 1080 o Addressed review comments from Kent. 1082 v13 - v14 1083 o Addressed review comments from IESG. 1085 v12 - v13 1087 o Enhanced "error-tag" values based on SN review. 1089 v11 - v12 1091 o Added text in 3.2 for expected behavior when ietf-restconf- 1092 monitoring.yang is also supported. 1094 o Added section 2 to the reference to draft-ietf-netconf-nmda- 1095 restconf. 1097 o Replaced kill-subscription-error by delete-subscription-error in 1098 section 3.3. 1100 o Clarified vertical lines (a) and (b) in Figure 1 of section 3.4 1102 o Section 3.4, 3rd bullet after Figure 1, replaced "must" with 1103 "MUST". 1105 o Modified text in section 3.4 regarding access to RPCs modify- 1106 subscription, resync-subscription, delete-subscription and kill- 1107 subscription. 1109 o Section 4, first bullet for HTTP2: replaced dscp and priority with 1110 weighting and weight. 1112 o Section 6, added YANG tree diagram and fixed description of the 1113 module. 1115 o Section 7, fixed indentation of module description statement. 1117 o Section 7, in YANG module changed year in copyright statement to 1118 2019. 1120 o Section 8, added text on how server protects access to the 1121 subscription URI. 1123 o Fixed outdated references and removed unused references. 1125 o Fixed the instances of line too long. 1127 o Fixed example in Figure 3. 1129 v10 - v11 1130 o Per Kent's request, added name attribute to artwork which need to 1131 be extracted 1133 v09 - v10 1135 o Fixed typo for resync. 1137 o Added text wrt RPC permissions and RESTCONF username. 1139 v08 - v09 1141 o Addressed comments received during WGLC. 1143 v07 - v08 1145 o Aligned with RESTCONF mechanism. 1147 o YANG model: removed augment of subscription-started, added 1148 restconf transport. 1150 o Tweaked Appendix A.1 to match draft-ietf-netconf-netconf-event- 1151 notifications-13. 1153 o Added Appendix A.3 for filter example. 1155 v06 - v07 1157 o Removed configured subscriptions. 1159 o Subscription identifier renamed to id. 1161 v05 - v06 1163 o JSON examples updated by Reshad. 1165 v04 - v05 1167 o Error mechanisms updated to match embedded RESTCONF mechanisms 1169 o Restructured format and sections of document. 1171 o Added a YANG data model for HTTP specific parameters. 1173 o Mirrored the examples from the NETCONF transport draft to allow 1174 easy comparison. 1176 v03 - v04 1177 o Draft not fully synched to new version of subscribed-notifications 1178 yet. 1180 o References updated 1182 v02 - v03 1184 o Event notification reframed to notification message. 1186 o Tweaks to wording/capitalization/format. 1188 v01 - v02 1190 o Removed sections now redundant with 1191 [I-D.draft-ietf-netconf-subscribed-notifications] and 1192 [I-D.ietf-netconf-yang-push] such as: mechanisms for subscription 1193 maintenance, terminology definitions, stream discovery. 1195 o 3rd party subscriptions are out-of-scope. 1197 o SSE only used with RESTCONF and HTTP1.1 dynamic subscriptions 1199 o Timeframes for event tagging are self-defined. 1201 o Clean-up of wording, references to terminology, section numbers. 1203 v00 - v01 1205 o Removed the ability for more than one subscription to go to a 1206 single HTTP2 stream. 1208 o Updated call flows. Extensively. 1210 o SSE only used with RESTCONF and HTTP1.1 dynamic subscriptions 1212 o HTTP is not used to determine that a receiver has gone silent and 1213 is not Receiving Event Notifications 1215 o Many clean-ups of wording and terminology 1217 Authors' Addresses 1219 Eric Voit 1220 Cisco Systems 1222 Email: evoit@cisco.com 1223 Reshad Rahman 1224 Cisco Systems 1226 Email: rrahman@cisco.com 1228 Einar Nilsen-Nygaard 1229 Cisco Systems 1231 Email: einarnn@cisco.com 1233 Alexander Clemm 1234 Huawei 1236 Email: ludwig@clemm.org 1238 Andy Bierman 1239 YumaWorks 1241 Email: andy@yumaworks.com