More p4runtime-related bazel build files

Change-Id: Icdd02a06d7905e4cd0a6c61d282fd522c7b75fe7
diff --git a/drivers/barefoot/BUILD b/drivers/barefoot/BUILD
new file mode 100644
index 0000000..ead7a3b
--- /dev/null
+++ b/drivers/barefoot/BUILD
@@ -0,0 +1,25 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "//drivers/p4runtime:onos-drivers-p4runtime",
+]
+
+BUNDLES = [
+    ":onos-drivers-barefoot",
+]
+
+osgi_jar(
+    deps = COMPILE_DEPS,
+    resources_root = "src/main/resources",
+    resources = glob(["src/main/resources/**"]),
+)
+
+onos_app (
+    app_name = "org.onosproject.drivers.barefoot",
+    title = "Barefoot Drivers",
+    category = "Drivers",
+    url = "http://onosproject.org",
+    description = "Adds support for Barefoot Networks devices",
+    included_bundles = BUNDLES,
+    required_apps = [
+        "org.onosproject.drivers.p4runtime",
+    ],
+)
diff --git a/drivers/bmv2/BUILD b/drivers/bmv2/BUILD
new file mode 100644
index 0000000..d17599f
--- /dev/null
+++ b/drivers/bmv2/BUILD
@@ -0,0 +1,41 @@
+COMPILE_DEPS = CORE_DEPS + KRYO + JACKSON + [
+    "//core/store/serializers:onos-core-serializers",
+    "//drivers/p4runtime:onos-drivers-p4runtime",
+    "//pipelines/basic:onos-pipelines-basic",
+    "//protocols/p4runtime/api:onos-protocols-p4runtime-api",
+    "//protocols/p4runtime/model:onos-protocols-p4runtime-model",
+    "@io_grpc_grpc_java//core",
+    "@io_grpc_grpc_java//netty",
+    "@minimal_json//jar",
+    # "//protocols/bmv2/thrift-api:onos-protocols-bmv2-thrift-api",
+    #"//lib:libthrift",
+]
+
+BUNDLES = [
+    ":onos-drivers-bmv2",
+    # "//lib:libthrift",
+    # "//protocols/bmv2/thrift-api:onos-protocols-bmv2-thrift-api",
+]
+
+osgi_jar(
+    deps = COMPILE_DEPS,
+    # FIXME: enable building other classes as soon as we implement BUILD for
+    # protocols/bmv2 (based on Thrift)
+    srcs = ["src/main/java/org/onosproject/drivers/bmv2/Bmv2PipelineProgrammable.java"],
+    resources_root = "src/main/resources",
+    resources = glob(["src/main/resources/**"]),
+)
+
+onos_app (
+    app_name = "org.onosproject.drivers.bmv2",
+    title = "BMv2 Drivers",
+    category = "Drivers",
+    url = "http://onosproject.org",
+    description = "Adds support for BMv2 devices.",
+    included_bundles = BUNDLES,
+    required_apps = [
+        "org.onosproject.drivers.p4runtime",
+        "org.onosproject.drivers.gnmi",
+        "org.onosproject.pipelines.basic",
+    ],
+)
diff --git a/drivers/gnmi/BUILD b/drivers/gnmi/BUILD
new file mode 100644
index 0000000..0616f27
--- /dev/null
+++ b/drivers/gnmi/BUILD
@@ -0,0 +1,36 @@
+COMPILE_DEPS = CORE_DEPS + KRYO + [
+    "@com_google_protobuf//:protobuf_java",
+    "@io_grpc_grpc_java//core",
+    "@io_grpc_grpc_java//netty",
+    "@io_grpc_grpc_java//stub",
+    "//core/store/serializers:onos-core-serializers",
+    "//protocols/gnmi/stub:gnmi_java_grpc",
+    "//protocols/gnmi/stub:gnmi_java_proto",
+    "//protocols/grpc/api:onos-protocols-grpc-api",
+    "//protocols/grpc/proto:dummy_java_grpc",
+]
+
+BUNDLES = [
+    ":onos-drivers-gnmi",
+]
+
+osgi_jar (
+    deps = COMPILE_DEPS,
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+)
+
+onos_app (
+    app_name = "org.onosproject.drivers.gnmi",
+    title = "gNMI Drivers",
+    category = "Drivers",
+    url = "http://onosproject.org",
+    description = "Adds support for devices using gNMI protocol based on " +
+    " openconfig models: http://openconfig.net/ .",
+    included_bundles = BUNDLES,
+    required_apps = [
+        "org.onosproject.generaldeviceprovider",
+        "org.onosproject.protocols.grpc",
+        "org.onosproject.protocols.gnmi"
+    ],
+)
diff --git a/drivers/gnmi/src/main/java/org/onosproject/drivers/gnmi/GnmiDeviceDescriptionDiscovery.java b/drivers/gnmi/src/main/java/org/onosproject/drivers/gnmi/GnmiDeviceDescriptionDiscovery.java
index 93083c5..843231e 100644
--- a/drivers/gnmi/src/main/java/org/onosproject/drivers/gnmi/GnmiDeviceDescriptionDiscovery.java
+++ b/drivers/gnmi/src/main/java/org/onosproject/drivers/gnmi/GnmiDeviceDescriptionDiscovery.java
@@ -22,7 +22,6 @@
 import io.grpc.ManagedChannelBuilder;
 import io.grpc.Status;
 import io.grpc.StatusRuntimeException;
