[YANGTOOLS-910] RFC7950Reactors.defaultReactor can not build the yang file with content "yang-version 1.0" Created: 17/Oct/18  Updated: 17/Oct/18  Resolved: 17/Oct/18

Status: Resolved
Project: yangtools
Component/s: parser
Affects Version/s: 2.1.2
Fix Version/s: None

Type: Bug Priority: High
Reporter: Liu Hui Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

In my project, I'm trying to parse the yang files with yangtools parser, and RFC7950Reactors.defaultReactor is chosen as below:

CrossSourceStatementReactor.BuildAction reactor = RFC7950Reactors.defaultReactor().newBuild();

addSourceFiles(reactor, compatibleDir);

SchemaContext schemaContext= reactor.buildEffective();

Then I test the yang files in compatibleDir, if the yang file is specified with "yang-version 1.0", I'll get the Exception below:

org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException: Some of FULL_DECLARATION modifiers for statements were not resolved.
org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.propagateException(BuildGlobalContext.java:256)
org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.loadPhaseStatementsFor(BuildGlobalContext.java:310)
org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.loadPhaseStatements(BuildGlobalContext.java:300)
org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.executePhases(BuildGlobalContext.java:218)
org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.buildEffective(BuildGlobalContext.java:230)

And if I remove the content "yang-version 1.0" or replace it with "yang-version 1.1", I'll get the yang file parsed correctly, no exceptions occured.

Can anyone help with the issue I encountered.Thacks.

 



 Comments   
Comment by Robert Varga [ 17/Oct/18 ]

"1.0" is not a valid yang-version string, as per https://tools.ietf.org/html/rfc6020#section-7.1.2 and https://tools.ietf.org/html/rfc7950#section-7.1.2

 

Comment by Liu Hui [ 17/Oct/18 ]

Thank you rovarga, I changed "yang-version 1.0" to "yang-version 1" , same exception occured, we have some yang files contains the string "yang-version 1"  , how to avoid this exception?

 

Comment by Robert Varga [ 17/Oct/18 ]

I cannot diagnose this without a full stack trace, including the cause stack. Given the problem disappears with YANG 1.1, I assume the model is using a YANG 1.1-only construct.

Comment by Liu Hui [ 17/Oct/18 ]

Thanks rovarga, Maybe you're right, I'll test those files later.

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