Adding Bazel BUILD files for yang subsystem.

Change-Id: I957cc95d56eb2ddf6906fa4a396ce2556b9b5e86
diff --git a/BUILD b/BUILD
index 3e36aa6..273678f 100644
--- a/BUILD
+++ b/BUILD
@@ -80,7 +80,6 @@
 )
 
 # Runs ONOS as a single instance from the /tmp directory
-# FIXME: Still work in progress
 genrule(
     name = "onos-local",
     srcs = [
diff --git a/apps/yang-gui/BUILD b/apps/yang-gui/BUILD
new file mode 100644
index 0000000..66f862a
--- /dev/null
+++ b/apps/yang-gui/BUILD
@@ -0,0 +1,22 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + ONOS_YANG + [
+    "@onos_yang_runtime//jar",
+    "//apps/yang:onos-apps-yang",
+]
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+    resources_root = "src/main/resources",
+    resources = glob(["src/main/resources/**"]),
+)
+
+onos_app (
+    category = "GUI",
+    description = "Adds GUI extension that allows the operator to view the list of currently " +
+        "registered YANG models, and their YANG sources. It also provides means for compiling " +
+        "source YANG files (*.yang, *.zip, *.jar) on the fly and directly from the GUI using " +
+        "drag-n-drop.<p/>User can simply compress a set of YANG source files and drop it on the " +
+        "YANG Models GUI view to automatically compile and then register the compiled YANG models.",
+    required_apps = [ "org.onosproject.yang" ],
+    title = "YANG Runtime GUI",
+    url = "http://onosproject.org",
+)
diff --git a/apps/yang/BUILD b/apps/yang/BUILD
new file mode 100644
index 0000000..d284902
--- /dev/null
+++ b/apps/yang/BUILD
@@ -0,0 +1,30 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + CLI + ONOS_YANG + [
+  "//core/common:onos-core-common",
+  "@onos_yang_runtime//jar",
+]
+
+BUNDLES = ONOS_YANG + [
+  "@onos_yang_runtime//jar",
+  "//apps/yang:onos-apps-yang",
+  "//apps/yang/web:onos-apps-yang-web",
+  "@org_apache_servicemix_bundles_dom4j//jar",
+]
+
+EXCLUDED_BUNDLES = [
+]
+
+osgi_jar_with_tests(
+  deps = COMPILE_DEPS,
+)
+
+onos_app(
+  category = "Utility",
+  description = "Provides ability to register compiled YANG models or even to compile YANG source " +
+    "files on the fly. Registering YANG models allows other ONOS subsystems to interact with " +
+    "orchestrators or individual network devices using XML or JSON data structured in accordance " +
+    "with those models.",
+  included_bundles = BUNDLES,
+  excluded_bundles = EXCLUDED_BUNDLES,
+  title = "YANG Compiler and Runtime",
+  url = "http://onosproject.org",
+)
diff --git a/apps/yang/web/BUILD b/apps/yang/web/BUILD
new file mode 100644
index 0000000..8d3a0a1
--- /dev/null
+++ b/apps/yang/web/BUILD
@@ -0,0 +1,15 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + REST + ONOS_YANG + [
+  "@jersey_media_multipart//jar",
+  "@onos_yang_runtime//jar",
+  "//apps/yang:onos-apps-yang",
+]
+
+osgi_jar_with_tests(
+    api_description = "REST API for YANG Runtime",
+    api_package = "org.onosproject.yang.web",
+    api_title = "YANG Runtime",
+    api_version = "1.0",
+    deps = COMPILE_DEPS,
+    test_deps = TEST_ADAPTERS,
+    web_context = "/onos/yang",
+)
\ No newline at end of file
diff --git a/modules.bzl b/modules.bzl
index cc53368..1efae28 100644
--- a/modules.bzl
+++ b/modules.bzl
@@ -215,8 +215,8 @@
     #"//protocols/restconf/server:onos-protocols-restconf-server-oar",
     #"//apps/restconf:onos-apps-restconf-oar",
     "//apps/flowspec-api:onos-apps-flowspec-api-oar",
-    #"//apps/yang:onos-apps-yang-oar",
-    #"//apps/yang-gui:onos-apps-yang-gui-oar",
+    "//apps/yang:onos-apps-yang-oar",
+    "//apps/yang-gui:onos-apps-yang-gui-oar",
     #"//apps/cord-support:onos-apps-cord-support-oar",
     #"//apps/network-troubleshoot:onos-apps-network-troubleshoot-oar",
     #"//apps/l3vpn:onos-apps-l3vpn-oar",
diff --git a/tools/build_rules/prelude_bazel b/tools/build_rules/prelude_bazel
index 3c71020..b426887 100644
--- a/tools/build_rules/prelude_bazel
+++ b/tools/build_rules/prelude_bazel
@@ -12,6 +12,7 @@
     "TEST",
     "TEST_ADAPTERS",
     "TEST_REST",
+    "ONOS_YANG",
     "generated_java_libraries",
 )
 load("//tools/build/bazel:osgi_java_library.bzl", "osgi_jar", "osgi_jar_with_tests")