Internet-Draft YANG Notifications Versioning October 2023
Graf, et al. Expires 9 April 2024 [Page]
Workgroup:
Network Working Group
Internet-Draft:
draft-ietf-netconf-yang-notifications-versioning-02
Published:
Intended Status:
Standards Track
Expires:
Authors:
T. Graf
Swisscom
B. Claise
Huawei
A. Huang Feng
INSA-Lyon

Support of Versioning in YANG Notifications Subscription

Abstract

This document extends the YANG notifications subscription mechanism to specify the YANG module semantic version at the subscription. Then, a new extension with the revision and the semantic version of the YANG push subscription state change notification is proposed.

Requirements Language

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on 9 April 2024.

Table of Contents

1. Introduction

In order to process the newly received YANG push notification messages described in section 3.7 of [RFC8641] without querying the Publisher IETF-YANG-LIBRARY each time to understand whether the YANG module(s) semantic has changed at the YANG push receiver, a semantic reference to the YANG module and the XPath or subtree is needed to determine the data types for each field and which part of the YANG module the metrics are expose from.

This specification applies to the YANG push configured subscriptions defined in Section 2.5 of [RFC8639], where a publisher is configured to stream notification out of band, as opposed to dynamic subscriptions defined in Section 2.4 of [RFC8639], where the subscriber can initiate and modify the subscription dynamically in-band. In the latter case, the subscriber knows already all the subscriber YANG-related information, which it has to know in order to configure the subscription.

This semantic reference is available when the subscription is established as described in Section 3.6 of [RFC8641] and being streamed from the publisher to receiver with the subscription state change notifications described in Section 2.7 of [RFC8639] where for each subscription a locally unique subscription ID described in Section 4.3.2 of [RFC8641] is being issued and streamed as metadata with the notification message in the YANG push message header.

The semantics can change between different YANG module revisions. The YANG module version statement is specified in Section 7.1.2 of [RFC6020] and states that the newer revision needs to be backward compatible to the previous revision. Section 3.1 of [I-D.ietf-netmod-yang-module-versioning] specifies that newer semantic versions introduced in [I-D.ietf-netmod-yang-semver] MAY not be backward compatible to the previous version when indicated with non-backwards-compatible keyword.

The YANG notifications subscription mechanism defined in [RFC8641] does not allow to specify the YANG module revision. When a network node is upgraded, the subscribed YANG module revision MAY have updated and might, consequently, break the data processing pipeline since the YANG push receiver may not be aware of this change.

This documents extends the current YANG notifications subscription mechanism to allow to subscribe to a specific revision or latest YANG module semantic version to which the YANG module version needs to be backward compatible to. The subscription state change "subscription-started" and "subscription-modified" notification messages are also extended to include the revision and semantic version.

2. Extend the Datastore Selection

The YANG notifications subscription OPTIONALLY can be restricted to the following YANG module revision for future capabilities:

module:
Restricts the subscription to one or more YANG module names with revision and revision-label together for the related streamed content.
revision:
Restricts the subscription to a specific YANG module revision. Example: "2014-05-08".
revision-label:
Restricts the subscription to the latest compatible YANG module semantic version referenced to. Example: "2.0.0".

When the NETCONF client creates or modifies the subscription using the RPCs establish-subscription and modify-subscription and the NETCONF server does not support the revision or revision-label specified in the RPC request, the NETCONF server MUST return an RPC reply including an <rpc-error> element as defined in Section 4.3 of [RFC6241] with the error information populated as follows:

Table 1: General Subscription Error Identities and Associated "error-tag" Use
Error identity Uses "error-tag"
revision-unsupported invalid-value
revision-label-unsupported invalid-value

Figure 1 provides an example of a "establish-subscription" RPC call with YANG revision and datastore-xpath-filter for periodical subscription. Figure 2 shows the response when the RPC has been accepted by the NETCONF server and Figure 3 the error sent by the NETCONF server when the revision is not supported.

<netconf:rpc message-id="101"
    xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0">
  <establish-subscription
      xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications"
      xmlns:yp="urn:ietf:params:xml:ns:yang:ietf-yang-push">
      xmlns:ypr="urn:ietf:params:xml:ns:yang:ietf-yang-push-revision">
    <yp:datastore
         xmlns:ds="urn:ietf:params:xml:ns:yang:ietf-datastores">
      ds:operational
    </yp:datastore>
    <yp:datastore-xpath-filter
        xmlns:ex="https://example.com/sample-data/1.0">
      /ex:foo
    </yp:datastore-xpath-filter>
    <ypr:module-version>
      <ypr:module-name>ex:foo</ypr:module-name>
      <ypr:revision>2023-09-17</ypr:revision>
    </ypr:module-version>
    <yp:periodic>
      <yp:period>500</yp:period>
    </yp:periodic>
  </establish-subscription>
</netconf:rpc>
Figure 1: RPC Example for an establish-subscription
<rpc-reply message-id="101"
   xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
   <id
     xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
      52
   </id>
</rpc-reply>
Figure 2: RPC Example for a positive establish-subscription response
<rpc-reply message-id="101"
  xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
  xmlns:yp="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-path xmlns:ypr="urn:ietf:params:xml:ns:yang:ietf-yang-push-revision">
    <error-info>
      <yp:establish-subscription-error-datastore>
        <yp:reason xmlns:ypr="urn:ietf:params:xml:ns:yang:ietf-yang-push-revision">
          ypr:revision-unsupported
        </yp:reason>
      </yp:establish-subscription-error-datastore>
    </error-info>
  </rpc-error>
</rpc-reply>
Figure 3: RPC Example for an error establish-subscription response

3. Extend the Subscription State Change Notifications

Besides the Subscription ID and the xpath or sub-tree filter reference as described in Section 2.7 of [RFC8639], the following metadata objects are part of a "subscription-started" or "subscription-modified" subscription state change notification.

