More p4runtime-related bazel build files

Change-Id: Icdd02a06d7905e4cd0a6c61d282fd522c7b75fe7
diff --git a/apps/p4-tutorial/mytunnel/BUILD b/apps/p4-tutorial/mytunnel/BUILD
new file mode 100644
index 0000000..415084e
--- /dev/null
+++ b/apps/p4-tutorial/mytunnel/BUILD
@@ -0,0 +1,23 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "//apps/p4-tutorial/pipeconf:onos-apps-p4-tutorial-pipeconf",
+]
+
+osgi_jar (
+    deps = COMPILE_DEPS,
+)
+
+BUNDLES = [
+    "//apps/p4-tutorial/mytunnel:onos-apps-p4-tutorial-mytunnel",
+]
+
+onos_app (
+    app_name = "org.onosproject.p4tutorial.mytunnel",
+    title = "MyTunnel Demo App",
+    category = "Traffic Engineering",
+    url = "http://onosproject.org",
+    description = "Provides forwarding between each pair of hosts via MyTunnel protocol",
+    included_bundles = BUNDLES,
+    required_apps = [
+        "org.onosproject.p4tutorial.pipeconf",
+    ]
+)
diff --git a/apps/p4-tutorial/pipeconf/BUILD b/apps/p4-tutorial/pipeconf/BUILD
new file mode 100644
index 0000000..2a39cbb
--- /dev/null
+++ b/apps/p4-tutorial/pipeconf/BUILD
@@ -0,0 +1,26 @@
+COMPILE_DEPS = CORE_DEPS + [
+    "@minimal_json//jar",
+    "//protocols/p4runtime/model:onos-protocols-p4runtime-model",
+    "//protocols/p4runtime/api:onos-protocols-p4runtime-api",
+    "//drivers/default:onos-drivers-default",
+]
+
+osgi_jar (
+    deps = COMPILE_DEPS,
+)
+
+BUNDLES = [
+    "//apps/p4-tutorial/pipeconf:onos-apps-p4-tutorial-pipeconf",
+]
+
+onos_app (
+    app_name = "org.onosproject.p4tutorial.pipeconf",
+    title = "P4 Tutorial Pipeconf",
+    category = "Pipeconf",
+    url = "http://onosproject.org",
+    description = "Provides pipeconf for the ONOS-P4 Tutorial",
+    included_bundles = BUNDLES,
+    required_apps = [
+        "org.onosproject.drivers.p4runtime",
+    ]
+)
diff --git a/apps/route-service/app/BUILD b/apps/route-service/app/BUILD
index 4eb3fe3..885fa8b 100644
--- a/apps/route-service/app/BUILD
+++ b/apps/route-service/app/BUILD
@@ -13,9 +13,9 @@
 osgi_jar_with_tests(
     test_deps = TEST_DEPS,
     deps = COMPILE_DEPS,
-    #web_context = '/onos/routeservice',
-    #api_title = 'Route Service App',
-    #api_version = '1.0',
-    #api_description = 'REST API for Route Service App',
-    #api_package = 'org.onosproject.routeservice.rest',
+    #web_context = "/onos/routeservice",
+    #api_title = "Route Service App",
+    #api_version = "1.0",
+    #api_description = "REST API for Route Service App",
+    #api_package = "org.onosproject.routeservice.rest",
 )
diff --git a/apps/segmentrouting/web/BUILD b/apps/segmentrouting/web/BUILD
index 757a30f..9b683d3 100644
--- a/apps/segmentrouting/web/BUILD
+++ b/apps/segmentrouting/web/BUILD
@@ -6,9 +6,9 @@
 
 osgi_jar_with_tests(
     deps = COMPILE_DEPS,
-    #web_context = '/onos/segmentrouting',
-    #api_title = 'Segment Routing Rest Server',
-    #api_version = '1.0',
-    #api_description = 'REST API for Segment Routing Application',
-    #api_package = 'org.onosproject.segmentrouting.web',
+    #web_context = "/onos/segmentrouting",
+    #api_title = "Segment Routing Rest Server",
+    #api_version = "1.0",
+    #api_description = "REST API for Segment Routing Application",
+    #api_package = "org.onosproject.segmentrouting.web",
 )
