Bazel build files for protocols

Change-Id: I12a9cfe2d135d10c640a51d9b3438bcd92f8e37f
diff --git a/apps/mappingmanagement/BUILD b/apps/mappingmanagement/BUILD
new file mode 100644
index 0000000..01ceec0
--- /dev/null
+++ b/apps/mappingmanagement/BUILD
@@ -0,0 +1,14 @@
+BUNDLES = [
+    "//apps/mappingmanagement/api:onos-apps-mappingmanagement-api",
+    "//apps/mappingmanagement/cli:onos-apps-mappingmanagement-cli",
+    "//apps/mappingmanagement/mgr:onos-apps-mappingmanagement-mgr",
+    "//apps/mappingmanagement/web:onos-apps-mappingmanagement-web",
+]
+
+onos_app(
+    category = "Monitoring",
+    description = "ONOS mapping management application",
+    included_bundles = BUNDLES,
+    title = "Mapping Management",
+    url = "https://onosproject.org/",
+)
diff --git a/apps/mappingmanagement/api/BUILD b/apps/mappingmanagement/api/BUILD
new file mode 100644
index 0000000..91e6af0
--- /dev/null
+++ b/apps/mappingmanagement/api/BUILD
@@ -0,0 +1,8 @@
+COMPILE_DEPS = CORE_DEPS + KRYO + JACKSON + [
+    "//core/store/serializers:onos-core-serializers",
+]
+
+osgi_jar_with_tests(
+    test_deps = TEST_ADAPTERS,
+    deps = COMPILE_DEPS,
+)
diff --git a/apps/mappingmanagement/cli/BUILD b/apps/mappingmanagement/cli/BUILD
new file mode 100644
index 0000000..8677a84
--- /dev/null
+++ b/apps/mappingmanagement/cli/BUILD
@@ -0,0 +1,14 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + [
+    "@org_apache_karaf_shell_console//jar",
+    "@javax_ws_rs_api//jar",
+    "//incubator/api:onos-incubator-api",
+    "//cli:onos-cli",
+    "//utils/rest:onlab-rest",
+    "//apps/mappingmanagement/api:onos-apps-mappingmanagement-api",
+    "//core/store/serializers:onos-core-serializers",
+]
+
+osgi_jar_with_tests(
+    import_packages = "*,org.onosproject.cli.net",
+    deps = COMPILE_DEPS,
+)
diff --git a/apps/mappingmanagement/mgr/BUILD b/apps/mappingmanagement/mgr/BUILD
new file mode 100644
index 0000000..33f5381
--- /dev/null
+++ b/apps/mappingmanagement/mgr/BUILD
@@ -0,0 +1,13 @@
+COMPILE_DEPS = CORE_DEPS + KRYO + [
+    "//apps/mappingmanagement/api:onos-apps-mappingmanagement-api",
+    "//core/store/serializers:onos-core-serializers",
+]
+
+TEST_DEPS = TEST_ADAPTERS + [
+    "//utils/osgi:onlab-osgi-tests",
+]
+
+osgi_jar_with_tests(
+    test_deps = TEST_DEPS,
+    deps = COMPILE_DEPS,
+)
diff --git a/apps/mappingmanagement/web/BUILD b/apps/mappingmanagement/web/BUILD
new file mode 100644
index 0000000..c858583
--- /dev/null
+++ b/apps/mappingmanagement/web/BUILD
@@ -0,0 +1,20 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + [
+    "@javax_ws_rs_api//jar",
+    "//utils/rest:onlab-rest",
+    "//apps/mappingmanagement/api:onos-apps-mappingmanagement-api",
+]
+
+TEST_DEPS = TEST_REST + [
+    "@minimal_json//jar",
+    "//web/api:onos-rest-tests",
+]
+
+osgi_jar_with_tests(
+    api_description = "REST API for ONOS Mapping Management",
+    api_package = "org.onosproject.mapping.web.api",
+    api_title = "Mapping Management API",
+    api_version = "1.0",
+    test_deps = TEST_DEPS,
+    web_context = "/onos/mappingmanagement",
+    deps = COMPILE_DEPS,
+)
diff --git a/apps/pcep-api/BUILD b/apps/pcep-api/BUILD
new file mode 100644
index 0000000..530f2b7
--- /dev/null
+++ b/apps/pcep-api/BUILD
@@ -0,0 +1,15 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + [
+    "//protocols/ovsdb/api:onos-protocols-ovsdb-api",
+    "//protocols/ovsdb/rfc:onos-protocols-ovsdb-rfc",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    category = "Protocol",
+    description = "PCEP protocol API.",
+    title = "PCEP Protocol API",
+    url = "http://onosproject.org",
+)
diff --git a/core/store/primitives/BUILD b/core/store/primitives/BUILD
new file mode 100644
index 0000000..96a99b9
--- /dev/null
+++ b/core/store/primitives/BUILD
@@ -0,0 +1,22 @@
+COMPILE_DEPS = CORE_DEPS + KRYO + [
+    "@atomix//jar",
+    "//core/common:onos-core-common",
+    "//core/store/serializers:onos-core-serializers",
+    "//incubator/api:onos-incubator-api",
+]
+
+TEST_DEPS = TEST + [
+    "@commons_math3//jar",
+    "@netty_handler//jar",
+    "@netty_buffer//jar",
+    "@netty_codec//jar",
+    "@netty_resolver//jar",
+    "//core/api:onos-api-tests",
+]
+
+osgi_jar_with_tests(
+    name = "onos-core-primitives",
+    test_deps = TEST_DEPS,
+    visibility = ["//visibility:public"],
+    deps = COMPILE_DEPS,
+)
diff --git a/modules.bzl b/modules.bzl
index 30ed0a6..d0e2387 100644
--- a/modules.bzl
+++ b/modules.bzl
@@ -4,7 +4,6 @@
     "//utils/junit:onlab-junit",
     "//utils/misc:onlab-misc",
     "//utils/rest:onlab-rest",
