[YANGTOOLS-964] YANG parser does not complain about missing feature definition Created: 07/Mar/19  Updated: 10/Mar/19  Resolved: 10/Mar/19

Status: Resolved
Project: yangtools
Component/s: parser
Affects Version/s: 2.0.10
Fix Version/s: 3.0.0, 2.0.17, 2.1.9

Type: Bug Priority: Medium
Reporter: Peter Verthez Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File example.yang    

 Description   

We are using version 2.0.11.

The YANG parser does not complain if an "if-feature" statement refers to a feature that is not defined in the YANG model. See the example model attached: this parses without error.

This should be an error according to https://tools.ietf.org/html/rfc7950#section-7.20.2 :

   If a prefix is present on a feature name in the boolean expression,
   the prefixed name refers to a feature defined in the module that was
   imported with that prefix, or the local module if the prefix matches
   the local module's prefix.  Otherwise, a feature with the matching
   name MUST be defined in the current module or an included submodule.

pyang throws the following error for this:
example.yang:9: error: feature "test-feature" not found in module example



 Comments   
Comment by Robert Varga [ 07/Mar/19 ]

Unfortunately fixing will require API changes to IfFeatureStatement, notably defining a traversable structure which will hold the if-feature expression.

Comment by Robert Varga [ 08/Mar/19 ]

Actually we can confine this through a hack, so an implementation for 2.x.x is forthcoming, too.

Generated at Wed Feb 07 20:54:48 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.