3

I added the following dependency in my pom.xml

<dependencies>
        <dependency>
            <groupId>org.opendaylight.yangtools</groupId>
            <artifactId>yang-parser-impl</artifactId>
            <version>2.1.8</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.opendaylight.yangtools</groupId>
            <artifactId>yang-parser-api</artifactId>
            <version>2.1.8</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.opendaylight.yangtools</groupId>
            <artifactId>yang-model-api</artifactId>
            <version>2.1.8</version>
            <type>jar</type>
        </dependency>
    </dependencies>

Then I tried to find documentation on how to parse the .yang/.yi files to build Schema.

I found the following example here:

https://docs.opendaylight.org/en/stable-boron/developer-guide/yang-tools.html

StatementStreamSource yangModuleSource == new YangStatementSourceImpl("/example.yang", false);
StatementStreamSource yangModuleSource2 == new YangStatementSourceImpl("/example2.yang", false);

CrossSourceStatementReactor.BuildAction reactor == YangInferencePipeline.RFC6020_REACTOR.newBuild();
reactor.addSources(yangModuleSource, yangModuleSource2);

SchemaContext schemaContext == reactor.buildEffective();

However I cannot find the class YangStatementSourceImpl or YinStatementSourceImpl in these jars.

So my question is:

  1. Where can I find these classes, YangStatementSourceImpl or YinStatementSourceImpl ?
  2. How is opendaylight versions like baron, oxygen ... matched to the maven module here: https://mvnrepository.com/artifact/org.opendaylight.yangtools ?

br,

//mike

1 Answers1

3
  1. These classes have been deprecated; their replacements are YangStatementStreamSource and YinStatementStreamSource. To initialise the first stream in the example, you should now write

    YangTextSchemaSource yangTextSchemaSource = YangTextSchemaSource.forFile(new File("/example.yang"));
    StatementStreamSource yangModuleSource = YangStatementStreamSource.create(yangTextSchemaSource);
    
  2. YANG Tools artifacts have only been published to Maven Central since Fluorine; you’ll find the corresponding versions in the platform versions table. Version 2.1.8, which you’re currently using, is targeted for Neon which is currently being released.

Stephen Kitt
  • 2,786
  • 22
  • 32
  • Thx! Where can I now find code examples? Similair to these: https://docs.opendaylight.org/en/stable-fluorine/developer-guide/yang-tools.html under heading "Working with YANG Model" – mikael petterson Mar 08 '19 at 09:50