0

I have OpenDayLight Boron-SR3 installed and a test YANG file in /opt/odl_l3vpn/dave/api/src/main/yang.

module DaveTest {

namespace "urn:opendaylight:params:xml:ns:DaveTest";
prefix dm;

import "ietf-inet-types" {
    prefix ietf-yang;
}

description "Dave testing file";

revision "2017-04-17" {
    description "Initial version.";
}



    container testing-vars {

            list test-list {

                    key "vpn-transaction-id";
                    unique "vpn-transaction-id";

                    leaf vpn-transaction-id {
                            type string;
                            description "Generated for the model.";
                    }

                    leaf vpn-id {
                            type string;
                            description "VPN ID for the VPN.";

                    }

            }
    }
}

When I compile the file using 'mvn clean install -nsu', I get an error:

[ERROR] Failed to execute goal org.opendaylight.yangtools:yang-maven-plugin:1.0.3-Boron-SR3:generate-sources (binding) on project dave-api: yang-to-sources: Unable to parse yang files from /opt/odl_l3vpn/dave/api/src/main/yang: Imported module [ietf-inet-types] was not found. [at META-INF/yang/DaveTest.yang:6:4]

Full Stack Below:

[ERROR] Failed to execute goal org.opendaylight.yangtools:yang-maven-plugin:1.0.3-Boron-SR3:generate-sources (binding) on project dave-api: yang-to-sources: Unable to parse yang files from /opt/odl_l3vpn/dave/api/src/main/yang: Imported module [ietf-inet-types] was not found. [at META-INF/yang/DaveTest.yang:6:8] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.opendaylight.yangtools:yang-maven-plugin:1.0.3-Boron-SR3:generate-sources (binding) on project dave-api: yang-to-sources: Unable to parse yang files from /opt/odl_l3vpn/dave/api/src/main/yang
at      org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at     org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at     org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: yang-to-sources: Unable to parse yang files from /opt/odl_l3vpn/dave/api/src/main/yang
at org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor.processYang(YangToSourcesProcessor.java:222)
at org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor.execute(YangToSourcesProcessor.java:95)
at org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor.conditionalExecute(YangToSourcesProcessor.java:118)
at org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesMojo.execute(YangToSourcesMojo.java:119)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException: Imported module [ietf-inet-types] was not found. [at META-INF/yang/DaveTest.yang:6:8]
at org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException.throwIf(InferenceException.java:47)
at org.opendaylight.yangtools.yang.parser.stmt.rfc6020.ImportStatementDefinition$1.prerequisiteFailed(ImportStatementDefinition.java:116)
at org.opendaylight.yangtools.yang.parser.stmt.reactor.ModifierImpl.failModifier(ModifierImpl.java:93)
at org.opendaylight.yangtools.yang.parser.stmt.reactor.SourceSpecificContext.failModifiers(SourceSpecificContext.java:294)
at org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.addSourceExceptions(BuildGlobalContext.java:268)
at org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.completePhaseActions(BuildGlobalContext.java:343)
at org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.buildEffective(BuildGlobalContext.java:200)
at org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor$BuildAction.buildEffective(CrossSourceStatementReactor.java:128)
at org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor$BuildAction.buildEffective(CrossSourceStatementReactor.java:145)
at org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor.processYang(YangToSourcesProcessor.java:191)
... 25 more

My pom.xml in the main directory /opt/odl_l3vpn/dave. I have added 'ietf-inet-types dependency under 'build' but could have placed it in the wrong place due to my lack of knowledge with the pom files.

  <build>
<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-deploy-plugin</artifactId>
    <configuration>
      <skip>true</skip>
    </configuration>
  </plugin>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-install-plugin</artifactId>
    <configuration>
      <skip>true</skip>
    </configuration>

    <dependencies>
      <dependency>
        <groupId>org.opendaylight.mdsal.model</groupId>
        <artifactId>ietf-inet-types</artifactId>
        <version>2010.09.24.8.5-SNAPSHOT</version>
        <type>bundle</type>
      </dependency>
    </dependencies>

  </plugin>
</plugins>

Where would be the proper place to add the dependency so my YANG file can compile? Or can you point me in the right direction? Thanks in advance.

David Roberts
  • 43
  • 1
  • 7

2 Answers2

0

Gee, something about OpenDaylight I can actually answer.

In your log output, you will see the mention of "org.opendaylight.yangtools:yang-maven-plugin". If you don't configure that, you get the defaults, which isn't much. You're going to have to learn how to configure that. You should be able to find documentation for it on the ODL site. If you have the YangIDE Eclipse plugin (which unfortunately isn't really supported anymore), you can see examples in the projects it creates.

Specifically, and I don't remember the syntax, I believe the Yang dependencies have to be specified as part of the yang-maven-plugin configuration.

David M. Karr
  • 14,317
  • 20
  • 94
  • 199
0

Thanks for the David, I was able figure out the answer by doing the following:

I downloaded theietf-yang-types-2010.09.24.9.3-Boron-SR3.jar from https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/mdsal/model/ietf-inet-types/2010.09.24.9.3-Boron-SR3/ and put it in the /tmp directory.

I then modified the project/api/pom.xml to include the dependency information.

I then ran the following command in the project root directory: mvn install:install-file -DgroupId=org.opendaylight.mdsal.model -DartifactId=ietf-inet-types -Dversion=2010.09.24.8.5-SNAPSHOT -Dpackaging=bundle -Dfile=/tmp/ietf-yang-types-2010.09.24.9.3-Boron-SR3.jar

The 'mvn clean install -nsu' worked fine and everything compiled.

David Roberts
  • 43
  • 1
  • 7