-import io.grpc.internal.DnsNameResolverProvider;
 import io.grpc.netty.NettyChannelBuilder;
 import io.grpc.stub.StreamObserver;
 import org.onosproject.grpc.api.GrpcChannelId;
@@ -162,8 +161,7 @@
 
             ManagedChannelBuilder channelBuilder = NettyChannelBuilder
                     .forAddress(serverAddr, Integer.valueOf(serverPortString))
-                    .usePlaintext(true)
-                    .nameResolverFactory(new DnsNameResolverProvider());
+                    .usePlaintext(true);
 
             try {
                 channel = controller.connectChannel(newChannelId, channelBuilder);
diff --git a/drivers/mellanox/BUILD b/drivers/mellanox/BUILD
new file mode 100644
index 0000000..4faeb31
--- /dev/null
+++ b/drivers/mellanox/BUILD
@@ -0,0 +1,26 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "//drivers/p4runtime:onos-drivers-p4runtime",
+]
+
+BUNDLES = [
+    ":onos-drivers-mellanox",
+]
+
+osgi_jar(
+    deps = COMPILE_DEPS,
+    resources_root = "src/main/resources",
+    resources = glob(["src/main/resources/**"]),
+)
+
+onos_app (
+    app_name = "org.onosproject.drivers.mellanox",
+    title = "Mellanox Drivers",
+    category = "Drivers",
+    url = "http://onosproject.org",
+    description = "Adds support for Mellanox Spectrum-based devices using P4Runtime",
+    included_bundles = BUNDLES,
+    required_apps = [
+        "org.onosproject.drivers.p4runtime",
+        "org.onosproject.pipelines.fabric",
+    ],
+)
diff --git a/drivers/odtn-driver/BUILD b/drivers/odtn-driver/BUILD
index 7f13b94..1c8aa8c 100644
--- a/drivers/odtn-driver/BUILD
+++ b/drivers/odtn-driver/BUILD
@@ -12,9 +12,9 @@
 
 BUNDLES = [
     ":onos-drivers-odtn-driver",
-    #     '//lib:commons-jxpath',
-    #     '//lib:commons-beanutils', # jxpath dependency
-    #     '//lib:jdom',  # jxpath dependency
+    #     "//lib:commons-jxpath",
+    #     "//lib:commons-beanutils", # jxpath dependency
+    #     "//lib:jdom",  # jxpath dependency
 ]
 
 osgi_jar_with_tests(
diff --git a/drivers/p4runtime/BUILD b/drivers/p4runtime/BUILD
new file mode 100644
index 0000000..1107577
--- /dev/null
+++ b/drivers/p4runtime/BUILD
@@ -0,0 +1,30 @@
+COMPILE_DEPS = CORE_DEPS + KRYO + [
+    "//core/store/serializers:onos-core-serializers",
+    "//protocols/p4runtime/api:onos-protocols-p4runtime-api",
+    "@io_grpc_grpc_java//core",
+]
+
+BUNDLES = [
+    ":onos-drivers-p4runtime",
+]
+
+osgi_jar (
+    deps = COMPILE_DEPS,
+    resources = glob(["src/main/resources/**"]),
+    resources_root = "src/main/resources",
+)
+
+onos_app (
+    app_name = "org.onosproject.drivers.p4runtime",
+    title = "P4Runtime Drivers",
+    category = "Drivers",
+    url = "http://onosproject.org",
+    description = "Adds support for devices using P4 Runtime protocol.",
+    included_bundles = BUNDLES,
+    required_apps = [
+        "org.onosproject.generaldeviceprovider",
+        "org.onosproject.protocols.p4runtime",
+        "org.onosproject.p4runtime",
+        "org.onosproject.drivers",
+    ],
+)