-    #"//tools/build/conf:onos-build-conf",
 ]
 
 API = [
@@ -15,7 +14,7 @@
 CORE = UTILS + API + [
     "//core/net:onos-core-net",
     "//core/common:onos-core-common",
-    #"//core/store/primitives:onos-core-primitives",
+    "//core/store/primitives:onos-core-primitives",
     "//core/store/serializers:onos-core-serializers",
     "//core/store/dist:onos-core-dist",
     "//core/security:onos-security",
@@ -26,38 +25,38 @@
     "//cli:onos-cli",
     "//protocols/rest/api:onos-protocols-rest-api",
     "//protocols/rest/ctl:onos-protocols-rest-ctl",
-    #"//protocols/bgp/bgpio:onos-protocols-bgp-bgpio",
-    #"//protocols/bgp/api:onos-protocols-bgp-api",
-    #"//protocols/bgp/ctl:onos-protocols-bgp-ctl",
+    "//protocols/bgp/bgpio:onos-protocols-bgp-bgpio",
+    "//protocols/bgp/api:onos-protocols-bgp-api",
+    "//protocols/bgp/ctl:onos-protocols-bgp-ctl",
     "//protocols/netconf/api:onos-protocols-netconf-api",
     "//protocols/netconf/ctl:onos-protocols-netconf-ctl",
     "//protocols/openflow/api:onos-protocols-openflow-api",
     "//protocols/openflow/ctl:onos-protocols-openflow-ctl",
-    #"//protocols/ospf/api:onos-protocols-ospf-api",
-    #"//protocols/ospf/protocol:onos-protocols-ospf-protocol",
-    #"//protocols/ospf/ctl:onos-protocols-ospf-ctl",
-    #"//protocols/ovsdb/rfc:onos-protocols-ovsdb-rfc",
-    #"//protocols/ovsdb/api:onos-protocols-ovsdb-api",
-    #"//protocols/ovsdb/ctl:onos-protocols-ovsdb-ctl",
+    "//protocols/ospf/api:onos-protocols-ospf-api",
+    "//protocols/ospf/protocol:onos-protocols-ospf-protocol",
+    "//protocols/ospf/ctl:onos-protocols-ospf-ctl",
+    "//protocols/ovsdb/rfc:onos-protocols-ovsdb-rfc",
+    "//protocols/ovsdb/api:onos-protocols-ovsdb-api",
+    "//protocols/ovsdb/ctl:onos-protocols-ovsdb-ctl",
     "//protocols/p4runtime/api:onos-protocols-p4runtime-api",
     "//protocols/p4runtime/model:onos-protocols-p4runtime-model",
-    #"//protocols/pcep/pcepio:onos-protocols-pcep-pcepio",
-    #"//protocols/pcep/server/api:onos-protocols-pcep-server-api",
-    #"//protocols/pcep/server/ctl:onos-protocols-pcep-server-ctl",
-    #"//protocols/snmp/api:onos-protocols-snmp-api",
-    #"//protocols/snmp/ctl:onos-protocols-snmp-ctl",
-    #"//protocols/isis/api:onos-protocols-isis-api",
-    #"//protocols/isis/ctl:onos-protocols-isis-ctl",
-    #"//protocols/isis/isisio:onos-protocols-isis-isisio",
-    #"//protocols/lisp/api:onos-protocols-lisp-api",
-    #"//protocols/lisp/ctl:onos-protocols-lisp-ctl",
-    #"//protocols/lisp/msg:onos-protocols-lisp-msg",
-    #"//protocols/tl1/api:onos-protocols-tl1-api",
-    #"//protocols/tl1/ctl:onos-protocols-tl1-ctl",
-    #"//protocols/restconf/client/api:onos-protocols-restconf-client-api",
-    #"//protocols/restconf/client/ctl:onos-protocols-restconf-client-ctl",
-    #"//protocols/xmpp/core/api:onos-protocols-xmpp-core-api",
-    #"//protocols/xmpp/core/ctl:onos-protocols-xmpp-core-ctl",
+    "//protocols/pcep/pcepio:onos-protocols-pcep-pcepio",
+    "//protocols/pcep/server/api:onos-protocols-pcep-server-api",
+    "//protocols/pcep/server/ctl:onos-protocols-pcep-server-ctl",
+    "//protocols/snmp/api:onos-protocols-snmp-api",
+    "//protocols/snmp/ctl:onos-protocols-snmp-ctl",
+    "//protocols/isis/api:onos-protocols-isis-api",
+    "//protocols/isis/ctl:onos-protocols-isis-ctl",
+    "//protocols/isis/isisio:onos-protocols-isis-isisio",
+    "//protocols/lisp/api:onos-protocols-lisp-api",
+    "//protocols/lisp/ctl:onos-protocols-lisp-ctl",
+    "//protocols/lisp/msg:onos-protocols-lisp-msg",
+    "//protocols/tl1/api:onos-protocols-tl1-api",
+    "//protocols/tl1/ctl:onos-protocols-tl1-ctl",
+    "//protocols/restconf/client/api:onos-protocols-restconf-client-api",
+    "//protocols/restconf/client/ctl:onos-protocols-restconf-client-ctl",
+    "//protocols/xmpp/core/api:onos-protocols-xmpp-core-api",
+    "//protocols/xmpp/core/ctl:onos-protocols-xmpp-core-ctl",
     "//drivers/utilities:onos-drivers-utilities",
     #"//providers/netconf/device:onos-providers-netconf-device",
     #"//providers/openflow/device:onos-providers-openflow-device",
@@ -75,7 +74,7 @@
     #"//providers/tl1/device:onos-providers-tl1-device",
     #"//providers/general/device:onos-providers-general-device",
     #"//providers/p4runtime/packet:onos-providers-p4runtime-packet",
-    #"//web/api:onos-rest",
+    "//web/api:onos-rest",
     #"//web/gui2:onos-gui2",
     #"//web/gui:onos-gui",
     #"//incubator/protobuf/models:onos-incubator-protobuf-models",
@@ -172,7 +171,7 @@
     #"//apps/optical-model:onos-apps-optical-model-oar",
     #"//apps/optical-rest:onos-apps-optical-rest-oar",
     #"//apps/pathpainter:onos-apps-pathpainter-oar",
-    #"//apps/pcep-api:onos-apps-pcep-api-oar",
+    "//apps/pcep-api:onos-apps-pcep-api-oar",
     #"//apps/pim:onos-apps-pim-oar",
     #"//apps/linkprops:onos-apps-linkprops-oar",
     #"//apps/reactive-routing:onos-apps-reactive-routing-oar",
@@ -204,7 +203,7 @@
     #"//apps/castor:onos-apps-castor-oar",
     #    '//apps/yms:onos-apps-yms-oar',
     #"//apps/ofagent:onos-apps-ofagent-oar",
-    #"//apps/mappingmanagement:onos-apps-mappingmanagement-oar",
+    "//apps/mappingmanagement:onos-apps-mappingmanagement-oar",
     #"//apps/config:onos-apps-config-oar",
     #"//apps/configsync:onos-apps-configsync-oar",
     #"//apps/configsync-netconf:onos-apps-configsync-netconf-oar",
@@ -254,8 +253,8 @@
     #"//protocols/grpc:onos-protocols-grpc-oar",
     #"//protocols/p4runtime:onos-protocols-p4runtime-oar",
     #"//protocols/gnmi:onos-protocols-gnmi-oar",
-    #"//protocols/xmpp/core:onos-protocols-xmpp-core-oar",
-    #"//protocols/xmpp/pubsub:onos-protocols-xmpp-pubsub-oar",
+    "//protocols/xmpp/core:onos-protocols-xmpp-core-oar",
+    "//protocols/xmpp/pubsub:onos-protocols-xmpp-pubsub-oar",
 ]
 
 MODELS = [
diff --git a/protocols/bgp/api/BUILD b/protocols/bgp/api/BUILD
new file mode 100644
index 0000000..7568aba
--- /dev/null
+++ b/protocols/bgp/api/BUILD
@@ -0,0 +1,8 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "@netty//jar",
+    "//protocols/bgp/bgpio:onos-protocols-bgp-bgpio",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/bgp/bgpio/BUILD b/protocols/bgp/bgpio/BUILD
new file mode 100644
index 0000000..a375113
--- /dev/null
+++ b/protocols/bgp/bgpio/BUILD
@@ -0,0 +1,7 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + [
+    "@netty//jar",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/bgp/ctl/BUILD b/protocols/bgp/ctl/BUILD
new file mode 100644
index 0000000..41ab47e
--- /dev/null
+++ b/protocols/bgp/ctl/BUILD
@@ -0,0 +1,18 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "@jersey_client//jar",
+    "@httpclient_osgi//jar",
+    "@httpcore_osgi//jar",
+    "@javax_ws_rs_api//jar",
+    "@netty_common//jar",
+    "@netty//jar",
+    "//protocols/bgp/api:onos-protocols-bgp-api",
+    "//protocols/bgp/bgpio:onos-protocols-bgp-bgpio",
+]
+
+osgi_jar_with_tests(
+    exclude_tests = [
+        "org.onosproject.bgp.BgpPeerChannelHandlerTest",
+        "org.onosproject.bgp.BgpPeerFrameDecoderTest",
+    ],
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/isis/api/BUILD b/protocols/isis/api/BUILD
new file mode 100644
index 0000000..e09f7da
--- /dev/null
+++ b/protocols/isis/api/BUILD
@@ -0,0 +1,7 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + JACKSON + [
+    "@netty//jar",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/isis/ctl/BUILD b/protocols/isis/ctl/BUILD
new file mode 100644
index 0000000..a74b52a
--- /dev/null
+++ b/protocols/isis/ctl/BUILD
@@ -0,0 +1,9 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + JACKSON + [
+    "@netty//jar",
+    "//protocols/isis/api:onos-protocols-isis-api",
+    "//protocols/isis/isisio:onos-protocols-isis-isisio",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/isis/isisio/BUILD b/protocols/isis/isisio/BUILD
new file mode 100644
index 0000000..08bce5d
--- /dev/null
+++ b/protocols/isis/isisio/BUILD
@@ -0,0 +1,8 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + [
+    "@netty//jar",
+    "//protocols/isis/api:onos-protocols-isis-api",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/lisp/api/BUILD b/protocols/lisp/api/BUILD
new file mode 100644
index 0000000..72ff459
--- /dev/null
+++ b/protocols/lisp/api/BUILD
@@ -0,0 +1,9 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + [
+    "@netty_transport//jar",
+    "//protocols/lisp/msg:onos-protocols-lisp-msg",
+    "//apps/mappingmanagement/api:onos-apps-mappingmanagement-api",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/lisp/ctl/BUILD b/protocols/lisp/ctl/BUILD
new file mode 100644
index 0000000..c16ccd8
--- /dev/null
+++ b/protocols/lisp/ctl/BUILD
@@ -0,0 +1,21 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + [
+    "@netty_codec//jar",
+    "@netty_transport//jar",
+    "@netty_transport_native_epoll//jar",
+    "@netty_handler//jar",
+    "@netty_resolver//jar",
+    "@concurrent_trees//jar",
+    "//protocols/lisp/api:onos-protocols-lisp-api",
+    "//protocols/lisp/msg:onos-protocols-lisp-msg",
+]
+
+TEST_DEPS = TEST_ADAPTERS + [
+    "//utils/osgi:onlab-osgi-tests",
+    "//core/api:onos-api-tests",
+    "//protocols/lisp/api:onos-protocols-lisp-api-tests",
+]
+
+osgi_jar_with_tests(
+    test_deps = TEST_DEPS,
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/lisp/msg/BUILD b/protocols/lisp/msg/BUILD
new file mode 100644
index 0000000..04a2def
--- /dev/null
+++ b/protocols/lisp/msg/BUILD
@@ -0,0 +1,11 @@
+COMPILE_DEPS = CORE_DEPS + NETTY
+
+TEST_DEPS = TEST_ADAPTERS + [
+    "//utils/osgi:onlab-osgi-tests",
+    "//core/api:onos-api-tests",
+]
+
+osgi_jar_with_tests(
+    test_deps = TEST_DEPS,
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/ospf/api/BUILD b/protocols/ospf/api/BUILD
new file mode 100644
index 0000000..e09f7da
--- /dev/null
+++ b/protocols/ospf/api/BUILD
@@ -0,0 +1,7 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + JACKSON + [
+    "@netty//jar",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/ospf/ctl/BUILD b/protocols/ospf/ctl/BUILD
new file mode 100644
index 0000000..40ce45b
--- /dev/null
+++ b/protocols/ospf/ctl/BUILD
@@ -0,0 +1,10 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + JACKSON + [
+    "@netty//jar",
+    "//protocols/ospf/api:onos-protocols-ospf-api",
+    "//protocols/ospf/protocol:onos-protocols-ospf-protocol",
+]
+
+osgi_jar_with_tests(
+    exclude_tests = ["org.onosproject.ospf.controller.impl.OspfPipelineFactoryTest"],
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/ospf/protocol/BUILD b/protocols/ospf/protocol/BUILD
new file mode 100644
index 0000000..a4bfe42
--- /dev/null
+++ b/protocols/ospf/protocol/BUILD
@@ -0,0 +1,8 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + [
+    "@netty//jar",
+    "//protocols/ospf/api:onos-protocols-ospf-api",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/ovsdb/api/BUILD b/protocols/ovsdb/api/BUILD
new file mode 100644
index 0000000..f344b92
--- /dev/null
+++ b/protocols/ovsdb/api/BUILD
@@ -0,0 +1,8 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + JACKSON + [
+    "@netty_transport//jar",
+    "//protocols/ovsdb/rfc:onos-protocols-ovsdb-rfc",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/ovsdb/ctl/BUILD b/protocols/ovsdb/ctl/BUILD
new file mode 100644
index 0000000..79bc630
--- /dev/null
+++ b/protocols/ovsdb/ctl/BUILD
@@ -0,0 +1,11 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + JACKSON + [
+    "@netty_transport//jar",
+    "@netty_codec//jar",
+    "@netty_handler//jar",
+    "//protocols/ovsdb/rfc:onos-protocols-ovsdb-rfc",
+    "//protocols/ovsdb/api:onos-protocols-ovsdb-api",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/ovsdb/rfc/BUILD b/protocols/ovsdb/rfc/BUILD
new file mode 100644
index 0000000..f3558c7
--- /dev/null
+++ b/protocols/ovsdb/rfc/BUILD
@@ -0,0 +1,7 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + JACKSON + [
+    "@netty_codec//jar",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/pcep/pcepio/BUILD b/protocols/pcep/pcepio/BUILD
new file mode 100644
index 0000000..6d51bf7
--- /dev/null
+++ b/protocols/pcep/pcepio/BUILD
@@ -0,0 +1,8 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + JACKSON + [
+    "@org_apache_karaf_shell_console//jar",
+    "@netty//jar",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/pcep/server/BUILD b/protocols/pcep/server/BUILD
new file mode 100644
index 0000000..c8b744d
--- /dev/null
+++ b/protocols/pcep/server/BUILD
@@ -0,0 +1,11 @@
+BUNDLES = [
+    "//protocols/pcep/server/api:onos-protocols-pcep-server-api",
+    "//protocols/pcep/server/ctl:onos-protocols-pcep-server-ctl",
+]
+
+onos_app(
+    category = "Utility",
+    included_bundles = BUNDLES,
+    title = "PCEP Server Module",
+    url = "http://onosproject.org",
+)
diff --git a/protocols/pcep/server/api/BUILD b/protocols/pcep/server/api/BUILD
new file mode 100644
index 0000000..f69f463
--- /dev/null
+++ b/protocols/pcep/server/api/BUILD
@@ -0,0 +1,10 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "@netty//jar",
+    "//protocols/pcep/pcepio:onos-protocols-pcep-pcepio",
+    "//apps/pcep-api:onos-apps-pcep-api",
+    "//incubator/api:onos-incubator-api",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/pcep/server/ctl/BUILD b/protocols/pcep/server/ctl/BUILD
new file mode 100644
index 0000000..45562dc
--- /dev/null
+++ b/protocols/pcep/server/ctl/BUILD
@@ -0,0 +1,12 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + JACKSON + KRYO + [
+    "@netty//jar",
+    "//incubator/api:onos-incubator-api",
+    "//protocols/pcep/pcepio:onos-protocols-pcep-pcepio",
+    "//protocols/pcep/server/api:onos-protocols-pcep-server-api",
+    "//core/store/serializers:onos-core-serializers",
+    "//apps/pcep-api:onos-apps-pcep-api",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/restconf/client/api/BUILD b/protocols/restconf/client/api/BUILD
new file mode 100644
index 0000000..de08614
--- /dev/null
+++ b/protocols/restconf/client/api/BUILD
@@ -0,0 +1,9 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "//incubator/api:onos-incubator-api",
+    "//utils/rest:onlab-rest",
+    "//protocols/rest/api:onos-protocols-rest-api",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/restconf/client/ctl/BUILD b/protocols/restconf/client/ctl/BUILD
new file mode 100644
index 0000000..e772dda
--- /dev/null
+++ b/protocols/restconf/client/ctl/BUILD
@@ -0,0 +1,16 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "@jersey_client//jar",
+    "@jersey_common//jar",
+    "@httpclient_osgi//jar",
+    "@httpcore_osgi//jar",
+    "@javax_ws_rs_api//jar",
+    "@hk2_api//jar",
+    "@aopalliance_repackaged//jar",
+    "@javax_inject//jar",
+    "//protocols/restconf/client/api:onos-protocols-restconf-client-api",
+    "//protocols/rest/api:onos-protocols-rest-api",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/snmp/api/BUILD b/protocols/snmp/api/BUILD
new file mode 100644
index 0000000..dc9eb55
--- /dev/null
+++ b/protocols/snmp/api/BUILD
@@ -0,0 +1,11 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + [
+    "@org_apache_servicemix_bundles_snmp4j//jar",
+    "@snmp_core//jar",
+    "@mibs_net_snmp//jar",
+    "@mibs_rfc//jar",
+    "//incubator/api:onos-incubator-api",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/snmp/ctl/BUILD b/protocols/snmp/ctl/BUILD
new file mode 100644
index 0000000..3ade757
--- /dev/null
+++ b/protocols/snmp/ctl/BUILD
@@ -0,0 +1,12 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "@org_apache_servicemix_bundles_snmp4j//jar",
+    "@snmp_core//jar",
+    "@mibs_net_snmp//jar",
+    "@mibs_rfc//jar",
+    "//incubator/api:onos-incubator-api",
+    "//protocols/snmp/api:onos-protocols-snmp-api",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/tl1/api/BUILD b/protocols/tl1/api/BUILD
new file mode 100644
index 0000000..1b2c9b7
--- /dev/null
+++ b/protocols/tl1/api/BUILD
@@ -0,0 +1,7 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "@netty_transport//jar",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/tl1/ctl/BUILD b/protocols/tl1/ctl/BUILD
new file mode 100644
index 0000000..e74c4bb
--- /dev/null
+++ b/protocols/tl1/ctl/BUILD
@@ -0,0 +1,15 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + [
+    "@netty_transport//jar",
+    "@netty_codec//jar",
+    "//protocols/tl1/api:onos-protocols-tl1-api",
+]
+
+TEST_DEPS = TEST_ADAPTERS + [
+    "//utils/osgi:onlab-osgi-tests",
+    "//core/api:onos-api-tests",
+]
+
+osgi_jar_with_tests(
+    test_deps = TEST_DEPS,
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/xmpp/core/BUILD b/protocols/xmpp/core/BUILD
new file mode 100644
index 0000000..c3834c8
--- /dev/null
+++ b/protocols/xmpp/core/BUILD
@@ -0,0 +1,23 @@
+BUNDLES = [
+    "@tinder_xmpp//jar",
+    "@org_apache_servicemix_bundles_dom4j//jar",
+    "@netty_common//jar",
+    "@netty_transport//jar",
+    "@netty_buffer//jar",
+    "@netty_codec//jar",
+    "@stax2_api//jar",
+    "@aalto_xml//jar",
+    "@concurrent_hashmap//jar",
+    "@gnu_idn//jar",
+    "//protocols/xmpp/core/api:onos-protocols-xmpp-core-api",
+    "//protocols/xmpp/core/ctl:onos-protocols-xmpp-core-ctl",
+]
+
+onos_app(
+    app_name = "org.onosproject.protocols.xmpp",
+    category = "Protocol",
+    description = "ONOS XMPP core protocol subsystem",
+    included_bundles = BUNDLES,
+    title = "XMPP Core Protocol Subsystem",
+    url = "https://wiki.onosproject.org/display/ONOS/XMPP+as+SBI",
+)
diff --git a/protocols/xmpp/core/api/BUILD b/protocols/xmpp/core/api/BUILD
new file mode 100644
index 0000000..29d19f1
--- /dev/null
+++ b/protocols/xmpp/core/api/BUILD
@@ -0,0 +1,9 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "@tinder_xmpp//jar",
+    "@netty_transport//jar",
+    "@netty_common//jar",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/xmpp/core/ctl/BUILD b/protocols/xmpp/core/ctl/BUILD
new file mode 100644
index 0000000..8c521a1
--- /dev/null
+++ b/protocols/xmpp/core/ctl/BUILD
@@ -0,0 +1,22 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "@netty_common//jar",
+    "@netty_transport//jar",
+    "@netty_transport_native_epoll//jar",
+    "@netty_buffer//jar",
+    "@netty_codec//jar",
+    "@tinder_xmpp//jar",
+    "@stax2_api//jar",
+    "@aalto_xml//jar",
+    "@concurrent_hashmap//jar",
+    "@gnu_idn//jar",
+    "//protocols/xmpp/core/api:onos-protocols-xmpp-core-api",
+]
+
+TEST_DEPS = TEST + [
+    "//core/api:onos-api-tests",
+]
+
+osgi_jar_with_tests(
+    test_deps = TEST_DEPS,
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/xmpp/pubsub/BUILD b/protocols/xmpp/pubsub/BUILD
new file mode 100644
index 0000000..6ce2904
--- /dev/null
+++ b/protocols/xmpp/pubsub/BUILD
@@ -0,0 +1,20 @@
+BUNDLES = [
+    "@tinder_xmpp//jar",
+    "@concurrent_hashmap//jar",
+    "@gnu_idn//jar",
+    "//protocols/xmpp/core/api:onos-protocols-xmpp-core-api",
+    "//protocols/xmpp/pubsub/api:onos-protocols-xmpp-pubsub-api",
+    "//protocols/xmpp/pubsub/ctl:onos-protocols-xmpp-pubsub-ctl",
+]
+
+onos_app(
+    app_name = "org.onosproject.protocols.xmpp.pubsub",
+    category = "Protocol",
+    description = "XMPP Publish/Subscribe protocol extension subsystem",
+    included_bundles = BUNDLES,
+    required_apps = [
+        "org.onosproject.protocols.xmpp",
+    ],
+    title = "XMPP Publish/Subscribe protocol extension subsystem",
+    url = "http://onosproject.org",
+)
diff --git a/protocols/xmpp/pubsub/api/BUILD b/protocols/xmpp/pubsub/api/BUILD
new file mode 100644
index 0000000..599a692
--- /dev/null
+++ b/protocols/xmpp/pubsub/api/BUILD
@@ -0,0 +1,7 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "@tinder_xmpp//jar",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/protocols/xmpp/pubsub/ctl/BUILD b/protocols/xmpp/pubsub/ctl/BUILD
new file mode 100644
index 0000000..1b868ca
--- /dev/null
+++ b/protocols/xmpp/pubsub/ctl/BUILD
@@ -0,0 +1,16 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "@tinder_xmpp//jar",
+    "@concurrent_hashmap//jar",
+    "@gnu_idn//jar",
+    "//protocols/xmpp/pubsub/api:onos-protocols-xmpp-pubsub-api",
+    "//protocols/xmpp/core/api:onos-protocols-xmpp-core-api",
+]
+
+TEST_DEPS = TEST + [
+    "//core/api:onos-api-tests",
+]
+
+osgi_jar_with_tests(
+    test_deps = TEST_DEPS,
+    deps = COMPILE_DEPS,
+)
diff --git a/web/api/BUILD b/web/api/BUILD
new file mode 100644
index 0000000..6c6595a
--- /dev/null
+++ b/web/api/BUILD
@@ -0,0 +1,22 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + METRICS + [
+    "@javax_ws_rs_api//jar",
+    "//incubator/api:onos-incubator-api",
+    "//utils/rest:onlab-rest",
+]
+
+TEST_DEPS = TEST_REST + [
+    "@minimal_json//jar",
+    "@jersey_security//jar",
+]
+
+osgi_jar_with_tests(
+    name = "onos-rest",
+    api_description = "ONOS Core REST API",
+    api_package = "org.onosproject.rest.impl",
+    api_title = "ONOS Core REST API",
+    api_version = "1.0",
+    exclude_tests = ["org.onosproject.rest.resources.ResourceTest"],
+    test_deps = TEST_DEPS,
+    web_context = "/onos/v1",
+    deps = COMPILE_DEPS,
+)