module:
Describes the YANG module names for the related streamed content.
revision:
Describes the YANG module revision as specified in Section 7.1.9 of [RFC6020] for the related streamed content.
revision-label:
Describes the YANG module semantic version as specified in [I-D.ietf-netmod-yang-semver] for the related streamed content.

Figure 4 provides an example of a "subscription-modified" subscription state change notification message with the YANG module name, revision, revision label and datastore-xpath-filter for tracking the operational status of a single Ethernet interface (per [RFC8343]). This subscription state change notification message is encoded XML [W3C.REC-xml-20081126] over the Network Configuration Protocol (NETCONF) as per [RFC8640].

<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
  <eventTime>2023-01-03T10:00:00Z</eventTime>
  <subscription-modified
      xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications">
    <id>101</id>
    <stream-xpath-filter
      xmlns:int="urn:ietf:params:xml:ns:yang:ietf-interfaces">
      /int:interfaces
    </stream-xpath-filter>
    <stream>NETCONF</stream>
    <module-version
      xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push-revision">
      <module-name>ietf-interfaces</module-name>
      <revision>2018-02-20</revision>
      <revision-label>2.0.0</revision-label>
    </module-version>
  </subscription-modified>
</notification>
Figure 4: XML Push Example for a subscription-modified notification message

Figure 5 provides an example of a JSON encoded, [RFC8259], subscription state change notification message over HTTPS-based [I-D.ietf-netconf-https-notif] or UDP-based [I-D.ietf-netconf-udp-notif] transport for the same subscription.

{
  "ietf-restconf:notification" : {
    "eventTime": "2023-01-03T10:00:00Z",
    "ietf-subscribed-notifications:subscription-modified": {
      "id": 101,
      "stream-xpath-filter": "/ietf-interfaces:interfaces",
      "stream": "NETCONF",
      "ietf-yang-push-revision:module-version": [{
        "module-name": "ietf-interfaces"
        "revision": "2018-02-20",
        "revision-label": "2.0.0",
      }],
    }
  }
}
Figure 5: JSON Push Example for a subscription-modified notification message

4. The "ietf-yang-push-revision" Module

4.1. Data Model Overview

This YANG module augments the "ietf-yang-push" module with the module-name, revision and revision-label in the "subscription-started" and "subscription-modified" subscription state change notifications and the ability to define the "revision" and "revision-label" in the "establish-subscription" and "modify-subscription" RPCs in the datastore push subscription.

4.1.1. Tree View

The following is the YANG tree diagram [RFC8340] for the ietf-yang-push-revision YANG module

module: ietf-yang-push-revision

  augment /sn:filters/sn:stream-filter:
    +--rw module-version* [module-name]
       +--rw module-name       yang:yang-identifier
       +--rw revision?         rev:revision-date-or-label
       +--rw revision-label?   ysver:version
  augment /sn:filters/yp:selection-filter:
    +--rw module-version* [module-name]
       +--rw module-name       yang:yang-identifier
       +--rw revision?         rev:revision-date-or-label
       +--rw revision-label?   ysver:version
  augment /sn:establish-subscription/sn:input/sn:target/sn:stream
            /sn:stream-filter/sn:within-subscription:
    +-- module-version* [module-name]
       +-- module-name       yang:yang-identifier
       +-- revision?         rev:revision-date-or-label
       +-- revision-label?   ysver:version
  augment /sn:establish-subscription/sn:input/sn:target/yp:datastore
            /yp:selection-filter/yp:within-subscription:
    +-- module-version* [module-name]
       +-- module-name       yang:yang-identifier
       +-- revision?         rev:revision-date-or-label
       +-- revision-label?   ysver:version
  augment /sn:modify-subscription/sn:input/sn:target/sn:stream
            /sn:stream-filter/sn:within-subscription:
    +-- module-version* [module-name]
       +-- module-name       yang:yang-identifier
       +-- revision?         rev:revision-date-or-label
       +-- revision-label?   ysver:version
  augment /sn:modify-subscription/sn:input/sn:target/yp:datastore
            /yp:selection-filter/yp:within-subscription:
    +-- module-version* [module-name]
       +-- module-name       yang:yang-identifier
       +-- revision?         rev:revision-date-or-label
       +-- revision-label?   ysver:version
  augment /sn:subscription-started/sn:target/sn:stream
            /sn:stream-filter/sn:within-subscription:
    +--ro module-version* [module-name]
       +--ro module-name       yang:yang-identifier
       +--ro revision          rev:revision-date-or-label
       +--ro revision-label?   ysver:version
  augment /sn:subscription-started/sn:target/yp:datastore
            /yp:selection-filter/yp:within-subscription:
    +--ro module-version* [module-name]
       +--ro module-name       yang:yang-identifier
       +--ro revision          rev:revision-date-or-label
       +--ro revision-label?   ysver:version
  augment /sn:subscription-modified/sn:target/sn:stream
            /sn:stream-filter/sn:within-subscription:
    +--ro module-version* [module-name]
       +--ro module-name       yang:yang-identifier
       +--ro revision          rev:revision-date-or-label
       +--ro revision-label?   ysver:version
  augment /sn:subscription-modified/sn:target/yp:datastore
            /yp:selection-filter/yp:within-subscription:
    +--ro module-version* [module-name]
       +--ro module-name       yang:yang-identifier
       +--ro revision          rev:revision-date-or-label
       +--ro revision-label?   ysver:version
  augment /sn:subscriptions/sn:subscription/sn:target/sn:stream
            /sn:stream-filter/sn:within-subscription:
    +--rw module-version* [module-name]
       +--rw module-name       yang:yang-identifier
       +--rw revision?         rev:revision-date-or-label
       +--rw revision-label?   ysver:version
  augment /sn:subscriptions/sn:subscription/sn:target/yp:datastore
            /yp:selection-filter/yp:within-subscription:
    +--rw module-version* [module-name]
       +--rw module-name       yang:yang-identifier
       +--rw revision?         rev:revision-date-or-label
       +--rw revision-label?   ysver:version

