Build providers using bazel

Change-Id: I7d4ebcfb1d593e10aa93f0a4f7111680ed66a7e7
diff --git a/providers/openflow/app/BUILD b/providers/openflow/app/BUILD
new file mode 100644
index 0000000..1440c8a
--- /dev/null
+++ b/providers/openflow/app/BUILD
@@ -0,0 +1,16 @@
+APPS = [
+    "org.onosproject.hostprovider",
+    "org.onosproject.lldpprovider",
+    "org.onosproject.openflow-base",
+]
+
+onos_app(
+    app_name = "org.onosproject.openflow",
+    category = "Provider",
+    description = "Suite of the OpenFlow base providers bundled together with ARP/NDP host " +
+                  "location provider and LLDP link provider.",
+    included_bundles = ["//utils/osgi:onlab-osgi"],  # FIXME to allow hollow oar files
+    required_apps = APPS,
+    title = "OpenFlow Provider Suite",
+    url = "http://onosproject.org",
+)
diff --git a/providers/openflow/base/BUILD b/providers/openflow/base/BUILD
new file mode 100644
index 0000000..2192afd
--- /dev/null
+++ b/providers/openflow/base/BUILD
@@ -0,0 +1,25 @@
+BUNDLES = [
+    "@openflowj//jar",
+    "//protocols/openflow/api:onos-protocols-openflow-api",
+    "//protocols/openflow/ctl:onos-protocols-openflow-ctl",
+    "//providers/openflow/device:onos-providers-openflow-device",
+    "//providers/openflow/packet:onos-providers-openflow-packet",
+    "//providers/openflow/flow:onos-providers-openflow-flow",
+    "//providers/openflow/group:onos-providers-openflow-group",
+    "//providers/openflow/meter:onos-providers-openflow-meter",
+]
+
+APPS = [
+    "org.onosproject.optical-model",
+]
+
+onos_app(
+    app_name = "org.onosproject.openflow-base",
+    category = "Provider",
+    description = "Provides the base suite of device, flow and packet providers that rely on the " +
+                  "OpenFlow protocol to interact with network devices.",
+    included_bundles = BUNDLES,
+    required_apps = APPS,
+    title = "OpenFlow Base Provider",
+    url = "https://wiki.onosproject.org/display/ONOS/OpenFlow",
+)
diff --git a/providers/openflow/device/BUILD b/providers/openflow/device/BUILD
new file mode 100644
index 0000000..4a51514
--- /dev/null
+++ b/providers/openflow/device/BUILD
@@ -0,0 +1,10 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "@openflowj//jar",
+    "//protocols/openflow/api:onos-protocols-openflow-api",
+    "//apps/optical-model:onos-apps-optical-model",
+]
+
+osgi_jar_with_tests(
+    test_deps = TEST_ADAPTERS,
+    deps = COMPILE_DEPS,
+)
diff --git a/providers/openflow/flow/BUILD b/providers/openflow/flow/BUILD
new file mode 100644
index 0000000..dadc9c0
--- /dev/null
+++ b/providers/openflow/flow/BUILD
@@ -0,0 +1,8 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + [
+    "@openflowj//jar",
+    "//protocols/openflow/api:onos-protocols-openflow-api",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
diff --git a/providers/openflow/group/BUILD b/providers/openflow/group/BUILD
new file mode 100644
index 0000000..b1edbda
--- /dev/null
+++ b/providers/openflow/group/BUILD
@@ -0,0 +1,10 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + [
+    "@openflowj//jar",
+    "//protocols/openflow/api:onos-protocols-openflow-api",
+    "//providers/openflow/flow:onos-providers-openflow-flow",
+]
+
+osgi_jar_with_tests(
+    test_deps = TEST_ADAPTERS,
+    deps = COMPILE_DEPS,
+)
diff --git a/providers/openflow/message/BUILD b/providers/openflow/message/BUILD
new file mode 100644
index 0000000..1f2dd66
--- /dev/null
+++ b/providers/openflow/message/BUILD
@@ -0,0 +1,26 @@
+COMPILE_DEPS = CORE_DEPS + METRICS + [
+    "@openflowj//jar",
+    "//protocols/openflow/api:onos-protocols-openflow-api",
+    "//apps/cpman/api:onos-apps-cpman-api",
+]
+
+BUNDLES = [
+    "//apps/cpman/api:onos-apps-cpman-api",
+    ":onos-providers-openflow-message",
+]
+
+osgi_jar_with_tests(
+    exclude_tests = [
+        "org.onosproject.provider.of.message.impl.OpenFlowControlMessageProviderTest",
+    ],
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.openflow-message",
+    category = "Provider",
+    description = "ONOS OpenFlow control message provider.",
+    included_bundles = BUNDLES,
+    title = "Control Message Stats Provider",
+    url = "http://onosproject.org",
+)
diff --git a/providers/openflow/meter/BUILD b/providers/openflow/meter/BUILD
new file mode 100644
index 0000000..40d4cef
--- /dev/null
+++ b/providers/openflow/meter/BUILD
@@ -0,0 +1,11 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + [
+    "@openflowj//jar",
+    "//protocols/openflow/api:onos-protocols-openflow-api",
+]
+
+osgi_jar_with_tests(
+    exclude_tests = [
+        "org.onosproject.provider.of.meter.impl.OpenFlowMeterProviderTest",
+    ],
+    deps = COMPILE_DEPS,
+)
diff --git a/providers/openflow/packet/BUILD b/providers/openflow/packet/BUILD
new file mode 100644
index 0000000..8ec8442
--- /dev/null
+++ b/providers/openflow/packet/BUILD
@@ -0,0 +1,8 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "@openflowj//jar",
+    "//protocols/openflow/api:onos-protocols-openflow-api",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)