diff --git a/core/api/BUILD b/core/api/BUILD
index 6f19099..23c4b4e 100644
--- a/core/api/BUILD
+++ b/core/api/BUILD
@@ -22,6 +22,6 @@
     ],
     visibility = ["//visibility:public"],
     deps = COMPILE_DEPS,
-    #javadoc_files = glob(['src/main/javadoc/**/*']),
-    #javadoc_files_root = 'src/main/javadoc',
+    #javadoc_files = glob(["src/main/javadoc/**/*"]),
+    #javadoc_files_root = "src/main/javadoc",
 )
diff --git a/docs/BUILD b/docs/BUILD
index 840d28a..39693ab 100644
--- a/docs/BUILD
+++ b/docs/BUILD
@@ -77,7 +77,7 @@
     "//providers/lisp/device:onos-providers-lisp-device-sources",
     "//providers/tl1/device:onos-providers-tl1-device-sources",
     "//providers/general/device:onos-providers-general-device-sources",
-    #    "//providers/p4runtime/packet:onos-providers-p4runtime-packet-sources",
+    # "//providers/p4runtime/packet:onos-providers-p4runtime-packet-sources",
     "//apps/pcep-api:onos-apps-pcep-api-sources",
     "//apps/optical-model:onos-apps-optical-model-sources",
     "//apps/mappingmanagement/api:onos-apps-mappingmanagement-api-sources",
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",
+    ],
+)
diff --git a/modules.bzl b/modules.bzl
index d920699..cc809ca 100644
--- a/modules.bzl
+++ b/modules.bzl
@@ -104,12 +104,12 @@
     "//drivers/huawei:onos-drivers-huawei-oar",
     "//drivers/microsemi/ea1000:onos-drivers-microsemi-ea1000-oar",
     "//drivers/oplink:onos-drivers-oplink-oar",
-    # "//drivers/bmv2:onos-drivers-bmv2-oar",
-    # "//drivers/barefoot:onos-drivers-barefoot-oar",
-    # "//drivers/mellanox:onos-drivers-mellanox-oar",
+    "//drivers/bmv2:onos-drivers-bmv2-oar",
+    "//drivers/barefoot:onos-drivers-barefoot-oar",
+    "//drivers/mellanox:onos-drivers-mellanox-oar",
     "//drivers/hp:onos-drivers-hp-oar",
-    # "//drivers/p4runtime:onos-drivers-p4runtime-oar",
-    # "//drivers/gnmi:onos-drivers-gnmi-oar",
+    "//drivers/p4runtime:onos-drivers-p4runtime-oar",
+    "//drivers/gnmi:onos-drivers-gnmi-oar",
     "//drivers/polatis/netconf:onos-drivers-polatis-netconf-oar",
     "//drivers/polatis/openflow:onos-drivers-polatis-openflow-oar",
     "//drivers/odtn-driver:onos-drivers-odtn-driver-oar",
@@ -234,8 +234,8 @@
     "//apps/evpn-route-service:onos-apps-evpn-route-service-oar",
     # "//incubator/protobuf/registry:onos-incubator-protobuf-registry-oar",
     # "//incubator/protobuf/services/nb:onos-incubator-protobuf-services-nb-oar",
-    # "//apps/p4-tutorial/pipeconf:onos-apps-p4-tutorial-pipeconf-oar",
-    # "//apps/p4-tutorial/mytunnel:onos-apps-p4-tutorial-mytunnel-oar",
+    "//apps/p4-tutorial/pipeconf:onos-apps-p4-tutorial-pipeconf-oar",
+    "//apps/p4-tutorial/mytunnel:onos-apps-p4-tutorial-mytunnel-oar",
     "//apps/cfm:onos-apps-cfm-oar",
     "//apps/routeradvertisement:onos-apps-routeradvertisement-oar",
     "//apps/powermanagement:onos-apps-powermanagement-oar",