4.1.2. Full Tree View

The following is the YANG tree diagram [RFC8340] for the ietf-yang-push-revision augmentation within the ietf-subscribed-notifications, including the RPCs and notifications.

module: ietf-yang-push

  rpcs:
    +---x resync-subscription {on-change}?
       +---w input
          +---w id    sn:subscription-id

  notifications:
    +---n push-update
    |  +--ro id?                   sn:subscription-id
    |  +--ro datastore-contents?   <anydata>
    |  +--ro incomplete-update?    empty
    +---n push-change-update {on-change}?
       +--ro id?                  sn:subscription-id
       +--ro datastore-changes
       |  +--ro yang-patch
       |     +--ro patch-id    string
       |     +--ro comment?    string
       |     +--ro edit* [edit-id]
       |        +--ro edit-id      string
       |        +--ro operation    enumeration
       |        +--ro target       target-resource-offset
       |        +--ro point?       target-resource-offset
       |        +--ro where?       enumeration
       |        +--ro value?       <anydata>
       +--ro incomplete-update?   empty

module: ietf-subscribed-notifications
  +--ro streams
  |  +--ro stream* [name]
  |     +--ro name                        string
  |     +--ro description?                string
  |     +--ro replay-support?             empty {replay}?
  |     +--ro replay-log-creation-time    yang:date-and-time {replay}?
  |     +--ro replay-log-aged-time?       yang:date-and-time {replay}?
  +--rw filters
  |  +--rw stream-filter* [name]
  |  |  +--rw name                           string
  |  |  +--rw (filter-spec)?
  |  |  |  +--:(stream-subtree-filter)
  |  |  |  |  +--rw stream-subtree-filter?   <anydata> {subtree}?
  |  |  |  +--:(stream-xpath-filter)
  |  |  |     +--rw stream-xpath-filter?     yang:xpath1.0 {xpath}?
  |  |  +--rw ypr:module-version* [module-name]
  |  |     +--rw ypr:module-name       yang:yang-identifier
  |  |     +--rw ypr:revision?         rev:revision-date-or-label
  |  |     +--rw ypr:revision-label?   ysver:version
  |  +--rw yp:selection-filter* [filter-id]
  |     +--rw yp:filter-id                         string
  |     +--rw (yp:filter-spec)?
  |     |  +--:(yp:datastore-subtree-filter)
  |     |  |  +--rw yp:datastore-subtree-filter?   <anydata>
  |     |  |          {sn:subtree}?
  |     |  +--:(yp:datastore-xpath-filter)
  |     |     +--rw yp:datastore-xpath-filter?     yang:xpath1.0
  |     |             {sn:xpath}?
  |     +--rw ypr:module-version* [module-name]
  |        +--rw ypr:module-name       yang:yang-identifier
  |        +--rw ypr:revision?         rev:revision-date-or-label
  |        +--rw ypr:revision-label?   ysver:version
  +--rw subscriptions
     +--rw subscription* [id]
        +--rw id
        |       subscription-id
        +--rw (target)
        |  +--:(stream)
        |  |  +--rw (stream-filter)?
        |  |  |  +--:(by-reference)
        |  |  |  |  +--rw stream-filter-name
        |  |  |  |          stream-filter-ref
        |  |  |  +--:(within-subscription)
        |  |  |     +--rw (filter-spec)?
        |  |  |     |  +--:(stream-subtree-filter)
        |  |  |     |  |  +--rw stream-subtree-filter?
        |  |  |     |  |          <anydata> {subtree}?
        |  |  |     |  +--:(stream-xpath-filter)
        |  |  |     |     +--rw stream-xpath-filter?
        |  |  |     |             yang:xpath1.0 {xpath}?
        |  |  |     +--rw ypr:module-version* [module-name]
        |  |  |        +--rw ypr:module-name
        |  |  |        |       yang:yang-identifier
        |  |  |        +--rw ypr:revision?
        |  |  |        |       rev:revision-date-or-label
        |  |  |        +--rw ypr:revision-label?   ysver:version
        |  |  +--rw stream
        |  |  |       stream-ref
        |  |  +--ro replay-start-time?
        |  |  |       yang:date-and-time {replay}?
        |  |  +--rw configured-replay?                         empty
        |  |          {configured,replay}?
        |  +--:(yp:datastore)
        |     +--rw yp:datastore
        |     |       identityref
        |     +--rw (yp:selection-filter)?
        |        +--:(yp:by-reference)
        |        |  +--rw yp:selection-filter-ref
        |        |          selection-filter-ref
        |        +--:(yp:within-subscription)
        |           +--rw (yp:filter-spec)?
        |           |  +--:(yp:datastore-subtree-filter)
        |           |  |  +--rw yp:datastore-subtree-filter?
        |           |  |          <anydata> {sn:subtree}?
        |           |  +--:(yp:datastore-xpath-filter)
        |           |     +--rw yp:datastore-xpath-filter?
        |           |             yang:xpath1.0 {sn:xpath}?
        |           +--rw ypr:module-version* [module-name]
        |              +--rw ypr:module-name
        |              |       yang:yang-identifier
        |              +--rw ypr:revision?
        |              |       rev:revision-date-or-label
        |              +--rw ypr:revision-label?   ysver:version
        +--rw stop-time?
        |       yang:date-and-time
        +--rw dscp?
        |       inet:dscp {dscp}?
        +--rw weighting?                                       uint8
        |       {qos}?
        +--rw dependency?
        |       subscription-id {qos}?
        +--rw transport?
        |       transport {configured}?
        +--rw encoding?
        |       encoding
        +--rw purpose?                                         string
        |       {configured}?
        +--rw (notification-message-origin)? {configured}?
        |  +--:(interface-originated)
        |  |  +--rw source-interface?
        |  |          if:interface-ref {interface-designation}?
        |  +--:(address-originated)
        |     +--rw source-vrf?
        |     |       -> /ni:network-instances/network-instance/name
        |     |       {supports-vrf}?
        |     +--rw source-address?
        |             inet:ip-address-no-zone
        +--ro configured-subscription-state?
        |       enumeration {configured}?
        +--rw receivers
        |  +--rw receiver* [name]
        |     +--rw name                      string
        |     +--ro sent-event-records?
        |     |       yang:zero-based-counter64
        |     +--ro excluded-event-records?
        |     |       yang:zero-based-counter64
        |     +--ro state                     enumeration
        |     +---x reset {configured}?
        |        +--ro output
        |           +--ro time    yang:date-and-time
        +--rw (yp:update-trigger)?
           +--:(yp:periodic)
           |  +--rw yp:periodic!
           |     +--rw yp:period         centiseconds
           |     +--rw yp:anchor-time?   yang:date-and-time
           +--:(yp:on-change) {on-change}?
              +--rw yp:on-change!
                 +--rw yp:dampening-period?   centiseconds
                 +--rw yp:sync-on-start?      boolean
                 +--rw yp:excluded-change*    change-type

  rpcs:
    +---x establish-subscription
    |  +---w input
    |  |  +---w (target)
    |  |  |  +--:(stream)
    |  |  |  |  +---w (stream-filter)?
    |  |  |  |  |  +--:(by-reference)
    |  |  |  |  |  |  +---w stream-filter-name
    |  |  |  |  |  |          stream-filter-ref
    |  |  |  |  |  +--:(within-subscription)
    |  |  |  |  |     +---w (filter-spec)?
    |  |  |  |  |     |  +--:(stream-subtree-filter)
    |  |  |  |  |     |  |  +---w stream-subtree-filter?
    |  |  |  |  |     |  |          <anydata> {subtree}?
    |  |  |  |  |     |  +--:(stream-xpath-filter)
    |  |  |  |  |     |     +---w stream-xpath-filter?
    |  |  |  |  |     |             yang:xpath1.0 {xpath}?
    |  |  |  |  |     +---w ypr:module-version* [module-name]
    |  |  |  |  |        +---w ypr:module-name
    |  |  |  |  |        |       yang:yang-identifier
    |  |  |  |  |        +---w ypr:revision?
    |  |  |  |  |        |       rev:revision-date-or-label
    |  |  |  |  |        +---w ypr:revision-label?   ysver:version
    |  |  |  |  +---w stream
    |  |  |  |  |       stream-ref
    |  |  |  |  +---w replay-start-time?
    |  |  |  |          yang:date-and-time {replay}?
    |  |  |  +--:(yp:datastore)
    |  |  |     +---w yp:datastore
    |  |  |     |       identityref
    |  |  |     +---w (yp:selection-filter)?
    |  |  |        +--:(yp:by-reference)
    |  |  |        |  +---w yp:selection-filter-ref
    |  |  |        |          selection-filter-ref
    |  |  |        +--:(yp:within-subscription)
    |  |  |           +---w (yp:filter-spec)?
    |  |  |           |  +--:(yp:datastore-subtree-filter)
    |  |  |           |  |  +---w yp:datastore-subtree-filter?
    |  |  |           |  |          <anydata> {sn:subtree}?
    |  |  |           |  +--:(yp:datastore-xpath-filter)
    |  |  |           |     +---w yp:datastore-xpath-filter?
    |  |  |           |             yang:xpath1.0 {sn:xpath}?
    |  |  |           +---w ypr:module-version* [module-name]
    |  |  |              +---w ypr:module-name
    |  |  |              |       yang:yang-identifier
    |  |  |              +---w ypr:revision?
    |  |  |              |       rev:revision-date-or-label
    |  |  |              +---w ypr:revision-label?   ysver:version
    |  |  +---w stop-time?
    |  |  |       yang:date-and-time
    |  |  +---w dscp?
    |  |  |       inet:dscp {dscp}?
    |  |  +---w weighting?                                       uint8
    |  |  |       {qos}?
    |  |  +---w dependency?
    |  |  |       subscription-id {qos}?
    |  |  +---w encoding?
    |  |  |       encoding
    |  |  +---w (yp:update-trigger)?
    |  |     +--:(yp:periodic)
    |  |     |  +---w yp:periodic!
    |  |     |     +---w yp:period         centiseconds
    |  |     |     +---w yp:anchor-time?   yang:date-and-time
    |  |     +--:(yp:on-change) {on-change}?
    |  |        +---w yp:on-change!
    |  |           +---w yp:dampening-period?   centiseconds
    |  |           +---w yp:sync-on-start?      boolean
    |  |           +---w yp:excluded-change*    change-type
    |  +--ro output
    |     +--ro id                            subscription-id
    |     +--ro replay-start-time-revision?   yang:date-and-time
    |             {replay}?
    +---x modify-subscription
    |  +---w input
    |     +---w id
    |     |       subscription-id
    |     +---w (target)
    |     |  +--:(stream)
    |     |  |  +---w (stream-filter)?
    |     |  |     +--:(by-reference)
    |     |  |     |  +---w stream-filter-name
    |     |  |     |          stream-filter-ref
    |     |  |     +--:(within-subscription)
    |     |  |        +---w (filter-spec)?
    |     |  |        |  +--:(stream-subtree-filter)
    |     |  |        |  |  +---w stream-subtree-filter?
    |     |  |        |  |          <anydata> {subtree}?
    |     |  |        |  +--:(stream-xpath-filter)
    |     |  |        |     +---w stream-xpath-filter?
    |     |  |        |             yang:xpath1.0 {xpath}?
    |     |  |        +---w ypr:module-version* [module-name]
    |     |  |           +---w ypr:module-name
    |     |  |           |       yang:yang-identifier
    |     |  |           +---w ypr:revision?
    |     |  |           |       rev:revision-date-or-label
    |     |  |           +---w ypr:revision-label?   ysver:version
    |     |  +--:(yp:datastore)
    |     |     +---w yp:datastore
    |     |     |       identityref
    |     |     +---w (yp:selection-filter)?
    |     |        +--:(yp:by-reference)
    |     |        |  +---w yp:selection-filter-ref
    |     |        |          selection-filter-ref
    |     |        +--:(yp:within-subscription)
    |     |           +---w (yp:filter-spec)?
    |     |           |  +--:(yp:datastore-subtree-filter)
    |     |           |  |  +---w yp:datastore-subtree-filter?
    |     |           |  |          <anydata> {sn:subtree}?
    |     |           |  +--:(yp:datastore-xpath-filter)
    |     |           |     +---w yp:datastore-xpath-filter?
    |     |           |             yang:xpath1.0 {sn:xpath}?
    |     |           +---w ypr:module-version* [module-name]
    |     |              +---w ypr:module-name
    |     |              |       yang:yang-identifier
    |     |              +---w ypr:revision?
    |     |              |       rev:revision-date-or-label
    |     |              +---w ypr:revision-label?   ysver:version
    |     +---w stop-time?
    |     |       yang:date-and-time
    |     +---w (yp:update-trigger)?
    |        +--:(yp:periodic)
    |        |  +---w yp:periodic!
    |        |     +---w yp:period         centiseconds
    |        |     +---w yp:anchor-time?   yang:date-and-time
    |        +--:(yp:on-change) {on-change}?
    |           +---w yp:on-change!
    |              +---w yp:dampening-period?   centiseconds
    +---x delete-subscription
    |  +---w input
    |     +---w id    subscription-id
    +---x kill-subscription
       +---w input
          +---w id    subscription-id

  notifications:
    +---n replay-completed {replay}?
    |  +--ro id    subscription-id
    +---n subscription-completed {configured}?
    |  +--ro id    subscription-id
    +---n subscription-modified
    |  +--ro id
    |  |       subscription-id
    |  +--ro (target)
    |  |  +--:(stream)
    |  |  |  +--ro (stream-filter)?
    |  |  |  |  +--:(by-reference)
    |  |  |  |  |  +--ro stream-filter-name
    |  |  |  |  |          stream-filter-ref
    |  |  |  |  +--:(within-subscription)
    |  |  |  |     +--ro (filter-spec)?
    |  |  |  |     |  +--:(stream-subtree-filter)
    |  |  |  |     |  |  +--ro stream-subtree-filter?
    |  |  |  |     |  |          <anydata> {subtree}?
    |  |  |  |     |  +--:(stream-xpath-filter)
    |  |  |  |     |     +--ro stream-xpath-filter?
    |  |  |  |     |             yang:xpath1.0 {xpath}?
    |  |  |  |     +--ro ypr:module-version* [module-name]
    |  |  |  |        +--ro ypr:module-name       yang:yang-identifier
    |  |  |  |        +--ro ypr:revision
    |  |  |  |        |       rev:revision-date-or-label
    |  |  |  |        +--ro ypr:revision-label?   ysver:version
    |  |  |  +--ro stream
    |  |  |  |       stream-ref
    |  |  |  +--ro replay-start-time?
    |  |  |          yang:date-and-time {replay}?
    |  |  +--:(yp:datastore)
    |  |     +--ro yp:datastore
    |  |     |       identityref
    |  |     +--ro (yp:selection-filter)?
    |  |        +--:(yp:by-reference)
    |  |        |  +--ro yp:selection-filter-ref
    |  |        |          selection-filter-ref
    |  |        +--:(yp:within-subscription)
    |  |           +--ro (yp:filter-spec)?
    |  |           |  +--:(yp:datastore-subtree-filter)
    |  |           |  |  +--ro yp:datastore-subtree-filter?
    |  |           |  |          <anydata> {sn:subtree}?
    |  |           |  +--:(yp:datastore-xpath-filter)
    |  |           |     +--ro yp:datastore-xpath-filter?
    |  |           |             yang:xpath1.0 {sn:xpath}?
    |  |           +--ro ypr:module-version* [module-name]
    |  |              +--ro ypr:module-name       yang:yang-identifier
    |  |              +--ro ypr:revision
    |  |              |       rev:revision-date-or-label
    |  |              +--ro ypr:revision-label?   ysver:version
    |  +--ro stop-time?
    |  |       yang:date-and-time
    |  +--ro dscp?
    |  |       inet:dscp {dscp}?
    |  +--ro weighting?                                       uint8
    |  |       {qos}?
    |  +--ro dependency?
    |  |       subscription-id {qos}?
    |  +--ro transport?
    |  |       transport {configured}?
    |  +--ro encoding?                                        encoding
    |  +--ro purpose?                                         string
    |  |       {configured}?
    |  +--ro (yp:update-trigger)?
    |     +--:(yp:periodic)
    |     |  +--ro yp:periodic!
    |     |     +--ro yp:period         centiseconds
    |     |     +--ro yp:anchor-time?   yang:date-and-time
    |     +--:(yp:on-change) {on-change}?
    |        +--ro yp:on-change!
    |           +--ro yp:dampening-period?   centiseconds
    |           +--ro yp:sync-on-start?      boolean
    |           +--ro yp:excluded-change*    change-type
    +---n subscription-resumed
    |  +--ro id    subscription-id
    +---n subscription-started {configured}?
    |  +--ro id
    |  |       subscription-id
    |  +--ro (target)
    |  |  +--:(stream)
    |  |  |  +--ro (stream-filter)?
    |  |  |  |  +--:(by-reference)
    |  |  |  |  |  +--ro stream-filter-name
    |  |  |  |  |          stream-filter-ref
    |  |  |  |  +--:(within-subscription)
    |  |  |  |     +--ro (filter-spec)?
    |  |  |  |     |  +--:(stream-subtree-filter)
    |  |  |  |     |  |  +--ro stream-subtree-filter?
    |  |  |  |     |  |          <anydata> {subtree}?
    |  |  |  |     |  +--:(stream-xpath-filter)
    |  |  |  |     |     +--ro stream-xpath-filter?
    |  |  |  |     |             yang:xpath1.0 {xpath}?
    |  |  |  |     +--ro ypr:module-version* [module-name]
    |  |  |  |        +--ro ypr:module-name       yang:yang-identifier
    |  |  |  |        +--ro ypr:revision
    |  |  |  |        |       rev:revision-date-or-label
    |  |  |  |        +--ro ypr:revision-label?   ysver:version
    |  |  |  +--ro stream
    |  |  |  |       stream-ref
    |  |  |  +--ro replay-start-time?
    |  |  |  |       yang:date-and-time {replay}?
    |  |  |  +--ro replay-previous-event-time?
    |  |  |          yang:date-and-time {replay}?
    |  |  +--:(yp:datastore)
    |  |     +--ro yp:datastore
    |  |     |       identityref
    |  |     +--ro (yp:selection-filter)?
    |  |        +--:(yp:by-reference)
    |  |        |  +--ro yp:selection-filter-ref
    |  |        |          selection-filter-ref
    |  |        +--:(yp:within-subscription)
    |  |           +--ro (yp:filter-spec)?
    |  |           |  +--:(yp:datastore-subtree-filter)
    |  |           |  |  +--ro yp:datastore-subtree-filter?
    |  |           |  |          <anydata> {sn:subtree}?
    |  |           |  +--:(yp:datastore-xpath-filter)
    |  |           |     +--ro yp:datastore-xpath-filter?
    |  |           |             yang:xpath1.0 {sn:xpath}?
    |  |           +--ro ypr:module-version* [module-name]
    |  |              +--ro ypr:module-name       yang:yang-identifier
    |  |              +--ro ypr:revision
    |  |              |       rev:revision-date-or-label
    |  |              +--ro ypr:revision-label?   ysver:version
    |  +--ro stop-time?
    |  |       yang:date-and-time
    |  +--ro dscp?
    |  |       inet:dscp {dscp}?
    |  +--ro weighting?                                       uint8
    |  |       {qos}?
    |  +--ro dependency?
    |  |       subscription-id {qos}?
    |  +--ro transport?
    |  |       transport {configured}?
    |  +--ro encoding?                                        encoding
    |  +--ro purpose?                                         string
    |  |       {configured}?
    |  +--ro (yp:update-trigger)?
    |     +--:(yp:periodic)
    |     |  +--ro yp:periodic!
    |     |     +--ro yp:period         centiseconds
    |     |     +--ro yp:anchor-time?   yang:date-and-time
    |     +--:(yp:on-change) {on-change}?
    |        +--ro yp:on-change!
    |           +--ro yp:dampening-period?   centiseconds
    |           +--ro yp:sync-on-start?      boolean
    |           +--ro yp:excluded-change*    change-type
    +---n subscription-suspended
    |  +--ro id        subscription-id
    |  +--ro reason    identityref
    +---n subscription-terminated
       +--ro id        subscription-id
       +--ro reason    identityref

