aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/tools/package
diff options
context:
space:
mode:
authorAshlee Young <ashlee@wildernessvoice.com>2015-12-06 07:15:03 -0800
committerAshlee Young <ashlee@wildernessvoice.com>2015-12-08 10:55:21 -0800
commit76dc892491948adae5e5e62cf94448967e8d865b (patch)
tree7a33ef05cc583946db21edad627060f280a53549 /framework/src/onos/tools/package
parentd333c63fdec8b064184b0a26f8d777f267577fde (diff)
Fixes bad POM file with ONOS commit 8c68536972f63069c263635c9d9f4f31d7f3e9a2
Change-Id: I7adb5a2d3738d53dbc41db7577768b0e7ced5450 Signed-off-by: Ashlee Young <ashlee@wildernessvoice.com>
Diffstat (limited to 'framework/src/onos/tools/package')
-rw-r--r--framework/src/onos/tools/package/config/samples/network-cfg.json109
-rw-r--r--framework/src/onos/tools/package/etc/samples/org.onosproject.faultmanagement.impl.AlarmsManager.cfg6
-rwxr-xr-xframework/src/onos/tools/package/karaf-assembly/onos-assembly.py80
-rw-r--r--framework/src/onos/tools/package/karaf-assembly/pom.xml84
-rw-r--r--framework/src/onos/tools/package/maven-plugin/pom.xml3
-rw-r--r--framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java3
-rw-r--r--framework/src/onos/tools/package/yangtools/pom.xml76
-rw-r--r--framework/src/onos/tools/package/yangtools/src/main/java/org/onoproject/yangtool/YangLoader.java167
-rw-r--r--framework/src/onos/tools/package/yangtools/src/main/java/org/onoproject/yangtool/YangLoaderMain.java16
-rw-r--r--framework/src/onos/tools/package/yangtools/src/main/resources/pom-template.xml95
10 files changed, 592 insertions, 47 deletions
diff --git a/framework/src/onos/tools/package/config/samples/network-cfg.json b/framework/src/onos/tools/package/config/samples/network-cfg.json
index 9e9257e0..f6879f07 100644
--- a/framework/src/onos/tools/package/config/samples/network-cfg.json
+++ b/framework/src/onos/tools/package/config/samples/network-cfg.json
@@ -1,67 +1,86 @@
{
"ports" : {
- "of:0000000000000002/1" : {
- "interfaces" : [
- {
- "ips" : [ "192.168.10.101/24" ],
- "mac" : "08:9e:01:82:38:68",
- "vlan" : "100"
- }
- ]
- },
- "of:0000000000000002/20" : {
- "interfaces" : [
- {
- "ips" : [ "192.168.20.101/24" ],
- "mac" : "08:9e:01:82:38:68",
- "vlan" : "200"
- }
- ]
- }
+ "of:0000000000000002/1" : {
+ "interfaces" : [
+ {
+ "ips" : [ "192.168.10.101/24" ],
+ "mac" : "08:9e:01:82:38:68",
+ "vlan" : "100"
+ }
+ ]
+ },
+ "of:0000000000000002/2" : {
+ "interfaces" : [
+ {
+ "ips" : [ "192.168.20.101/24" ],
+ "mac" : "08:9e:01:82:38:68",
+ "vlan" : "200"
+ }
+ ]
+ }
},
"devices" : {
- "of:0000000000000002" : {
- "segmentrouting" : {
+ "of:0000000000000002" : {
+ "segmentrouting" : {
"name" : "Leaf-R1",
"nodeSid" : 101,
"routerIp" : "10.0.1.254",
"routerMac" : "00:00:00:00:01:80",
"isEdgeRouter" : true,
"adjacencySids" : [
- { "sid" : 100, "ports" : [2, 3] },
- { "sid" : 200, "ports" : [4, 5] }
+ { "adjSids" : 100, "ports" : [2, 3] },
+ { "adjSids" : 200, "ports" : [4, 5] }
]
}
- },
- "of:0000000000000191" : {
- "segmentrouting" : {
+ },
+ "of:0000000000000191" : {
+ "segmentrouting" : {
"name" : "Spine-R1",
"nodeSid" : 105,
"routerIp" : "192.168.0.11",
"routerMac" : "00:00:01:00:11:80",
- "isEdgeRouter" : false
+ "isEdgeRouter" : false,
+ "adjacencySids" : []
}
- }
+ }
},
"apps" : {
- "org.onosproject.router" : {
- "bgp" : {
- "bgpSpeakers" : [
- {
- "connectPoint" : "of:00000000000000aa/10",
- "peers" : [
- "192.168.10.1"
- ]
- },
- {
- "connectPoint" : "of:00000000000000aa/20",
- "peers" : [
- "192.168.20.1"
- ]
- }
- ]
- }
- }
+ "org.onosproject.router" : {
+ "bgp" : {
+ "bgpSpeakers" : [
+ {
+ "connectPoint" : "of:00000000000000aa/10",
+ "peers" : [
+ "192.168.10.1"
+ ]
+ },
+ {
+ "connectPoint" : "of:00000000000000aa/20",
+ "peers" : [
+ "192.168.20.1"
+ ]
+ }
+ ]
+ }
+ }
+ },
+ "hosts" : {
+ "00:00:00:00:00:01/4093": {
+ "basic": {
+ "ips": [
+ "10.0.1.1"
+ ],
+ "location": "of:0000000000000001/3"
+ }
+ },
+ "00:00:00:00:00:02/4093": {
+ "basic": {
+ "ips": [
+ "10.0.1.2"
+ ],
+ "location": "of:0000000000000001/4"
+ }
+ }
}
}
diff --git a/framework/src/onos/tools/package/etc/samples/org.onosproject.faultmanagement.impl.AlarmsManager.cfg b/framework/src/onos/tools/package/etc/samples/org.onosproject.faultmanagement.impl.AlarmsManager.cfg
new file mode 100644
index 00000000..99795e57
--- /dev/null
+++ b/framework/src/onos/tools/package/etc/samples/org.onosproject.faultmanagement.impl.AlarmsManager.cfg
@@ -0,0 +1,6 @@
+#
+# devices which may have faults.
+# TODO change to NetworkConfig subsystem.
+#
+fmDevices = 172.27.7.110,172.27.7.110,3.3.3.3
+
diff --git a/framework/src/onos/tools/package/karaf-assembly/onos-assembly.py b/framework/src/onos/tools/package/karaf-assembly/onos-assembly.py
new file mode 100755
index 00000000..1e394bf6
--- /dev/null
+++ b/framework/src/onos/tools/package/karaf-assembly/onos-assembly.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+'''
+ Builds synthetic feature file that includes all core, provider, and application
+ features, so that we can pre-stage all bundles required to run ONOS off-line.
+'''
+
+import os
+import xml.etree.ElementTree as ET
+
+FEATURE_TAG = '{http://karaf.apache.org/xmlns/features/v1.2.0}feature'
+STAGED_REPOS = 'target/staged-repos.xml'
+
+if 'ONOS_ROOT' in os.environ:
+ ONOS_ROOT = os.environ['ONOS_ROOT']
+else:
+ # fallback to working directory if ONOS_ROOT is not set
+ ONOS_ROOT = os.getcwd()
+
+def findFeatureFiles(path=ONOS_ROOT):
+ #only descend into target directories that have pom
+ for root, dirs, files in os.walk(path):
+ if 'pom.xml' not in files:
+ if 'target' in dirs:
+ #pruning target dir with no pom.xml
+ dirs.remove('target')
+ if '/target' in root:
+ if '/classes/' in root:
+ #filter out features.xml for maven-plugin
+ continue
+ for f in files:
+ if f.endswith('features.xml'):
+ yield os.path.join(root, f)
+
+def featuresFromFile(file):
+ features = []
+ tree = ET.parse(file)
+ root = tree.getroot()
+ for feature in root.findall(FEATURE_TAG):
+ features.append(feature.attrib['name'])
+ return features
+
+if __name__ == '__main__':
+ outputTree = ET.Element('features')
+ uberFeature = ET.Element('feature', attrib={'name' : 'onos-uber-synthetic'})
+ for file in findFeatureFiles():
+ features = featuresFromFile(file)
+ if len(features) > 0:
+ ET.SubElement(outputTree, 'repository').text = 'file:%s' % file
+ for feature in features:
+ ET.SubElement(uberFeature, 'feature').text = feature
+ outputTree.append(uberFeature)
+
+ outputFile = os.path.join(os.path.dirname(os.path.realpath(__file__)), STAGED_REPOS)
+ outputDir = os.path.dirname(outputFile)
+ if not os.path.exists(outputDir):
+ os.mkdir(outputDir)
+ ET.ElementTree(outputTree).write(outputFile)
+
+ import sys
+ if '-d' in sys.argv:
+ # -------- TODO for debug only --------
+ def indent(elem, level=0):
+ #function borrowed from: http://effbot.org/zone/element-lib.htm#prettyprint
+ i = "\n" + level*" "
+ if len(elem):
+ if not elem.text or not elem.text.strip():
+ elem.text = i + " "
+ if not elem.tail or not elem.tail.strip():
+ elem.tail = i
+ for elem in elem:
+ indent(elem, level+1)
+ if not elem.tail or not elem.tail.strip():
+ elem.tail = i
+ else:
+ if level and (not elem.tail or not elem.tail.strip()):
+ elem.tail = i
+
+ print 'Writing to file:', outputFile
+ indent(outputTree)
+ ET.dump(outputTree)
diff --git a/framework/src/onos/tools/package/karaf-assembly/pom.xml b/framework/src/onos/tools/package/karaf-assembly/pom.xml
new file mode 100644
index 00000000..4b47c0d1
--- /dev/null
+++ b/framework/src/onos/tools/package/karaf-assembly/pom.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ Copyright 2014-2015 Open Networking Laboratory
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-base</artifactId>
+ <version>1</version>
+ </parent>
+
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-assembly</artifactId>
+ <version>1.0</version>
+ <packaging>pom</packaging>
+
+ <description>ONOS Apache Karaf assembly definitions</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <configuration>
+ <target>
+ <exec executable="python">
+ <arg value="${basedir}/onos-assembly.py"/>
+ </exec>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-maven-plugin</artifactId>
+ <version>3.0.3</version>
+
+ <executions>
+ <execution>
+ <id>features-add-to-repo</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>features-add-to-repository</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>file:${basedir}/target/staged-repos.xml</descriptor>
+ </descriptors>
+ <features>
+ <feature>onos-uber-synthetic</feature>
+ </features>
+ <repository>target/repo</repository>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/framework/src/onos/tools/package/maven-plugin/pom.xml b/framework/src/onos/tools/package/maven-plugin/pom.xml
index c2b5d8ae..5a287d04 100644
--- a/framework/src/onos/tools/package/maven-plugin/pom.xml
+++ b/framework/src/onos/tools/package/maven-plugin/pom.xml
@@ -23,8 +23,9 @@
<relativePath>../../build/pom.xml</relativePath>
</parent>
+ <groupId>org.onosproject</groupId>
<artifactId>onos-maven-plugin</artifactId>
- <version>1.6-SNAPSHOT</version>
+ <version>1.7-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<description>Maven plugin for packaging ONOS applications or generating
diff --git a/framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java b/framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java
index 0ee5382e..a98557dc 100644
--- a/framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java
+++ b/framework/src/onos/tools/package/maven-plugin/src/main/java/org/onosproject/maven/OnosSwaggerMojo.java
@@ -243,7 +243,7 @@ public class OnosSwaggerMojo extends AbstractMojo {
String resourcePath, ArrayNode tagArray, ObjectNode definitions) {
String fullPath = resourcePath, consumes = "", produces = "",
comment = javaMethod.getComment();
- DocletTag tag = javaMethod.getTagByName("rsModel");
+ DocletTag tag = javaMethod.getTagByName("onos.rsModel");
for (JavaAnnotation annotation : javaMethod.getAnnotations()) {
String name = annotation.getType().getName();
if (name.equals(PATH)) {
@@ -293,6 +293,7 @@ public class OnosSwaggerMojo extends AbstractMojo {
+ param + ".json");
String lines = Files.readLines(config, Charsets.UTF_8).stream().reduce((t, u) -> t + u).
get();
+ lines = lines.replaceAll("\\s+","");
definitions.putPOJO(param, lines);
} catch (IOException e) {
e.printStackTrace();
diff --git a/framework/src/onos/tools/package/yangtools/pom.xml b/framework/src/onos/tools/package/yangtools/pom.xml
new file mode 100644
index 00000000..82422c0f
--- /dev/null
+++ b/framework/src/onos/tools/package/yangtools/pom.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.onosproject</groupId>
+ <artifactId>yangloader</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <dependencies>
+ <dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ <version>1.10</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>18.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onlab-misc</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.1</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ <version>1.7.12</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.3</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>2.3</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <transformers>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+ <mainClass>org.onoproject.yangtool.YangLoaderMain</mainClass>
+ </transformer>
+ </transformers>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/framework/src/onos/tools/package/yangtools/src/main/java/org/onoproject/yangtool/YangLoader.java b/framework/src/onos/tools/package/yangtools/src/main/java/org/onoproject/yangtool/YangLoader.java
new file mode 100644
index 00000000..37126890
--- /dev/null
+++ b/framework/src/onos/tools/package/yangtools/src/main/java/org/onoproject/yangtool/YangLoader.java
@@ -0,0 +1,167 @@
+package org.onoproject.yangtool;
+
+import com.google.common.io.Files;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.XMLConfiguration;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.onlab.util.Tools;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Class that takes in input two paths, one to the yang file and one where
+ * to generate the interface, and a yang container name, generates the sources
+ * through OpenDaylight code generator plugin from yang, and modifies
+ * them accordingly to the needs of the ONOS behavior system.
+ */
+public class YangLoader {
+ /**
+ * Public method to take a yang file from the input folder and generate classes
+ * to the output folder.
+ * @param inputFolder forlder with the yang files
+ * @param completeOuputFolder folder where to put the desired classes
+ * @throws IOException
+ * @throws ConfigurationException
+ * @throws InterruptedException
+ */
+ public void generateBehaviourInterface(String inputFolder,
+ String completeOuputFolder)
+ throws IOException, ConfigurationException, InterruptedException {
+ File projectDir = createTemporaryProject(inputFolder);
+ List<String> containerNames = findContainerName(
+ new File(projectDir.getAbsolutePath() + "/src"));
+ System.out.println("Containers " + containerNames);
+ generateJava(projectDir);
+ //modifyClasses(containerName, projectDir, completeInterfaceOuputFolder);
+ copyFiles(new File(projectDir.getAbsolutePath() + "/dst"),
+ new File(completeOuputFolder));
+ //System.out.println("Sources in " + completeOuputFolder);
+
+ }
+
+ private List<String> findContainerName(File scrDir) {
+ List<String> allContainers = new ArrayList<>();
+ Arrays.asList(scrDir.listFiles()).stream().forEach(f -> {
+ try {
+ FileUtils.readLines(f).stream()
+ .filter(line -> line.matches("(.*)container(.*)\\{"))
+ .collect(Collectors.toList()).forEach(s -> {
+ s = s.replace("container", "");
+ s = s.replace("{", "");
+ allContainers.add(s.trim());
+ });
+
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ });
+ return allContainers;
+ }
+
+ private File createTemporaryProject(String inputFolder) throws IOException,
+ ConfigurationException {
+ File tempDir = Files.createTempDir();
+ File scrDir = new File(tempDir, "src");
+ scrDir.mkdir();
+ copyFiles(new File(inputFolder), scrDir);
+ createPomFile(tempDir, scrDir);
+ return tempDir;
+
+ }
+
+ private void copyFiles(File inputFolder, File scrDir) throws IOException {
+ Tools.copyDirectory(inputFolder, scrDir);
+ }
+
+ private void createPomFile(File tempDir, File scrDir) throws ConfigurationException {
+ File pom = new File(tempDir, "pom.xml");
+ File dstDir = new File(tempDir, "dst");
+ dstDir.mkdir();
+ XMLConfiguration cfg = new XMLConfiguration();
+ cfg.load(getClass().getResourceAsStream("/pom-template.xml"));
+ cfg.setProperty("build.plugins.plugin.executions.execution." +
+ "configuration.yangFilesRootDir", scrDir.getPath());
+ cfg.setProperty("build.plugins.plugin.executions." +
+ "execution.configuration.codeGenerators." +
+ "generator.outputBaseDir", dstDir.getPath());
+ cfg.save(pom);
+ }
+
+ private void generateJava(File projectDir)
+ throws IOException, InterruptedException {
+ Runtime rt = Runtime.getRuntime();
+ Process pr = rt.exec("mvn generate-sources", null, projectDir);
+ String s = IOUtils.toString(pr.getInputStream(), "UTF-8");
+ if (pr.waitFor() == 0) {
+ if (s.contains("[WARNING]")) {
+ System.out.println("Sources not generated, warning log: \n" + s);
+ } else {
+ System.out.println("Sources generated");
+ }
+ } else {
+ System.out.println("Sources not generated. " + s +
+ " \nError " + pr.getInputStream().read());
+ }
+ }
+
+ //parsing classes part, for now is not used.
+ private void modifyClasses(String containerName, File projectDir,
+ String pathToNewInterface) throws IOException {
+ String odlInterfacepath = getPathWithFileName(containerName, projectDir.getPath());
+ odlInterfacepath = odlInterfacepath + "/";
+ parseClass(odlInterfacepath, pathToNewInterface, containerName);
+ System.out.println("ONOS behaviour interface generated " +
+ "correctly at " + pathToNewInterface);
+ }
+
+ private String getPathWithFileName(String filename, String pathToGenerated) {
+ File[] directories = new File(pathToGenerated).listFiles(File::isDirectory);
+ while (directories.length != 0) {
+ pathToGenerated = pathToGenerated + "/" + directories[0].getName();
+ directories = new File(pathToGenerated).listFiles(File::isDirectory);
+ }
+ File dir = new File(pathToGenerated);
+ File behaviour = (File) Arrays.asList(dir.listFiles()).stream()
+ .filter(f -> f.getName().equals(filename)).toArray()[0];
+ return behaviour.getParentFile().getAbsolutePath();
+ }
+
+ private void parseClass(String filePath, String pathToNewInterface,
+ String filename) throws IOException {
+ InputStream fis = null;
+ String newFile = "package org.onosproject.net.behaviour;\n" +
+ "import org.onosproject.net.driver.HandlerBehaviour;\n";
+ fis = new FileInputStream(filePath + filename);
+ InputStreamReader isr = new InputStreamReader(fis, Charset.forName("UTF-8"));
+ BufferedReader br = new BufferedReader(isr);
+ String line;
+ while ((line = br.readLine()) != null) {
+ if (!line.contains("org.opendaylight.")) {
+ if (line.contains("ChildOf")) {
+ newFile = newFile + "HandlerBehaviour\n";
+ } else {
+ newFile = newFile + line + "\n";
+ }
+ }
+ }
+ PrintWriter out = new PrintWriter(pathToNewInterface +
+ filename.replace(".java", "")
+ + "Interface.java");
+ out.print(newFile);
+ out.flush();
+ }
+
+
+}
diff --git a/framework/src/onos/tools/package/yangtools/src/main/java/org/onoproject/yangtool/YangLoaderMain.java b/framework/src/onos/tools/package/yangtools/src/main/java/org/onoproject/yangtool/YangLoaderMain.java
new file mode 100644
index 00000000..7b137677
--- /dev/null
+++ b/framework/src/onos/tools/package/yangtools/src/main/java/org/onoproject/yangtool/YangLoaderMain.java
@@ -0,0 +1,16 @@
+package org.onoproject.yangtool;
+
+import org.apache.commons.configuration.ConfigurationException;
+
+import java.io.IOException;
+
+/**
+ * Main of the uangloader tool in order to be called through command line.
+ */
+public class YangLoaderMain {
+ public static void main (String args []) throws IOException,
+ ConfigurationException, InterruptedException {
+ YangLoader yl = new YangLoader();
+ yl.generateBehaviourInterface(args[0], args[1]);
+ }
+}
diff --git a/framework/src/onos/tools/package/yangtools/src/main/resources/pom-template.xml b/framework/src/onos/tools/package/yangtools/src/main/resources/pom-template.xml
new file mode 100644
index 00000000..5280e213
--- /dev/null
+++ b/framework/src/onos/tools/package/yangtools/src/main/resources/pom-template.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>groupId</groupId>
+ <artifactId>yangloader</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>opendaylight-release</id>
+ <name>opendaylight-release</name>
+ <url>
+ http://nexus.opendaylight.org/content/repositories/opendaylight.release/
+ </url>
+ </pluginRepository>
+ <pluginRepository>
+ <id>opendaylight-snapshot</id>
+ <name>opendaylight-snapshot</name>
+ <url>
+ http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/
+ </url>
+ </pluginRepository>
+ </pluginRepositories>
+ <repositories>
+ <repository>
+ <id>opendaylight-release</id>
+ <name>opendaylight-release</name>
+ <url>
+ http://nexus.opendaylight.org/content/repositories/opendaylight.release/
+ </url>
+ </repository>
+ <repository>
+ <id>opendaylight-snapshot</id>
+ <name>opendaylight-snapshot</name>
+ <url>
+ http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/
+ </url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-binding</artifactId>
+ <version>0.7.2-Lithium-SR2</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-maven-plugin</artifactId>
+ <version>0.7.2-Lithium-SR2</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <!-- directory containing yang files to parse and generate code -->
+ <yangFilesRootDir>INPUTDIR</yangFilesRootDir>
+ <codeGenerators>
+ <generator>
+ <codeGeneratorClass>
+ org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl
+ </codeGeneratorClass>
+ <!-- directory into which generated files will be placed -->
+ <outputBaseDir>OUTPUTDIR</outputBaseDir>
+ </generator>
+ </codeGenerators>
+ <inspectDependencies>false</inspectDependencies>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>maven-sal-api-gen-plugin</artifactId>
+ <version>0.7.2-Lithium-SR2</version>
+ <type>jar</type>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.3</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>