@@ -255,7 +255,7 @@
 PROTOCOL_APPS = [
     "//protocols/grpc:onos-protocols-grpc-oar",
     "//protocols/p4runtime:onos-protocols-p4runtime-oar",
-    # "//protocols/gnmi:onos-protocols-gnmi-oar",
+    "//protocols/gnmi:onos-protocols-gnmi-oar",
     "//protocols/xmpp/core:onos-protocols-xmpp-core-oar",
     "//protocols/xmpp/pubsub:onos-protocols-xmpp-pubsub-oar",
 ]
@@ -294,7 +294,6 @@
     "//apps/vtn/sfcmgr:onos-apps-vtn-sfcmgr",
     "//apps/vtn/vtnmgr:onos-apps-vtn-vtnmgr",
     "//apps/vtn/vtnweb:onos-apps-vtn-vtnweb",
-    # "//apps/p4runtime-test:onos-apps-p4runtime-test",
     "//apps/kafka-integration/api:onos-apps-kafka-integration-api",
     # "//apps/kafka-integration/app:onos-apps-kafka-integration-app",
 ]
diff --git a/pipelines/fabric/BUILD b/pipelines/fabric/BUILD
index 06b0ab4..75fb50c 100644
--- a/pipelines/fabric/BUILD
+++ b/pipelines/fabric/BUILD
@@ -10,7 +10,6 @@
 ]
 
 osgi_jar_with_tests(
-    exclude_tests = ["org/onosproject/pipelines/fabric/pipeliner/FabricPipelinerTest"],
     test_deps = TEST_ADAPTERS,
     deps = COMPILE_DEPS,
 )
diff --git a/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipelinerTest.java b/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipelinerTest.java
index b907bdf..5e08aa2 100644
--- a/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipelinerTest.java
+++ b/pipelines/fabric/src/test/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipelinerTest.java
@@ -17,6 +17,7 @@
 package org.onosproject.pipelines.fabric.pipeliner;
 
 import org.junit.Before;
+import org.junit.Test;
 import org.onlab.junit.TestUtils;
 import org.onlab.osgi.ServiceDirectory;
 import org.onlab.packet.IpPrefix;
@@ -41,7 +42,7 @@
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
 
-public abstract class FabricPipelinerTest {
+public class FabricPipelinerTest {
     static final ApplicationId APP_ID = TestApplicationId.create("FabricPipelinerTest");
     static final DeviceId DEVICE_ID = DeviceId.deviceId("device:bmv2:11");
     static final int PRIORITY = 100;
@@ -98,4 +99,10 @@
         pipeliner.init(DEVICE_ID, pipelinerContext);
         interpreter = new FabricInterpreter();
     }
+
+    @Test
+    public void fakeTest() {
+        // Needed otherwise Bazel complains about a test class without test cases.
+        assert true;
+    }
 }
