| Internet-Draft | A YANG Extension for Declaring the Compa | November 2026 |
| Dikshit | Expires 27 May 2027 | [Page] |
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.¶
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.¶
Copyright (c) 2026 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
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.¶
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 }
¶
It cannot tell.¶
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 }
¶
-> never merged.¶
Appendix A shows the same pattern in a deployed protocol: the candidate paths of a Segment Routing Policy [RFC9256].¶
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.¶
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.¶
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.¶
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; }
}
}
¶
A tool or receiver comparing (summing, differencing, or averaging) two readings of a value from two different subtree instances:¶
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.¶
MUST reject the comparison if both readings are domain-local and the tuple of values resolved by their domain-id-ref statement(s) differs.¶
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).¶
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.¶
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.¶
[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.¶
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.¶
[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.¶
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.¶
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¶
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.¶
[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.¶
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.¶
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.¶
From -04 to -05:¶
Supplied the complete ietf-comparability-scope YANG module in Section 4 and updated Section 10 with the IANA URI and module registrations.¶
Formally defined domain-id-ref as a sibling extension to comparability-scope, specified the annotated leaf as its XPath context node, and added support for multiple domain-id-ref statements for compound keys.¶
Moved the RFC 8407 non-backward-compatibility rule for scope widening into Section 4 and the YANG extension description.¶
Clarified strict versus default handling of unannotated legacy leaves in Section 5 Rule 1.¶
From -03 to -04 (restructuring for readability; the mechanism is unchanged except for the new Section 6):¶
Replaced the domain-specific example in Section 2 with a short, abstract parent/child example and two figures. Moved the SR Policy (RFC 9256) example, previously Sections 2, 6.1 and 6.3, to Appendix A.¶
Added Section 2.1, explaining why collector-side normalization (EMS-to-NMS mediation) does not recover a key that was never exported, and Section 2.2 on scope beyond a single device.¶
Added Section 6, an export rule proposing that the leaf named by domain-id-ref be exported together with the value it scopes, including in filtered YANG-Push subscriptions. Its normative strength is an open question for the WG.¶
Added a figure for the scope lattice in Section 3, and an abstract YANG example in Section 4.¶
Shortened the Abstract and Introduction; moved the measurement-method observation and domain-id-ref limitations under Section 7. No technical change to the lattice or the compatibility rule.¶
From -02 to -03:¶
Added a worked before-and-after example of published instance data (now Appendix A.3).¶
Added limitations of domain-id-ref: identifier uniqueness and domain identity succession (now Section 7.2).¶
Added a note on the forward compatibility of the comparability-scope argument value, with reference to [RFC8407].¶
Added guidance preferring an existing, operationally load-bearing identifier for domain-id-ref.¶
Added a note that the compatibility rule can be enforced as a grouped aggregation on the domain-id-ref value.¶