Internet-Draft A YANG Extension for Declaring the Compa November 2026
Dikshit Expires 27 May 2027 [Page]
Workgroup:
Network Working Group
Internet-Draft:
draft-dikshit-netmod-comparability-scope-extension-05
Published:
Intended Status:
Standards Track
Expires:
Author:
S. Dikshit
Hewlett Packard Enterprise

A YANG Extension for Declaring the Comparability Scope of Operational State

Abstract

A value exported from a YANG data tree is often unique only within its parent, for example an entry numbered 0 under two different parents. Once the value is exported without the parent's key, a collector cannot tell whether two such values refer to the same thing, and no collector-side normalization can recover the missing key. YANG (RFC 7950) has no way to state this dependency in the schema. This document defines a YANG extension statement, "csc:comparability-scope", a four-level scope lattice, a compatibility rule, and an export rule, so that the key needed to compare a value travels with it, and a schema-aware tool can detect an invalid comparison before any data is exported.

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 27 May 2027.

▲

Table of Contents

1. Introduction

YANG [RFC7950] lets a module author state a value's type, range, and units. It has no construct to state the value's comparability: which other readings of the value, from other subtrees or other nodes, it can be meaningfully compared, summed, or differenced against. Today this is left to description prose, if it is stated at all.

This document does not propose a new telemetry export mechanism. It proposes one small, reusable YANG statement that a module can attach to any leaf or leaf-list representing a measured or identifying value, declaring the scope over which that value is unique and comparable.

2. The Problem in One Picture

Consider a list of parents, each holding a list of children whose key restarts at 0 under every parent. This is common and valid YANG. Figure 1 shows what happens when only the child subtree is exported.

       One device
       +-------------------------------+
       |  parent "A"                   |
       |     +-- child  id=0  value=7  |
       |  parent "B"                   |
       |     +-- child  id=0  value=9  |
       +-------------------------------+
                      |
                      |  export the child only
                      |  (flat list, filtered YANG-Push,
                      |   database row, ...)
                      v
       Collector receives:
          { "id": 0, "value": 7 }
          { "id": 0, "value": 9 }
Figure 1: The parent key is lost on export

The parent key is what made "id=0" unique. Nothing in the schema says so, nothing requires the parent key to be exported with the child, and nothing lets a tool catch the omission before a collector merges, sums, or overwrites the two readings.

Figure 2 shows the same export after the extension defined in Section 4 is applied to the "id" leaf.

       Schema (declared once):
          leaf id {
            csc:comparability-scope "domain-local";
            csc:domain-id-ref "../../name";   // the parent key
          }
       Collector receives:
          { "parent": "A", "id": 0, "value": 7 }
          { "parent": "B", "id": 0, "value": 9 }
Figure 2: The scope key travels with the value

Appendix A shows the same pattern in a deployed protocol: the candidate paths of a Segment Routing Policy [RFC9256].

2.1. Why Collector-Side Normalization Does Not Help

Mediation between a device model and a canonical model (the classic EMS-to-NMS transformation) fixes representation: names, units, and structure. It cannot add a key that was never exported. In Figure 1 both records are already normalized; what is missing is not a format but a fact.

A collector that reads the full tree from one live device can sometimes rebuild the parent context itself, but only if the module nests the child under its parent and the export keeps that nesting. A flat list, a subscription filtered down to the child leaf, or a stored record does not.

2.2. Beyond a Single Device

Figure 1 needs only one device. The same pattern appears across devices under one controller, and across domains under separate administration, which is why Section 3 defines four scope levels rather than one.

[I-D.dikshit-nmop-telemetry-identifier-scoping] records six independent instances of this pattern across five working groups, each currently addressed by its own prose. That document proposes textual requirements for exported identifiers in non-YANG formats. This document takes the complementary step for YANG-modeled data: it lets the schema state the requirement once, in a machine-checkable form.

3. Terminology and the Scope Lattice

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.

This document defines a total order over four comparability scopes, written narrowest to widest:

   narrowest                                          widest
   node-local < domain-local < controller-scoped < global
       |             |                |               |
    one node    one stated      one controller    everywhere
                domain or       or orchestrator
                parent

          Figure 3: The scope lattice