4.2. YANG Module

The YANG module has two leaves augmenting the model of Subscription to YANG Notifications [RFC8639].

<CODE BEGINS> file "ietf-yang-push-revision@2023-09-17.yang"

module ietf-yang-push-revision {
  yang-version 1.1;
  namespace
    "urn:ietf:params:xml:ns:yang:ietf-yang-push-revision";
  prefix ypr;
  import ietf-subscribed-notifications {
    prefix sn;
    reference
      "RFC 8639: Subscription to YANG Notifications";
  }
  import ietf-yang-push {
    prefix yp;
    rev:recommended-min "2019-09-09";
    reference
      "RFC 8641: Subscriptions to YANG Datastores";
  }
  import ietf-yang-revisions {
    prefix rev;
    reference
      "RFC XXXX: draft-ietf-netmod-yang-module-versioning-06,
      Updated YANG Module Revision Handling";
  }
  import ietf-yang-types {
    prefix yang;
    rev:recommended-min "2013-07-15";
    reference
      "RFC 6991: Common YANG Data Types.";
  }
  import ietf-yang-semver {
    prefix ysver;
    reference
      "RFC XXXX: draft-ietf-netmod-yang-semver-08, YANG Semantic
      Versioning";
  }

  organization "IETF NETCONF (Network Configuration) Working Group";
  contact
    "WG Web:   <http:/tools.ietf.org/wg/netconf/>
     WG List:  <mailto:netconf@ietf.org>

