Bazel build files for protocols

Change-Id: I12a9cfe2d135d10c640a51d9b3438bcd92f8e37f
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,
+)