On Tue, May 27, 2025 at 3:18 PM Jason Sterne (Nokia) <jason.sterne= [email protected]> wrote:
> Hi all, > > > > I was surprised recently when yanglint output an error that indicated a > ‘mandatory’ statement was being enforced for an obsolete node. > > > I agree the RFC is not super clear so not yanglint's fault > RFC7950 doesn’t directly address this issue, although the text does imply > (or by omission) that constraints still apply regardless of ‘status’. I > assume that would also include things like ‘min-elements’ (not sure about > “must”). > > > https://datatracker.ietf.org/doc/html/rfc7950#section-7.21.2 The problem is the status-stmt definition of deprecated and obsolete. If a definition is "current", it MUST NOT reference a "deprecated" or "obsolete" definition within the same module. What does 'reference' mean here? Why isn't the status hierarchical? What does it even mean to have 'current' descendants of an obsolete node? That is somehow OK because the child does not reference its parent? What a mess. We implement what makes sense. - deprecated means MUST implement (same as current but with a 'going away' warning) - obsolete nodes are removed from the schema tree by the server so no validation is done on them and they are never implemented That means you can’t simply mark a node as obsolete and leave its > definition as it was in a YANG module. You’d have to alter the definition > to remove statements like ‘mandatory’, ‘min-elements’, etc. And when > marking some top level container as obsolete, you’d have to look through > all descendants to find & remove all constraints? > > > > Does that seem correct to folks here? > The MUST NOT above seems relevant here. Does this require all the referencing data nodes to be obsolete as well? Andy > > Output of yanglint: > > ----------------------- > > yanglint -t config test-module.yang test-mod-data.xml > > libyang err : Mandatory node "baz2" instance does not exist. (Schema > location /test-module:foo/bar/baz2.) > > YANGLINT[E]: Failed to parse input data file "test-mod-data.xml". > > > > Module > > -------------- > > module test-module { > > namespace "urn:top.com:top"; > > prefix "top"; > > container foo { > > container bar { > > presence "bar"; > > leaf baz1 { > > type string; > > } > > leaf baz2 { > > type string; > > mandatory true; > > status obsolete; > > } > > } > > leaf blah { type string; } > > } > > } > > > > Instance data > > -------------- > > <foo xmlns="urn:top.com:top"> > > <bar> > > <baz1>test</baz1> > > </bar> > > <blah>test</blah> > > </foo> > > > > > > Jason (he/him) > > > _______________________________________________ > netmod mailing list -- [email protected] > To unsubscribe send an email to [email protected] >
_______________________________________________ netmod mailing list -- [email protected] To unsubscribe send an email to [email protected]