     Authors:  Thomas Graf
               <mailto:thomas.graf@swisscom.com>
               Benoit Claise
               <mailto:benoit.claise@huawei.com>
               Alex Huang Feng
               <mailto:alex.huang-feng@insa-lyon.fr>";

  description
    "Defines YANG push event notification header with the revision and
    the revision-label. Adds the support of the revision and
    revision-label selection in the YANG push subscription RPCs.

    Copyright (c) 2023 IETF Trust and the persons identified as
    authors of the code.  All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, is permitted pursuant to, and subject to the license
    terms contained in, the Revised BSD License set forth in Section
    4.c of the IETF Trust's Legal Provisions Relating to IETF Documents
    (https://trustee.ietf.org/license-info).

    This version of this YANG module is part of RFC XXXX; see the RFC
    itself for full legal notices.";

  revision 2023-09-17 {
    description
      "First revision";
    reference
      "RFC XXXX: Support of Versioning in YANG Notifications
      Subscription";
  }

  feature yang-push-revision-supported {
    description
      "This feature indicates the YANG Subscription Notifications
      supports specifying the list of modules, revisions and
      revision-label in the YANG subscription.";
  }

  // Identities
  identity revision-unsupported {
    base sn:establish-subscription-error;
    base sn:modify-subscription-error;
    description
      "Revision not supported.  This failure can be due to subscribing
       to a specific revision not supported by the publisher.";
  }

  identity revision-label-unsupported {
    base sn:establish-subscription-error;
    base sn:modify-subscription-error;
    description
      "Revision-label not supported.  This failure can be due to subscribing
       to a specific revision-label not supported by the publisher.";
  }

  grouping yang-push-module-version-config {
    description
      "This grouping combines the module name, the revision and
      revision-label leaves, with the revision being configurable.";
    leaf module-name {
      type yang:yang-identifier;
      description
        "This references the YANG module name.";
    }
    leaf revision {
      type rev:revision-date-or-label;
      description
        "This references the YANG module revision to be sent in the
        subscription.";
    }
    leaf revision-label {
      type ysver:version;
      description
        "This references the YANG module semversion to be sent in the
        subscription.";
    }
  }

  grouping yang-push-module-version {
    description
      "This grouping combines the module name, the revision and
      revision-label leaves, with the revision being non
      configurable.";
    leaf module-name {
      type yang:yang-identifier;
      config false;
      mandatory true;
      description
        "This references the YANG module name.";
    }
    leaf revision {
      type rev:revision-date-or-label;
      config false;
      mandatory true;
      description
        "This references the YANG module revision of the sent
        notification message.";
    }
    leaf revision-label {
      type ysver:version;
      description
        "This references the YANG module semversion of the sent
        notification message.";
    }
  }

  grouping yang-push-module-version-list {
    description
      "This grouping defines a list of yang-push-module-version
      grouping.";
    list module-version {
      key "module-name";
      config false;
      description
        "List of yang-push-module-version grouping. The revision is
        not configurable.";
      uses ypr:yang-push-module-version;
    }
  }

  grouping yang-push-module-version-config-list {
    description
      "This grouping defines a list of yang-push-module-version-config
      grouping.";
    list module-version {
      key "module-name";
      description
        "List of yang-push-module-version-config grouping. The revision
        is configurable.";
      uses ypr:yang-push-module-version-config;
    }
  }

  // Filters
  augment "/sn:filters/sn:stream-filter" {
    description
      "Augment the filters from subscribed notifications with a list
      of yang-push-module-version-config grouping.";
    uses ypr:yang-push-module-version-config-list;
  }
  augment "/sn:filters/yp:selection-filter" {
    description
      "Augment the filters from YANG push with a list of
      yang-push-module-version grouping.";
    uses ypr:yang-push-module-version-config-list;
  }

  // Subscription parameters
  augment "/sn:establish-subscription/sn:input/sn:target/sn:stream"
        + "/sn:stream-filter/sn:within-subscription" {
    description
      "Augment the establish-subscription RPC from the
      ietf-subscribed-notifications YANG module with the
      yang-push-module-version-config-list grouping.";
    uses ypr:yang-push-module-version-config-list;
  }
  augment "/sn:establish-subscription/sn:input/sn:target"
        + "/yp:datastore/yp:selection-filter/yp:within-subscription" {
    description
      "Augment the establish-subscription RPC from the ietf-yang-push
      YANG module with the yang-push-module-version-config-list
      grouping.";
    uses ypr:yang-push-module-version-config-list;
  }
  augment "/sn:modify-subscription/sn:input/sn:target/sn:stream"
        + "/sn:stream-filter/sn:within-subscription" {
    description
      "Augment the modify-subscription RPC from the
      ietf-subscribed-notifications YANG module with the
      yang-push-module-version-config-list grouping.";
    uses ypr:yang-push-module-version-config-list;
  }
  augment "/sn:modify-subscription/sn:input/sn:target/yp:datastore"
        + "/yp:selection-filter/yp:within-subscription" {
    description
      "Augment the modify-subscription RPC from the ietf-yang-push
      YANG module with the yang-push-module-version-config-list
      grouping.";
    uses ypr:yang-push-module-version-config-list;
  }

  // Subscription notifications
  augment "/sn:subscription-started/sn:target/sn:stream"
        + "/sn:stream-filter/sn:within-subscription" {
    description
      "Augment the subscription-started notification from the
      ietf-subscribed-notifications YANG module with the
      yang-push-module-version-list grouping.";
    uses ypr:yang-push-module-version-list;
  }
  augment "/sn:subscription-started/sn:target/yp:datastore"
        + "/yp:selection-filter/yp:within-subscription" {
    description
      "Augment the subscription-started notification from the
      ietf-yang-push YANG module with the
      yang-push-module-version-list grouping.";
    uses ypr:yang-push-module-version-list;
  }
  augment "/sn:subscription-modified/sn:target/sn:stream"
        + "/sn:stream-filter/sn:within-subscription" {
    description
      "Augment the subscription-modified notification from the
      ietf-subscribed-notifications YANG module with the
      yang-push-module-version-list grouping.";
    uses ypr:yang-push-module-version-list;
  }
  augment "/sn:subscription-modified/sn:target/yp:datastore"
        + "/yp:selection-filter/yp:within-subscription" {
    description
      "Augment the subscription-modified notification from the
      ietf-yang-push YANG module with the
      yang-push-module-version-list grouping.";
    uses ypr:yang-push-module-version-list;
  }

  // Subscription container
  augment "/sn:subscriptions/sn:subscription/sn:target/sn:stream"
        + "/sn:stream-filter/sn:within-subscription" {
    description
      "Augment the subscriptions RPC container from the
      ietf-subscribed-notifications YANG module with the
      yang-push-module-version-config-list grouping.";
    uses ypr:yang-push-module-version-config-list;
  }
  augment "/sn:subscriptions/sn:subscription/sn:target/yp:datastore"
        + "/yp:selection-filter/yp:within-subscription" {
    description
      "Augment the subscription RPC container from ietf-yang-push
      YANG module with the yang-push-module-version-config-list grouping.";
    uses ypr:yang-push-module-version-config-list;
  }
}

<CODE ENDS>

5. IANA Considerations

5.1. IETF XML Registry

This document registers the following URIs in the "IETF XML Registry" [RFC3688]:

  URI: urn:ietf:params:xml:ns:yang:ietf-yang-push-revision
  Registrant Contact: The IESG.
  XML: N/A; the requested URI is an XML namespace.

5.2. YANG Module Name

This document registers the following YANG modules in the "YANG Module Names" registry [RFC6020]:

  name: ietf-yang-push-revision
  namespace: urn:ietf:params:xml:ns:yang:ietf-yang-push-revision
  prefix: ypr
  reference: RFC-to-be

6. Operational Considerations

A YANG package [I-D.ietf-netmod-yang-packages], specifies a versioned organizational structure used to manage a set of YANG modules that collectively defines a package schema. For example, a YANG package could contain a set of YANG modules required to implement a L3VPN service on a network node. It offers therefore a complementary information to the solution in this draft by describing how one specific YANG module revision is part of a set of YANG modules.

7. Security Considerations

The security considerations for the YANG notifications subscription mechanism are described in [RFC8641]. This documents adds no additional security considerations.

8. Acknowledgements

The authors would like to thank Qiufang Ma and Robert Wilton for their review and valuable comments.

9. References

9.1. Normative References

[I-D.ietf-netmod-yang-module-versioning]
Wilton, R., Rahman, R., Lengyel, B., Clarke, J., and J. Sterne, "Updated YANG Module Revision Handling", Work in Progress, Internet-Draft, draft-ietf-netmod-yang-module-versioning-09, , <https://datatracker.ietf.org/doc/html/draft-ietf-netmod-yang-module-versioning-09>.
[I-D.ietf-netmod-yang-semver]
Clarke, J., Wilton, R., Rahman, R., Lengyel, B., Sterne, J., and B. Claise, "YANG Semantic Versioning", Work in Progress, Internet-Draft, draft-ietf-netmod-yang-semver-12, , <https://datatracker.ietf.org/doc/html/draft-ietf-netmod-yang-semver-12>.
[RFC2119]
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/info/rfc2119>.
[RFC3688]
Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, DOI 10.17487/RFC3688, , <https://www.rfc-editor.org/info/rfc3688>.
[RFC6020]
Bjorklund, M., Ed., "YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)", RFC 6020, DOI 10.17487/RFC6020, , <https://www.rfc-editor.org/info/rfc6020>.
[RFC6241]
Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., and A. Bierman, Ed., "Network Configuration Protocol (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, , <https://www.rfc-editor.org/info/rfc6241>.
[RFC8174]
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, , <https://www.rfc-editor.org/info/rfc8174>.
[RFC8639]
Voit, E., Clemm, A., Gonzalez Prieto, A., Nilsen-Nygaard, E., and A. Tripathy, "Subscription to YANG Notifications", RFC 8639, DOI 10.17487/RFC8639, , <https://www.rfc-editor.org/info/rfc8639>.
[RFC8641]
Clemm, A. and E. Voit, "Subscription to YANG Notifications for Datastore Updates", RFC 8641, DOI 10.17487/RFC8641, , <https://www.rfc-editor.org/info/rfc8641>.

9.2. Informative References

[I-D.ietf-netconf-https-notif]
Jethanandani, M. and K. Watsen, "An HTTPS-based Transport for YANG Notifications", Work in Progress, Internet-Draft, draft-ietf-netconf-https-notif-13, , <https://datatracker.ietf.org/doc/html/draft-ietf-netconf-https-notif-13>.
[I-D.ietf-netconf-udp-notif]
Zheng, G., Zhou, T., Graf, T., Francois, P., Feng, A. H., and P. Lucente, "UDP-based Transport for Configured Subscriptions", Work in Progress, Internet-Draft, draft-ietf-netconf-udp-notif-10, , <https://datatracker.ietf.org/doc/html/draft-ietf-netconf-udp-notif-10>.
[I-D.ietf-netmod-yang-packages]
Wilton, R., Rahman, R., Clarke, J., Sterne, J., and B. Wu, "YANG Packages", Work in Progress, Internet-Draft, draft-ietf-netmod-yang-packages-03, , <https://datatracker.ietf.org/doc/html/draft-ietf-netmod-yang-packages-03>.
[RFC8259]
Bray, T., Ed., "The JavaScript Object Notation (JSON) Data Interchange Format", STD 90, RFC 8259, DOI 10.17487/RFC8259, , <https://www.rfc-editor.org/info/rfc8259>.
[RFC8340]
Bjorklund, M. and L. Berger, Ed., "YANG Tree Diagrams", BCP 215, RFC 8340, DOI 10.17487/RFC8340, , <https://www.rfc-editor.org/info/rfc8340>.
[RFC8343]
Bjorklund, M., "A YANG Data Model for Interface Management", RFC 8343, DOI 10.17487/RFC8343, , <https://www.rfc-editor.org/info/rfc8343>.
[RFC8640]
Voit, E., Clemm, A., Gonzalez Prieto, A., Nilsen-Nygaard, E., and A. Tripathy, "Dynamic Subscription to YANG Events and Datastores over NETCONF", RFC 8640, DOI 10.17487/RFC8640, , <https://www.rfc-editor.org/info/rfc8640>.
[W3C.REC-xml-20081126]
Bray, T., Paoli, J., Sperberg-McQueen, M., Maler, E., and F. Yergeau, "Extensible Markup Language (XML) 1.0 (Fifth Edition)", World Wide Web Consortium Recommendation REC-xml-20081126, , <https://www.w3.org/TR/2008/REC-xml-20081126>.

Authors' Addresses

Thomas Graf
Swisscom
Binzring 17
CH-8045 Zurich
Switzerland
Benoit Claise
Huawei
Alex Huang Feng
INSA-Lyon
Lyon
France