diff --git a/protocols/gnmi/BUILD b/protocols/gnmi/BUILD
new file mode 100644
index 0000000..56ed52c
--- /dev/null
+++ b/protocols/gnmi/BUILD
@@ -0,0 +1,16 @@
+BUNDLES = [
+    "//protocols/gnmi/stub:gnmi_java_grpc",
+    "//protocols/gnmi/stub:gnmi_java_proto",
+]
+
+onos_app(
+    app_name = "org.onosproject.protocols.gnmi",
+    title = "gNMI Protocol Subsystem",
+    category = "Protocol",
+    url = "http://onosproject.org",
+    description = "ONOS gNMI protocol subsystem",
+    included_bundles = BUNDLES,
+    required_apps = [
+        "org.onosproject.protocols.grpc"
+    ],
+)
diff --git a/protocols/gnmi/stub/BUILD b/protocols/gnmi/stub/BUILD
new file mode 100644
index 0000000..3dc5351
--- /dev/null
+++ b/protocols/gnmi/stub/BUILD
@@ -0,0 +1,43 @@
+load("//tools/build/bazel:osgi_java_library.bzl", "wrapped_osgi_jar")
+load("@io_grpc_grpc_java//:java_grpc_library.bzl", "java_grpc_library")
+
+wrapped_osgi_jar(
+    name = "gnmi_java_grpc",
+    jar = ":gnmi_java_grpc_native",
+    deps = [
+        "@io_grpc_grpc_java//stub",
+        "@io_grpc_grpc_java//core",
+        "@io_grpc_grpc_java//protobuf"
+    ],
+    visibility = ["//visibility:public"],
+)
+
+wrapped_osgi_jar(
+    name = "gnmi_java_proto",
+    jar = ":gnmi_java_proto_native",
+    deps = [
+        "@com_google_protobuf//:protobuf_java",
+    ],
+    visibility = ["//visibility:public"],
+)
+
+java_proto_library(
+    name = "gnmi_java_proto_native",
+    deps = [":gnmi_proto"],
+    visibility = ["//visibility:public"],
+)
+
+java_grpc_library(
+    name = "gnmi_java_grpc_native",
+    srcs = [":gnmi_proto"],
+    deps = [":gnmi_java_proto_native"],
+)
+
+proto_library(
+    name = "gnmi_proto",
+    srcs = ["src/main/proto/gnmi.proto"],
+    deps = [
+        "@com_google_protobuf//:any_proto",
+        "@com_google_protobuf//:descriptor_proto",
+    ]
+)
diff --git a/protocols/p4runtime/BUILD b/protocols/p4runtime/BUILD
index 66e2f59..407aa46 100644
--- a/protocols/p4runtime/BUILD
+++ b/protocols/p4runtime/BUILD
@@ -1,18 +1,24 @@
 BUNDLES = [
-    '//protocols/p4runtime/api:onos-protocols-p4runtime-api',
-    '//protocols/p4runtime/ctl:onos-protocols-p4runtime-ctl',
-    '//protocols/p4runtime/model:onos-protocols-p4runtime-model',
+    "//protocols/p4runtime/api:onos-protocols-p4runtime-api",
+    "//protocols/p4runtime/ctl:onos-protocols-p4runtime-ctl",
+    "//protocols/p4runtime/model:onos-protocols-p4runtime-model",
     "//protocols/p4runtime/proto:p4runtime_java_grpc",
+    "//protocols/p4runtime/proto:p4config_java_proto",
+    "//protocols/p4runtime/proto:p4data_java_proto",
+    "//protocols/p4runtime/proto:p4info_java_proto",
+    "//protocols/p4runtime/proto:p4runtime_java_proto",
+    "//protocols/p4runtime/proto:p4types_java_proto",
+    "//protocols/p4runtime/proto:status_java_proto",
 ]
 
 onos_app(
-    app_name = 'org.onosproject.protocols.p4runtime',
-    title = 'P4Runtime Protocol Subsystem',
-    category = 'Protocol',
-    url = 'http://onosproject.org',
-    description = 'ONOS P4Runtime protocol subsystem',
+    app_name = "org.onosproject.protocols.p4runtime",
+    title = "P4Runtime Protocol Subsystem",
+    category = "Protocol",
+    url = "http://onosproject.org",
+    description = "ONOS P4Runtime protocol subsystem",
     included_bundles = BUNDLES,
     required_apps = [
-        'org.onosproject.protocols.grpc'
+        "org.onosproject.protocols.grpc"
     ],
 )
diff --git a/protocols/p4runtime/proto/BUILD b/protocols/p4runtime/proto/BUILD
index 2da5615..4c99b0d 100644
--- a/protocols/p4runtime/proto/BUILD
+++ b/protocols/p4runtime/proto/BUILD
@@ -1,58 +1,61 @@
 load("//tools/build/bazel:osgi_java_library.bzl", "wrapped_osgi_jar")
 load("@io_grpc_grpc_java//:java_grpc_library.bzl", "java_grpc_library")
 
