Adding demo yang models and working on yang model packaging.
Change-Id: Ief674880920cf6165c863909298eb4fa6dd3fb64
diff --git a/buck-tools/BUCK b/buck-tools/BUCK
index afc1815..6d05f9e 100644
--- a/buck-tools/BUCK
+++ b/buck-tools/BUCK
@@ -41,3 +41,14 @@
visibility = ['PUBLIC'],
)
+export_file(
+ name = 'yang-registrator',
+ src = 'yang-registrator',
+ visibility = [ 'PUBLIC' ],
+)
+
+export_file(
+ name = 'yang-schema',
+ src = 'yang-schema',
+ visibility = [ 'PUBLIC' ],
+)
diff --git a/buck-tools/yang-registrator b/buck-tools/yang-registrator
new file mode 100755
index 0000000..56dc54a
--- /dev/null
+++ b/buck-tools/yang-registrator
@@ -0,0 +1,32 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Generates YANG Model registrator component.
+# -----------------------------------------------------------------------------
+
+output=$1
+package=$2
+shift 2
+
+aux=/tmp/yr-$$
+
+trap "rm -fr $aux" EXIT
+
+pkgDir=$aux/${package//./\/}
+rm -fr $aux $output
+mkdir -p $pkgDir
+cd $aux
+
+cat <<EOF >$output
+// Auto-generated code
+package $package;
+
+import org.onosproject.yang.AbstractYangModelRegistrator;
+import org.apache.felix.scr.annotations.Component;
+
+@Component(immediate = true)
+public class YangModelRegistrator extends AbstractYangModelRegistrator {
+ public YangModelRegistrator() {
+ super(YangModelRegistrator.class);
+ }
+}
+EOF
diff --git a/buck-tools/yang-schema b/buck-tools/yang-schema
new file mode 100755
index 0000000..bcb6e1b
--- /dev/null
+++ b/buck-tools/yang-schema
@@ -0,0 +1,17 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Extracts YANG model schema and YANG sources from a YANG model jar.
+# -----------------------------------------------------------------------------
+
+output=$1
+jar=$2
+
+aux=/tmp/ys-$$
+trap "rm -fr $aux" EXIT
+
+rm -fr $aux
+mkdir -p $aux $output
+
+cd $aux
+jar xf $jar
+mv yang/* $output
\ No newline at end of file