Build drivers with bazel

Change-Id: I033ac32b3ef8119fc65e046c821ff17f12709261
diff --git a/drivers/ciena/c5162/BUILD b/drivers/ciena/c5162/BUILD
new file mode 100644
index 0000000..e949093
--- /dev/null
+++ b/drivers/ciena/c5162/BUILD
@@ -0,0 +1,42 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + [
+    "@javax_ws_rs_api//jar",
+    "//incubator/api:onos-incubator-api",
+    "//utils/rest:onlab-rest",
+    "//drivers/utilities:onos-drivers-utilities",
+    "//drivers/netconf:onos-drivers-netconf",
+    "//protocols/netconf/api:onos-protocols-netconf-api",
+]
+
+TEST_DEPS = TEST_ADAPTERS + [
+    "//drivers/netconf:onos-drivers-netconf-tests",
+]
+
+BUNDLES = [
+    ":onos-drivers-ciena-c5162",
+    "//drivers/utilities:onos-drivers-utilities",
+    "//drivers/netconf:onos-drivers-netconf",
+]
+
+REQUIRED_APPS = [
+    "org.onosproject.linkdiscovery",
+    "org.onosproject.netconf",
+    "org.onosproject.netconfsb",
+    "org.onosproject.drivers.netconf",
+]
+
+osgi_jar_with_tests(
+    resources = glob(["src/*/resources/**"]),
+    resources_root = "src/main/resources",
+    test_deps = TEST_DEPS,
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.ciena.c5162",
+    category = "Drivers",
+    description = "Adds support for Ciena 5162 devices.",
+    included_bundles = BUNDLES,
+    required_apps = REQUIRED_APPS,
+    title = "Ciena 5162 Drivers",
+    url = "http://onosproject.org",
+)
diff --git a/drivers/ciena/c5170/BUILD b/drivers/ciena/c5170/BUILD
new file mode 100644
index 0000000..f539f35
--- /dev/null
+++ b/drivers/ciena/c5170/BUILD
@@ -0,0 +1,42 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + [
+    "@javax_ws_rs_api//jar",
+    "//incubator/api:onos-incubator-api",
+    "//utils/rest:onlab-rest",
+    "//drivers/utilities:onos-drivers-utilities",
+    "//drivers/netconf:onos-drivers-netconf",
+    "//protocols/netconf/api:onos-protocols-netconf-api",
+]
+
+TEST_DEPS = TEST_ADAPTERS + [
+    "//drivers/netconf:onos-drivers-netconf-tests",
+]
+
+BUNDLES = [
+    ":onos-drivers-ciena-c5170",
+    "//drivers/utilities:onos-drivers-utilities",
+    "//drivers/netconf:onos-drivers-netconf",
+]
+
+REQUIRED_APPS = [
+    "org.onosproject.linkdiscovery",
+    "org.onosproject.netconf",
+    "org.onosproject.netconfsb",
+    "org.onosproject.drivers.netconf",
+]
+
+osgi_jar_with_tests(
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+    test_deps = TEST_DEPS,
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.ciena.c5170",
+    category = "Drivers",
+    description = "Adds support for Ciena 5170 devices.",
+    included_bundles = BUNDLES,
+    required_apps = REQUIRED_APPS,
+    title = "Ciena 5170 Drivers",
+    url = "http://onosproject.org",
+)
diff --git a/drivers/ciena/waveserver/BUILD b/drivers/ciena/waveserver/BUILD
new file mode 100644
index 0000000..64cd99f
--- /dev/null
+++ b/drivers/ciena/waveserver/BUILD
@@ -0,0 +1,37 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + [
+    "@javax_ws_rs_api//jar",
+    "//incubator/api:onos-incubator-api",
+    "//utils/rest:onlab-rest",
+    "//drivers/utilities:onos-drivers-utilities",
+    "//protocols/rest/api:onos-protocols-rest-api",
+    "//apps/optical-model:onos-apps-optical-model",
+    "//drivers/optical:onos-drivers-optical",
+]
+
+BUNDLES = [
+    ":onos-drivers-ciena-waveserver",
+    "//drivers/utilities:onos-drivers-utilities",
+]
+
+REQUIRED_APPS = [
+    "org.onosproject.restsb",
+    "org.onosproject.optical-model",
+    "org.onosproject.drivers.optical",
+]
+
+osgi_jar_with_tests(
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+    test_deps = TEST_ADAPTERS,
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.ciena.waveserver",
+    category = "Drivers",
+    description = "Adds support for Ciena Waveserver devices.",
+    included_bundles = BUNDLES,
+    required_apps = REQUIRED_APPS,
+    title = "Ciena Waveserver Drivers",
+    url = "http://onosproject.org",
+)
diff --git a/drivers/cisco/netconf/BUILD b/drivers/cisco/netconf/BUILD
new file mode 100644
index 0000000..181f625
--- /dev/null
+++ b/drivers/cisco/netconf/BUILD
@@ -0,0 +1,29 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "//drivers/utilities:onos-drivers-utilities",
+    "//protocols/netconf/api:onos-protocols-netconf-api",
+]
+
+BUNDLES = [
+    ":onos-drivers-cisco-netconf",
+    "//drivers/utilities:onos-drivers-utilities",
+]
+
+osgi_jar_with_tests(
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+    test_deps = TEST_ADAPTERS,
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.cisco.netconf",
+    category = "Drivers",
+    description = "Adds support for Cisco devices using NETCONF protocol.",
+    included_bundles = BUNDLES,
+    required_apps = [
+        "org.onosproject.netconf",
+        "org.onosproject.drivers.netconf",
+    ],
+    title = "Cisco NETCONF Drivers",
+    url = "http://onosproject.org",
+)
diff --git a/drivers/cisco/rest/BUILD b/drivers/cisco/rest/BUILD
new file mode 100644
index 0000000..d5b7ac7
--- /dev/null
+++ b/drivers/cisco/rest/BUILD
@@ -0,0 +1,29 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + [
+    "@javax_ws_rs_api//jar",
+    "//incubator/api:onos-incubator-api",
+    "//utils/rest:onlab-rest",
+    "//drivers/utilities:onos-drivers-utilities",
+    "//protocols/rest/api:onos-protocols-rest-api",
+]
+
+BUNDLES = [
+    ":onos-drivers-cisco-rest",
+    "//drivers/utilities:onos-drivers-utilities",
+]
+
+osgi_jar_with_tests(
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+    test_deps = TEST_ADAPTERS,
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.cisco.rest",
+    category = "Drivers",
+    description = "Adds support for Cisco devices using REST.",
+    included_bundles = BUNDLES,
+    required_apps = ["org.onosproject.restsb"],
+    title = "Cisco REST Drivers",
+    url = "http://onosproject.org",
+)
diff --git a/drivers/corsa/BUILD b/drivers/corsa/BUILD
new file mode 100644
index 0000000..a38d02e
--- /dev/null
+++ b/drivers/corsa/BUILD
@@ -0,0 +1,22 @@
+COMPILE_DEPS = CORE_DEPS + KRYO + [
+    "@openflowj//jar",
+    "//drivers/default:onos-drivers-default",
+    "//drivers/utilities:onos-drivers-utilities",
+    "//protocols/openflow/api:onos-protocols-openflow-api",
+]
+
+osgi_jar_with_tests(
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+    test_deps = TEST_ADAPTERS,
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.corsa",
+    category = "Drivers",
+    description = "Adds support for Corsa devices.",
+    required_apps = ["org.onosproject.openflow"],
+    title = "Corsa Drivers",
+    url = "http://onosproject.org",
+)
diff --git a/drivers/flowspec/BUILD b/drivers/flowspec/BUILD
new file mode 100644
index 0000000..fd1b1a7
--- /dev/null
+++ b/drivers/flowspec/BUILD
@@ -0,0 +1,20 @@
+COMPILE_DEPS = CORE_DEPS + KRYO + [
+    "//drivers/default:onos-drivers-default",
+    "//apps/flowspec-api/flowapi:onos-apps-flowspec-api-flowapi",
+]
+
+osgi_jar_with_tests(
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+    test_deps = TEST_ADAPTERS,
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.flowspec",
+    category = "Drivers",
+    description = "Adds support for devices using flow specs.",
+    required_apps = ["org.onosproject.drivers"],
+    title = "Generic Flow Spec Drivers",
+    url = "http://onosproject.org",
+)
diff --git a/drivers/fujitsu/BUILD b/drivers/fujitsu/BUILD
new file mode 100644
index 0000000..f6a2fdd
--- /dev/null
+++ b/drivers/fujitsu/BUILD
@@ -0,0 +1,36 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "@org_apache_karaf_shell_console//jar",
+    "//drivers/utilities:onos-drivers-utilities",
+    "//protocols/netconf/api:onos-protocols-netconf-api",
+    "//protocols/netconf/ctl:onos-protocols-netconf-ctl",
+    "//cli:onos-cli",
+    "//apps/optical-model:onos-apps-optical-model",
+    "//incubator/api:onos-incubator-api",
+]
+
+BUNDLES = [
+    ":onos-drivers-fujitsu",
+    "//drivers/utilities:onos-drivers-utilities",
+]
+
+osgi_jar_with_tests(
+    exclude_tests = ["org.onosproject.drivers.fujitsu.FujitsuNetconfSessionListenerTest"],
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+    test_deps = TEST_ADAPTERS,
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.fujitsu",
+    category = "Drivers",
+    description = "Adds support for Fujitsu devices.",
+    included_bundles = BUNDLES,
+    required_apps = [
+        "org.onosproject.netconf",
+        "org.onosproject.optical-model",
+        "org.onosproject.drivers.optical",
+    ],
+    title = "Fujitsu Drivers",
+    url = "http://onosproject.org",
+)
diff --git a/drivers/hp/BUILD b/drivers/hp/BUILD
new file mode 100644
index 0000000..bba0b3f
--- /dev/null
+++ b/drivers/hp/BUILD
@@ -0,0 +1,22 @@
+COMPILE_DEPS = CORE_DEPS + KRYO + [
+    "@openflowj//jar",
+    "//drivers/default:onos-drivers-default",
+    "//drivers/utilities:onos-drivers-utilities",
+    "//protocols/openflow/api:onos-protocols-openflow-api",
+]
+
+osgi_jar_with_tests(
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+    test_deps = TEST_ADAPTERS,
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.hp",
+    category = "Drivers",
+    description = "Adds support for HP devices.",
+    required_apps = ["org.onosproject.openflow"],
+    title = "HP Drivers",
+    url = "http://onosproject.org",
+)
diff --git a/drivers/juniper/BUILD b/drivers/juniper/BUILD
new file mode 100644
index 0000000..9bc897d
--- /dev/null
+++ b/drivers/juniper/BUILD
@@ -0,0 +1,25 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "//drivers/utilities:onos-drivers-utilities",
+    "//protocols/netconf/api:onos-protocols-netconf-api",
+]
+
+BUNDLES = [
+    ":onos-drivers-juniper",
+    "//drivers/utilities:onos-drivers-utilities",
+]
+
+osgi_jar_with_tests(
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.juniper",
+    category = "Drivers",
+    description = "Adds support for Juniper devices.",
+    included_bundles = BUNDLES,
+    required_apps = ["org.onosproject.netconf"],
+    title = "Juniper Drivers",
+    url = "http://onosproject.org",
+)
diff --git a/drivers/lisp/BUILD b/drivers/lisp/BUILD
new file mode 100644
index 0000000..49d6bf0
--- /dev/null
+++ b/drivers/lisp/BUILD
@@ -0,0 +1,36 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + [
+    "//protocols/lisp/api:onos-protocols-lisp-api",
+    "//protocols/lisp/msg:onos-protocols-lisp-msg",
+    "//apps/mappingmanagement/api:onos-apps-mappingmanagement-api",
+    "//core/store/serializers:onos-core-serializers",
+]
+
+TEST_DEPS = TEST_ADAPTERS + [
+    "@jersey_test_framework_core//jar",
+    "@jersey_test_framework_jetty//jar",
+    "//apps/mappingmanagement/api:onos-apps-mappingmanagement-api-tests",
+    "//core/api:onos-api-tests",
+    "//utils/osgi:onlab-osgi-tests",
+    "//web/api:onos-rest-tests",
+]
+
+BUNDLES = [
+    ":onos-drivers-lisp",
+]
+
+osgi_jar_with_tests(
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+    test_deps = TEST_DEPS,
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.lisp",
+    category = "Drivers",
+    description = "Adds support for devices using LISP.",
+    included_bundles = BUNDLES,
+    required_apps = ["org.onosproject.lisp"],
+    title = "Generic LISP Drivers",
+    url = "https://wiki.onosproject.org/display/ONOS/LISP+as+SBI",
+)
diff --git a/drivers/lumentum/BUILD b/drivers/lumentum/BUILD
new file mode 100644
index 0000000..5ccb339
--- /dev/null
+++ b/drivers/lumentum/BUILD
@@ -0,0 +1,39 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "@org_apache_servicemix_bundles_snmp4j//jar",
+    "//drivers/utilities:onos-drivers-utilities",
+    "//protocols/snmp/api:onos-protocols-snmp-api",
+    "//protocols/tl1/api:onos-protocols-tl1-api",
+    "//protocols/netconf/api:onos-protocols-netconf-api",
+    "//incubator/api:onos-incubator-api",
+    "//apps/optical-model:onos-apps-optical-model",
+    "//drivers/optical:onos-drivers-optical",
+]
+
+BUNDLES = [
+    ":onos-drivers-lumentum",
+    "//drivers/utilities:onos-drivers-utilities",
+]
+
+osgi_jar_with_tests(
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+    test_deps = TEST_ADAPTERS,
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.lumentum",
+    category = "Drivers",
+    description = "ONOS Lumentum Device Drivers application.",
+    included_bundles = BUNDLES,
+    required_apps = [
+        "org.onosproject.snmp",
+        "org.onosproject.faultmanagement",
+        "org.onosproject.optical-model",
+        "org.onosproject.tl1",
+        "org.onosproject.netconf",
+        "org.onosproject.drivers.optical",
+    ],
+    title = "Lumentum Drivers",
+    url = "http://onosproject.org",
+)
diff --git a/drivers/netconf/BUILD b/drivers/netconf/BUILD
new file mode 100644
index 0000000..be9fe7e
--- /dev/null
+++ b/drivers/netconf/BUILD
@@ -0,0 +1,26 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "//drivers/utilities:onos-drivers-utilities",
+    "//protocols/netconf/api:onos-protocols-netconf-api",
+]
+
+BUNDLES = [
+    ":onos-drivers-netconf",
+    "//drivers/utilities:onos-drivers-utilities",
+]
+
+osgi_jar_with_tests(
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+    test_deps = TEST_ADAPTERS,
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.netconf",
+    category = "Drivers",
+    description = "Adds support for devices using NETCONF.",
+    included_bundles = BUNDLES,
+    required_apps = ["org.onosproject.netconf"],
+    title = "Generic NETCONF Drivers",
+    url = "http://onosproject.org",
+)
diff --git a/drivers/oplink/BUILD b/drivers/oplink/BUILD
new file mode 100644
index 0000000..abcf874
--- /dev/null
+++ b/drivers/oplink/BUILD
@@ -0,0 +1,31 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "//drivers/default:onos-drivers-default",
+    "//drivers/utilities:onos-drivers-utilities",
+    "//protocols/netconf/api:onos-protocols-netconf-api",
+    "//apps/optical-model:onos-apps-optical-model",
+]
+
+BUNDLES = [
+    ":onos-drivers-oplink",
+    "//drivers/utilities:onos-drivers-utilities",
+]
+
+osgi_jar_with_tests(
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+    test_deps = TEST_ADAPTERS,
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.oplink",
+    category = "Drivers",
+    description = "Adds support for Oplink devices.",
+    included_bundles = BUNDLES,
+    required_apps = [
+        "org.onosproject.netconf",
+        "org.onosproject.optical-model",
+    ],
+    title = "Oplink Drivers",
+    url = "http://onosproject.org",
+)
diff --git a/drivers/optical/BUILD b/drivers/optical/BUILD
new file mode 100644
index 0000000..9d47a2d
--- /dev/null
+++ b/drivers/optical/BUILD
@@ -0,0 +1,30 @@
+COMPILE_DEPS = CORE_DEPS + NETTY + JACKSON + [
+    "@openflowj//jar",
+    "//protocols/openflow/api:onos-protocols-openflow-api",
+    "//drivers/default:onos-drivers-default",
+    "//apps/optical-model:onos-apps-optical-model",
+]
+
+TEST_DEPS = TEST_ADAPTERS + [
+    "//core/api:onos-api-tests",
+    "//utils/osgi:onlab-osgi-tests",
+]
+
+osgi_jar_with_tests(
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+    test_deps = TEST_DEPS,
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.optical",
+    category = "Drivers",
+    description = "Suite of basic optical device drivers.",
+    required_apps = [
+        "org.onosproject.drivers",
+        "org.onosproject.optical-model",
+    ],
+    title = "Basic Optical Drivers",
+    url = "http://onosproject.org",
+)
diff --git a/drivers/ovsdb/BUILD b/drivers/ovsdb/BUILD
new file mode 100644
index 0000000..56c8b22
--- /dev/null
+++ b/drivers/ovsdb/BUILD
@@ -0,0 +1,25 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "//drivers/utilities:onos-drivers-utilities",
+    "//protocols/ovsdb/api:onos-protocols-ovsdb-api",
+    "//protocols/ovsdb/rfc:onos-protocols-ovsdb-rfc",
+]
+
+TEST_DEPS = TEST_ADAPTERS + [
+    "//protocols/ovsdb/api:onos-protocols-ovsdb-api-tests",
+]
+
+osgi_jar_with_tests(
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+    test_deps = TEST_DEPS,
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.ovsdb",
+    category = "Drivers",
+    description = "Adds support for devices using OVSDB.",
+    required_apps = ["org.onosproject.ovsdb-base"],
+    title = "Generic OVSDB Drivers",
+    url = "http://onosproject.org",
+)
diff --git a/drivers/polatis/openflow/BUILD b/drivers/polatis/openflow/BUILD
new file mode 100644
index 0000000..03a8791
--- /dev/null
+++ b/drivers/polatis/openflow/BUILD
@@ -0,0 +1,26 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "@openflowj//jar",
+    "//protocols/openflow/api:onos-protocols-openflow-api",
+    "//apps/optical-model:onos-apps-optical-model",
+]
+
+APPS = [
+    "org.onosproject.drivers.optical",
+    "org.onosproject.optical-model",
+]
+
+osgi_jar_with_tests(
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+    test_deps = TEST_ADAPTERS,
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.polatis.openflow",
+    category = "Drivers",
+    description = "ONOS Polatis OpenFlow Device Drivers application.",
+    required_apps = APPS,
+    title = "Polatis OpenFlow Device Drivers",
+    url = "http://www.polatis.com",
+)
diff --git a/drivers/server/BUILD b/drivers/server/BUILD
new file mode 100644
index 0000000..c2ab312
--- /dev/null
+++ b/drivers/server/BUILD
@@ -0,0 +1,32 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + [
+    "@javax_ws_rs_api//jar",
+    "//incubator/api:onos-incubator-api",
+    "//utils/rest:onlab-rest",
+    "//protocols/rest/api:onos-protocols-rest-api",
+]
+
+BUNDLES = [
+    ":onos-drivers-server",
+]
+
+REQUIRED_APPS = [
+    "org.onosproject.restsb",
+]
+
+osgi_jar_with_tests(
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+    test_deps = TEST_ADAPTERS,
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    app_name = "org.onosproject.drivers.server",
+    category = "Drivers",
+    description = "ONOS southbound drivers for commodity servers",
+    included_bundles = BUNDLES,
+    origin = "KTH Royal Institute of Technology & RISE SICS",
+    required_apps = REQUIRED_APPS,
+    title = "Server Device Drivers",
+    url = "https://github.com/gkatsikas/onos/tree/metron-driver",
+)