Skip to content

yang-maven-plugin based on JNC( Java NETCONF Client, https://github.com/tail-f-systems/JNC ) ,and a plugin for pyang to generate Java classes from YANG models

License

Notifications You must be signed in to change notification settings

airshiplay/yang-maven-plugin

Repository files navigation

play-yang

Play Yang based on JNC,and a plugin for pyang to generate Java classes from YANG models.

Reference JNC pyang

play-jnc

Modify based on JNC

yang-maven-plugin

Download

Download the latest JAR or grab via Maven:

<dependency>
  <groupId>com.airlenet.yang</groupId>
  <artifactId>yang-maven-plugin</artifactId>
  <version>1.2.0-SNAPSHOT</version>
</dependency>

or Gradle:

compile 'com.airlenet.yang:yang-maven-plugin:1.2.0-SNAPSHOT'

Snapshots of the development version are available in Sonatype's snapshots repository.

Usage

<plugins>
    <plugin>
        <groupId>com.airlenet.yang</groupId>
        <artifactId>yang-maven-plugin</artifactId>
        <version>1.2.0-SNAPSHOT</version>
        <configuration>
            <skip>false</skip>
            <showWarnings>false</showWarnings>
            <errorAbort>false</errorAbort>
            <excludes>
                <exclude>tailf/*.yang</exclude>
                <exclude>ietf/*.yang</exclude>
                <exclude>iana/*.yang</exclude>
            </excludes>
        </configuration>
        <executions>
            <execution>
                <id>process</id>
                <goals>
                    <goal>process</goal>
                </goals>
                <configuration>
                    <outputDirectory>target/generated-sources/java</outputDirectory><!-- src/main/java -->
                    <packageName>com.airlenet.yang.model</packageName>
                </configuration>
            </execution>
        </executions>
    </plugin>
    <!-- add source resource: java class & resource -->
    <plugin>
       <groupId>org.codehaus.mojo</groupId>
       <artifactId>build-helper-maven-plugin</artifactId>
       <version>1.7</version>
       <executions>
           <execution>
               <id>add-source</id>
               <phase>generate-sources</phase>
               <goals>
                   <goal>add-source</goal>
               </goals>
               <configuration>
                   <sources>
                       <source>target/generated-sources/java</source>
                   </sources>
               </configuration>
           </execution>
           <execution>
               <id>add-resource</id>
               <phase>generate-resources</phase>
               <goals>
                   <goal>add-resource</goal>
               </goals>
               <configuration>
                   <resources>
                       <resource>
                           <directory>target/generated-sources/java</directory>
                       </resource>
                   </resources>
               </configuration>
           </execution>
       </executions>
    </plugin>
</plugins>
mvn package                 # generator java class from yang model,compile,package

mvn yang:validate           # validate yang model

yang-example

License

See License File.