+GRPC_DEPS = [
+    "@io_grpc_grpc_java//stub",
+    "@io_grpc_grpc_java//core",
+    "@io_grpc_grpc_java//protobuf",
+]
+
+PROTOBUF_DEPS = [
+    "@com_google_protobuf//:protobuf_java",
+]
+
 wrapped_osgi_jar(
     name = "p4config_java_proto",
     jar = "@com_github_p4lang_pi//:p4config_java_proto_native",
-    deps = [
-        "@com_google_protobuf//:protobuf_java",
-    ],
+    deps = PROTOBUF_DEPS,
     visibility = ["//visibility:public"],
 )
 
 wrapped_osgi_jar(
     name = "p4data_java_proto",
     jar = "@com_github_p4lang_p4runtime//:p4data_java_proto_native",
-    deps = [
-        "@com_google_protobuf//:protobuf_java",
-    ],
+    deps = PROTOBUF_DEPS,
+    visibility = ["//visibility:public"],
+)
+
+wrapped_osgi_jar(
+    name = "p4types_java_proto",
+    jar = "@com_github_p4lang_p4runtime//:p4types_java_proto_native",
+    deps = PROTOBUF_DEPS,
     visibility = ["//visibility:public"],
 )
 
 wrapped_osgi_jar(
     name = "p4info_java_proto",
     jar = "@com_github_p4lang_p4runtime//:p4info_java_proto_native",
-    deps = [
-        "@com_google_protobuf//:protobuf_java",
-    ],
+    deps = PROTOBUF_DEPS,
     visibility = ["//visibility:public"],
 )
 
 wrapped_osgi_jar(
     name = "p4runtime_java_proto",
     jar = "@com_github_p4lang_p4runtime//:p4runtime_java_proto_native",
-    deps = [
-        "@com_google_protobuf//:protobuf_java",
-    ],
+    deps = PROTOBUF_DEPS,
     visibility = ["//visibility:public"],
 )
 
 wrapped_osgi_jar(
     name = "p4runtime_java_grpc",
     jar = "@com_github_p4lang_p4runtime//:p4runtime_java_grpc_native",
-    deps = [
-        "@io_grpc_grpc_java//stub",
-        "@io_grpc_grpc_java//core",
-        "@io_grpc_grpc_java//protobuf",
-    ],
+    deps = GRPC_DEPS,
     visibility = ["//visibility:public"],
 )
 
 wrapped_osgi_jar(
     name = "status_java_proto",
     jar = "@com_github_googleapis//:status_java_proto_native",
-    deps = [
-        "@com_google_protobuf//:protobuf_java",
-    ],
+    deps = PROTOBUF_DEPS,
     visibility = ["//visibility:public"],
 )
diff --git a/providers/rest/device/BUILD b/providers/rest/device/BUILD
index 297d383..9c17e2f 100644
--- a/providers/rest/device/BUILD
+++ b/providers/rest/device/BUILD
@@ -1,8 +1,8 @@
 COMPILE_DEPS = CORE_DEPS + JACKSON + [
     "@javax_ws_rs_api//jar",
-    #'//protocols/ovsdb/api:onos-protocols-ovsdb-api',
-    #'//protocols/ovsdb/rfc:onos-protocols-ovsdb-rfc',
-    #'//apps/pcep-api:onos-apps-pcep-api',
+    #"//protocols/ovsdb/api:onos-protocols-ovsdb-api",
+    #"//protocols/ovsdb/rfc:onos-protocols-ovsdb-rfc",
+    #"//apps/pcep-api:onos-apps-pcep-api",
     "//incubator/api:onos-incubator-api",
     "//protocols/rest/api:onos-protocols-rest-api",
 ]
diff --git a/tools/build/bazel/p4runtime_BUILD b/tools/build/bazel/p4runtime_BUILD
index 4ade336..8d1b221 100644
--- a/tools/build/bazel/p4runtime_BUILD
+++ b/tools/build/bazel/p4runtime_BUILD
@@ -39,6 +39,11 @@
 )
 
 java_proto_library(
+    name = "p4types_java_proto_native",
+    deps = [":p4types_proto"],
+)
+
+java_proto_library(
     name = "p4info_java_proto_native",
     deps = [":p4info_proto"],
 )