Hi all,

I was surprised recently when yanglint output an error that indicated a 
'mandatory' statement was being enforced for an obsolete node.

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").

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?

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]

Reply via email to