[DOCS-126] YANG Tools Developer Guide out of date (incorrect code examples) Created: 15/Jul/20  Updated: 15/Jul/20

Status: Open
Project: docs
Component/s: Developer Guide, General
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Medium
Reporter: Toine Siebelink Assignee: Charles La Voy
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

version: Magnesium
page: developer-guide/yang-tools

 

 

While trying out this developers guide (as I want to start using the Yang tools) I realized the code in the example no longer matches the current libraries

I suspect the content of this page hasn't been updated for a while. I am not sure if the  diagrams are still correct but some of the code definitely is wrong. Some examples

1) new YangStatementSourceImpl("/example.yang", false); I

This is no longer a valid contructor. Instead  the code should be something like this:

YangTextSchemaSource source = YangTextSchemaSource.forFile(new File("/exampleI.yang"));
StatementStreamSource yangModuleSource = YangStatementStreamSource.create(source);

2) YangInferencePipeline.RFC6020_REACTOR.newBuild();  refers to a class that no longer exists!

instead I used

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

3) Set<DataSchemaNodes> dataSchemaNodes = schemaContext.getDataDefinitions();

Is might just be a typo but DataSchemaNodes (plural) is incorrect, it should be

Set<DataSchemaNode> dataSchemaNodes = schemaContext.getDataDefinitions();

4) Note the use of double == instead of =

I suspect there are more issues with the remainder of the code but I didn't explore. Its probably best left to someone that is familiar with yang tools to reproduce all the samples using the current libraries and update the code (and possibly diagrams)


Generated at Wed Feb 07 19:58:44 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.