idnits 2.17.1 draft-ietf-netconf-subscribed-notifications-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 656 has weird spacing: '...ntifier sub...' == Line 682 has weird spacing: '...ntifier sub...' == Line 1265 has weird spacing: '...ntifier sub...' == Line 1300 has weird spacing: '...ntifier sub...' == Line 1317 has weird spacing: '...ntifier sub...' == (4 more instances...) -- The document date (July 2, 2018) is 2096 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) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) -- Possible downref: Non-RFC (?) normative reference: ref. 'XPATH' -- Obsolete informational reference (is this intentional?): RFC 7540 (Obsoleted by RFC 9113) Summary: 1 error (**), 0 flaws (~~), 7 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 NETCONF E. Voit 3 Internet-Draft Cisco Systems 4 Intended status: Standards Track A. Clemm 5 Expires: January 3, 2019 Huawei 6 A. Gonzalez Prieto 7 VMWare 8 E. Nilsen-Nygaard 9 A. Tripathy 10 Cisco Systems 11 July 2, 2018 13 Customized Subscriptions to a Publisher's Event Streams 14 draft-ietf-netconf-subscribed-notifications-14 16 Abstract 18 This document defines a YANG data model and associated mechanisms 19 enabling subscriber-specific subscriptions to a publisher's event 20 streams. Applying these elements allows a subscriber to request for 21 and receive a continuous, custom feed of publisher generated 22 information. 24 Status of This Memo 26 This Internet-Draft is submitted in full conformance with the 27 provisions of BCP 78 and BCP 79. 29 Internet-Drafts are working documents of the Internet Engineering 30 Task Force (IETF). Note that other groups may also distribute 31 working documents as Internet-Drafts. The list of current Internet- 32 Drafts is at https://datatracker.ietf.org/drafts/current/. 34 Internet-Drafts are draft documents valid for a maximum of six months 35 and may be updated, replaced, or obsoleted by other documents at any 36 time. It is inappropriate to use Internet-Drafts as reference 37 material or to cite them other than as "work in progress." 39 This Internet-Draft will expire on January 3, 2019. 41 Copyright Notice 43 Copyright (c) 2018 IETF Trust and the persons identified as the 44 document authors. All rights reserved. 46 This document is subject to BCP 78 and the IETF Trust's Legal 47 Provisions Relating to IETF Documents 48 (https://trustee.ietf.org/license-info) in effect on the date of 49 publication of this document. Please review these documents 50 carefully, as they describe your rights and restrictions with respect 51 to this document. Code Components extracted from this document must 52 include Simplified BSD License text as described in Section 4.e of 53 the Trust Legal Provisions and are provided without warranty as 54 described in the Simplified BSD License. 56 Table of Contents 58 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 59 1.1. Motivation . . . . . . . . . . . . . . . . . . . . . . . 3 60 1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 61 1.3. Solution Overview . . . . . . . . . . . . . . . . . . . . 5 62 1.4. Relationship to RFC-5277 . . . . . . . . . . . . . . . . 6 63 2. Solution . . . . . . . . . . . . . . . . . . . . . . . . . . 6 64 2.1. Event Streams . . . . . . . . . . . . . . . . . . . . . . 7 65 2.2. Event Stream Filters . . . . . . . . . . . . . . . . . . 7 66 2.3. QoS . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 67 2.4. Dynamic Subscriptions . . . . . . . . . . . . . . . . . . 9 68 2.5. Configured Subscriptions . . . . . . . . . . . . . . . . 16 69 2.6. Event Record Delivery . . . . . . . . . . . . . . . . . . 23 70 2.7. Subscription State Notifications . . . . . . . . . . . . 24 71 2.8. Subscription Monitoring . . . . . . . . . . . . . . . . . 30 72 2.9. Advertisement . . . . . . . . . . . . . . . . . . . . . . 31 73 3. YANG Data Model Trees . . . . . . . . . . . . . . . . . . . . 31 74 3.1. Event Streams Container . . . . . . . . . . . . . . . . . 31 75 3.2. Filters Container . . . . . . . . . . . . . . . . . . . . 32 76 3.3. Subscriptions Container . . . . . . . . . . . . . . . . . 32 77 4. Data Model . . . . . . . . . . . . . . . . . . . . . . . . . 34 78 5. Considerations . . . . . . . . . . . . . . . . . . . . . . . 61 79 5.1. IANA Considerations . . . . . . . . . . . . . . . . . . . 61 80 5.2. Implementation Considerations . . . . . . . . . . . . . . 61 81 5.3. Transport Requirements . . . . . . . . . . . . . . . . . 62 82 5.4. Security Considerations . . . . . . . . . . . . . . . . . 63 83 6. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 66 84 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 66 85 7.1. Normative References . . . . . . . . . . . . . . . . . . 66 86 7.2. Informative References . . . . . . . . . . . . . . . . . 68 87 Appendix A. Changes between revisions . . . . . . . . . . . . . 69 88 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 73 90 1. Introduction 92 This document defines a YANG data model and associated mechanisms 93 enabling subscriber-specific subscriptions to a publisher's event 94 streams. Effectively this enables a 'subscribe then publish' 95 capability where the customized information needs and access 96 permissions of each target receiver are understood by the publisher 97 before subscribed event records are marshaled and pushed. The 98 receiver then gets a continuous, custom feed of publisher generated 99 information. 101 While the functionality defined in this document is transport- 102 agnostic, transports like NETCONF [RFC6241] or RESTCONF [RFC8040] can 103 be used to configure or dynamically signal subscriptions, and there 104 are bindings defined for subscribed event record delivery for NETCONF 105 within [I-D.draft-ietf-netconf-netconf-event-notifications], and for 106 HTTP2 or HTTP1.1 within [I-D.draft-ietf-netconf-restconf-notif]. 108 The YANG model in this document conforms to the Network Management 109 Datastore Architecture defined in [RFC8342]. 111 1.1. Motivation 113 Various limitations in [RFC5277] are discussed in [RFC7923]. 114 Resolving these issues is the primary motivation for this work. Key 115 capabilities supported by this document include: 117 o multiple subscriptions on a single transport session 119 o support for dynamic and configured subscriptions 121 o modification of an existing subscription in progress 123 o per-subscription operational counters 125 o negotiation of subscription parameters (through the use of hints 126 returned as part of declined subscription requests) 128 o subscription state change notifications (e.g., publisher driven 129 suspension, parameter modification) 131 o independence from transport 133 1.2. Terminology 135 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 136 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 137 "OPTIONAL" in this document are to be interpreted as described in BCP 138 14 [RFC2119] [RFC8174] when, and only when, they appear in all 139 capitals, as shown here. 141 Client: defined in [RFC8342]. 143 Configuration: defined in [RFC8342]. 145 Configuration datastore: defined in [RFC8342]. 147 Configured subscription: A subscription installed via configuration 148 into a configuration datastore. 150 Dynamic subscription: A subscription created dynamically by a 151 subscriber via a remote procedure call. 153 Event: An occurrence of something that may be of interest. Examples 154 include a configuration change, a fault, a change in status, crossing 155 a threshold, or an external input to the system. 157 Event occurrence time: a timestamp matching the time an originating 158 process identified as when an event happened. 160 Event record: A set of information detailing an event. 162 Event stream: A continuous, chronologically ordered set of events 163 aggregated under some context. 165 Event stream filter: Evaluation criteria which may be applied against 166 event records within an event stream. Event records pass the filter 167 when specified criteria are met. 169 Notification message: Information intended for a receiver indicating 170 that one or more event(s) have occurred. 172 Publisher: An entity responsible for streaming notification messages 173 per the terms of a subscription. 175 Receiver: A target to which a publisher pushes subscribed event 176 records. For dynamic subscriptions, the receiver and subscriber are 177 the same entity. 179 Subscriber: A client able to request and negotiate a contract for the 180 generation and push of event records from a publisher. For dynamic 181 subscriptions, the receiver and subscriber are the same entity. 183 Subscription: A contract with a publisher, stipulating which 184 information one or more receivers wish to have pushed from the 185 publisher without the need for further solicitation. 187 All YANG tree diagrams used in this document follow the notation 188 defined in [RFC8340]. 190 1.3. Solution Overview 192 This document describes a transport agnostic mechanism for 193 subscribing to and receiving content from an event stream within a 194 publisher. This mechanism is through the use of a subscription. 196 Two types of subscriptions are supported: 198 1. Dynamic subscriptions, where a subscriber initiates a 199 subscription negotiation with a publisher via an RPC. If the 200 publisher is able to serve this request, it accepts it, and then 201 starts pushing notification messages back to the subscriber. If 202 the publisher is not able to serve it as requested, then an error 203 response is returned. This response MAY include hints at 204 subscription parameters that, had they been present, would have 205 enabled the dynamic subscription request to be accepted. 207 2. Configured subscriptions, which allow the management of 208 subscriptions via a configuration so that a publisher can send 209 notification messages to a receiver of a configured subscription. 210 Support for configured subscriptions is optional, with its 211 availability advertised via a YANG feature. 213 Additional characteristics differentiating configured from dynamic 214 subscriptions include: 216 o The lifetime of a dynamic subscription is bound by the transport 217 session used to establish it. For connection-oriented stateful 218 transports like NETCONF, the loss of the transport session will 219 result in the immediate termination of any associated dynamic 220 subscriptions. For connectionless or stateless transports like 221 HTTP, a lack of receipt acknowledgment of a sequential set of 222 notification messages and/or keep-alives can be used to trigger a 223 termination of a dynamic subscription. Contrast this to the 224 lifetime of a configured subscription. This lifetime is driven by 225 relevant configuration being present within the publisher's 226 applied configuration. Being tied to configuration operations 227 implies configured subscriptions can be configured to persist 228 across reboots, and implies a configured subscription can persist 229 even when its publisher is fully disconnected from any network. 231 o Configured subscriptions can be modified by any configuration 232 client with write permission on the configuration of the 233 subscription. Dynamic subscriptions can only be modified via an 234 RPC request made by the original subscriber, or a change to 235 configuration data referenced by the subscription. 237 Note that there is no mixing-and-matching of dynamic and configured 238 operations on a single subscription. Specifically, a configured 239 subscription cannot be modified or deleted using RPCs defined in this 240 document. Similarly, a subscription established via RPC cannot be 241 modified through configuration operations. Also note that transport 242 specific transport drafts based on this specification MUST detail the 243 life cycles of both dynamic and configured subscriptions. 245 A publisher MAY terminate a dynamic subscription at any time. 246 Similarly, it MAY decide to temporarily suspend the sending of 247 notification messages for any dynamic subscription, or for one or 248 more receivers of a configured subscription. Such termination or 249 suspension is driven by internal considerations of the publisher. 251 1.4. Relationship to RFC-5277 253 This document is intended to provide a superset of the subscription 254 capabilities initially defined within [RFC5277]. Especially when 255 extending an existing [RFC5277] implementation, it is important to 256 understand what has been reused and what has been replaced. Key 257 relationships between these two documents include: 259 o this document defines a transport independent capability, 260 [RFC5277] is specific to NETCONF. 262 o the data model in this document is used instead of the data model 263 in Section 3.4 of [RFC5277] for the new operations. 265 o the RPC operations in this draft replaces the operation "create- 266 subscription" defined in [RFC5277], section 4. 268 o the message of [RFC5277], Section 4 is used. 270 o the included contents of the "NETCONF" event stream are identical 271 between this document and [RFC5277]. 273 o a publisher MAY implement both the Notification Management Schema 274 and RPCs defined in [RFC5277] and this new document concurrently. 276 o unlike [RFC5277], this document enables a single transport session 277 to intermix of notification messages and RPCs for different 278 subscriptions. 280 2. Solution 282 Per the overview provided in Section 1.3, this section details the 283 overall context, state machines, and subsystems which may be 284 assembled to allow the subscription of events from a publisher. 286 2.1. Event Streams 288 An event stream is a named entity on a publisher which exposes a 289 continuously updating set of event records. Each event stream is 290 available for subscription. It is out of the scope of this document 291 to identify a) how streams are defined (other than the NETCONF 292 stream), b) how event records are defined/generated, and c) how event 293 records are assigned to streams. 295 There is only one reserved event stream name within this document: 296 "NETCONF". The "NETCONF" event stream contains all NETCONF XML event 297 record information supported by the publisher, except for the 298 subscription state notifications described in Section 2.7. Among 299 these included NETCONF XML event records are individual YANG 1.1 300 notifications described in section 7.16 of [RFC7950]. Each of these 301 YANG 1.1 notifications will be treated as a distinct event record. 302 Beyond the "NETCONF" stream, implementations MAY define additional 303 event streams. 305 As event records are created by a system, they may be assigned to one 306 or more streams. The event record is distributed to a subscription's 307 receiver(s) where: (1) a subscription includes the identified stream, 308 and (2) subscription filtering does not exclude the event record from 309 that receiver. 311 Access control permissions may be used to silently exclude event 312 records from within an event stream for which the receiver has no 313 read access. As an example of how this might be accomplished, see 314 [RFC8341] section 3.4.6. Note that per Section 2.7 of this document, 315 subscription state change notifications are never filtered out. 317 If no access control permissions are in place for event records on an 318 event stream, then a receiver MUST be allowed access to all the event 319 records. If subscriber permissions change during the lifecycle of a 320 subscription and event stream access is no longer permitted, then the 321 subscription MUST be terminated. 323 Event records MUST NOT be delivered to a receiver in a different 324 order than they were placed onto an event stream. 326 2.2. Event Stream Filters 328 This document defines an extensible filtering mechanism. The filter 329 itself is a boolean test which is placed on the content of an event 330 record. A 'false' filtering result causes the event message to be 331 excluded from delivery to a receiver. A filter never results in 332 information being stripped from within an event record prior to that 333 event record being encapsulated within a notification message. The 334 two optional event stream filtering syntaxes supported are [XPATH] 335 and subtree [RFC6241]. 337 If no event stream filter is provided within a subscription, all 338 event records on an event stream are to be sent. 340 2.3. QoS 342 This document provide for several QoS parameters. These parameters 343 indicate the treatment of a subscription relative to other traffic 344 between publisher and receiver. Included are: 346 o A "dscp" marking to differentiate prioritization of notification 347 messages during network transit. 349 o A "weighting" so that bandwidth proportional to this weighting can 350 be allocated to this subscription relative to other subscriptions 351 destined for that receiver. 353 o a "dependency" upon another subscription. 355 If the publisher supports the "dscp" feature, then a subscription 356 with a "dscp" leaf MUST result in a corresponding [RFC2474] DSCP 357 marking being placed within the IP header of any resulting 358 notification messages and subscription state change notifications. 360 For the "weighting" parameter, when concurrently dequeuing 361 notification messages from multiple subscriptions to a receiver, the 362 publisher MUST allocate bandwidth to each subscription proportionally 363 to the weights assigned to those subscriptions. "Weighting" is an 364 optional capability of the publisher; support for it is identified 365 via the "qos" feature. 367 If a subscription has the "dependency" parameter set, then any 368 buffered notification messages containing event records selected by 369 the parent subscription MUST be dequeued prior to the notification 370 messages of the dependent subscription. If notification messages 371 have dependencies on each other, the notification message queued the 372 longest MUST go first. If a "dependency" included within an RPC 373 references a subscription which does not exist or is no longer 374 accessible to that subscriber, that "dependency" MUST be silently 375 removed. "Dependency" is an optional capability of the publisher; 376 support for it is identified via the "qos" feature. 378 2.4. Dynamic Subscriptions 380 Dynamic subscriptions are managed via protocol operations (in the 381 form of [RFC7950], Section 7.14 RPCs) made against targets located 382 within the publisher. These RPCs have been designed extensibly so 383 that they may be augmented for subscription targets beyond event 384 streams. For examples of such augmentations, see the RPC 385 augmentations within [I-D.ietf-netconf-yang-push]'s YANG model. 387 2.4.1. Dynamic Subscription State Model 389 Below is the publisher's state machine for a dynamic subscription. 390 Each state is shown in its own box. It is important to note that 391 such a subscription doesn't exist at the publisher until an 392 "establish-subscription" RPC is accepted. The mere request by a 393 subscriber to establish a subscription is insufficient for that 394 subscription to be externally visible. Start and end states are 395 depicted to reflect subscription creation and deletion events. 397 ......... 398 : start : 399 :.......: 400 | 401 establish-subscription 402 | 403 | .-------modify-subscription--------. 404 v v | 405 .-----------. .-----------. 406 .--------. | receiver |--insufficient CPU, b/w-->| receiver | 407 modify- '| active | | suspended | 408 subscription | |<----CPU, b/w sufficient--| | 409 ---------->'-----------' '-----------' 410 | | 411 delete/kill-subscription delete/kill- 412 | subscription 413 v | 414 ......... | 415 : end :<---------------------------------' 416 :.......: 418 Figure 1: Publisher's state for a dynamic subscription 420 Of interest in this state machine are the following: 422 o Successful "establish-subscription" or "modify-subscription" RPCs 423 put the subscription into the active state. 425 o Failed "modify-subscription" RPCs will leave the subscription in 426 its previous state, with no visible change to any streaming 427 updates. 429 o A delete or kill RPC will end the subscription, as will the 430 reaching of a "stop-time". 432 o A publisher may choose to suspend a subscription when there is 433 insufficient CPU or bandwidth available to service the 434 subscription. This is notified to a subscriber with a 435 "subscription-suspended" state change notification. 437 o A suspended subscription may be modified by the subscriber (for 438 example in an attempt to use fewer resources). Successful 439 modification returns the subscription to an active state. 441 o Even without a "modify-subscription" request, a publisher may 442 return a subscription to the active state should the resource 443 constraints become sufficient again. This is announced to the 444 subscriber via the "subscription-resumed" subscription state 445 change notification. 447 2.4.2. Establishing a Dynamic Subscription 449 The "establish-subscription" RPC allows a subscriber to request the 450 creation of a subscription. The transport selected by the subscriber 451 to reach the publisher MUST be able to support multiple "establish- 452 subscription" requests made within the same transport session. 454 The input parameters of the operation are: 456 o A "stream" name which identifies the targeted event stream against 457 which the subscription is applied. 459 o An event stream filter which may reduce the set of event records 460 pushed. 462 o Where the transport used by the RPC supports multiple encodings, 463 an optional "encoding" for the event records pushed. Note: If no 464 "encoding" is included, the encoding of the RPC MUST be used. 466 o An optional "stop-time" for the subscription. If no "stop-time" 467 is present, notification messages will continue to be sent until 468 the subscription is terminated. 470 o An optional "start-time" for the subscription. The "start-time" 471 MUST be in the past and indicates that the subscription is 472 requesting a replay of previously generated information from the 473 event stream. For more on replay, see Section 2.4.2.1. Where 474 there is no "start-time", the subscription starts immediately. 476 If the publisher can satisfy the "establish-subscription" request, it 477 replies with an identifier for the subscription, and then immediately 478 starts streaming notification messages. 480 Below is a tree diagram for "establish-subscription". All objects 481 contained in this tree are described within the included YANG model 482 within Section 4. 484 +---x establish-subscription 485 +---w input 486 | +---w (target) 487 | | +--:(stream) 488 | | +---w (stream-filter)? 489 | | | +--:(by-reference) 490 | | | | +---w stream-filter-ref 491 | | | | stream-filter-ref 492 | | | +--:(within-subscription) 493 | | | +---w (filter-spec)? 494 | | | +--:(stream-subtree-filter) 495 | | | | +---w stream-subtree-filter? 496 | | | | {subtree}? 497 | | | +--:(stream-xpath-filter) 498 | | | +---w stream-xpath-filter? 499 | | | yang:xpath1.0 {xpath}? 500 | | +---w stream stream-ref 501 | | +---w replay-start-time? yang:date-and-time 502 | | {replay}? 503 | +---w stop-time? yang:date-and-time 504 | +---w dscp? inet:dscp {dscp}? 505 | +---w weighting? uint8 {qos}? 506 | +---w dependency? subscription-id {qos}? 507 | +---w encoding? encoding 508 +--ro output 509 +--ro identifier subscription-id 510 +--ro replay-start-time-revision? yang:date-and-time 511 {replay}? 513 Figure 2: establish-subscription RPC tree diagram 515 A publisher MAY reject the "establish-subscription" RPC for many 516 reasons as described in Section 2.4.6. The contents of the resulting 517 RPC error response MAY include details on input parameters which if 518 considered in a subsequent "establish-subscription" RPC, may result 519 in a successful subscription establishment. Any such hints MUST be 520 transported within a yang-data "establish-subscription-stream-error- 521 info" container included within the RPC error response. 523 yang-data establish-subscription-stream-error-info 524 +--ro establish-subscription-stream-error-info 525 +--ro reason? identityref 526 +--ro filter-failure-hint? string 528 Figure 3: establish-subscription RPC yang-data tree diagram 530 2.4.2.1. Requesting a replay of event records 532 Replay provides the ability to establish a subscription which is also 533 capable of passing recently generated event records. In other words, 534 as the subscription initializes itself, it sends any previously 535 generated content from within the target event stream which meets the 536 filter and timeframe criteria. The end of these historical event 537 records is identified via a "replay-completed" state change 538 notification. Any event records generated since the subscription 539 establishment may then follow. For a particular subscription, all 540 event records will be delivered in the order they are placed into the 541 stream. 543 Replay is an optional feature which is dependent on an event stream 544 supporting some form of logging. This document puts no restrictions 545 on the size or form of the log, where it resides within the 546 publisher, or when event record entries in the log are purged. 548 The inclusion of a "replay-start-time" within an "establish- 549 subscription" RPC indicates a replay request. If the "replay-start- 550 time" contains a value that is earlier than what a publisher's 551 retained history supports, then if the subscription is accepted, the 552 actual publisher's revised start time MUST be set in the returned 553 "replay-start-time-revision" object. 555 A "stop-time" parameter may be included in a replay subscription. 556 For a replay subscription, the "stop-time" MAY be earlier than the 557 current time, but MUST be later than the "replay-start-time". 559 If the time the replay starts is later than the time marked within 560 any event records retained within the replay buffer, then the 561 publisher MUST send a "replay-completed" notification immediately 562 after a successful establish-subscription RPC response. 564 If an event stream supports replay, the "replay-support" leaf is 565 present in the "/streams/stream" list entry for the stream. An event 566 stream that does support replay is not expected to have an unlimited 567 supply of saved notifications available to accommodate any given 568 replay request. To assess the timeframe available for replay, 569 subscribers can read the leafs "replay-log-creation-time" and 570 "replay-log-aged-time". See Figure 18 for the YANG tree, and 571 Section 4 for the YANG model describing these elements. The actual 572 size of the replay log at any given time is a publisher specific 573 matter. Control parameters for the replay log are outside the scope 574 of this document. 576 2.4.3. Modifying a Dynamic Subscription 578 The "modify-subscription" operation permits changing the terms of an 579 existing dynamic subscription. Dynamic subscriptions can be modified 580 any number of times. If the publisher accepts the requested 581 modifications, it acknowledges success to the subscriber, then 582 immediately starts sending event records based on the new terms. 584 Subscriptions created by configuration cannot be modified via this 585 RPC. However configuration may be used to modify objects referenced 586 by the subscription (such as a referenced filter). 588 Below is a tree diagram for "modify-subscription". All objects 589 contained in this tree are described within the included YANG model 590 within Section 4. 592 +---x modify-subscription 593 +---w input 594 +---w identifier subscription-id 595 +---w (target) 596 | +--:(stream) 597 | +---w (stream-filter)? 598 | +--:(by-reference) 599 | | +---w stream-filter-ref 600 | | stream-filter-ref 601 | +--:(within-subscription) 602 | +---w (filter-spec)? 603 | +--:(stream-subtree-filter) 604 | | +---w stream-subtree-filter? 605 | | {subtree}? 606 | +--:(stream-xpath-filter) 607 | +---w stream-xpath-filter? 608 | yang:xpath1.0 {xpath}? 609 +---w stop-time? yang:date-and-time 611 Figure 4: modify-subscription RPC tree diagram 613 If the publisher accepts the requested modifications on a currently 614 suspended subscription, the subscription will immediately be resumed 615 (i.e., the modified subscription is returned to the active state.) 616 The publisher MAY immediately suspend this newly modified 617 subscription through the "subscription-suspended" notification before 618 any event records are sent. 620 If the publisher rejects the RPC request, the subscription remains as 621 prior to the request. That is, the request has no impact whatsoever. 622 Rejection of the RPC for any reason is indicated by via RPC error as 623 described in Section 2.4.6. The contents of such a rejected RPC MAY 624 include hints on inputs which (if considered) may result in a 625 successfully modified subscription. These hints MUST be transported 626 within a yang-data "modify-subscription-stream-error-info" container 627 inserted into the RPC error response. 629 Below is a tree diagram for "modify-subscription-RPC-yang-data". All 630 objects contained in this tree are described within the included YANG 631 model within Section 4. 633 yang-data modify-subscription-stream-error-info 634 +--ro modify-subscription-stream-error-info 635 +--ro reason? identityref 636 +--ro filter-failure-hint? string 638 Figure 5: modify-subscription RPC yang-data tree diagram 640 2.4.4. Deleting a Dynamic Subscription 642 The "delete-subscription" operation permits canceling an existing 643 subscription. If the publisher accepts the request, and the 644 publisher has indicated success, the publisher MUST NOT send any more 645 notification messages for this subscription. If the delete request 646 matches a known subscription established on the same transport 647 session, then it MUST be deleted; otherwise it MUST be rejected with 648 no changes to the publisher. 650 Below is a tree diagram for "delete-subscription". All objects 651 contained in this tree are described within the included YANG model 652 within Section 4. 654 +---x delete-subscription 655 +---w input 656 +---w identifier subscription-id 658 Figure 6: delete-subscription RPC tree diagram 660 Dynamic subscriptions can only be deleted via this RPC using the same 661 transport session previously used for subscription establishment. 662 Configured subscriptions cannot be deleted using RPCs. 664 2.4.5. Killing a Dynamic Subscription 666 The "kill-subscription" operation permits an operator to end a 667 dynamic subscription which is not associated with the transport 668 session used for the RPC. A publisher MUST terminate any dynamic 669 subscription identified by RPC request. 671 Configured subscriptions cannot be killed using this RPC. Instead, 672 configured subscriptions are deleted as part of regular configuration 673 operations. Publishers MUST reject any RPC attempt to kill a 674 configured subscription. 676 Below is a tree diagram for "kill-subscription". All objects 677 contained in this tree are described within the included YANG model 678 within Section 4. 680 +---x kill-subscription 681 +---w input 682 +---w identifier subscription-id 684 Figure 7: kill-subscription RPC tree diagram 686 2.4.6. RPC Failures 688 Whenever an RPC is unsuccessful, the publisher returns relevant 689 information as part of the RPC error response. Transport level error 690 processing MUST be done before RPC error processing described in this 691 section. In all cases, RPC error information returned will use 692 existing transport layer RPC structures, such as those seen with 693 NETCONF in [RFC6241] Appendix A, or with RESTCONF in [RFC8040] 694 Section 7.1. These structures MUST be able to encode subscription 695 specific errors identified below and defined within this document's 696 YANG model. 698 As a result of this mixture, how subscription errors are encoded 699 within an RPC error response is transport dependent. Following are 700 valid errors which can occur for each RPC: 702 establish-subscription modify-subscription 703 ---------------------- ------------------- 704 dscp-unavailable filter-unsupported 705 encoding-unsupported insufficient-resources 706 filter-unsupported no-such-subscription 707 history-unavailable 708 insufficient-resources 709 replay-unsupported 711 delete-subscription kill-subscription 712 ---------------------- ---------------------- 713 no-such-subscription no-such-subscription 715 To see a NETCONF based example of an error response from above, see 716 [I-D.draft-ietf-netconf-netconf-event-notifications], Figure 10. 718 There is one final set of transport independent RPC error elements 719 included in the YANG model. These are the following three yang-data 720 structures for failed event stream subscriptions: 722 1. "establish-subscription-stream-error-info": This MUST be returned 723 if an RPC error reason has not been placed elsewhere within the 724 transport portion of a failed "establish-subscription" RPC 725 response. This MUST be sent if hints on how to overcome the RPC 726 error are included. 728 2. "modify-subscription-stream-error-info": This MUST be returned if 729 an RPC error reason has not been placed elsewhere within the 730 transport portion of a failed "modify-subscription" RPC response. 731 This MUST be sent if hints on how to overcome the RPC error are 732 included. 734 3. "delete-subscription-error-info": This MUST be returned if an RPC 735 error reason has not been placed elsewhere within the transport 736 portion of a failed "delete-subscription" or "kill-subscription" 737 RPC response. 739 2.5. Configured Subscriptions 741 A configured subscription is a subscription installed via 742 configuration. Configured subscriptions may be modified by any 743 configuration client with the proper permissions. Subscriptions can 744 be modified or terminated via configuration at any point of their 745 lifetime. Multiple configured subscriptions MUST be supportable over 746 a single transport session. 748 Configured subscriptions have several characteristics distinguishing 749 them from dynamic subscriptions: 751 o persistence across publisher reboots, 753 o persistence even when transport is unavailable, and 755 o an ability to send notification messages to more than one receiver 756 (note that receivers are unaware of the existence of any other 757 receivers.) 759 On the publisher, supporting configured subscriptions is optional and 760 advertised using the "configured" feature. On a receiver of a 761 configured subscription, support for dynamic subscriptions is 762 optional except where replaying missed event records is required. 764 In addition to the subscription parameters available to dynamic 765 subscriptions described in Section 2.4.2, the following additional 766 parameters are also available to configured subscriptions: 768 o A "transport" which identifies the transport protocol to use to 769 connect with all subscription receivers. 771 o One or more receivers, each intended as the destination for event 772 records. Note that each individual receiver is identifiable by 773 its "name". This "name" plus the "transport" are used by a 774 publisher implementation to a parameters needed to establish and 775 maintain a network connection using that transport. 777 o Optional parameters to identify where traffic should egress a 778 publisher: 780 * A "source-interface" which identifies the egress interface to 781 use from the publisher. Publisher support for this is optional 782 and advertised using the "interface-designation" feature. 784 * A "source-address" address, which identifies the IP address to 785 stamp on notification messages destined for the receiver. 787 * A "source-vrf" which identifies the VRF on which to reach 788 receivers. This VRF is a network instance as defined within 789 [I-D.draft-ietf-rtgwg-ni-model]. Publisher support for VRFs is 790 optional and advertised using the "supports-vrf" feature. 792 If none of the above parameters are set, notification messages 793 MUST egress the publisher's default interface. 795 A tree diagram describing these parameters is shown in Figure 20 796 within Section 3.3. All parameters are described within the YANG 797 model in Section 4. 799 2.5.1. Configured Subscription State Model 801 Below is the state machine for a configured subscription on the 802 publisher. This state machine describes the three states (valid, 803 invalid, and concluded), as well as the transitions between these 804 states. Start and end states are depicted to reflect configured 805 subscription creation and deletion events. The creation or 806 modification of a configured subscription initiates an evaluation by 807 the publisher to determine if the subscription is in valid or invalid 808 states. The publisher uses its own criteria in making this 809 determination. If in the valid state, the subscription becomes 810 operational. See (1) in the diagram below. 812 ......... 813 : start :-. 814 :.......: | 815 create .---modify-----.----------------------------------. 816 | | | | 817 V V .-------. ....... .---------. 818 .----[evaluate]--no--->|invalid|-delete->: end :<-delete-|concluded| 819 | '-------' :.....: '---------' 820 |-[evaluate]--no-(2). ^ ^ ^ 821 | ^ | | | | 822 yes | '->unsupportable delete stop-time 823 | modify (subscription- (subscription- (subscription- 824 | | terminated*) terminated*) concluded*) 825 | | | | | 826 (1) | (3) (4) (5) 827 | .---------------------------------------------------------------. 828 '-->| valid | 829 '---------------------------------------------------------------' 831 Legend: 832 dotted boxes: subscription added or removed via configuration 833 dashed boxes: states for a subscription 834 [evaluate]: decision point on whether the subscription is supportable 835 (*): resulting subscription state change notification 837 Figure 8: Publisher state model for a configured subscription 839 A subscription in the valid state may move to the invalid state in 840 one of two ways. First, it may be modified in a way which fails a 841 re-evaluation. See (2) in the diagram. Second, the publisher might 842 determine that the subscription is no longer supportable. This could 843 be for reasons of an unexpected but sustained increase in an event 844 stream's event records, degraded CPU capacity, a more complex 845 referenced filter, or other higher priority subscriptions which have 846 usurped resources. See (3) in the diagram. No matter the case, a 847 "subscription-terminated" notification is sent to any receivers in an 848 active or suspended state. A subscription in the valid state may 849 also transition to the concluded state via (5) if a configured stop 850 time has been reached. In this case, a "subscription-concluded" 851 notification is sent to any receivers in active or suspended states. 852 Finally, a subscription may be deleted by configuration (4). 854 When a subscription is in the valid state, a publisher will attempt 855 to connect with all receivers of a configured subscription and 856 deliver notification messages. Below is the state machine for each 857 receiver of a configured subscription. This receiver state machine 858 is fully contained within the state machine of the configured 859 subscription, and is only relevant when the configured subscription 860 is in the valid state. 862 .-----------------------------------------------------------------. 863 | valid | 864 | .----------. .--------. | 865 | | receiver |---timeout---------------->|receiver| | 866 | |connecting|<----------------reset--(c)|timeout | | 867 | | |<-transport '--------' | 868 | '----------' loss,reset------------------------------. | 869 | (a) | | | 870 | subscription- (b) (b) | 871 | started* .--------. .---------. | 872 | '----->| |(d)-insufficient CPU,------->| | | 873 | |receiver| buffer overflow |receiver | | 874 | subscription-| active | |suspended| | 875 | modified* | |<----CPU, b/w sufficient,-(e)| | | 876 | '---->'--------' subscription-modified* '---------' | 877 '-----------------------------------------------------------------' 879 Legend: 880 dashed boxes which include the word 'receiver' show the possible 881 states for an individual receiver of a valid configured subscription. 882 * indicates a state change notification 884 Figure 9: Receiver state for a configured subscription on a Publisher 886 When a configured subscription first moves to the valid state, the 887 "state" leaf of each receiver is initialized to "connecting". If 888 transport connectivity is not available to any receiver and there are 889 any notification messages to deliver, a transport session is 890 established (e.g., through [RFC8071]). Individual receivers are 891 moved to the active state when a "subscription-started" state change 892 notification is successfully passed to that receiver (a). Event 893 records are only sent to active receivers. Receivers of a configured 894 subscription remain active if both transport connectivity can be 895 verified to the receiver, and event records are not being dropped due 896 to a publisher buffer overflow. The result is that a receiver will 897 remain active on the publisher as long as events aren't being lost, 898 or the receiver cannot be reached. In addition, a configured 899 subscription's receiver MUST be moved to connecting if transport 900 connectivity cannot be achieved, or if the receiver is reset via the 901 "reset" action (b), (c). For more on reset, see Section 2.5.5. 903 A configured subscription's receiver MUST be moved to the suspended 904 state if there is transport connectivity between the publisher and 905 receiver, but notification messages are failing to be delivered due 906 to publisher buffer overflow, or notification messages are not able 907 to be generated for that receiver due to insufficient CPU (d). This 908 is indicated to the receiver by the "subscription-suspended" state 909 change notification. 911 A configured subscription receiver MUST be returned to the active 912 state from the suspended state when notification messages are able to 913 be generated, bandwidth is sufficient to handle the notification 914 messages, and a receiver has successfully been sent a "subscription- 915 resumed" or "subscription-modified" state change notification (e). 916 The choice as to which of these two state change notifications is 917 sent is determined by whether the subscription was modified during 918 the period of suspension. 920 Modification of a configured subscription is possible at any time. A 921 "subscription-modified" state change notification will be sent to all 922 active receivers, immediately followed by notification messages 923 conforming to the new parameters. Suspended receivers will also be 924 informed of the modification. However this notification will await 925 the end of the suspension for that receiver (e). 927 The mechanisms described above are mirrored in the RPCs and 928 notifications within the document. It should be noted that these 929 RPCs and notifications have been designed to be extensible and allow 930 subscriptions into targets other than event streams. For instance, 931 the YANG module defined in Section 5 of [I-D.ietf-netconf-yang-push] 932 augments "/sn:modify-subscription/sn:input/sn:target". 934 2.5.2. Creating a Configured Subscription 936 Configured subscriptions are established using configuration 937 operations against the top-level "subscriptions" subtree. 939 Because there is no explicit association with an existing transport 940 session, configuration operations require additional parameters 941 beyond those of dynamic subscriptions to indicate receivers, and 942 possibly whether the notification messages need to come from a 943 specific egress interface on the publisher. 945 After a subscription is successfully established, the publisher 946 immediately sends a "subscription-started" state change notification 947 to each receiver. It is quite possible that upon configuration, 948 reboot, or even steady-state operations, a transport session may not 949 be currently available to the receiver. In this case, when there is 950 something to transport for an active subscription, transport specific 951 call-home operations will be used to establish the connection. When 952 transport connectivity is available, notification messages may then 953 be pushed. 955 With active configured subscriptions, it is allowable to buffer event 956 records even after a "subscription-started" has been sent. However 957 if events are lost (rather than just delayed) due to replay buffer 958 overflow, a new "subscription-started" must be sent. This new 959 "subscription-started" indicates an event record discontinuity. 961 To see an example of subscription creation using configuration 962 operations over NETCONF, see Appendix A of 963 [I-D.draft-ietf-netconf-netconf-event-notifications]. 965 Note that is possible to configure replay on a configured 966 subscription. This capability is to allow a configured subscription 967 to exist on a system so that event records generated during and 968 following boot can be buffered and pushed as soon as the transport 969 session is established. 971 2.5.3. Modifying a Configured Subscription 973 Configured subscriptions can be modified using configuration 974 operations against the top-level "subscriptions" subtree. 976 If the modification involves adding receivers, added receivers are 977 placed in the connecting state. If a receiver is removed, the state 978 change notification "subscription-terminated" is sent to that 979 receiver if that receiver is active or suspended. 981 If the modification involves changing the policies for the 982 subscription, the publisher sends to currently active receivers a 983 "subscription-modified" notification. For any suspended receivers, a 984 "subscription-modified" notification will be delayed until the 985 receiver is resumed. (Note: in this case, the "subscription- 986 modified" notification informs the receiver that the subscription has 987 been resumed, so no additional "subscription-resumed" need be sent. 988 Also note that if multiple modifications have occurred during the 989 suspension, only the latest one need be sent to the receiver.) 991 2.5.4. Deleting a Configured Subscription 993 Subscriptions can be deleted through configuration against the top- 994 level "subscriptions" subtree. 996 Immediately after a subscription is successfully deleted, the 997 publisher sends to all receivers of that subscription a state change 998 notification stating the subscription has ended (i.e., "subscription- 999 terminated"). 1001 2.5.5. Resetting a Configured Subscription Receiver 1003 It is possible that a configured subscription to a receiver needs to 1004 be reset. This is accomplished via the "reset" action within the 1005 YANG model at "/subscriptions/subscription/receivers/receiver/reset". 1006 This re-initialization may be useful in cases where a publisher has 1007 timed out trying to reach a receiver. When such a reset occurs, a 1008 transport session will be initiated if necessary, and a new 1009 "subscription-started" notification will be sent. This action does 1010 not have any effect on transport connectivity if the needed 1011 connectivity already exists. 1013 2.5.6. Replay for a Configured Subscription 1015 It is possible to do replay on a configured subscription. This is 1016 supported via the configuration of the "configured-replay" object on 1017 the subscription. The setting of this object enables the streaming 1018 of the buffered events for the subscribed stream. All buffered event 1019 which have been retained since the last publisher restart will be 1020 sent. 1022 Replay of events records created since restart is useful. It allows 1023 event records generated before transport connectivity establishment 1024 to be passed to a receiver. Setting the restart time as the earliest 1025 configured replay time precludes possibility of resending of event 1026 records logged prior to publisher restart. It also ensures the same 1027 records will be sent to each configured receiver, regardless of the 1028 speed of transport connectivity establishment to each receiver. 1029 Finally, establishing restart as the earliest potential time for 1030 event records to be included within notification messages, a well- 1031 understood timeframe for replay is defined. 1033 As a result, when any configured subscription receivers become 1034 active, buffered event records will be sent immediately after the 1035 "subscription-started" notification. The leading event record sent 1036 will be the first event record subsequent to the latest of three 1037 different times: the "replay-log-creation-time", "replay-log-aged- 1038 time", or the most recent publisher boot time. The "replay-log- 1039 creation-time" and "replay-log-aged-time" are discussed in 1040 Section 2.4.2.1, and "replay-start-time" in Section 2.7.1. The most 1041 recent publisher boot time ensures that duplicate event records are 1042 not replayed from a previous time the publisher was booted. 1044 It is quite possible that a receiver might want to retrieve event 1045 records from a stream prior to the latest boot. If such records 1046 exist where there is a configured replay, the publisher MUST send the 1047 time of the event record immediately preceding the "replay-start- 1048 time" within the "replay-previous-event-time" leaf. Through the 1049 existence of the "replay-previous-event-time", the receiver will know 1050 that earlier events prior to reboot exist. In addition, if the 1051 subscriber was previously receiving event records with the same 1052 subscription id, the receiver can determine if there was a timegap 1053 where records generated on the publisher were not successully 1054 received. And with this information, the receiver may choose to 1055 dynamically subscribe to retrieve any event records placed into the 1056 stream before the most recent boot time. 1058 All other replay functionality remains the same as with dynamic 1059 subscriptions as described in Section 2.4.2.1. 1061 2.6. Event Record Delivery 1063 Whether dynamic or configured, once a subscription has been set up, 1064 the publisher streams event records via notification messages per the 1065 terms of the subscription. For dynamic subscriptions, notification 1066 messages are sent over the session used to establish the 1067 subscription. For configured subscriptions, notification messages 1068 are sent over the connections specified by the transport and each 1069 receiver of a configured subscription. 1071 A notification message is sent to a receiver when an event record is 1072 not blocked by either the specified filter criteria or receiver 1073 permissions. This notification message MUST be encoded in a 1074 message as defined within [RFC5277], Section 4. And 1075 per [RFC5277]'s "eventTime" object definition, the "eventTime" is 1076 populated with the event occurrence time. 1078 The following example within [RFC7950] section 7.16.3 is an example 1079 of a compliant message: 1081 1083 2007-09-01T10:00:00Z 1084 1085 so-1/2/3.0 1086 up 1087 down 1088 1089 1091 Figure 10: subscribed notification message 1093 When a dynamic subscription has been started or modified, with 1094 "establish-subscription" or "modify-subscription" respectively, event 1095 records matching the newly applied filter criteria MUST NOT be sent 1096 until after the RPC reply has been sent. 1098 When a configured subscription has been started or modified, event 1099 records matching the newly applied filter criteria MUST NOT be sent 1100 until after the "subscription-started" or "subscription-modified" 1101 notifications has been sent, respectively. 1103 2.7. Subscription State Notifications 1105 In addition to sending event records to receivers, a publisher MUST 1106 also send subscription state notifications when events related to 1107 subscription management have occurred. 1109 Subscription state notifications are unlike other notifications in 1110 that they are never included in any stream. Instead, they are 1111 inserted (as defined in this section) within the sequence of 1112 notification messages sent to a particular receiver. Subscription 1113 state notifications cannot be filtered out, they cannot be stored in 1114 replay buffers, and they are delivered only to impacted receivers of 1115 a subscription. The identification of subscription state 1116 notifications is easy to separate from other notification messages 1117 through the use of the YANG extension "subscription-state-notif". 1118 This extension tags a notification as a subscription state 1119 notification. 1121 The complete set of subscription state notifications is described in 1122 the following subsections. 1124 2.7.1. subscription-started 1126 This notification indicates that a configured subscription has 1127 started, and event records may be sent. Included in this state 1128 change notification are all the parameters of the subscription, 1129 except for the receiver(s) addressing information and origin 1130 information indicating where notification messages will egress the 1131 publisher. Note that if a referenced filter from the "filters" 1132 container has been used within the subscription, the notification 1133 still provides the contents of that referenced filter under the 1134 "within-subscription" subtree. 1136 Note that for dynamic subscriptions, no "subscription-started" 1137 notifications are ever sent. 1139 Below is a tree diagram for "subscription-started". All objects 1140 contained in this tree are described within the included YANG model 1141 within Section 4. 1143 +---n subscription-started {configured}? 1144 +--ro identifier 1145 | subscription-id 1146 +--ro (target) 1147 | +--:(stream) 1148 | +--ro (stream-filter)? 1149 | | +--:(by-reference) 1150 | | | +--ro stream-filter-ref 1151 | | | stream-filter-ref 1152 | | +--:(within-subscription) 1153 | | +--ro (filter-spec)? 1154 | | +--:(stream-subtree-filter) 1155 | | | +--ro stream-subtree-filter? 1156 | | | {subtree}? 1157 | | +--:(stream-xpath-filter) 1158 | | +--ro stream-xpath-filter? yang:xpath1.0 1159 | | {xpath}? 1160 | +--ro stream stream-ref 1161 | +--ro replay-start-time? 1162 | | yang:date-and-time {replay}? 1163 | +--ro replay-previous-event-time? 1164 | yang:date-and-time {replay}? 1165 +--ro stop-time? 1166 | yang:date-and-time 1167 +--ro dscp? inet:dscp 1168 | {dscp}? 1169 +--ro weighting? uint8 {qos}? 1170 +--ro dependency? 1171 | subscription-id {qos}? 1172 +--ro transport transport 1173 | {configured}? 1174 +--ro encoding? encoding 1175 +--ro purpose? string 1176 {configured}? 1178 Figure 11: subscription-started notification tree diagram 1180 2.7.2. subscription-modified 1182 This notification indicates that a subscription has been modified by 1183 configuration operations. It is delivered directly after the last 1184 event records processed using the previous subscription parameters, 1185 and before any event records processed after the modification. 1187 Below is a tree diagram for "subscription-modified". All objects 1188 contained in this tree are described within the included YANG model 1189 within Section 4. 1191 +---n subscription-modified 1192 +--ro identifier subscription-id 1193 +--ro (target) 1194 | +--:(stream) 1195 | +--ro (stream-filter)? 1196 | | +--:(by-reference) 1197 | | | +--ro stream-filter-ref stream-filter-ref 1198 | | +--:(within-subscription) 1199 | | +--ro (filter-spec)? 1200 | | +--:(stream-subtree-filter) 1201 | | | +--ro stream-subtree-filter? 1202 | | | {subtree}? 1203 | | +--:(stream-xpath-filter) 1204 | | +--ro stream-xpath-filter? yang:xpath1.0 1205 | | {xpath}? 1206 | +--ro stream stream-ref 1207 | +--ro replay-start-time? yang:date-and-time 1208 | {replay}? 1209 +--ro stop-time? yang:date-and-time 1210 +--ro dscp? inet:dscp {dscp}? 1211 +--ro weighting? uint8 {qos}? 1212 +--ro dependency? subscription-id {qos}? 1213 +--ro transport transport {configured}? 1214 +--ro encoding? encoding 1215 +--ro purpose? string {configured}? 1217 Figure 12: subscription-modified notification tree diagram 1219 A publisher most often sends this notification directly after the 1220 modification of any configuration parameters impacting a configured 1221 subscription. But it may also be sent at two other times: 1223 1. Where a configured subscription has been modified during the 1224 suspension of a receiver, the notification will be delayed until 1225 the receiver's suspension is lifted. In this situation, the 1226 notification indicates that the subscription has been both 1227 modified and resumed. 1229 2. While this state change will most commonly be used with 1230 configured subscriptions, with dynamic subscriptions, there is 1231 also one time this notification will be sent. A "subscription- 1232 modified" state change notification MUST be sent if the contents 1233 of the filter identified by the subscription's "stream-filter- 1234 ref" leaf has changed. 1236 2.7.3. subscription-terminated 1238 This notification indicates that no further event records for this 1239 subscription should be expected from the publisher. A publisher may 1240 terminate the sending event records to a receiver for the following 1241 reasons: 1243 1. Configuration which removes a configured subscription, or a 1244 "kill-subscription" RPC which ends a dynamic subscription. These 1245 are identified via the reason "no-such-subscription". 1247 2. A referenced filter is no longer accessible. This is identified 1248 by "filter-unavailable". 1250 3. The event stream referenced by a subscription is no longer 1251 accessible by the receiver. This is identified by "stream- 1252 unavailable". 1254 4. A suspended subscription has exceeded some timeout. This is 1255 identified by "suspension-timeout". 1257 Each of the reasons above correspond one-to-one with a "reason" 1258 identityref specified within the YANG model. 1260 Below is a tree diagram for "subscription-terminated". All objects 1261 contained in this tree are described within the included YANG model 1262 within Section 4. 1264 +---n subscription-terminated 1265 +--ro identifier subscription-id 1266 +--ro reason identityref 1268 Figure 13: subscription-terminated notification tree diagram 1270 Note: this state change notification MUST be sent to a dynamic 1271 subscription's receiver when the subscription ends unexpectedly. The 1272 cases when this might happen are when a "kill-subscription" RPC is 1273 successful, or when some other event not including the reaching the 1274 subscription's "stop-time" results in a publisher choosing to end the 1275 subscription. 1277 2.7.4. subscription-suspended 1279 This notification indicates that a publisher has suspended the 1280 sending of event records to a receiver, and also indicates the 1281 possible loss of events. Suspension happens when capacity 1282 constraints stop a publisher from serving a valid subscription. The 1283 two conditions where is this possible are: 1285 1. "insufficient-resources" when a publisher is unable to produce 1286 the requested event stream of notification messages, and 1288 2. "unsupportable-volume" when the bandwidth needed to get generated 1289 notification messages to a receiver exceeds a threshold. 1291 These conditions are encoded within the "reason" object. No further 1292 notification will be sent until the subscription resumes or is 1293 terminated. 1295 Below is a tree diagram for "subscription-suspended". All objects 1296 contained in this tree are described within the included YANG model 1297 within Section 4. 1299 +---n subscription-suspended 1300 +--ro identifier subscription-id 1301 +--ro reason identityref 1303 Figure 14: subscription-suspended notification tree diagram 1305 2.7.5. subscription-resumed 1307 This notification indicates that a previously suspended subscription 1308 has been resumed under the unmodified terms previously in place. 1309 Subscribed event records generated after the issuance of this state 1310 change notification may now be sent. 1312 Below is the tree diagram for "subscription-resumed". All objects 1313 contained in this tree are described within the included YANG model 1314 within Section 4. 1316 +---n subscription-resumed 1317 +--ro identifier subscription-id 1319 Figure 15: subscription-resumed notification tree diagram 1321 2.7.6. subscription-completed 1323 This notification indicates that a subscription that includes a 1324 "stop-time" has successfully finished passing event records upon the 1325 reaching of that time. 1327 Below is a tree diagram for "subscription-completed". All objects 1328 contained in this tree are described within the included YANG model 1329 within Section 4. 1331 +---n subscription-completed 1332 +--ro identifier subscription-id 1334 Figure 16: subscription-completed notification tree diagram 1336 2.7.7. replay-completed 1338 This notification indicates that all of the event records prior to 1339 the current time have been passed to a receiver. It is sent before 1340 any notification message containing an event record with a timestamp 1341 later than (1) the "stop-time" or (2) the subscription's start time. 1343 If a subscription contains no "stop-time", or has a "stop-time" that 1344 has not been reached, then after the "replay-completed" notification 1345 has been sent, additional event records will be sent in sequence as 1346 they arise naturally on the publisher. 1348 Below is a tree diagram for "replay-completed". All objects 1349 contained in this tree are described within the included YANG model 1350 within Section 4. 1352 +---n replay-completed 1353 +--ro identifier subscription-id 1355 Figure 17: replay-completed notification tree diagram 1357 2.8. Subscription Monitoring 1359 In the operational datastore, the container "subscriptions" maintains 1360 the state of all dynamic subscriptions, as well as all configured 1361 subscriptions. Using datastore retrieval operations, or subscribing 1362 to the "subscriptions" container [I-D.ietf-netconf-yang-push] allows 1363 the state of subscriptions and their connectivity to receivers to be 1364 monitored. 1366 Each subscription in the operational datastore is represented as a 1367 list element. Included in this list are event counters for each 1368 receiver, the state of each receiver, as well as the subscription 1369 parameters currently in effect. The appearance of the leaf 1370 "configured-subscription-state" indicates that a particular 1371 subscription came into being via configuration. This leaf also 1372 indicates if current state of that subscription is valid, invalid, 1373 and concluded. 1375 To understand the flow of event records within a subscription, there 1376 are two counters available for each configured and dynamic receiver. 1377 The first counter is "count-sent" which shows the quantity of events 1378 actually identified for sending to a receiver. The second counter is 1379 "count-excluded" which shows event records not sent to receiver. 1380 "count-excluded" shows the combined results of both access control 1381 and per-subscription filtering. For configured subscriptions, 1382 counters are reset whenever the subscription is evaluated to valid 1383 (see (1) in Figure 8). 1385 Dynamic subscriptions are removed from the operational datastore once 1386 they expire (reaching stop-time) or when they are terminated. While 1387 many subscription objects are shown as configurable, dynamic 1388 subscriptions are only included within the operational datastore and 1389 as a result are not configurable. 1391 2.9. Advertisement 1393 Publishers supporting this document MUST indicate support of the YANG 1394 model "ietf-subscribed-notifications" within the YANG library of the 1395 publisher. In addition support for optional features "encode-xml", 1396 "encode-json", "configured" "supports-vrf", "qos", "xpath", 1397 "subtree", "interface-designation", "dscp", and "replay" MUST be 1398 indicated if supported. 1400 3. YANG Data Model Trees 1402 This section contains tree diagrams for nodes defined in Section 4. 1403 For tree diagrams of state change notifications, see Section 2.7. Or 1404 for the tree diagrams for the RPCs, see Section 2.4. 1406 3.1. Event Streams Container 1408 A publisher maintains a list of available event streams as 1409 operational data. This list contains both standardized and vendor- 1410 specific event streams. This enables subscribers to discover what 1411 streams a publisher supports. 1413 +--ro streams 1414 +--ro stream* [name] 1415 +--ro name string 1416 +--ro description string 1417 +--ro replay-support? empty {replay}? 1418 +--ro replay-log-creation-time yang:date-and-time {replay}? 1419 +--ro replay-log-aged-time? yang:date-and-time {replay}? 1421 Figure 18: Stream Container tree diagram 1423 Above is a tree diagram for the streams container. All objects 1424 contained in this tree are described within the included YANG model 1425 within Section 4. 1427 3.2. Filters Container 1429 The "filters" container maintains a list of all subscription filters 1430 that persist outside the life-cycle of a single subscription. This 1431 enables pre-defined filters which may be referenced by more than one 1432 subscription. 1434 +--rw filters 1435 +--rw stream-filter* [identifier] 1436 +--rw identifier filter-id 1437 +--rw (filter-spec)? 1438 +--:(stream-subtree-filter) 1439 | +--rw stream-subtree-filter? {subtree}? 1440 +--:(stream-xpath-filter) 1441 +--rw stream-xpath-filter? yang:xpath1.0 {xpath}? 1443 Figure 19: Filter Container tree diagram 1445 Above is a tree diagram for the filters container. All objects 1446 contained in this tree are described within the included YANG model 1447 within Section 4. 1449 3.3. Subscriptions Container 1451 The "subscriptions" container maintains a list of all subscriptions 1452 on a publisher, both configured and dynamic. It can be used to 1453 retrieve information about the subscriptions which a publisher is 1454 serving. 1456 +--rw subscriptions 1457 +--rw subscription* [identifier] 1458 +--rw identifier 1459 | subscription-id 1460 +--rw (target) 1461 | +--:(stream) 1462 | +--rw (stream-filter)? 1463 | | +--:(by-reference) 1464 | | | +--rw stream-filter-ref 1465 | | | stream-filter-ref 1466 | | +--:(within-subscription) 1467 | | +--rw (filter-spec)? 1468 | | +--:(stream-subtree-filter) 1469 | | | +--rw stream-subtree-filter? 1470 | | | {subtree}? 1471 | | +--:(stream-xpath-filter) 1472 | | +--rw stream-xpath-filter? yang:xpath1.0 1473 | | {xpath}? 1474 | +--rw stream stream-ref 1475 | +--ro replay-start-time? 1476 | | yang:date-and-time {replay}? 1477 | +--rw configured-replay? empty 1478 | {configured,replay}? 1479 +--rw stop-time? 1480 | yang:date-and-time 1481 +--rw dscp? inet:dscp 1482 | {dscp}? 1483 +--rw weighting? uint8 {qos}? 1484 +--rw dependency? 1485 | subscription-id {qos}? 1486 +--rw transport transport 1487 | {configured}? 1488 +--rw encoding? encoding 1489 +--rw purpose? string 1490 | {configured}? 1491 +--rw (notification-message-origin)? {configured}? 1492 | +--:(interface-originated) 1493 | | +--rw source-interface? 1494 | | if:interface-ref {interface-designation}? 1495 | +--:(address-originated) 1496 | +--rw source-vrf? 1497 | | -> /ni:network-instances/network-instance/name 1498 | | {supports-vrf}? 1499 | +--rw source-address? 1500 | inet:ip-address-no-zone 1501 +--ro configured-subscription-state? enumeration 1502 | {configured}? 1503 +--rw receivers 1504 +--rw receiver* [name] 1505 +--rw name string 1506 +--ro count-sent? yang:zero-based-counter64 1507 +--ro count-excluded? yang:zero-based-counter64 1508 +--ro state enumeration 1509 +---x reset {configured}? 1510 +--ro output 1511 +--ro time yang:date-and-time 1513 Figure 20: Subscriptions tree diagram 1515 Above is a tree diagram for the subscriptions container. All objects 1516 contained in this tree are described within the included YANG model 1517 within Section 4. 1519 4. Data Model 1521 This module imports typedefs from [RFC6991], [RFC8343], and 1522 [RFC8040], and it references [I-D.draft-ietf-rtgwg-ni-model], 1523 [XPATH], [RFC6241], [RFC7540], [RFC7951] and [RFC7950]. 1525 [ note to the RFC Editor - please replace XXXX within this YANG model 1526 with the number of this document, and XXXY with the number of 1527 [I-D.draft-ietf-rtgwg-ni-model] ] 1529 [ note to the RFC Editor - please replace the two dates within the 1530 YANG module with the date of publication ] 1532 file "ietf-subscribed-notifications@2018-07-02.yang" 1533 module ietf-subscribed-notifications { 1534 yang-version 1.1; 1535 namespace 1536 "urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications"; 1538 prefix sn; 1540 import ietf-inet-types { 1541 prefix inet; 1542 reference 1543 "RFC 6991: Common YANG Data Types"; 1544 } 1545 import ietf-interfaces { 1546 prefix if; 1547 reference 1548 "RFC 8343: A YANG Data Model for Interface Management"; 1549 } 1550 import ietf-network-instance { 1551 prefix ni; 1552 reference 1553 "draft-ietf-rtgwg-ni-model-12: YANG Model for Network Instances"; 1554 } 1555 import ietf-restconf { 1556 prefix rc; 1557 reference 1558 "RFC 8040: RESTCONF Protocol"; 1559 } 1560 import ietf-yang-types { 1561 prefix yang; 1562 reference 1563 "RFC 6991: Common YANG Data Types"; 1564 } 1566 organization "IETF NETCONF (Network Configuration) Working Group"; 1567 contact 1568 "WG Web: 1569 WG List: 1571 Author: Alexander Clemm 1572 1574 Author: Eric Voit 1575 1577 Author: Alberto Gonzalez Prieto 1578 1580 Author: Einar Nilsen-Nygaard 1581 1583 Author: Ambika Prasad Tripathy 1584 "; 1586 description 1587 "Contains a YANG specification for subscribing to event records 1588 and receiving matching content within notification messages. 1590 Copyright (c) 2018 IETF Trust and the persons identified as authors 1591 of the code. All rights reserved. 1593 Redistribution and use in source and binary forms, with or without 1594 modification, is permitted pursuant to, and subject to the license 1595 terms contained in, the Simplified BSD License set forth in Section 1596 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents 1597 (https://trustee.ietf.org/license-info). 1599 This version of this YANG module is part of RFC XXXX; see the RFC 1600 itself for full legal notices."; 1602 revision 2018-07-02 { 1603 description 1604 "Initial version"; 1605 reference 1606 "RFC XXXX: Customized Subscriptions to a Publisher's Event Streams"; 1607 } 1609 /* 1610 * FEATURES 1611 */ 1613 feature configured { 1614 description 1615 "This feature indicates that configuration of subscription is 1616 supported."; 1617 } 1619 feature dscp { 1620 description 1621 "This feature indicates a publisher supports the placement of 1622 suggested prioritization levels for network transport within 1623 notification messages."; 1624 } 1626 feature encode-json { 1627 description 1628 "This feature indicates that JSON encoding of notification 1629 messages is supported."; 1630 } 1632 feature encode-xml { 1633 description 1634 "This feature indicates that XML encoding of notification 1635 messages is supported."; 1636 } 1638 feature interface-designation { 1639 description 1640 "This feature indicates a publisher supports sourcing all receiver 1641 interactions for a configured subscription from a single 1642 designated egress interface."; 1643 } 1645 feature qos { 1646 description 1647 "This feature indicates a publisher supports absolute dependencies 1648 of one subscription's traffic over another, as well as weighted 1649 bandwidth sharing between subscriptions. Both of these are 1650 Quality of Service (QoS) features which allow differentiated 1651 treatment of notification messages between a publisher and a 1652 specific receiver."; 1653 } 1655 feature replay { 1656 description 1657 "This feature indicates that historical event record replay is 1658 supported. With replay, it is possible for past event records to 1659 be streamed in chronological order."; 1660 } 1662 feature subtree { 1663 description 1664 "This feature indicates support for YANG subtree filtering."; 1665 reference "RFC 6241, Section 6."; 1666 } 1668 feature supports-vrf { 1669 description 1670 "This feature indicates a publisher supports VRF configuration 1671 for configured subscriptions. VRF support for dynamic 1672 subscriptions does not require this feature."; 1673 reference "RFC XXXY, Section 6."; 1674 } 1676 feature xpath { 1677 description 1678 "This feature indicates support for xpath filtering."; 1679 reference "http://www.w3.org/TR/1999/REC-xpath-19991116"; 1680 } 1682 /* 1683 * EXTENSIONS 1684 */ 1686 extension subscription-state-notification { 1687 description 1688 "This statement applies only to notifications. It indicates that 1689 the notification is a subscription state notification. Therefore 1690 it does not participate in a regular event stream and does not 1691 need to be specifically subscribed to in order to be received. 1692 This statement can only occur as a substatement to the YANG 1693 'notification' statement. This statement is not for use outside 1694 of this YANG module."; 1695 } 1697 /* 1698 * IDENTITIES 1699 */ 1701 /* Identities for RPC and Notification errors */ 1703 identity delete-subscription-error { 1704 description 1705 "Problem found while attempting to fulfill either a 1706 'delete-subscription' RPC request or a 'kill-subscription' 1707 RPC request."; 1708 } 1710 identity establish-subscription-error { 1711 description 1712 "Problem found while attempting to fulfill an 1713 'establish-subscription' RPC request."; 1714 } 1716 identity modify-subscription-error { 1717 description 1718 "Problem found while attempting to fulfill a 1719 'modify-subscription' RPC request."; 1720 } 1722 identity subscription-suspended-reason { 1723 description 1724 "Problem condition communicated to a receiver as part of a 1725 'subscription-terminated' notification."; 1726 } 1728 identity subscription-terminated-reason { 1729 description 1730 "Problem condition communicated to a receiver as part of a 1731 'subscription-terminated' notification."; 1732 } 1734 identity dscp-unavailable { 1735 base establish-subscription-error; 1736 if-feature "dscp"; 1737 description 1738 "The publisher is unable mark notification messages with a 1739 prioritization information in a way which will be respected during 1740 network transit."; 1741 } 1743 identity encoding-unsupported { 1744 base establish-subscription-error; 1745 description 1746 "Unable to encode notification messages in the desired format."; 1747 } 1749 identity filter-unavailable { 1750 base subscription-terminated-reason; 1751 description 1752 "Referenced filter does not exist. This means a receiver is 1753 referencing a filter which doesn't exist, or to which they do not 1754 have access permissions."; 1755 } 1757 identity filter-unsupported { 1758 base establish-subscription-error; 1759 base modify-subscription-error; 1760 description 1761 "Cannot parse syntax within the filter. This failure can be from 1762 a syntax error, or a syntax too complex to be processed by the 1763 publisher."; 1764 } 1766 identity history-unavailable { 1767 base establish-subscription-error; 1768 if-feature "replay"; 1769 description 1770 "Replay request too far into the past. This means the publisher 1771 does store historic information for the requested stream, but 1772 not back to the requested timestamp."; 1773 } 1775 identity insufficient-resources { 1776 base establish-subscription-error; 1777 base modify-subscription-error; 1778 base subscription-suspended-reason; 1779 description 1780 "The publisher has insufficient resources to support the 1781 requested subscription. An example might be that allocated CPU 1782 is too limited to generate the desired set of notification 1783 messages."; 1784 } 1786 identity no-such-subscription { 1787 base modify-subscription-error; 1788 base delete-subscription-error; 1789 base subscription-terminated-reason; 1790 description 1791 "Referenced subscription doesn't exist. This may be as a result of 1792 a non-existent subscription ID, an ID which belongs to another 1793 subscriber, or an ID for configured subscription."; 1794 } 1796 identity replay-unsupported { 1797 base establish-subscription-error; 1798 if-feature "replay"; 1799 description 1800 "Replay cannot be performed for this subscription. This means the 1801 publisher will not provide the requested historic information from 1802 the event stream via replay to this receiver."; 1803 } 1805 identity stream-unavailable { 1806 base subscription-terminated-reason; 1807 description 1808 "Not a subscribable stream. This means the referenced event stream 1809 is not available for subscription by the receiver."; 1810 } 1812 identity suspension-timeout { 1813 base subscription-terminated-reason; 1814 description 1815 "Termination of previously suspended subscription. The publisher 1816 has eliminated the subscription as it exceeded a time limit for 1817 suspension."; 1818 } 1820 identity unsupportable-volume { 1821 base subscription-suspended-reason; 1822 description 1823 "The publisher does not have the network bandwidth needed to get 1824 the volume of generated information intended for a receiver."; 1825 } 1827 /* Identities for encodings */ 1829 identity configurable-encoding { 1830 description 1831 "If a transport identity derives from this identity, it means 1832 that it supports configurable encodings."; 1833 } 1835 identity encoding { 1836 description 1837 "Base identity to represent data encodings"; 1838 } 1840 identity encode-xml { 1841 base encoding; 1842 if-feature "encode-xml"; 1843 description 1844 "Encode data using XML as described in RFC 7950"; 1845 reference 1846 "RFC 7950 - The YANG 1.1 Data Modeling Language"; 1847 } 1849 identity encode-json { 1850 base encoding; 1851 if-feature "encode-json"; 1852 description 1853 "Encode data using JSON as described in RFC 7951"; 1854 reference 1855 "RFC 7951 - JSON Encoding of Data Modeled with YANG"; 1856 } 1858 /* Identities for transports */ 1859 identity transport { 1860 description 1861 "An identity that represents the underlying mechanism for 1862 passing notification messages."; 1863 } 1865 identity inline-address { 1866 description 1867 "A transport identity can derive from this identity in order to 1868 allow inline definition of the host address in the 1869 'receiver' list"; 1870 } 1872 /* 1873 * TYPEDEFs 1874 */ 1876 typedef encoding { 1877 type identityref { 1878 base encoding; 1879 } 1880 description 1881 "Specifies a data encoding, e.g. for a data subscription."; 1882 } 1884 typedef filter-id { 1885 type string; 1886 description 1887 "A type to identify filters which can be associated with a 1888 subscription."; 1889 } 1891 typedef stream-filter-ref { 1892 type leafref { 1893 path "/sn:filters/sn:stream-filter/sn:identifier"; 1894 } 1895 description 1896 "This type is used to reference an event stream filter."; 1897 } 1899 typedef stream-ref { 1900 type leafref { 1901 path "/sn:streams/sn:stream/sn:name"; 1902 } 1903 description 1904 "This type is used to reference a system-provided stream."; 1905 } 1907 typedef subscription-id { 1908 type uint32; 1909 description 1910 "A type for subscription identifiers."; 1911 } 1913 typedef transport { 1914 type identityref { 1915 base transport; 1916 } 1917 description 1918 "Specifies transport used to send notification messages to a 1919 receiver."; 1920 } 1922 /* 1923 * GROUPINGS 1924 */ 1926 grouping stream-filter-elements { 1927 description 1928 "This grouping defines the base for filters applied to event 1929 streams."; 1930 choice filter-spec { 1931 description 1932 "The content filter specification for this request."; 1933 anydata stream-subtree-filter { 1934 if-feature "subtree"; 1935 description 1936 "Event stream evaluation criteria encoded in the syntax of a 1937 subtree filter as defined in RFC 6241, Section 6. 1939 The subtree filter is applied to the representation of 1940 individual, delineated event records as contained within the 1941 event stream. For example, if the notification message 1942 contains an instance of a notification defined in YANG, then 1943 the top-level element is the name of the YANG notification. 1945 If the subtree filter returns a non-empty node set, the filter 1946 matches the event record, and the event record is included in 1947 the notification message sent to the receivers."; 1948 reference "RFC 6241, Section 6."; 1949 } 1950 leaf stream-xpath-filter { 1951 if-feature "xpath"; 1952 type yang:xpath1.0; 1953 description 1954 "Event stream evaluation criteria encoded in the syntax of 1955 an XPath 1.0 expression. 1957 The XPath expression is evaluated on the representation of 1958 individual, delineated event records as contained within 1959 the event stream. For example, if the notification message 1960 contains an instance of a notification defined in YANG, 1961 then the top-level element is the name of the YANG 1962 notification, and the root node has this top-level element 1963 as the only child. 1965 The result of the XPath expression is converted to a 1966 boolean value using the standard XPath 1.0 rules. If the 1967 boolean value is 'true', the filter matches the event record, 1968 and the event record is included in the notification message 1969 sent to the receivers. 1971 The expression is evaluated in the following XPath context: 1973 o The set of namespace declarations are those in scope on 1974 the 'stream-xpath-filter' leaf element. 1976 o The set of variable bindings is empty. 1978 o The function library is the core function library, and 1979 the XPath functions defined in section 10 in RFC 7950. 1981 o The context node is the root node."; 1982 reference 1983 "http://www.w3.org/TR/1999/REC-xpath-19991116 1984 RFC 7950, Section 10."; 1986 } 1987 } 1988 } 1990 grouping update-qos { 1991 description 1992 "This grouping describes Quality of Service information 1993 concerning a subscription. This information is passed to lower 1994 layers for transport prioritization and treatment"; 1995 leaf dscp { 1996 if-feature "dscp"; 1997 type inet:dscp; 1998 default "0"; 1999 description 2000 "The desired network transport priority level. This is the 2001 priority set on notification messages encapsulating the results 2002 of the subscription. This transport priority is shared for all 2003 receivers of a given subscription."; 2004 } 2005 leaf weighting { 2006 if-feature "qos"; 2007 type uint8 { 2008 range "0 .. 255"; 2009 } 2010 description 2011 "Relative weighting for a subscription. Allows an underlying 2012 transport layer perform informed load balance allocations 2013 between various subscriptions"; 2014 reference 2015 "RFC-7540, section 5.3.2"; 2016 } 2017 leaf dependency { 2018 if-feature "qos"; 2019 type subscription-id; 2020 description 2021 "Provides the 'subscription-id' of a parent subscription which 2022 has absolute precedence should that parent have push updates 2023 ready to egress the publisher. In other words, there should be 2024 no streaming of objects from the current subscription if 2025 the parent has something ready to push. 2027 If a dependency is asserted via configuration or via RPC, but 2028 the referenced 'subscription-id' does not exist, the dependency 2029 is silently discarded. If a referenced subscription is deleted 2030 this dependency is removed."; 2031 reference 2032 "RFC-7540, section 5.3.1"; 2033 } 2034 } 2036 grouping subscription-policy-modifiable { 2037 description 2038 "This grouping describes all objects which may be changed 2039 in a subscription."; 2040 choice target { 2041 mandatory true; 2042 description 2043 "Identifies the source of information against which a 2044 subscription is being applied, as well as specifics on the 2045 subset of information desired from that source."; 2046 case stream { 2047 choice stream-filter { 2048 description 2049 "An event stream filter can be applied to a subscription. 2050 That filter will come either referenced from a global list, 2051 or be provided within the subscription itself."; 2052 case by-reference { 2053 description 2054 "Apply a filter that has been configured separately."; 2055 leaf stream-filter-ref { 2056 type stream-filter-ref; 2057 mandatory true; 2058 description 2059 "References an existing stream filter which is to 2060 be applied to an event stream for the subscription."; 2061 } 2062 } 2063 case within-subscription { 2064 description 2065 "Local definition allows a filter to have the same 2066 lifecycle as the subscription."; 2067 uses stream-filter-elements; 2068 } 2069 } 2070 } 2071 } 2072 leaf stop-time { 2073 type yang:date-and-time; 2074 description 2075 "Identifies a time after which notification messages for a 2076 subscription should not be sent. If 'stop-time' is not present, 2077 the notification messages will continue until the subscription 2078 is terminated. If 'replay-start-time' exists, 'stop-time' must 2079 be for a subsequent time. If 'replay-start-time' doesn't exist, 2080 'stop-time' when established must be for a future time."; 2081 } 2082 } 2084 grouping subscription-policy-dynamic { 2085 description 2086 "This grouping describes the only information concerning a 2087 subscription which can be passed over the RPCs defined in this 2088 model."; 2089 uses subscription-policy-modifiable { 2090 augment target/stream { 2091 description 2092 "Adds additional objects which can be modified by RPC."; 2093 leaf stream { 2094 type stream-ref { 2095 require-instance false; 2096 } 2097 mandatory true; 2098 description 2099 "Indicates the event stream to be considered for 2100 this subscription."; 2101 } 2102 leaf replay-start-time { 2103 if-feature "replay"; 2104 type yang:date-and-time; 2105 config false; 2106 description 2107 "Used to trigger the replay feature for a dynamic 2108 subscription, with event records being selected needing to 2109 be at or after the start at the time specified. If 2110 'replay-start-time' is not present, this is not a replay 2111 subscription and event record push should start immediately. 2112 It is never valid to specify start times that are later than 2113 or equal to the current time."; 2114 } 2115 } 2116 } 2117 uses update-qos; 2118 } 2120 grouping subscription-policy { 2121 description 2122 "This grouping describes the full set of policy information 2123 concerning both dynamic and configured subscriptions, with the 2124 exclusion of both receivers and networking information specific to 2125 the publisher such as what interface should be used to transmit 2126 notification messages."; 2127 uses subscription-policy-dynamic; 2128 leaf transport { 2129 if-feature "configured"; 2130 type transport; 2131 mandatory true; 2132 description 2133 "This leaf specifies the transport used to deliver 2134 messages destined to all receivers of a subscription."; 2135 } 2136 leaf encoding { 2137 when 'not(../transport) or derived-from(../transport, 2138 "sn:configurable-encoding")'; 2139 type encoding; 2140 description 2141 "The type of encoding for notification messages. For a 2142 dynamic subscription, if not included as part of an establish- 2143 subscription RPC, the encoding will be populated with the 2144 encoding used by that RPC. For a configured subscription, if 2145 not explicitly configured the encoding with be the default 2146 encoding for an underlying transport."; 2147 } 2148 leaf purpose { 2149 if-feature "configured"; 2150 type string; 2151 description 2152 "Open text allowing a configuring entity to embed the 2153 originator or other specifics of this subscription."; 2154 } 2155 } 2157 /* 2158 * RPCs 2159 */ 2161 rpc establish-subscription { 2162 description 2163 "This RPC allows a subscriber to create (and possibly negotiate) 2164 a subscription on its own behalf. If successful, the 2165 subscription remains in effect for the duration of the 2166 subscriber's association with the publisher, or until the 2167 subscription is terminated. In case an error occurs, or the 2168 publisher cannot meet the terms of a subscription, an RPC error 2169 is returned, the subscription is not created. In that case, the 2170 RPC reply's 'error-info' MAY include suggested parameter settings 2171 that would have a higher likelihood of succeeding in a subsequent 2172 'establish-subscription' request."; 2173 input { 2174 uses subscription-policy-dynamic; 2175 leaf encoding { 2176 type encoding; 2177 description 2178 "The type of encoding for the subscribed data. If not 2179 included as part of the RPC, the encoding MUST be set by the 2180 publisher to be the encoding used by this RPC."; 2181 } 2182 } 2183 output { 2184 leaf identifier { 2185 type subscription-id; 2186 mandatory true; 2187 description 2188 "Identifier used for this subscription."; 2189 } 2190 leaf replay-start-time-revision { 2191 if-feature "replay"; 2192 type yang:date-and-time; 2193 description 2194 "If a replay has been requested, this represents the 2195 earliest time covered by the event buffer for the requested 2196 stream. The value of this object is the 2197 'replay-log-aged-time' if it exists. Otherwise it is the 2198 'replay-log-creation-time'. All buffered event records 2199 after this time will be replayed to a receiver. This 2200 object will only be sent if the starting time has been 2201 revised to be later than the time requested by the 2202 subscriber."; 2203 } 2204 } 2205 } 2207 rc:yang-data establish-subscription-stream-error-info { 2208 container establish-subscription-stream-error-info { 2209 description 2210 "If any 'establish-subscription' RPC parameters are 2211 unsupportable against the event stream, a subscription is not 2212 created and the RPC error response MUST indicate the reason 2213 why the subscription failed to be created. This yang-data MAY be 2214 inserted as structured data within a subscription's RPC error 2215 response to indicate the failure reason. This yang-data MUST be 2216 inserted if hints are to be provided back to the subscriber."; 2217 leaf reason { 2218 type identityref { 2219 base establish-subscription-error; 2220 } 2221 description 2222 "Indicates the reason why the subscription has failed to 2223 be created to a targeted stream."; 2224 } 2225 leaf filter-failure-hint { 2226 type string; 2227 description 2228 "Information describing where and/or why a provided filter 2229 was unsupportable for a subscription."; 2230 } 2231 } 2232 } 2234 rpc modify-subscription { 2235 description 2236 "This RPC allows a subscriber to modify a dynamic subscription's 2237 parameters. If successful, the changed subscription 2238 parameters remain in effect for the duration of the subscription, 2239 until the subscription is again modified, or until the 2240 subscription is terminated. In case of an error or an inability 2241 to meet the modified parameters, the subscription is not modified 2242 and the original subscription parameters remain in effect. 2243 In that case, the RPC error MAY include 'error-info' suggested 2244 parameter hints that would have a high likelihood of succeeding 2245 in a subsequent 'modify-subscription' request. A successful 2246 'modify-subscription' will return a suspended subscription to an 2247 'active' state."; 2248 input { 2249 leaf identifier { 2250 type subscription-id; 2251 mandatory true; 2252 description 2253 "Identifier to use for this subscription."; 2254 } 2255 uses subscription-policy-modifiable; 2256 } 2257 } 2259 rc:yang-data modify-subscription-stream-error-info { 2260 container modify-subscription-stream-error-info { 2261 description 2262 "This yang-data MAY be provided as part of a subscription's RPC 2263 error response when there is a failure of a 2264 'modify-subscription' RPC which has been made against a 2265 stream. This yang-data MUST be used if hints are to be 2266 provided back to the subscriber."; 2267 leaf reason { 2268 type identityref { 2269 base modify-subscription-error; 2270 } 2271 description 2272 "Information in a 'modify-subscription' RPC error response 2273 which indicates the reason why the subscription to an event 2274 stream has failed to be modified."; 2275 } 2276 leaf filter-failure-hint { 2277 type string; 2278 description 2279 "Information describing where and/or why a provided filter 2280 was unsupportable for a subscription."; 2281 } 2282 } 2283 } 2285 rpc delete-subscription { 2286 description 2287 "This RPC allows a subscriber to delete a subscription that 2288 was previously created from by that same subscriber using the 2289 'establish-subscription' RPC. 2291 If an error occurs, the server replies with an 'rpc-error' where 2292 the 'error-info' field MAY contain an 2293 'delete-subscription-error-info' structure."; 2294 input { 2295 leaf identifier { 2296 type subscription-id; 2297 mandatory true; 2298 description 2299 "Identifier of the subscription that is to be deleted. 2300 Only subscriptions that were created using 2301 'establish-subscription' from the same origin as this RPC 2302 can be deleted via this RPC."; 2303 } 2304 } 2305 } 2307 rpc kill-subscription { 2308 description 2309 "This RPC allows an operator to delete a dynamic subscription 2310 without restrictions on the originating subscriber or underlying 2311 transport session. 2313 If an error occurs, the server replies with an 'rpc-error' where 2314 the 'error-info' field MAY contain an 2315 'delete-subscription-error-info' structure."; 2316 input { 2317 leaf identifier { 2318 type subscription-id; 2319 mandatory true; 2320 description 2321 "Identifier of the subscription that is to be deleted. Only 2322 subscriptions that were created using 2323 'establish-subscription' can be deleted via this RPC."; 2324 } 2325 } 2326 } 2328 rc:yang-data delete-subscription-error-info { 2329 container delete-subscription-error-info { 2330 description 2331 "If a 'delete-subscription' RPC or a 'kill-subscription' RPC 2332 fails, the subscription is not deleted and the RPC error 2333 response MUST indicate the reason for this failure. This 2334 yang-data MAY be inserted as structured data within a 2335 subscription's RPC error response to indicate the failure 2336 reason."; 2337 leaf reason { 2338 type identityref { 2339 base delete-subscription-error; 2340 } 2341 mandatory true; 2342 description 2343 "Indicates the reason why the subscription has failed to be 2344 deleted."; 2345 } 2346 } 2347 } 2349 /* 2350 * NOTIFICATIONS 2351 */ 2353 notification replay-completed { 2354 sn:subscription-state-notification; 2355 if-feature "replay"; 2356 description 2357 "This notification is sent to indicate that all of the replay 2358 notifications have been sent. It must not be sent for any other 2359 reason."; 2360 leaf identifier { 2361 type subscription-id; 2362 mandatory true; 2363 description 2364 "This references the affected subscription."; 2365 } 2366 } 2368 notification subscription-completed { 2369 sn:subscription-state-notification; 2370 if-feature "configured"; 2371 description 2372 "This notification is sent to indicate that a subscription has 2373 finished passing event records, as the 'stop-time' has been 2374 reached."; 2375 leaf identifier { 2376 type subscription-id; 2377 mandatory true; 2378 description 2379 "This references the gracefully completed subscription."; 2380 } 2381 } 2382 notification subscription-modified { 2383 sn:subscription-state-notification; 2384 description 2385 "This notification indicates that a subscription has been 2386 modified. Notification messages sent from this point on will 2387 conform to the modified terms of the subscription. For 2388 completeness, this state change notification includes both 2389 modified and non-modified aspects of a subscription."; 2390 leaf identifier { 2391 type subscription-id; 2392 mandatory true; 2393 description 2394 "This references the affected subscription."; 2395 } 2396 uses subscription-policy { 2397 refine "target/stream/stream-filter/within-subscription" { 2398 description 2399 "Filter applied to the subscription. If the 2400 'stream-filter-ref' is populated, the filter within the 2401 subscription came from the 'filters' container. Otherwise it 2402 is populated in-line as part of the subscription."; 2403 } 2404 } 2405 } 2407 notification subscription-resumed { 2408 sn:subscription-state-notification; 2409 description 2410 "This notification indicates that a subscription that had 2411 previously been suspended has resumed. Notifications will once 2412 again be sent. In addition, a 'subscription-resumed' indicates 2413 that no modification of parameters has occurred since the last 2414 time event records have been sent."; 2415 leaf identifier { 2416 type subscription-id; 2417 mandatory true; 2418 description 2419 "This references the affected subscription."; 2420 } 2421 } 2423 notification subscription-started { 2424 sn:subscription-state-notification; 2425 if-feature "configured"; 2426 description 2427 "This notification indicates that a subscription has started and 2428 notifications are beginning to be sent. This notification shall 2429 only be sent to receivers of a subscription; it does not 2430 constitute a general-purpose notification."; 2431 leaf identifier { 2432 type subscription-id; 2433 mandatory true; 2434 description 2435 "This references the affected subscription."; 2436 } 2437 uses subscription-policy { 2438 refine "target/stream/replay-start-time" { 2439 description 2440 "Indicates the time that a replay using for the streaming of 2441 buffered event records. This will be populated with the most 2442 recent of the following: 'replay-log-creation-time', 2443 'replay-log-aged-time', 'replay-start-time', or the most 2444 recent publisher boot time."; 2445 } 2446 refine "target/stream/stream-filter/within-subscription" { 2447 description 2448 "Filter applied to the subscription. If the 2449 'stream-filter-ref' is populated, the filter within the 2450 subscription came from the 'filters' container. Otherwise it 2451 is populated in-line as part of the subscription."; 2452 } 2453 augment "target/stream" { 2454 description 2455 "This augmentation adds additional parameters specific to a 2456 subscription-started notification."; 2457 leaf replay-previous-event-time { 2458 when "../replay-start-time"; 2459 if-feature "replay"; 2460 type yang:date-and-time; 2461 description 2462 "If there is at least one event in the replay buffer prior 2463 to 'replay-start-time', this gives the time of the event 2464 generated immediately prior to the 'replay-start-time'. 2466 If a receiver previously received event records for this 2467 configured subscription, it can compare this time to the 2468 last event record previously received. If the two are not 2469 the same (perhaps due to a reboot), then a dynamic replay 2470 can be initiated to acquire any missing event records."; 2471 } 2472 } 2473 } 2474 } 2476 notification subscription-suspended { 2477 sn:subscription-state-notification; 2478 description 2479 "This notification indicates that a suspension of the 2480 subscription by the publisher has occurred. No further 2481 notifications will be sent until the subscription resumes. 2482 This notification shall only be sent to receivers of a 2483 subscription; it does not constitute a general-purpose 2484 notification."; 2485 leaf identifier { 2486 type subscription-id; 2487 mandatory true; 2488 description 2489 "This references the affected subscription."; 2490 } 2491 leaf reason { 2492 type identityref { 2493 base subscription-suspended-reason; 2494 } 2495 mandatory true; 2496 description 2497 "Identifies the condition which resulted in the suspension."; 2498 } 2499 } 2501 notification subscription-terminated { 2502 sn:subscription-state-notification; 2503 description 2504 "This notification indicates that a subscription has been 2505 terminated."; 2506 leaf identifier { 2507 type subscription-id; 2508 mandatory true; 2509 description 2510 "This references the affected subscription."; 2511 } 2512 leaf reason { 2513 type identityref { 2514 base subscription-terminated-reason; 2515 } 2516 mandatory true; 2517 description 2518 "Identifies the condition which resulted in the termination ."; 2519 } 2520 } 2522 /* 2523 * DATA NODES 2524 */ 2526 container streams { 2527 config false; 2528 description 2529 "This container contains information on the built-in streams 2530 provided by the publisher."; 2531 list stream { 2532 key "name"; 2533 description 2534 "Identifies the built-in event streams that are supported by the 2535 publisher."; 2536 leaf name { 2537 type string; 2538 description 2539 "A handle for a system-provided event stream made up of a 2540 sequential set of event records, each of which is 2541 characterized by its own domain and semantics."; 2542 } 2543 leaf description { 2544 type string; 2545 mandatory true; 2546 description 2547 "A description of the event stream, including such information 2548 as the type of event records that are available within this 2549 event stream."; 2550 } 2551 leaf replay-support { 2552 if-feature "replay"; 2553 type empty; 2554 description 2555 "Indicates that event record replay is available on this 2556 stream."; 2557 } 2558 leaf replay-log-creation-time { 2559 when "../replay-support"; 2560 if-feature "replay"; 2561 type yang:date-and-time; 2562 mandatory true; 2563 description 2564 "The timestamp of the creation of the log used to support the 2565 replay function on this stream. This time might be earlier 2566 than the earliest available information contained in the log. 2567 This object is updated if the log resets for some reason."; 2568 } 2569 leaf replay-log-aged-time { 2570 if-feature "replay"; 2571 type yang:date-and-time; 2572 description 2573 "The timestamp associated with last event record which has 2574 been aged out of the log. This timestamp identifies how far 2575 back into history this replay log extends, if it doesn't 2576 extend back to the 'replay-log-creation-time'. This object 2577 MUST be present if replay is supported and any event records 2578 have been aged out of the log."; 2579 } 2580 } 2581 } 2583 container filters { 2584 description 2585 "This container contains a list of configurable filters 2586 that can be applied to subscriptions. This facilitates 2587 the reuse of complex filters once defined."; 2588 list stream-filter { 2589 key "identifier"; 2590 description 2591 "A list of pre-configured filters that can be applied to 2592 subscriptions."; 2593 leaf identifier { 2594 type filter-id; 2595 description 2596 "An identifier to differentiate between filters."; 2597 } 2598 uses stream-filter-elements; 2599 } 2600 } 2602 container subscriptions { 2603 description 2604 "Contains the list of currently active subscriptions, i.e. 2605 subscriptions that are currently in effect, used for subscription 2606 management and monitoring purposes. This includes subscriptions 2607 that have been setup via RPC primitives as well as subscriptions 2608 that have been established via configuration."; 2609 list subscription { 2610 key "identifier"; 2611 description 2612 "The identity and specific parameters of a subscription. 2613 Subscriptions within this list can be created using a control 2614 channel or RPC, or be established through configuration. 2616 If configuration operations or the 'kill-subscription' RPC are 2617 used to delete a subscription, a 'subscription-terminated' 2618 message is sent to any active or suspended receivers."; 2619 leaf identifier { 2620 type subscription-id; 2621 description 2622 "Identifier of a subscription; unique within a publisher"; 2623 } 2624 uses subscription-policy { 2625 refine "target/stream/stream" { 2626 description 2627 "Indicates the event stream to be considered for this 2628 subscription. If an event stream has been removed, 2629 and no longer can be referenced by an active subscription, 2630 send a 'subscription-terminated' notification with 2631 'stream-unavailable' as the reason. If a configured 2632 subscription refers to a non-existent stream, move that 2633 subscription to the 'invalid' state."; 2634 } 2635 augment "target/stream" { 2636 description 2637 "Enables objects to added to a configured stream 2638 subscription"; 2639 leaf configured-replay { 2640 if-feature "configured"; 2641 if-feature "replay"; 2642 type empty; 2643 description 2644 "The presence of this leaf indicates that replay for the 2645 configured subscription should start at the earliest time 2646 in the event log, or at the publisher boot time, which 2647 ever is later."; 2648 } 2649 } 2650 } 2651 choice notification-message-origin { 2652 if-feature "configured"; 2653 description 2654 "Identifies the egress interface on the publisher from which 2655 notification messages are to be sent."; 2656 case interface-originated { 2657 description 2658 "When notification messages to egress a specific, designated 2659 interface on the publisher."; 2660 leaf source-interface { 2661 if-feature "interface-designation"; 2662 type if:interface-ref; 2663 description 2664 "References the interface for notification messages."; 2665 } 2666 } 2667 case address-originated { 2668 description 2669 "When notification messages are to depart from a publisher 2670 using specific originating address and/or routing context 2671 information."; 2672 leaf source-vrf { 2673 if-feature "supports-vrf"; 2674 type leafref { 2675 path "/ni:network-instances/ni:network-instance/ni:name"; 2676 } 2677 description 2678 "VRF from which notification messages should egress a 2679 publisher."; 2680 } 2681 leaf source-address { 2682 type inet:ip-address-no-zone; 2683 description 2684 "The source address for the notification messages. If a 2685 source VRF exists, but this object doesn't, a publisher's 2686 default address for that VRF must be used."; 2687 } 2688 } 2689 } 2690 leaf configured-subscription-state { 2691 if-feature "configured"; 2692 type enumeration { 2693 enum valid { 2694 value 1; 2695 description 2696 "Connection is active and healthy."; 2697 } 2698 enum invalid { 2699 value 2; 2700 description 2701 "The subscription as a whole is unsupportable with its 2702 current parameters."; 2703 } 2704 enum concluded { 2705 value 3; 2706 description 2707 "A subscription is inactive as it has hit a stop time, 2708 but not yet been removed from configuration."; 2709 } 2710 } 2711 config false; 2712 description 2713 "The presence of this leaf indicates that the subscription 2714 originated from configuration, not through a control channel 2715 or RPC. The value indicates the system established state 2716 of the subscription."; 2717 } 2718 container receivers { 2719 description 2720 "Set of receivers in a subscription."; 2721 list receiver { 2722 key "name"; 2723 min-elements 1; 2724 description 2725 "A host intended as a recipient for the notification 2726 messages of a subscription. For configured subscriptions, 2727 transport specific network parameters (or a leafref to 2728 those parameters) may augmentated to a specific receiver 2729 within this list."; 2730 leaf name { 2731 type string; 2732 description 2733 "Identifies a unique receiver for a subscription."; 2734 } 2735 leaf count-sent { 2736 type yang:zero-based-counter64; 2737 config false; 2738 description 2739 "The number of event records sent to the receiver. The 2740 count is initialized when a dynamic subscription is 2741 established, or when a configured subscription 2742 transitions to the valid state."; 2743 } 2744 leaf count-excluded { 2745 type yang:zero-based-counter64; 2746 config false; 2747 description 2748 "The number of event records explicitly removed either 2749 via an event stream filter or an access control filter so 2750 that they are not passed to a receiver. This count is 2751 set to zero each time 'count-sent' is initialized."; 2752 } 2753 leaf state { 2754 type enumeration { 2755 enum active { 2756 value 1; 2757 description 2758 "Receiver is currently being sent any applicable 2759 notification messages for the subscription."; 2760 } 2761 enum suspended { 2762 value 2; 2763 description 2764 "Receiver state is 'suspended', so the publisher 2765 is currently unable to provide notification messages 2766 for the subscription."; 2767 } 2768 enum connecting { 2769 value 3; 2770 if-feature "configured"; 2771 description 2772 "A subscription has been configured, but a 2773 'subscription-started' state change notification needs 2774 to be successfully received before notification 2775 messages are sent. 2777 If the 'reset' action is invoked for a receiver of an 2778 active configured subscription, the state must be 2779 moved to 'connecting'."; 2780 } 2781 enum timeout { 2782 value 4; 2783 if-feature "configured"; 2784 description 2785 "A subscription has failed in sending a subscription 2786 started state change to the receiver. 2787 Additional attempts at connection attempts are not 2788 currently being made."; 2789 } 2790 } 2791 config false; 2792 mandatory true; 2793 description 2794 "Specifies the state of a subscription from the 2795 perspective of a particular receiver. With this info it 2796 is possible to determine whether a subscriber is currently 2797 generating notification messages intended for that 2798 receiver."; 2799 } 2800 action reset { 2801 if-feature "configured"; 2802 description 2803 "Allows the reset of this configured subscription receiver 2804 to the 'connecting' state. This enables the 2805 connection process to be re-initiated."; 2806 output { 2807 leaf time { 2808 type yang:date-and-time; 2809 mandatory true; 2810 description 2811 "Time a publisher returned the receiver to a 2812 'connecting' state."; 2813 } 2815 } 2816 } 2817 } 2818 } 2819 } 2820 } 2821 } 2823 2825 5. Considerations 2827 5.1. IANA Considerations 2829 This document registers the following namespace URI in the "IETF XML 2830 Registry" [RFC3688]: 2832 URI: urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications 2833 Registrant Contact: The IESG. 2834 XML: N/A; the requested URI is an XML namespace. 2836 This document registers the following YANG module in the "YANG Module 2837 Names" registry [RFC6020]: 2839 Name: ietf-subscribed-notifications 2840 Namespace: urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications 2841 Prefix: sn 2842 Reference: draft-ietf-netconf-ietf-subscribed-notifications-11.txt 2843 (RFC form) 2845 5.2. Implementation Considerations 2847 To support deployments including both configured and dynamic 2848 subscriptions, it is recommended to split subscription identifiers 2849 into static and dynamic halves. That way it eliminates the 2850 possibility of collisions if the configured subscriptions attempt to 2851 set a subscription-id which might have already been dynamically 2852 allocated. A best practice is to use lower half the "identifier" 2853 object's integer space when that "identifier" is assigned by an 2854 external entity (such as with a configured subscription). This 2855 leaves the upper half of subscription identifiers available to be 2856 dynamically assigned by the publisher. 2858 If a subscription is unable to marshal a series of filtered event 2859 records into transmittable notification messages, the receiver should 2860 be suspended with the reason "unsupportable-volume". 2862 For configured subscriptions, operations are against the set of 2863 receivers using the subscription identifier as a handle for that set. 2864 But for streaming updates, state change notifications are local to a 2865 receiver. In this specification it is the case that receivers get no 2866 information from the publisher about the existence of other 2867 receivers. But if a network operator wants to let the receivers 2868 correlate results, it is useful to use the subscription identifier 2869 across the receivers to allow that correlation. 2871 For configured replay subscriptions, the receiver is protected from 2872 duplicated events being pushed after a publisher is rebooted. 2873 However it is possible that a receiver might want to acquire event 2874 records which failed to be delivered just prior to the reboot. 2875 Delivering these event records be accomplished by leveraging the 2876 "eventTime" from the last event record received prior to the receipt 2877 of a "subscription-started" state change notification. With this 2878 "eventTime" and the "replay-start-time" from the "subscription- 2879 started" notification, an independent dynamic subscription can be 2880 established which retrieves any event records which may have been 2881 generated but not sent to the receiver. 2883 5.3. Transport Requirements 2885 This section provides requirements for any subscribed notification 2886 transport supporting the solution presented in this document. 2888 For both configured and dynamic subscriptions the publisher MUST 2889 authenticate a receiver via some transport level mechanism before 2890 sending any event records for which they are authorized to see. In 2891 addition, the receiver MUST authenticate the publisher at the 2892 transport level. The result is mutual authentication between the 2893 two. 2895 A secure transport is highly recommended and the publisher MUST 2896 ensure that the receiver has sufficient authorization to perform the 2897 function they are requesting against the specific subset of content 2898 involved. 2900 A specific transport specification built upon this document may or 2901 may not choose to require the use of the same logical channel for the 2902 RPCs and the event records. However the event records and the 2903 subscription state notifications MUST be sent on the same transport 2904 session to ensure the properly ordered delivery. 2906 Additional transport requirements will be dictated by the choice of 2907 transport used with a subscription. For an example of such 2908 requirements with NETCONF transport, see 2909 [I-D.draft-ietf-netconf-netconf-event-notifications]. 2911 5.4. Security Considerations 2913 The YANG module specified in this document defines a schema for data 2914 that is designed to be accessed via network management transports 2915 such as NETCONF [RFC6241] or RESTCONF [RFC8040]. The lowest NETCONF 2916 layer is the secure transport layer, and the mandatory-to-implement 2917 secure transport is Secure Shell (SSH) [RFC6242]. The lowest 2918 RESTCONF layer is HTTPS, and the mandatory-to-implement secure 2919 transport is TLS [RFC5246]. 2921 The NETCONF Access Control Model (NACM) [RFC8341] provides the means 2922 to restrict access for particular NETCONF or RESTCONF users to a 2923 preconfigured subset of all available NETCONF or RESTCONF operations 2924 and content. 2926 One subscription identifier can be used for two or more receivers of 2927 the same configured subscription. But due to the possibility of 2928 different access control permissions per receiver, it cannot be 2929 assumed that each receiver is getting identical updates. 2931 With configured subscriptions, one or more publishers could be used 2932 to overwhelm a receiver. Notification messages SHOULD NOT be sent to 2933 any receiver which does not support this specification. Receivers 2934 that do not want notification messages need only terminate or refuse 2935 any transport sessions from the publisher. 2937 When a receiver of a configured subscription gets a new 2938 "subscription-started" message for a known subscription where it is 2939 already consuming events, the receiver SHOULD retrieve any event 2940 records generated since the last event record was received. This can 2941 be accomplish by establishing a separate dynamic replay subscription 2942 with the same filtering criteria with the publisher", assuming the 2943 publisher supports the "replay" feature. 2945 There are a number of data nodes defined in this YANG module that are 2946 writable/creatable/deletable (i.e., config true, which is the 2947 default). These data nodes may be considered sensitive or vulnerable 2948 in some network environments. Write operations (e.g., edit-config) 2949 to these data nodes without proper protection can have a negative 2950 effect on network operations. These are the subtrees and data nodes 2951 where there is a specific sensitivity/vulnerability: 2953 Container: "/filters" 2955 o "stream-subtree-filter": updating a filter could increase the 2956 computational complexity of all referencing subscriptions. 2958 o "stream-xpath-filter": updating a filter could increase the 2959 computational complexity of all referencing subscriptions. 2961 Container: "/subscriptions" 2963 The following considerations are only relevant for configuration 2964 operations made upon configured subscriptions: 2966 o "configured-replay": can be used to send a large number of event 2967 records to a receiver. 2969 o "dependency": can be used to force important traffic to be queued 2970 behind less important updates. 2972 o "dscp": if unvalidated, can result in the sending of traffic with 2973 a higher priority marking than warranted. 2975 o "identifier": can overwrite an existing subscription, perhaps one 2976 configured by another entity. 2978 o "name": can be used to attempt to send traffic to an unwilling 2979 receiver. 2981 o "replay-start-time": can be used to push very large logs, wasting 2982 resources. 2984 o "source-address": the configured address might not be able to 2985 reach a desired receiver. 2987 o "source-interface": the configured interface might not be able to 2988 reach a desired receiver. 2990 o "source-vrf": can place a subscription into a virtual network 2991 where receivers are not entitled to view the subscribed content. 2993 o "stop-time": could be used to terminate content at an inopportune 2994 time. 2996 o "stream": could set a subscription to an event stream containing 2997 no content permitted for the targeted receivers. 2999 o "stream-filter-ref": could be set to a filter which is irrelevant 3000 to the event stream. 3002 o "stream-subtree-filter": a complex filter can increase the 3003 computational resources for this subscription. 3005 o "stream-xpath-filter": a complex filter can increase the 3006 computational resources for this subscription. 3008 o "weighting": placing a large weight can overwhelm the dequeuing of 3009 other subscriptions. 3011 Some of the readable data nodes in this YANG module may be considered 3012 sensitive or vulnerable in some network environments. It is thus 3013 important to control read access (e.g., via get, get-config, or 3014 notification) to these data nodes. These are the subtrees and data 3015 nodes and their sensitivity/vulnerability: 3017 Container: "/streams" 3019 o "name": if access control is not properly configured, can expose 3020 system internals to those who should have no access to this 3021 information. 3023 o "replay-support": if access control is not properly configured, 3024 can expose logs to those who should have no access. 3026 Container: "/subscriptions" 3028 o "count-excluded": leaf can provide information about filtered 3029 event records. A network operator should have permissions to know 3030 about such filtering. 3032 o "subscription": different operational teams might have a desire to 3033 set varying subsets of subscriptions. Access control should be 3034 designed to permit read access to just the allowed set. 3036 Some of the RPC operations in this YANG module may be considered 3037 sensitive or vulnerable in some network environments. It is thus 3038 important to control access to these operations. These are the 3039 operations and their sensitivity/vulnerability: 3041 RPC: all 3043 o If a malicious or buggy subscriber sends an unexpectedly large 3044 number of RPCs, the result might be an excessive use of system 3045 resources on the publisher just to determine that these 3046 subscriptions should be declined. In such a situation, 3047 subscription interactions MAY be terminated by terminating the 3048 transport session. 3050 RPC: "delete-subscription" 3052 o No special considerations. 3054 RPC: "establish-subscription" 3056 o Subscriptions could overload a publisher's resources. For this 3057 reason, publishers MUST ensure that they have sufficient resources 3058 to fulfill this request or otherwise reject the request. 3060 RPC: "kill-subscription" 3062 o The "kill-subscription" RPC MUST be secured so that only 3063 connections with administrative rights are able to invoke this 3064 RPC. 3066 RPC: "modify-subscription" 3068 o Subscriptions could overload a publisher's resources. For this 3069 reason, publishers MUST ensure that they have sufficient resources 3070 to fulfill this request or otherwise reject the request. 3072 6. Acknowledgments 3074 For their valuable comments, discussions, and feedback, we wish to 3075 acknowledge Andy Bierman, Tim Jenkins, Martin Bjorklund, Kent Watsen, 3076 Balazs Lengyel, Robert Wilton, Sharon Chisholm, Hector Trevino, Susan 3077 Hares, Michael Scharf, and Guangying Zheng. 3079 7. References 3081 7.1. Normative References 3083 [I-D.draft-ietf-rtgwg-ni-model] 3084 Berger, L., Hopps, C., and A. Lindem, "YANG Network 3085 Instances", draft-ietf-rtgwg-ni-model-12 (work in 3086 progress), March 2018. 3088 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 3089 Requirement Levels", BCP 14, RFC 2119, 3090 DOI 10.17487/RFC2119, March 1997, 3091 . 3093 [RFC2474] Nichols, K., Blake, S., Baker, F., and D. Black, 3094 "Definition of the Differentiated Services Field (DS 3095 Field) in the IPv4 and IPv6 Headers", RFC 2474, 3096 DOI 10.17487/RFC2474, December 1998, 3097 . 3099 [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, 3100 DOI 10.17487/RFC3688, January 2004, 3101 . 3103 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 3104 (TLS) Protocol Version 1.2", RFC 5246, 3105 DOI 10.17487/RFC5246, August 2008, 3106 . 3108 [RFC5277] Chisholm, S. and H. Trevino, "NETCONF Event 3109 Notifications", RFC 5277, DOI 10.17487/RFC5277, July 2008, 3110 . 3112 [RFC6020] Bjorklund, M., Ed., "YANG - A Data Modeling Language for 3113 the Network Configuration Protocol (NETCONF)", RFC 6020, 3114 DOI 10.17487/RFC6020, October 2010, 3115 . 3117 [RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., 3118 and A. Bierman, Ed., "Network Configuration Protocol 3119 (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011, 3120 . 3122 [RFC6242] Wasserman, M., "Using the NETCONF Protocol over Secure 3123 Shell (SSH)", RFC 6242, DOI 10.17487/RFC6242, June 2011, 3124 . 3126 [RFC6991] Schoenwaelder, J., Ed., "Common YANG Data Types", 3127 RFC 6991, DOI 10.17487/RFC6991, July 2013, 3128 . 3130 [RFC7950] Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language", 3131 RFC 7950, DOI 10.17487/RFC7950, August 2016, 3132 . 3134 [RFC7951] Lhotka, L., "JSON Encoding of Data Modeled with YANG", 3135 RFC 7951, DOI 10.17487/RFC7951, August 2016, 3136 . 3138 [RFC8040] Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF 3139 Protocol", RFC 8040, DOI 10.17487/RFC8040, January 2017, 3140 . 3142 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 3143 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 3144 May 2017, . 3146 [RFC8341] Bierman, A. and M. Bjorklund, "Network Configuration 3147 Access Control Model", STD 91, RFC 8341, 3148 DOI 10.17487/RFC8341, March 2018, 3149 . 3151 [RFC8342] Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K., 3152 and R. Wilton, "Network Management Datastore Architecture 3153 (NMDA)", RFC 8342, DOI 10.17487/RFC8342, March 2018, 3154 . 3156 [RFC8343] Bjorklund, M., "A YANG Data Model for Interface 3157 Management", RFC 8343, DOI 10.17487/RFC8343, March 2018, 3158 . 3160 [XPATH] Clark, J. and S. DeRose, "XML Path Language (XPath) 3161 Version 1.0", November 1999, 3162 . 3164 7.2. Informative References 3166 [I-D.draft-ietf-netconf-netconf-event-notifications] 3167 Clemm, Alexander., Voit, Eric., Gonzalez Prieto, Alberto., 3168 Nilsen-Nygaard, E., and A. Tripathy, "NETCONF support for 3169 event notifications", May 2018, 3170 . 3173 [I-D.draft-ietf-netconf-restconf-notif] 3174 Voit, Eric., Clemm, Alexander., Tripathy, A., Nilsen- 3175 Nygaard, E., and Alberto. Gonzalez Prieto, "Restconf and 3176 HTTP transport for event notifications", May 2018, 3177 . 3180 [I-D.ietf-netconf-yang-push] 3181 Clemm, Alexander., Voit, Eric., Gonzalez Prieto, Alberto., 3182 Tripathy, A., Nilsen-Nygaard, E., Bierman, A., and B. 3183 Lengyel, "YANG Datastore Subscription", May 2018, 3184 . 3187 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 3188 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 3189 DOI 10.17487/RFC7540, May 2015, 3190 . 3192 [RFC7923] Voit, E., Clemm, A., and A. Gonzalez Prieto, "Requirements 3193 for Subscription to YANG Datastores", RFC 7923, 3194 DOI 10.17487/RFC7923, June 2016, 3195 . 3197 [RFC8071] Watsen, K., "NETCONF Call Home and RESTCONF Call Home", 3198 RFC 8071, DOI 10.17487/RFC8071, February 2017, 3199 . 3201 [RFC8340] Bjorklund, M. and L. Berger, Ed., "YANG Tree Diagrams", 3202 BCP 215, RFC 8340, DOI 10.17487/RFC8340, March 2018, 3203 . 3205 Appendix A. Changes between revisions 3207 (To be removed by RFC editor prior to publication) 3209 v13 - v14 3211 o Removed the 'address' leaf. 3213 o Replay is now of type 'empty' for configured. 3215 v12 - v13 3217 o Tweaks from Kent's comments 3219 o Referenced in YANG model updated per Tom Petch's comments 3221 o Added leaf replay-previous-event-time 3223 o Renamed the event counters, downshifted the subscription states 3225 v11 - v12 3227 o Tweaks from Kent's, Tim's, and Martin's comments 3229 o Clarified dscp text, and made its own feature 3231 o YANG model tweaks alphabetizing, features. 3233 v10 - v11 3235 o access control filtering of events in streams included to match 3236 RFC5277 behavior 3238 o security considerations updated based on YANG template. 3240 o dependency QoS made non-normative on HTTP2 QoS 3242 o tree diagrams referenced for each figure using them 3244 o reference numbers placed into state machine figures 3245 o broke configured replay into its own section 3247 o many tweaks updates based on LC and YANG doctor reviews 3249 o trees and YANG model reconciled were deltas existed 3251 o new feature for interface originated. 3253 o dscp removed from the qos feature 3255 o YANG model updated in a way which collapses groups only used once 3256 so that they are part of the 'subscriptions' container. 3258 o alternative encodings only allowed for transports which support 3259 them. 3261 v09 - v10 3263 o Typos and tweaks 3265 v08 - v09 3267 o NMDA model supported. Non NMDA version at https://github.com/ 3268 netconf-wg/rfc5277bis/ 3270 o Error mechanism revamped to match to embedded implementations. 3272 o Explicitly identified error codes relevant to each RPC/ 3273 Notification 3275 v07 - v08 3277 o Split YANG trees to separate document subsections. 3279 o Clarified configured state machine based on Balazs comments, and 3280 moved it into the configured subscription subsections. 3282 o Normative reference to Network Instance model for VRF 3284 o One transport for all receivers of configured subscriptions. 3286 o QoS section moved in from yang-push 3288 v06 - v07 3290 o Clarification on state machine for configured subscriptions. 3292 v05 - v06 3293 o Made changes proposed by Martin, Kent, and others on the list. 3294 Most significant of these are stream returned to string (with the 3295 SYSLOG identity removed), intro section on 5277 relationship, an 3296 identity set moved to an enumeration, clean up of definitions/ 3297 terminology, state machine proposed for configured subscriptions 3298 with a clean-up of subscription state options. 3300 o JSON and XML become features. Also Xpath and subtree filtering 3301 become features 3303 o Terminology updates with event records, and refinement of filters 3304 to just event stream filters. 3306 o Encoding refined in establish-subscription so it takes the RPC's 3307 encoding as the default. 3309 o Namespaces in examples fixed. 3311 v04 - v05 3313 o Returned to the explicit filter subtyping of v00 3315 o stream object changed to 'name' from 'stream' 3317 o Cleaned up examples 3319 o Clarified that JSON support needs notification-messages draft. 3321 v03 - v04 3323 o Moved back to the use of RFC5277 one-way notifications and 3324 encodings. 3326 v03 - v04 3328 o Replay updated 3330 v02 - v03 3332 o RPCs and Notification support is identified by the Notification 3333 2.0 capability. 3335 o Updates to filtering identities and text 3337 o New error type for unsupportable volume of updates 3339 o Text tweaks. 3341 v01 - v02 3343 o Subscription status moved under receiver. 3345 v00 - v01 3347 o Security considerations updated 3349 o Intro rewrite, as well as scattered text changes 3351 o Added Appendix A, to help match this to related drafts in progress 3353 o Updated filtering definitions, and filter types in yang file, and 3354 moved to identities for filter types 3356 o Added Syslog as an event stream 3358 o HTTP2 moved in from YANG-Push as a transport option 3360 o Replay made an optional feature for events. Won't apply to 3361 datastores 3363 o Enabled notification timestamp to have different formats. 3365 o Two error codes added. 3367 v01 5277bis - v00 subscribed notifications 3369 o Kill subscription RPC added. 3371 o Renamed from 5277bis to Subscribed Notifications. 3373 o Changed the notification capabilities version from 1.1 to 2.0. 3375 o Extracted create-subscription and other elements of RFC5277. 3377 o Error conditions added, and made specific in return codes. 3379 o Simplified yang model structure for removal of 'basic' grouping. 3381 o Added a grouping for items which cannot be statically configured. 3383 o Operational counters per receiver. 3385 o Subscription-id and filter-id renamed to identifier 3387 o Section for replay added. Replay now cannot be configured. 3389 o Control plane notification renamed to subscription state 3390 notification 3392 o Source address: Source-vrf changed to string, default address 3393 option added 3395 o In yang model: 'info' changed to 'policy' 3397 o Scattered text clarifications 3399 v00 - v01 of 5277bis 3401 o YANG Model changes. New groupings for subscription info to allow 3402 restriction of what is changeable via RPC. Removed notifications 3403 for adding and removing receivers of configured subscriptions. 3405 o Expanded/renamed definitions from event server to publisher, and 3406 client to subscriber as applicable. Updated the definitions to 3407 include and expand on RFC 5277. 3409 o Removal of redundancy with other drafts 3411 o Many other clean-ups of wording and terminology 3413 Authors' Addresses 3415 Eric Voit 3416 Cisco Systems 3418 Email: evoit@cisco.com 3420 Alexander Clemm 3421 Huawei 3423 Email: ludwig@clemm.org 3425 Alberto Gonzalez Prieto 3426 VMWare 3428 Email: agonzalezpri@vmware.com 3430 Einar Nilsen-Nygaard 3431 Cisco Systems 3433 Email: einarnn@cisco.com 3434 Ambika Prasad Tripathy 3435 Cisco Systems 3437 Email: ambtripa@cisco.com