node-local: the value is comparable only to other values read from the same originating node. A node-local value read from two different nodes carries no defined relationship.

domain-local: the value is comparable to values within a single stated domain or parent context (for example an enclosing list entry, an IGP area, a VRF, or a BGP Route Distinguisher's scope), identified by a companion leaf named by domain-id-ref, but not beyond that context.

controller-scoped: the value is comparable across every node managed by a single controller or orchestration system, for as long as that controller's assignment record for the value is retained, and not beyond a change of controller.

global: the value is comparable across every node and every domain, independent of controller or administrative boundary, for the lifetime the defining module states.

A scope to the left of "<" is strictly narrower than one to the right, meaning fewer pairs of readings are guaranteed comparable.

4. The comparability-scope Extension

This document defines, using the YANG language [RFC7950], the module ietf-comparability-scope, which provides two extension statements. The comparability-scope statement declares, for a leaf or leaf-list, the scope within which two readings of that value are comparable, using the four-value lattice of Section 3. The domain-id-ref statement is a sibling that names, by a relative XPath expression, the leaf identifying the domain when the scope is domain-local.

The domain-id-ref XPath is evaluated with the annotated leaf or leaf-list as the context node. More than one domain-id-ref statement may be attached to form a compound domain key, in which case two readings share a domain only when every referenced leaf resolves to an equal value.

Widening the declared scope of an existing leaf, for example from node-local to domain-local, is a non-backward-compatible change and is handled per the module update rules of [RFC8407].

<CODE BEGINS> file "ietf-comparability-scope@2026-11-23.yang"


module ietf-comparability-scope {
  yang-version 1.1;
  namespace
    "urn:ietf:params:xml:ns:yang:ietf-comparability-scope";
  prefix csc;

  organization
    "IETF NETMOD (Network Modeling) Working Group";
  contact
    "WG Web:   <https://datatracker.ietf.org/wg/netmod/>
     WG List:  <mailto:netmod@ietf.org>

     Author:   Saumya Dikshit
               <mailto:saumya.dikshit@hpe.com>";
  description
    "This module defines two YANG extension statements,
     'comparability-scope' and 'domain-id-ref', that let a module
     author declare the scope over which a measured, counted, or
     identifying value is unique and comparable to other readings
     of the same value.

     Copyright (c) 2026 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
     (https://www.rfc-editor.org/info/rfcXXXX); see the RFC itself
     for full legal notices.";

  revision 2026-11-23 {
    description
      "Initial revision.";
    reference
      "RFC XXXX: A YANG Extension for Declaring the Comparability
       Scope of Operational State";
  }

  extension comparability-scope {
    argument scope-value;
    description
      "Attached to a leaf or leaf-list representing a measured,
       counted, or identifying value, this statement declares the
       scope within which two readings of that value are
       comparable (summed, differenced, or averaged).

       The 'scope-value' argument must be one of 'node-local',
       'domain-local', 'controller-scoped', or 'global', ordered
       from narrowest to widest.

       When 'scope-value' is 'domain-local', at least one
       'domain-id-ref' statement must be present on the same leaf
       or leaf-list to identify the domain within which the value
       is unique.

       Widening the declared scope of an existing leaf, for example
       from 'node-local' to 'domain-local', is a
       non-backward-compatible change and is handled per the module
       update rules of RFC 8407.";
  }

  extension domain-id-ref {
    argument domain-xpath;
    description
      "A sibling statement of 'comparability-scope' on the same
       leaf or leaf-list.  Its 'domain-xpath' argument is a
       relative XPath expression, evaluated with the annotated leaf
       or leaf-list as the context node, that resolves to the leaf
       identifying the domain within which the annotated value is
       unique.

       More than one 'domain-id-ref' statement may be present; the
       set of referenced leaves then forms a compound domain key,
       and two readings are in the same domain only when every
       referenced leaf resolves to an equal value.";
  }
}


<CODE ENDS>

A module author attaches the statements to a leaf exactly as they would attach "units" or "status". Using the structure of Figure 1:

  list parent {
    key name;
    leaf name { type string; }
    list child {
      key id;
      leaf id {
        type uint32;
        csc:comparability-scope "domain-local";
        csc:domain-id-ref "../../name";
        description
          "Unique only within the enclosing parent.";
      }
      leaf value { type uint64; }
    }
  }

5. The Compatibility Rule

A tool or receiver comparing (summing, differencing, or averaging) two readings of a value from two different subtree instances:

  1. When operating in strict validation mode, MUST reject the comparison if either reading lacks a comparability-scope statement and the comparison spans more than one node, one controller, or one domain, as applicable. In default mode, a tool SHOULD flag such comparisons as having unverified comparability rather than rejecting legacy unannotated modules outright.

  2. MUST reject the comparison if both readings are domain-local and the tuple of values resolved by their domain-id-ref statement(s) differs.

  3. MAY accept a comparison across two different scope values only if the narrower scope is also satisfied by the context of the read (for example, a domain-local reading and a controller-scoped reading MAY be compared only within the domain the domain-local reading names).

  4. MUST reject a comparison of two node-local readings from different nodes.

This is a static check: it needs no run-time state beyond what the schema and the domain-id-ref leaf already carry, so it can be enforced by a validator rather than discovered as an operational incident.

6. The Export Rule: The Key Travels with the Value

The compatibility rule in Section 5 only works if the leaf named by domain-id-ref reaches the receiver. This document therefore proposes the following rule; whether it is normative or advisory is an open question for the working group.

When a leaf carrying comparability-scope "domain-local" is included in exported data, for example in a YANG-Push [RFC8641] update, a filtered retrieval, or a flattened export, the leaf named by its domain-id-ref SHOULD be included in the same exported data. A publisher or tool that builds a subscription filter selecting a domain-local leaf SHOULD add the referenced leaf to the filter automatically.

7. Further Observations

7.1. Measurement-Method Scope in draft-ietf-rtgwg-qos-model

[I-D.ietf-rtgwg-qos-model] Section 4.4 defines a "classified-rate" leaf, typed as gauge64 with units bits-per-second and described as "Rate of average data flow through a classifier." The averaging window and computation method are left to the implementation, as is usual for gauge64 [RFC6991]. Two implementations may use different windows, for example one second and five minutes, and produce values that look comparable but are not.

This observation has the same shape as Section 2: a value is exported with no machine-checkable statement of when it may be compared to another reading. It is, however, about measurement method rather than administrative or topological scope, which is what the lattice in Section 3 expresses. This document does not extend the lattice to cover it, and records it as a candidate for a separate extension or future revision.

7.2. Known Limitations of domain-id-ref

First, the compatibility rule establishes that two domain-local readings are incomparable if their domain-id-ref values differ, but it cannot establish that a domain-id-ref value is unique across every context in which it is used. If the referenced identifier comes from a namespace that is not collision-free across the boundaries in scope, for example a private Autonomous System Number reused by two independently operated networks sharing one collector, two unrelated domains could be wrongly treated as comparable. Module authors SHOULD reference an identifier that is unique across every boundary the comparison is expected to span.

Second, domain-id-ref is a pure equality test. It cannot express that two different values refer, over time, to the same domain, for example after an Autonomous System renumbering or merger. Domain identity succession is not addressed by this document and is a candidate for future work.

Third, widening a value's declared scope, for example from node-local to domain-local, changes which comparisons are valid. Under the general rule in [RFC8407] such a change is not backward-compatible. A future revision will state this explicitly in the extension definition in Section 4.

Finally, a module author can point domain-id-ref at an identifier that already exists for an operational reason (for example a BGP neighbor's Autonomous System Number, which the protocol cannot work without), or introduce a new leaf whose only purpose is to identify the domain. The former is RECOMMENDED where available: an error in it is caught by the protocol that depends on it. A single-purpose identifier has no such independent check, and an operator error in it may persist unnoticed. If one is used, the module SHOULD document that its correctness depends entirely on operator configuration.

8. Relationship to Existing Work

[RFC8343] defines a mandatory "discontinuity-time" leaf because a plain counter64 does not say whether it has been reset. That leaf answers one narrow, temporal case of the question this document generalizes: when is a reading comparable to another reading. It was not intended to cover the administrative or topological cases in Section 2, nor the averaging-window case in Section 7.1. This document proposes doing once, in the language, what RFC 8343 did by hand for one counter family.

[RFC8911] and [RFC8912] address the analogous question one layer up, for a metric's name, method, and applicability, through a registry. This document addresses value-level comparability as a YANG extension rather than a registry, because the property being declared, a scope over a data-tree instance, is a schema-level fact and is naturally stated where the value is defined.

[I-D.dikshit-nmop-telemetry-identifier-scoping] and this document are complementary: the former gives textual requirements for identifiers exported in non-YANG formats (IPFIX Information Elements, BMP TLVs), and this document gives YANG-modeled data a language-level way to carry the same answer.

9. Tooling Implications

Because the compatibility rule is static, it can be checked without executing the comparison. A pyang or yanglint plugin can inspect two subtrees named in an aggregation expression (for example in a dashboard configuration, or in a YANG-Push filter combining two subscriptions) and reject the combination at configuration time. The same plugin can check the export rule in Section 6 against a subscription filter. This document does not specify such a plugin; a reference implementation tested against existing WG modules, including the example in Appendix A, is future work. At schema compile time, a validator can also verify that any domain-local leaf carries at least one domain-id-ref statement and that each relative XPath resolves to a valid leaf in the schema tree.

Enforcement does not need a bespoke algorithm. An implementation MAY partition readings by their domain-id-ref value before any aggregation, treating it as an ordinary grouping key, so that readings in different partitions are never combined. This is the grouped aggregation already supported by most collection and storage systems.

10. IANA Considerations

This document registers a URI in the "IETF XML Registry" [RFC3688]:

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

This document registers a YANG module in the "YANG Module Names" registry [RFC6020]:

Name: ietf-comparability-scope
Namespace: urn:ietf:params:xml:ns:yang:ietf-comparability-scope
Prefix: csc
Reference: RFC XXXX

11. Security Considerations

A misdeclared comparability-scope value does not by itself create a protocol vulnerability, but it can cause a monitoring or automated-remediation system to aggregate incomparable values and act on the wrong result. As telemetry increasingly drives closed-loop automation, an incorrectly widened scope (for example, a node-local value declared domain-local) becomes a data-integrity concern with an impact beyond the originating node. Implementations SHOULD treat a comparability-scope statement as subject to the same integrity protections as the rest of the schema, and MUST NOT allow it to be widened by any entity other than the module's author.

12. References

12.1. Normative References

[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>.
[RFC7950]
Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language", RFC 7950, DOI 10.17487/RFC7950, , <https://www.rfc-editor.org/info/rfc7950>.
[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>.
[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>.

12.2. Informative References

[I-D.ietf-rtgwg-qos-model]
Choudhary, A., Jethanandani, M., Aries, E., and H. Chen, "A YANG Data Model for Quality of Service (QoS) in IP Networks", Work in Progress, Internet-Draft, draft-ietf-rtgwg-qos-model-16, , <https://datatracker.ietf.org/doc/html/draft-ietf-rtgwg-qos-model-16>.
[I-D.dikshit-nmop-telemetry-identifier-scoping]
Dikshit, D., "Scoping and Comparability Requirements for Exported Network Telemetry Identifiers", Work in Progress, Internet-Draft, draft-dikshit-nmop-telemetry-identifier-scoping-01, , <https://datatracker.ietf.org/doc/html/draft-dikshit-nmop-telemetry-identifier-scoping-01>.
[RFC6991]
Schoenwaelder, J., Ed., "Common YANG Data Types", RFC 6991, DOI 10.17487/RFC6991, , <https://www.rfc-editor.org/info/rfc6991>.
[RFC7951]
Lhotka, L., "JSON Encoding of Data Modeled with YANG", RFC 7951, DOI 10.17487/RFC7951, , <https://www.rfc-editor.org/info/rfc7951>.
[RFC8343]
Bjorklund, M., "A YANG Data Model for Interface Management", RFC 8343, DOI 10.17487/RFC8343, , <https://www.rfc-editor.org/info/rfc8343>.
[RFC8407]
Bierman, A., "Guidelines for Authors and Reviewers of Documents Containing YANG Data Models", RFC 8407, DOI 10.17487/RFC8407, , <https://www.rfc-editor.org/info/rfc8407>.
[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>.
[RFC8911]
Bagnulo, M., Claise, B., Eardley, P., Morton, A., and A. Akhter, "Registry for Performance Metrics", RFC 8911, DOI 10.17487/RFC8911, , <https://www.rfc-editor.org/info/rfc8911>.
[RFC8912]
Morton, A., Bagnulo, M., Eardley, P., and K. D'Souza, "Initial Performance Metrics Registry Entries", RFC 8912, DOI 10.17487/RFC8912, , <https://www.rfc-editor.org/info/rfc8912>.
[RFC9256]
Filsfils, C., Talaulikar, K., Ed., Voyer, D., Bogdanov, A., and P. Mattes, "Segment Routing Policy Architecture", RFC 9256, DOI 10.17487/RFC9256, , <https://www.rfc-editor.org/info/rfc9256>.

Appendix A. Worked Example: SR Policy Candidate Paths (RFC 9256)

A.1. The Observation

[RFC9256] identifies a candidate path of an SR Policy by the tuple <Protocol-Origin, Originator, Discriminator>. For a candidate path provisioned by configuration, Section 2.5 gives the Discriminator a default value of 0, and Section 2.4 gives the Originator (an <ASN, node-address> pair) a default of 0 for both parts. Two unrelated configured candidate paths can therefore carry the identical tuple.

Section 2.6 states that this tuple identifies a candidate path only "in the context of a single SR Policy", and that an SR Policy is itself identified by <Headend, Color, Endpoint>. This is exactly the parent/child pattern of Figure 1: the SR Policy is the parent, and the candidate-path tuple is the child key. One headend serving two SR Policies is enough to produce two identical tuples on a single device.

A.2. Applying the Extension

The annotation follows Section 4, with domain-id-ref pointing at the enclosing SR Policy's key:

  leaf discriminator {
    type uint32;
    csc:comparability-scope "domain-local";
    csc:domain-id-ref "../../sr-policy-key";
    description
      "Discriminator of this candidate path, per RFC 9256
       Section 2.5. Comparable only within the same enclosing
       SR Policy.";
  }

No new counter, no new export mechanism, and no change to the Discriminator's encoding in RFC 9256 is required; the change is confined to the exporting module's schema.

A.3. Instance Data, Before and After

Using the JSON encoding of [RFC7951], a module exporting per-candidate-path state without the parent key carries:

{
  "example-sr-policy-state:candidate-paths": [
    { "protocol-origin": 20, "originator": 0,
      "discriminator": 0 },
    { "protocol-origin": 20, "originator": 0,
      "discriminator": 0 }
  ]
}

One entry belongs to an SR Policy with Color 100 and Endpoint P, the other to an unrelated SR Policy with Color 200 and Endpoint Q. The two entries are byte-identical.

With the extension applied and the export rule of Section 6 followed, the same entries are:

{
  "example-sr-policy-state:candidate-paths": [
    { "sr-policy-key": "HeadendA,Color100,EndpointP",
      "protocol-origin": 20, "originator": 0,
      "discriminator": 0 },
    { "sr-policy-key": "HeadendB,Color200,EndpointQ",
      "protocol-origin": 20, "originator": 0,
      "discriminator": 0 }
  ]
}

The comparability-scope and domain-id-ref statements are schema facts, declared once and never repeated in instance data. A tool that has loaded the module sees that the two sr-policy-key values differ and, by rule 2 of Section 5, does not treat the two discriminator readings as the same candidate path.

Appendix B. Changes Between Revisions

From -04 to -05:

From -03 to -04 (restructuring for readability; the mechanism is unchanged except for the new Section 6):

From -02 to -03:

Author's Address

Saumya Dikshit
Hewlett Packard Enterprise
Mahadevpura
Bangalore 560 048
Karnataka
India