在哪里可以找到使用opendaylight解析YANG文件的示例

问题描述 投票:0回答:1

我在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>

然后我试着找到有关如何解析.yang / .yi文件来构建Schema的文档。

我在这里找到了以下示例:

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();

但是我在这些jar中找不到类YangStatementSourceImpl或YinStatementSourceImpl。

所以我的问题是:

  1. 我在哪里可以找到这些类,YangStatementSourceImpl或YinStatementSourceImpl?
  2. opendaylight版本如baron,oxygen ...如何与maven模块匹配:https://mvnrepository.com/artifact/org.opendaylight.yangtools

BR,

//麦克风

opendaylight ietf-netmod-yang
1个回答
1
投票
  1. 这些类已被弃用;他们的替补是YangStatementStreamSourceYinStatementStreamSource。要初始化示例中的第一个流,您现在应该编写 YangTextSchemaSource yangTextSchemaSource = YangTextSchemaSource.forFile(new File("/example.yang")); StatementStreamSource yangModuleSource = YangStatementStreamSource.create(yangTextSchemaSource);
  2. 自从Fluorine以来,YANG Tools工艺品一直只发布到Maven Central;你会在the platform versions table找到相应的版本。您目前正在使用的2.1.8版针对目前正在发布的Neon。
© www.soinside.com 2019 - 2024. All rights reserved.