[WIP] Attempt at building grpc and p4runtime protocols with Bazel

STILL NOT WORKING AT RUNTIME

Change-Id: I1f9e60b12a12e09edad2a714ec2921a4f71c6d35
diff --git a/tools/build/bazel/checkstyle.bzl b/tools/build/bazel/checkstyle.bzl
index d27ac57..92d3adb 100644
--- a/tools/build/bazel/checkstyle.bzl
+++ b/tools/build/bazel/checkstyle.bzl
@@ -59,7 +59,7 @@
                     Label("@commons_cli//jar"),
                     Label("@commons_collections//jar"),
                     Label("@antlr//jar"),
-                    Label("@guava//jar"),
+                    Label("@com_google_guava_guava//jar"),
                     Label("@commons_logging//jar"),
                 ]),
         "srcs": attr.label_list(allow_files = FileType([".java"])),
diff --git a/tools/build/bazel/generate_workspace.bzl b/tools/build/bazel/generate_workspace.bzl
index c38c3de..5dcbe45 100644
--- a/tools/build/bazel/generate_workspace.bzl
+++ b/tools/build/bazel/generate_workspace.bzl
@@ -1,4 +1,4 @@
-# ***** This file was auto-generated at Wed, 8 Aug 2018 21:33:41 GMT. Do not edit this file manually. *****
+# ***** This file was auto-generated at Thu, 9 Aug 2018 18:35:45 GMT. Do not edit this file manually. *****
 # ***** Use onos-lib-gen *****
 
 load("//tools/build/bazel:variables.bzl", "ONOS_GROUP_ID", "ONOS_VERSION")
@@ -11,7 +11,7 @@
     "@commons_lang3//jar",
     "@commons_io//jar",
     "@commons_pool//jar",
-    "@guava//jar",
+    "@com_google_guava_guava//jar",
     "@slf4j_api//jar",
     "@osgi_core//jar",
     "@org_osgi_compendium//jar",
@@ -19,7 +19,7 @@
     "@org_apache_felix_scr//jar",
     "@org_apache_karaf_features_core//jar",
     "@org_apache_karaf_system_core//jar",
-    "@jsr305//jar",
+    "@com_google_code_findbugs_jsr305//jar",
     "@org_apache_servicemix_bundles_dom4j//jar",
 ]
 CORE_DEPS = [] + COMPILE + [
@@ -32,7 +32,7 @@
     "@easymock//jar",
     "@hamcrest_all//jar",
     "@hamcrest_optional//jar",
-    "@guava_testlib//jar",
+    "@com_google_guava_guava_testlib//jar",
     "//utils/junit:onlab-junit",
 ]
 TEST_ADAPTERS = [] + TEST + [
@@ -59,7 +59,7 @@
     "@hk2_utils//jar",
     "@javax_inject//jar",
     "@hk2_osgi_resource_locator//jar",
-    "@javax_annotation_api//jar",
+    "@javax_annotation_api_mvn//jar",
     "@validation_api//jar",
     "//core/common:onos-core-common",
     "//core/api:onos-api-tests",
@@ -67,25 +67,8 @@
     "//utils/osgi:onlab-osgi-tests",
 ]
 NETTY = [
-    "@netty_buffer//jar",
-    "@netty_common//jar",
-]
-GRPC_1_3 = [
-    "@grpc_protobuf_1_3_1//jar",
-    "@grpc_stub_1_3_1//jar",
-    "@grpc_netty_1_3_1//jar",
-    "@grpc_auth_1_3_1//jar",
-    "@grpc_context_1_3_1//jar",
-    "@google_truth_0_28//jar",
-]
-GRPC_TEST_1_3 = [
-    "@grpc_testing_1_3_1//jar",
-    "@grpc_testing_proto_1_3_1//jar",
-    "@google_code_findbugs_3_0_0//jar",
-    "@google_errorprone_2_0_19//jar",
-    "@google_instrumentation_0_3_0//jar",
-    "@junit_dep//jar",
-    "@objenesis//jar",
+    "@io_netty_netty_buffer//jar",
+    "@io_netty_netty_common//jar",
 ]
 ONOS_YANG = [
     "@onos_yang_model//jar",
@@ -130,6 +113,23 @@
     "@typesafe_config//jar",
     "@classgraph//jar",
 ]
+GRPC_1_3 = [
+    "@grpc_protobuf_1_3_1//jar",
+    "@grpc_stub_1_3_1//jar",
+    "@grpc_netty_1_3_1//jar",
+    "@grpc_auth_1_3_1//jar",
+    "@grpc_context_1_3_1//jar",
+    "@google_truth_0_28//jar",
+]
+GRPC_TEST_1_3 = [
+    "@grpc_testing_1_3_1//jar",
+    "@grpc_testing_proto_1_3_1//jar",
+    "@google_code_findbugs_3_0_0//jar",
+    "@google_errorprone_2_0_19//jar",
+    "@google_instrumentation_0_3_0//jar",
+    "@junit_dep//jar",
+    "@objenesis//jar",
+]
 
 def generated_maven_jars():
     native.maven_jar(
@@ -319,12 +319,6 @@
     )
 
     native.maven_jar(
-        name = "error_prone_annotations",
-        artifact = "com.google.errorprone:error_prone_annotations:2.0.18",
-        sha1 = "5f65affce1684999e2f4024983835efc3504012e",
-    )
-
-    native.maven_jar(
         name = "ganymed_ssh2",
         artifact = "ch.ethz.ganymed:ganymed-ssh2:262",
         sha1 = "7761dc665d0f6993dc846d914214fb93291e2bdf",
@@ -337,19 +331,19 @@
     )
 
     native.maven_jar(
-        name = "gson",
+        name = "com_google_code_gson_gson",
         artifact = "com.google.code.gson:gson:2.7",
         sha1 = "751f548c85fa49f330cecbb1875893f971b33c4e",
     )
 
     native.maven_jar(
-        name = "guava",
+        name = "com_google_guava_guava",
         artifact = "com.google.guava:guava:22.0",
         sha1 = "3564ef3803de51fb0530a8377ec6100b33b0d073",
     )
 
     native.maven_jar(
-        name = "guava_testlib",
+        name = "com_google_guava_guava_testlib",
         artifact = "com.google.guava:guava-testlib:22.0",
         sha1 = "3be1b88f1cfc6592acbcbfe1f3a420f79eb2b146",
     )
@@ -457,7 +451,7 @@
     )
 
     native.maven_jar(
-        name = "javax_annotation_api",
+        name = "javax_annotation_api_mvn",
         artifact = "javax.annotation:javax.annotation-api:1.2",
         sha1 = "479c1e06db31c432330183f5cae684163f186146",
     )
@@ -595,7 +589,7 @@
     )
 
     native.maven_jar(
-        name = "jsr305",
+        name = "com_google_code_findbugs_jsr305",
         artifact = "com.google.code.findbugs:jsr305:3.0.1",
         sha1 = "f7be08ec23c21485b9b5a1cf1654c2ec8c58168d",
     )
@@ -667,63 +661,81 @@
     )
 
     native.maven_jar(
-        name = "netty",
+        name = "io_netty_netty",
         artifact = "io.netty:netty:3.10.5.Final",
         sha1 = "9ca7d55d246092bddd29b867706e2f6c7db701a0",
     )
 
     native.maven_jar(
-        name = "netty_buffer",
-        artifact = "io.netty:netty-buffer:4.1.8.Final",
-        sha1 = "43292c2622e340a0d07178c341ca3bdf3d662034",
+        name = "io_netty_netty_buffer",
+        artifact = "io.netty:netty-buffer:4.1.27.Final",
+        sha1 = "aafe2b9fb0d8f3b200cf10b9fd6486c6a722d7a1",
     )
 
     native.maven_jar(
-        name = "netty_codec",
-        artifact = "io.netty:netty-codec:4.1.8.Final",
-        sha1 = "1bd0a2d032e5c7fc3f42c1b483d0f4c57eb516a3",
+        name = "io_netty_netty_codec",
+        artifact = "io.netty:netty-codec:4.1.27.Final",
+        sha1 = "d2653d78ebaa650064768fb26b10051f5c8efb2c",
     )
 
     native.maven_jar(
-        name = "netty_common",
-        artifact = "io.netty:netty-common:4.1.8.Final",
-        sha1 = "ee62c80318413d2375d145e51e48d7d35c901324",
+        name = "io_netty_netty_common",
+        artifact = "io.netty:netty-common:4.1.27.Final",
+        sha1 = "6a12a969c27fb37b230c4bde5a67bd822fa6b7a4",
     )
 
     native.maven_jar(
-        name = "netty_handler",
-        artifact = "io.netty:netty-handler:4.1.8.Final",
-        sha1 = "db01139bfb11afd009a695eef55b43bbf22c4ef5",
+        name = "io_netty_netty_handler",
+        artifact = "io.netty:netty-handler:4.1.27.Final",
+        sha1 = "21bd9cf565390a8d72579b8664303e3c175dfc6a",
     )
 
     native.maven_jar(
-        name = "netty_transport",
-        artifact = "io.netty:netty-transport:4.1.8.Final",
-        sha1 = "905b5dadce881c9824b3039c0df36dabbb7b6a07",
+        name = "io_netty_netty_handler_proxy",
+        artifact = "io.netty:netty-handler-proxy:4.1.27.Final",
+        sha1 = "1a822ce7760bc6eb4937b7e448c9e081fedcc807",
     )
 
     native.maven_jar(
-        name = "netty_transport_native_epoll",
-        artifact = "io.netty:netty-transport-native-epoll:4.1.8.Final",
-        sha1 = "de9052874d9ff9b411bfc465869f620cab643d8d",
+        name = "io_netty_netty_transport",
+        artifact = "io.netty:netty-transport:4.1.27.Final",
+        sha1 = "b5c2da3ea89dd67320925f1504c9eb3615241b7c",
     )
 
     native.maven_jar(
-        name = "netty_resolver",
-        artifact = "io.netty:netty-resolver:4.1.8.Final",
-        sha1 = "2e116cdd5edc01b2305072b1dbbd17c0595dbfef",
+        name = "io_netty_netty_transport_native_unix_common",
+        artifact = "io.netty:netty-transport-native-unix-common:4.1.27.Final",
+        sha1 = "2b0667fe5c1df78c6cfbf9d53ad8b1fb533fb8e8",
     )
 
     native.maven_jar(
-        name = "netty_codec_http2",
-        artifact = "io.netty:netty-codec-http2:4.1.8.Final",
-        sha1 = "105a99ee5767463370ccc3d2e16800bd99f5648e",
+        name = "io_netty_netty_transport_native_epoll",
+        artifact = "io.netty:netty-transport-native-epoll:4.1.27.Final",
+        sha1 = "addbd481940a3cce57cb5736ecef5db909b7b5d0",
     )
 
     native.maven_jar(
-        name = "netty_codec_http",
-        artifact = "io.netty:netty-codec-http:4.1.8.Final",
-        sha1 = "1e88617c4a6c88da7e86fdbbd9494d22a250c879",
+        name = "io_netty_netty_resolver",
+        artifact = "io.netty:netty-resolver:4.1.27.Final",
+        sha1 = "2536447ef9605ccb2b5203aa22392c6514484ea9",
+    )
+
+    native.maven_jar(
+        name = "io_netty_netty_codec_http2",
+        artifact = "io.netty:netty-codec-http2:4.1.27.Final",
+        sha1 = "3769790a2033667d663f9a526d5b63cfecdbdf4e",
+    )
+
+    native.maven_jar(
+        name = "io_netty_netty_codec_http",
+        artifact = "io.netty:netty-codec-http:4.1.27.Final",
+        sha1 = "a1722d6bcbbef1c4c7877e8bf38b07a3db5ed07f",
+    )
+
+    native.maven_jar(
+        name = "io_netty_netty_codec_socks",
+        artifact = "io.netty:netty-codec-socks:4.1.27.Final",
+        sha1 = "285b09af98764cf02e4b77b3d95af188469a7133",
     )
 
     native.maven_jar(
@@ -1070,6 +1082,72 @@
     )
 
     native.maven_jar(
+        name = "bcpkix_jdk15on",
+        artifact = "org.bouncycastle:bcpkix-jdk15on:1.59",
+        sha1 = "9cef0aab8a4bb849a8476c058ce3ff302aba3fff",
+    )
+
+    native.maven_jar(
+        name = "bcprov_jdk15on",
+        artifact = "org.bouncycastle:bcprov-jdk15on:1.59",
+        sha1 = "2507204241ab450456bdb8e8c0a8f986e418bd99",
+    )
+
+    native.maven_jar(
+        name = "hamcrest_optional",
+        artifact = "com.spotify:hamcrest-optional:1.1.0",
+        sha1 = "c2dfe3a43794b15fb4c28de0027fe6e249855b3b",
+    )
+
+    native.maven_jar(
+        name = "swagger_annotations",
+        artifact = "io.swagger:swagger-annotations:1.5.16",
+        sha1 = "935f1f2fed2cbdd7a0513981d6c53201e21155f4",
+    )
+
+    native.maven_jar(
+        name = "kafka_clients",
+        artifact = "org.apache.servicemix.bundles:org.apache.servicemix.bundles.kafka-clients:0.8.2.2_1",
+        sha1 = "19ba66200cc3617fad12843788dff818b9882008",
+    )
+
+    native.maven_jar(
+        name = "tinder_xmpp",
+        artifact = "org.igniterealtime:tinder:1.3.0",
+        sha1 = "46353ded2a1d1a87d17600206d61814eb0b8a711",
+    )
+
+    native.maven_jar(
+        name = "aalto_xml",
+        artifact = "com.fasterxml:aalto-xml:1.0.0",
+        sha1 = "aeae9e8a71914e7f5efc8a69d2f5cb1f2224f2c6",
+    )
+
+    native.maven_jar(
+        name = "stax2_api",
+        artifact = "org.codehaus.woodstox:stax2-api:4.0.0",
+        sha1 = "6fa8b05f7587a3cb819d223ee0b0de0c126e3dd1",
+    )
+
+    native.maven_jar(
+        name = "concurrent_hashmap",
+        artifact = "com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.0",
+        sha1 = "db7b7a28b835db4717d4aaf31f5d4441887a6d46",
+    )
+
+    native.maven_jar(
+        name = "gnu_idn",
+        artifact = "org.gnu.inet:libidn:1.15",
+        sha1 = "b5bede3c1c031a827b604da31768ddaf833495c6",
+    )
+
+    native.maven_jar(
+        name = "sigar",
+        artifact = "org.knowhowlab.osgi:sigar:1.6.5_01",
+        sha1 = "58eb4af0dc4a1d331cd7620767216494e2984dea",
+    )
+
+    native.maven_jar(
         name = "grpc_core_1_3_1",
         artifact = "io.grpc:grpc-core:1.3.1",
         sha1 = "a9b38b4a19af3ef208f4f6bf7871876d959c5eb1",
@@ -1159,72 +1237,6 @@
         sha1 = "a2e145e7a7567c6372738f5c5a6f3ba6407ac354",
     )
 
-    native.maven_jar(
-        name = "bcpkix_jdk15on",
-        artifact = "org.bouncycastle:bcpkix-jdk15on:1.59",
-        sha1 = "9cef0aab8a4bb849a8476c058ce3ff302aba3fff",
-    )
-
-    native.maven_jar(
-        name = "bcprov_jdk15on",
-        artifact = "org.bouncycastle:bcprov-jdk15on:1.59",
-        sha1 = "2507204241ab450456bdb8e8c0a8f986e418bd99",
-    )
-
-    native.maven_jar(
-        name = "hamcrest_optional",
-        artifact = "com.spotify:hamcrest-optional:1.1.0",
-        sha1 = "c2dfe3a43794b15fb4c28de0027fe6e249855b3b",
-    )
-
-    native.maven_jar(
-        name = "swagger_annotations",
-        artifact = "io.swagger:swagger-annotations:1.5.16",
-        sha1 = "935f1f2fed2cbdd7a0513981d6c53201e21155f4",
-    )
-
-    native.maven_jar(
-        name = "kafka_clients",
-        artifact = "org.apache.servicemix.bundles:org.apache.servicemix.bundles.kafka-clients:0.8.2.2_1",
-        sha1 = "19ba66200cc3617fad12843788dff818b9882008",
-    )
-
-    native.maven_jar(
-        name = "tinder_xmpp",
-        artifact = "org.igniterealtime:tinder:1.3.0",
-        sha1 = "46353ded2a1d1a87d17600206d61814eb0b8a711",
-    )
-
-    native.maven_jar(
-        name = "aalto_xml",
-        artifact = "com.fasterxml:aalto-xml:1.0.0",
-        sha1 = "aeae9e8a71914e7f5efc8a69d2f5cb1f2224f2c6",
-    )
-
-    native.maven_jar(
-        name = "stax2_api",
-        artifact = "org.codehaus.woodstox:stax2-api:4.0.0",
-        sha1 = "6fa8b05f7587a3cb819d223ee0b0de0c126e3dd1",
-    )
-
-    native.maven_jar(
-        name = "concurrent_hashmap",
-        artifact = "com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.0",
-        sha1 = "db7b7a28b835db4717d4aaf31f5d4441887a6d46",
-    )
-
-    native.maven_jar(
-        name = "gnu_idn",
-        artifact = "org.gnu.inet:libidn:1.15",
-        sha1 = "b5bede3c1c031a827b604da31768ddaf833495c6",
-    )
-
-    native.maven_jar(
-        name = "sigar",
-        artifact = "org.knowhowlab.osgi:sigar:1.6.5_01",
-        sha1 = "58eb4af0dc4a1d331cd7620767216494e2984dea",
-    )
-
 def generated_java_libraries():
     native.java_library(
         name = "aopalliance_repackaged",
@@ -1413,12 +1425,6 @@
     )
 
     native.java_library(
-        name = "error_prone_annotations",
-        visibility = ["//visibility:public"],
-        exports = ["@error_prone_annotations//jar"],
-    )
-
-    native.java_library(
         name = "ganymed_ssh2",
         visibility = ["//visibility:public"],
         exports = ["@ganymed_ssh2//jar"],
@@ -1431,21 +1437,21 @@
     )
 
     native.java_library(
-        name = "gson",
+        name = "com_google_code_gson_gson",
         visibility = ["//visibility:public"],
-        exports = ["@gson//jar"],
+        exports = ["@com_google_code_gson_gson//jar"],
     )
 
     native.java_library(
-        name = "guava",
+        name = "com_google_guava_guava",
         visibility = ["//visibility:public"],
-        exports = ["@guava//jar"],
+        exports = ["@com_google_guava_guava//jar"],
     )
 
     native.java_library(
-        name = "guava_testlib",
+        name = "com_google_guava_guava_testlib",
         visibility = ["//visibility:public"],
-        exports = ["@guava_testlib//jar"],
+        exports = ["@com_google_guava_guava_testlib//jar"],
     )
 
     native.java_library(
@@ -1551,9 +1557,9 @@
     )
 
     native.java_library(
-        name = "javax_annotation_api",
+        name = "javax_annotation_api_mvn",
         visibility = ["//visibility:public"],
-        exports = ["@javax_annotation_api//jar"],
+        exports = ["@javax_annotation_api_mvn//jar"],
     )
 
     native.java_library(
@@ -1689,9 +1695,9 @@
     )
 
     native.java_library(
-        name = "jsr305",
+        name = "com_google_code_findbugs_jsr305",
         visibility = ["//visibility:public"],
-        exports = ["@jsr305//jar"],
+        exports = ["@com_google_code_findbugs_jsr305//jar"],
     )
 
     native.java_library(
@@ -1761,63 +1767,81 @@
     )
 
     native.java_library(
-        name = "netty",
+        name = "io_netty_netty",
         visibility = ["//visibility:public"],
-        exports = ["@netty//jar"],
+        exports = ["@io_netty_netty//jar"],
     )
 
     native.java_library(
-        name = "netty_buffer",
+        name = "io_netty_netty_buffer",
         visibility = ["//visibility:public"],
-        exports = ["@netty_buffer//jar"],
+        exports = ["@io_netty_netty_buffer//jar"],
     )
 
     native.java_library(
-        name = "netty_codec",
+        name = "io_netty_netty_codec",
         visibility = ["//visibility:public"],
-        exports = ["@netty_codec//jar"],
+        exports = ["@io_netty_netty_codec//jar"],
     )
 
     native.java_library(
-        name = "netty_common",
+        name = "io_netty_netty_common",
         visibility = ["//visibility:public"],
-        exports = ["@netty_common//jar"],
+        exports = ["@io_netty_netty_common//jar"],
     )
 
     native.java_library(
-        name = "netty_handler",
+        name = "io_netty_netty_handler",
         visibility = ["//visibility:public"],
-        exports = ["@netty_handler//jar"],
+        exports = ["@io_netty_netty_handler//jar"],
     )
 
     native.java_library(
-        name = "netty_transport",
+        name = "io_netty_netty_handler_proxy",
         visibility = ["//visibility:public"],
-        exports = ["@netty_transport//jar"],
+        exports = ["@io_netty_netty_handler_proxy//jar"],
     )
 
     native.java_library(
-        name = "netty_transport_native_epoll",
+        name = "io_netty_netty_transport",
         visibility = ["//visibility:public"],
-        exports = ["@netty_transport_native_epoll//jar"],
+        exports = ["@io_netty_netty_transport//jar"],
     )
 
     native.java_library(
-        name = "netty_resolver",
+        name = "io_netty_netty_transport_native_unix_common",
         visibility = ["//visibility:public"],
-        exports = ["@netty_resolver//jar"],
+        exports = ["@io_netty_netty_transport_native_unix_common//jar"],
     )
 
     native.java_library(
-        name = "netty_codec_http2",
+        name = "io_netty_netty_transport_native_epoll",
         visibility = ["//visibility:public"],
-        exports = ["@netty_codec_http2//jar"],
+        exports = ["@io_netty_netty_transport_native_epoll//jar"],
     )
 
     native.java_library(
-        name = "netty_codec_http",
+        name = "io_netty_netty_resolver",
         visibility = ["//visibility:public"],
-        exports = ["@netty_codec_http//jar"],
+        exports = ["@io_netty_netty_resolver//jar"],
+    )
+
+    native.java_library(
+        name = "io_netty_netty_codec_http2",
+        visibility = ["//visibility:public"],
+        exports = ["@io_netty_netty_codec_http2//jar"],
+    )
+
+    native.java_library(
+        name = "io_netty_netty_codec_http",
+        visibility = ["//visibility:public"],
+        exports = ["@io_netty_netty_codec_http//jar"],
+    )
+
+    native.java_library(
+        name = "io_netty_netty_codec_socks",
+        visibility = ["//visibility:public"],
+        exports = ["@io_netty_netty_codec_socks//jar"],
     )
 
     native.java_library(
@@ -2151,6 +2175,72 @@
     )
 
     native.java_library(
+        name = "bcpkix_jdk15on",
+        visibility = ["//visibility:public"],
+        exports = ["@bcpkix_jdk15on//jar"],
+    )
+
+    native.java_library(
+        name = "bcprov_jdk15on",
+        visibility = ["//visibility:public"],
+        exports = ["@bcprov_jdk15on//jar"],
+    )
+
+    native.java_library(
+        name = "hamcrest_optional",
+        visibility = ["//visibility:public"],
+        exports = ["@hamcrest_optional//jar"],
+    )
+
+    native.java_library(
+        name = "swagger_annotations",
+        visibility = ["//visibility:public"],
+        exports = ["@swagger_annotations//jar"],
+    )
+
+    native.java_library(
+        name = "kafka_clients",
+        visibility = ["//visibility:public"],
+        exports = ["@kafka_clients//jar"],
+    )
+
+    native.java_library(
+        name = "tinder_xmpp",
+        visibility = ["//visibility:public"],
+        exports = ["@tinder_xmpp//jar"],
+    )
+
+    native.java_library(
+        name = "aalto_xml",
+        visibility = ["//visibility:public"],
+        exports = ["@aalto_xml//jar"],
+    )
+
+    native.java_library(
+        name = "stax2_api",
+        visibility = ["//visibility:public"],
+        exports = ["@stax2_api//jar"],
+    )
+
+    native.java_library(
+        name = "concurrent_hashmap",
+        visibility = ["//visibility:public"],
+        exports = ["@concurrent_hashmap//jar"],
+    )
+
+    native.java_library(
+        name = "gnu_idn",
+        visibility = ["//visibility:public"],
+        exports = ["@gnu_idn//jar"],
+    )
+
+    native.java_library(
+        name = "sigar",
+        visibility = ["//visibility:public"],
+        exports = ["@sigar//jar"],
+    )
+
+    native.java_library(
         name = "grpc_core_1_3_1",
         visibility = ["//visibility:public"],
         exports = ["@grpc_core_1_3_1//jar"],
@@ -2240,72 +2330,6 @@
         exports = ["@google_instrumentation_0_3_0//jar"],
     )
 
-    native.java_library(
-        name = "bcpkix_jdk15on",
-        visibility = ["//visibility:public"],
-        exports = ["@bcpkix_jdk15on//jar"],
-    )
-
-    native.java_library(
-        name = "bcprov_jdk15on",
-        visibility = ["//visibility:public"],
-        exports = ["@bcprov_jdk15on//jar"],
-    )
-
-    native.java_library(
-        name = "hamcrest_optional",
-        visibility = ["//visibility:public"],
-        exports = ["@hamcrest_optional//jar"],
-    )
-
-    native.java_library(
-        name = "swagger_annotations",
-        visibility = ["//visibility:public"],
-        exports = ["@swagger_annotations//jar"],
-    )
-
-    native.java_library(
-        name = "kafka_clients",
-        visibility = ["//visibility:public"],
-        exports = ["@kafka_clients//jar"],
-    )
-
-    native.java_library(
-        name = "tinder_xmpp",
-        visibility = ["//visibility:public"],
-        exports = ["@tinder_xmpp//jar"],
-    )
-
-    native.java_library(
-        name = "aalto_xml",
-        visibility = ["//visibility:public"],
-        exports = ["@aalto_xml//jar"],
-    )
-
-    native.java_library(
-        name = "stax2_api",
-        visibility = ["//visibility:public"],
-        exports = ["@stax2_api//jar"],
-    )
-
-    native.java_library(
-        name = "concurrent_hashmap",
-        visibility = ["//visibility:public"],
-        exports = ["@concurrent_hashmap//jar"],
-    )
-
-    native.java_library(
-        name = "gnu_idn",
-        visibility = ["//visibility:public"],
-        exports = ["@gnu_idn//jar"],
-    )
-
-    native.java_library(
-        name = "sigar",
-        visibility = ["//visibility:public"],
-        exports = ["@sigar//jar"],
-    )
-
 artifact_map = {}
 artifact_map["@aopalliance_repackaged//jar"] = "mvn:org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b42"
 artifact_map["@amqp_client//jar"] = "mvn:com.rabbitmq:amqp-client:jar:3.6.1"
@@ -2338,12 +2362,11 @@
 artifact_map["@concurrent_trees//jar"] = "mvn:com.googlecode.concurrent-trees:concurrent-trees:jar:2.6.1"
 artifact_map["@easymock//jar"] = "mvn:org.easymock:easymock:jar:3.6"
 artifact_map["@antlr//jar"] = "mvn:antlr:antlr:jar:NON-OSGI:2.7.7"
-artifact_map["@error_prone_annotations//jar"] = "mvn:com.google.errorprone:error_prone_annotations:jar:NON-OSGI:2.0.18"
 artifact_map["@ganymed_ssh2//jar"] = "mvn:ch.ethz.ganymed:ganymed-ssh2:jar:NON-OSGI:262"
 artifact_map["@gmetric4j//jar"] = "mvn:info.ganglia.gmetric4j:gmetric4j:jar:1.0.10"
-artifact_map["@gson//jar"] = "mvn:com.google.code.gson:gson:jar:2.7"
-artifact_map["@guava//jar"] = "mvn:com.google.guava:guava:jar:22.0"
-artifact_map["@guava_testlib//jar"] = "mvn:com.google.guava:guava-testlib:jar:NON-OSGI:22.0"
+artifact_map["@com_google_code_gson_gson//jar"] = "mvn:com.google.code.gson:gson:jar:2.7"
+artifact_map["@com_google_guava_guava//jar"] = "mvn:com.google.guava:guava:jar:22.0"
+artifact_map["@com_google_guava_guava_testlib//jar"] = "mvn:com.google.guava:guava-testlib:jar:NON-OSGI:22.0"
 artifact_map["@hamcrest_all//jar"] = "mvn:org.hamcrest:hamcrest-all:jar:NON-OSGI:1.3"
 artifact_map["@hk2_api//jar"] = "mvn:org.glassfish.hk2:hk2-api:jar:2.5.0-b42"
 artifact_map["@hk2_locator//jar"] = "mvn:org.glassfish.hk2:hk2-locator:jar:2.5.0-b42"
@@ -2361,7 +2384,7 @@
 artifact_map["@jackson_annotations//jar"] = "mvn:com.fasterxml.jackson.core:jackson-annotations:jar:2.9.5"
 artifact_map["@jackson_core//jar"] = "mvn:com.fasterxml.jackson.core:jackson-core:jar:2.9.5"
 artifact_map["@jackson_databind//jar"] = "mvn:com.fasterxml.jackson.core:jackson-databind:jar:2.9.5"
-artifact_map["@javax_annotation_api//jar"] = "mvn:javax.annotation:javax.annotation-api:jar:1.2"
+artifact_map["@javax_annotation_api_mvn//jar"] = "mvn:javax.annotation:javax.annotation-api:jar:1.2"
 artifact_map["@javax_inject//jar"] = "mvn:org.glassfish.hk2.external:javax.inject:jar:2.5.0-b42"
 artifact_map["@javax_ws_rs_api//jar"] = "mvn:javax.ws.rs:javax.ws.rs-api:jar:2.1"
 artifact_map["@jersey_client//jar"] = "mvn:org.glassfish.jersey.core:jersey-client:jar:2.26"
@@ -2384,7 +2407,7 @@
 artifact_map["@javax_servlet_api//jar"] = "mvn:javax.servlet:javax.servlet-api:jar:3.1.0"
 artifact_map["@joda_time//jar"] = "mvn:joda-time:joda-time:jar:2.9.3"
 artifact_map["@jsch//jar"] = "mvn:com.jcraft:jsch:jar:NON-OSGI:0.1.53"
-artifact_map["@jsr305//jar"] = "mvn:com.google.code.findbugs:jsr305:jar:3.0.1"
+artifact_map["@com_google_code_findbugs_jsr305//jar"] = "mvn:com.google.code.findbugs:jsr305:jar:3.0.1"
 artifact_map["@junit//jar"] = "mvn:junit:junit:jar:NON-OSGI:4.12"
 artifact_map["@junit_dep//jar"] = "mvn:junit:junit:jar:NON-OSGI:4.10"
 artifact_map["@kryo//jar"] = "mvn:com.esotericsoftware:kryo:jar:4.0.1"
@@ -2396,16 +2419,19 @@
 artifact_map["@metrics_json//jar"] = "mvn:io.dropwizard.metrics:metrics-json:jar:3.2.2"
 artifact_map["@minimal_json//jar"] = "mvn:com.eclipsesource.minimal-json:minimal-json:jar:0.9.4"
 artifact_map["@minlog//jar"] = "mvn:com.esotericsoftware:minlog:jar:1.3.0"
-artifact_map["@netty//jar"] = "mvn:io.netty:netty:jar:3.10.5.Final"
-artifact_map["@netty_buffer//jar"] = "mvn:io.netty:netty-buffer:jar:4.1.8.Final"
-artifact_map["@netty_codec//jar"] = "mvn:io.netty:netty-codec:jar:4.1.8.Final"
-artifact_map["@netty_common//jar"] = "mvn:io.netty:netty-common:jar:4.1.8.Final"
-artifact_map["@netty_handler//jar"] = "mvn:io.netty:netty-handler:jar:4.1.8.Final"
-artifact_map["@netty_transport//jar"] = "mvn:io.netty:netty-transport:jar:4.1.8.Final"
-artifact_map["@netty_transport_native_epoll//jar"] = "mvn:io.netty:netty-transport-native-epoll:jar:4.1.8.Final"
-artifact_map["@netty_resolver//jar"] = "mvn:io.netty:netty-resolver:jar:4.1.8.Final"
-artifact_map["@netty_codec_http2//jar"] = "mvn:io.netty:netty-codec-http2:jar:4.1.8.Final"
-artifact_map["@netty_codec_http//jar"] = "mvn:io.netty:netty-codec-http:jar:4.1.8.Final"
+artifact_map["@io_netty_netty//jar"] = "mvn:io.netty:netty:jar:3.10.5.Final"
+artifact_map["@io_netty_netty_buffer//jar"] = "mvn:io.netty:netty-buffer:jar:4.1.27.Final"
+artifact_map["@io_netty_netty_codec//jar"] = "mvn:io.netty:netty-codec:jar:4.1.27.Final"
+artifact_map["@io_netty_netty_common//jar"] = "mvn:io.netty:netty-common:jar:4.1.27.Final"
+artifact_map["@io_netty_netty_handler//jar"] = "mvn:io.netty:netty-handler:jar:4.1.27.Final"
+artifact_map["@io_netty_netty_handler_proxy//jar"] = "mvn:io.netty:netty-handler-proxy:jar:4.1.27.Final"
+artifact_map["@io_netty_netty_transport//jar"] = "mvn:io.netty:netty-transport:jar:4.1.27.Final"
+artifact_map["@io_netty_netty_transport_native_unix_common//jar"] = "mvn:io.netty:netty-transport-native-unix-common:jar:4.1.27.Final"
+artifact_map["@io_netty_netty_transport_native_epoll//jar"] = "mvn:io.netty:netty-transport-native-epoll:jar:4.1.27.Final"
+artifact_map["@io_netty_netty_resolver//jar"] = "mvn:io.netty:netty-resolver:jar:4.1.27.Final"
+artifact_map["@io_netty_netty_codec_http2//jar"] = "mvn:io.netty:netty-codec-http2:jar:4.1.27.Final"
+artifact_map["@io_netty_netty_codec_http//jar"] = "mvn:io.netty:netty-codec-http:jar:4.1.27.Final"
+artifact_map["@io_netty_netty_codec_socks//jar"] = "mvn:io.netty:netty-codec-socks:jar:4.1.27.Final"
 artifact_map["@objenesis//jar"] = "mvn:org.objenesis:objenesis:jar:2.6"
 artifact_map["@openflowj//jar"] = "mvn:org.onosproject:openflowj:jar:3.2.1.onos"
 artifact_map["@org_apache_felix_framework_security//jar"] = "mvn:org.onosproject:org.apache.felix.framework.security:jar:2.2.0.onos"
@@ -2463,6 +2489,17 @@
 artifact_map["@org_apache_servicemix_bundles_dom4j//jar"] = "mvn:org.apache.servicemix.bundles:org.apache.servicemix.bundles.dom4j:jar:1.6.1_5"
 artifact_map["@plexus_utils//jar"] = "mvn:org.codehaus.plexus:plexus-utils:jar:NON-OSGI:3.0.24"
 artifact_map["@sshd_core//jar"] = "mvn:org.apache.sshd:sshd-core:jar:1.4.0"
+artifact_map["@bcpkix_jdk15on//jar"] = "mvn:org.bouncycastle:bcpkix-jdk15on:jar:1.59"
+artifact_map["@bcprov_jdk15on//jar"] = "mvn:org.bouncycastle:bcprov-jdk15on:jar:1.59"
+artifact_map["@hamcrest_optional//jar"] = "mvn:com.spotify:hamcrest-optional:jar:NON-OSGI:1.1.0"
+artifact_map["@swagger_annotations//jar"] = "mvn:io.swagger:swagger-annotations:jar:1.5.16"
+artifact_map["@kafka_clients//jar"] = "mvn:org.apache.servicemix.bundles:org.apache.servicemix.bundles.kafka-clients:jar:0.8.2.2_1"
+artifact_map["@tinder_xmpp//jar"] = "mvn:org.igniterealtime:tinder:jar:NON-OSGI:1.3.0"
+artifact_map["@aalto_xml//jar"] = "mvn:com.fasterxml:aalto-xml:jar:1.0.0"
+artifact_map["@stax2_api//jar"] = "mvn:org.codehaus.woodstox:stax2-api:jar:4.0.0"
+artifact_map["@concurrent_hashmap//jar"] = "mvn:com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:jar:NON-OSGI:1.0"
+artifact_map["@gnu_idn//jar"] = "mvn:org.gnu.inet:libidn:jar:NON-OSGI:1.15"
+artifact_map["@sigar//jar"] = "mvn:org.knowhowlab.osgi:sigar:jar:1.6.5_01"
 artifact_map["@grpc_core_1_3_1//jar"] = "mvn:io.grpc:grpc-core:jar:NON-OSGI:1.3.1"
 artifact_map["@grpc_protobuf_1_3_1//jar"] = "mvn:io.grpc:grpc-protobuf:jar:NON-OSGI:1.3.1"
 artifact_map["@grpc_protobuf_lite_1_3_1//jar"] = "mvn:io.grpc:grpc-protobuf-lite:jar:NON-OSGI:1.3.1"
@@ -2478,17 +2515,6 @@
 artifact_map["@google_code_findbugs_3_0_0//jar"] = "mvn:com.google.code.findbugs:jsr305:jar:NON-OSGI:3.0.0"
 artifact_map["@google_errorprone_2_0_19//jar"] = "mvn:com.google.errorprone:error_prone_annotations:jar:NON-OSGI:2.0.19"
 artifact_map["@google_instrumentation_0_3_0//jar"] = "mvn:com.google.instrumentation:instrumentation-api:jar:NON-OSGI:0.3.0"
-artifact_map["@bcpkix_jdk15on//jar"] = "mvn:org.bouncycastle:bcpkix-jdk15on:jar:1.59"
-artifact_map["@bcprov_jdk15on//jar"] = "mvn:org.bouncycastle:bcprov-jdk15on:jar:1.59"
-artifact_map["@hamcrest_optional//jar"] = "mvn:com.spotify:hamcrest-optional:jar:NON-OSGI:1.1.0"
-artifact_map["@swagger_annotations//jar"] = "mvn:io.swagger:swagger-annotations:jar:1.5.16"
-artifact_map["@kafka_clients//jar"] = "mvn:org.apache.servicemix.bundles:org.apache.servicemix.bundles.kafka-clients:jar:0.8.2.2_1"
-artifact_map["@tinder_xmpp//jar"] = "mvn:org.igniterealtime:tinder:jar:NON-OSGI:1.3.0"
-artifact_map["@aalto_xml//jar"] = "mvn:com.fasterxml:aalto-xml:jar:1.0.0"
-artifact_map["@stax2_api//jar"] = "mvn:org.codehaus.woodstox:stax2-api:jar:4.0.0"
-artifact_map["@concurrent_hashmap//jar"] = "mvn:com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:jar:NON-OSGI:1.0"
-artifact_map["@gnu_idn//jar"] = "mvn:org.gnu.inet:libidn:jar:NON-OSGI:1.15"
-artifact_map["@sigar//jar"] = "mvn:org.knowhowlab.osgi:sigar:jar:1.6.5_01"
 
 def maven_coordinates(label):
     label_string = str(label)
diff --git a/tools/build/bazel/google_RPC_BUILD b/tools/build/bazel/google_RPC_BUILD
deleted file mode 100644
index 76de8fd..0000000
--- a/tools/build/bazel/google_RPC_BUILD
+++ /dev/null
@@ -1,17 +0,0 @@
-package(default_visibility = ["//visibility:public"])
-
-proto_library(
-    name = "rpc_proto",
-    srcs = [ "//:google/rpc/code.proto", "//:google/rpc/status.proto" ],
-    deps = [
-        "@com_google_protobuf//:any_proto",
-    ],
-)
-
-java_proto_library(
-    name = "rpc_java_proto",
-    visibility = ["//visibility:public"],
-    deps = [":rpc_proto"],
-)
-
-
diff --git a/tools/build/bazel/googleapis_BUILD b/tools/build/bazel/googleapis_BUILD
new file mode 100644
index 0000000..97aea21
--- /dev/null
+++ b/tools/build/bazel/googleapis_BUILD
@@ -0,0 +1,12 @@
+package(default_visibility = [ "//visibility:public" ])
+
+proto_library(
+    name = "status_proto",
+    srcs = ["google/rpc/status.proto"],
+    deps = ["@com_google_protobuf//:any_proto"]
+)
+
+java_proto_library(
+    name = "status_java_proto_native",
+    deps = [":status_proto"],
+)
diff --git a/tools/build/bazel/googleapis_workspace.bzl b/tools/build/bazel/googleapis_workspace.bzl
new file mode 100644
index 0000000..94c84a9
--- /dev/null
+++ b/tools/build/bazel/googleapis_workspace.bzl
@@ -0,0 +1,13 @@
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+COMMIT = "37cc0e5acae50ee91f00827a7010c3b07dfa5311"
+SHA = "17d023f48ea290f25edaf25a967973b5a42ce6d71b1570862f302d95aa8b9f77"
+
+def generate_googleapis():
+    http_archive(
+        name = "com_github_googleapis",
+        urls = ["https://github.com/googleapis/googleapis/archive/%s.zip" % COMMIT],
+        sha256 = SHA,
+        strip_prefix = "googleapis-" + COMMIT,
+        build_file = "//tools/build/bazel:googleapis_BUILD",
+    )
diff --git a/tools/build/bazel/grpc_BUILD b/tools/build/bazel/grpc_BUILD
deleted file mode 100644
index 24795da..0000000
--- a/tools/build/bazel/grpc_BUILD
+++ /dev/null
@@ -1,44 +0,0 @@
-"""
- Copyright 2018-present Open Networking Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-     http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-"""
-
-
-"""
-    Bazel build file for GRPC java binaries. This build file is injected into the GRPC source tree to allow
-    ONOS to build it. Published binaries of the GRPC library split the definition of the io.grpc
-    package across multiple jar files. This renders them unusable in an OSGI environment, so
-    ONOS builds its own libraries here.
-"""
-
-GRPC_COMPILE = [
-    "@google_errorprone_2_0_19//jar",
-    "@google_instrumentation_0_3_0//jar",
-    "@guava//jar",
-    "@javax_annotation_api//jar",
-    "@jsr305//jar",
-    "@junit//jar",
-]
-
-java_library(
-    name = "grpc-core-repkg-1.3.1-native",
-    srcs = glob(
-        [
-            "context/src/main/java/**/*.java",
-            "core/src/main/java/**/*.java",
-        ],
-    ),
-    visibility = ["//visibility:public"],
-    deps = GRPC_COMPILE,
-)
diff --git a/tools/build/bazel/grpc_core_repkg_BUILD b/tools/build/bazel/grpc_core_repkg_BUILD
new file mode 100644
index 0000000..b5aa554
--- /dev/null
+++ b/tools/build/bazel/grpc_core_repkg_BUILD
@@ -0,0 +1,20 @@
+package(default_visibility = [ "//visibility:public" ])
+
+java_library(
+    name = "internal",
+    srcs = glob([
+        "src/main/java/io/grpc/internal/*.java",
+    ]),
+    deps = [
+        "@io_grpc_grpc_java//core",
+        "@io_grpc_grpc_java//context",
+        "@com_google_code_findbugs_jsr305//jar",
+        "@com_google_code_gson_gson//jar",
+        "@com_google_errorprone_error_prone_annotations//jar",
+        "@com_google_guava_guava//jar",
+        "@io_opencensus_opencensus_api//jar",
+        "@io_opencensus_opencensus_contrib_grpc_metrics//jar",
+    ],
+)
+
+
diff --git a/tools/build/bazel/grpc_workspace.bzl b/tools/build/bazel/grpc_workspace.bzl
index 826d304..331f0a4 100644
--- a/tools/build/bazel/grpc_workspace.bzl
+++ b/tools/build/bazel/grpc_workspace.bzl
@@ -1,92 +1,19 @@
-"""
- Copyright 2018-present Open Networking Foundation
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
 
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-     http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-"""
-
-
-"""
-    Workspace to build GRPC java binaries. please see the injected bazel build file
-    grpc_BUILD for additional information.
-"""
+GRPC_VER = "1.14.0"
+SHA = "657ee70cbbc7e8c5aa26d622329f5fc8bfa6ce5e960bcdbff802f785b0eba212"
 
 def generate_grpc():
-    native.new_http_archive(
-        name = "grpc_src_zip_131",
-        urls = ["https://github.com/grpc/grpc-java/archive/v1.3.1.zip"],
-        sha256 = "c529b4c2d80a6df8ddc0aa25d7599e46ffcd155cb67122513f8fb536cd96eca4",
-        build_file = "//tools/build/bazel:grpc_BUILD",
-        strip_prefix = "grpc-java-1.3.1",
+    http_archive(
+        name = "io_grpc_grpc_java",
+        urls = ["https://github.com/grpc/grpc-java/archive/v%s.zip" % GRPC_VER],
+        sha256 = SHA,
+        strip_prefix = "grpc-java-" + GRPC_VER,
     )
-
-def generated_maven_jars():
-    native.maven_jar(
-        name = "guava",
-        artifact = "com.google.guava:guava:22.0",
-        sha1 = "3564ef3803de51fb0530a8377ec6100b33b0d073",
-    )
-
-    native.maven_jar(
-        name = "google_instrumentation_0_3_0",
-        artifact = "com.google.instrumentation:instrumentation-api:0.3.0",
-        sha1 = "a2e145e7a7567c6372738f5c5a6f3ba6407ac354",
-    )
-
-    native.maven_jar(
-        name = "javax_annotation_api",
-        artifact = "javax.annotation:javax.annotation-api:1.2",
-        sha1 = "479c1e06db31c432330183f5cae684163f186146",
-    )
-
-    native.maven_jar(
-        name = "jsr305",
-        artifact = "com.google.code.findbugs:jsr305:3.0.1",
-        sha1 = "f7be08ec23c21485b9b5a1cf1654c2ec8c58168d",
-    )
-
-    native.java_library(
-        name = "google_errorprone_2_0_19",
-        visibility = ["//visibility:public"],
-        exports = ["@google_errorprone_2_0_19//jar"],
-    )
-
-def generated_java_libraries():
-    native.java_library(
-        name = "guava",
-        visibility = ["//visibility:public"],
-        exports = ["@guava//jar"],
-    )
-
-    native.java_library(
-        name = "google_instrumentation_0_3_0",
-        visibility = ["//visibility:public"],
-        exports = ["@google_instrumentation_0_3_0//jar"],
-    )
-
-    native.java_library(
-        name = "javax_annotation_api",
-        visibility = ["//visibility:public"],
-        exports = ["@javax_annotation_api//jar"],
-    )
-
-    native.java_library(
-        name = "jsr305",
-        visibility = ["//visibility:public"],
-        exports = ["@jsr305//jar"],
-    )
-
-    native.java_library(
-        name = "google_errorprone_2_0_19",
-        visibility = ["//visibility:public"],
-        exports = ["@google_errorprone_2_0_19//jar"],
+    http_archive(
+        name = "io_grpc_grpc_java_core_repkg",
+        urls = ["https://github.com/grpc/grpc-java/archive/v%s.zip" % GRPC_VER],
+        sha256 = SHA,
+        strip_prefix = "grpc-java-%s/core" % GRPC_VER,
+        build_file = "//tools/build/bazel:grpc_core_repkg_BUILD",
     )
diff --git a/tools/build/bazel/p4lang_BUILD b/tools/build/bazel/p4lang_BUILD
deleted file mode 100644
index 2c00fdf..0000000
--- a/tools/build/bazel/p4lang_BUILD
+++ /dev/null
@@ -1,16 +0,0 @@
-package(default_visibility = ["//visibility:public"])
-
-proto_library(
-    name = "p4_runtime_proto",
-    srcs = [
-            "//:p4/config/v1/p4types.proto",
-            "//:p4/config/v1/p4info.proto",
-            "//:p4/tmp/p4config.proto",
-            "//:p4/v1/p4runtime.proto",
-            "//:p4/v1/p4data.proto",
-    ],
-    deps = [
-        "@com_google_protobuf//:any_proto",
-        "@google_rpc//:rpc_proto",
-    ],
-)
\ No newline at end of file
diff --git a/tools/build/bazel/p4lang_workspace.bzl b/tools/build/bazel/p4lang_workspace.bzl
index d1bd40e..24da166 100644
--- a/tools/build/bazel/p4lang_workspace.bzl
+++ b/tools/build/bazel/p4lang_workspace.bzl
@@ -1,36 +1,19 @@
-GITHUB_BASE_URL = "https://github.com"
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
 
-PI_COMMIT_SHORT = "59c9409"
-PI_COMMIT = "59c940916b4f5b182f33b4788d8c410972eaecce"
-PI_REPO = "p4lang/PI"
-
-GOOGLE_RPC_COMMIT_SHORT = "916e66d"
-GOOGLE_RPC_COMMIT = "916e66d03a4f4716937b3bfa6539b9de8a598b7c"
-GOOGLE_RPC_REPO = "googleapis/googleapis"
-
-def _format_github_url(repo, commit):
-    return GITHUB_BASE_URL + "/{0}/tarball/{1}".format(repo, commit)
+P4RUNTIME_COMMIT = "028552d98b774301c51be0fe5bc97c9e95716759"
+PI_COMMIT = "36ca74fae69c8d0a142f8bfd2487bee72505cf48"
 
 def generate_p4lang():
-    native.http_archive(
-        name = "com_google_protobuf",
-        sha256 = "cef7f1b5a7c5fba672bec2a319246e8feba471f04dcebfe362d55930ee7c1c30",
-        strip_prefix = "protobuf-3.5.0",
-        urls = ["https://github.com/google/protobuf/archive/v3.5.0.zip"],
+    http_archive(
+        name = "com_github_p4lang_p4runtime",
+        urls = ["https://github.com/p4lang/p4runtime/archive/%s.zip" % P4RUNTIME_COMMIT],
+        strip_prefix = "p4runtime-%s/proto" % P4RUNTIME_COMMIT,
+        build_file = "//tools/build/bazel:p4runtime_BUILD"
     )
-
-    native.new_http_archive(
-        name = "p4lang_pi",
-        urls = [_format_github_url(PI_REPO, PI_COMMIT)],
-        build_file = "//tools/build/bazel:p4lang_BUILD",
-        strip_prefix = "p4lang-PI-" + PI_COMMIT_SHORT + "/proto",
-        type = "tar.gz",
-    )
-
-    native.new_http_archive(
-        name = "google_rpc",
-        urls = [_format_github_url(GOOGLE_RPC_REPO, GOOGLE_RPC_COMMIT)],
-        build_file = "//tools/build/bazel:google_RPC_BUILD",
-        strip_prefix = "googleapis-googleapis-" + GOOGLE_RPC_COMMIT_SHORT,
-        type = "tar.gz",
+    # Needed for PI/proto/p4/tmp/p4config.proto
+    http_archive(
+        name = "com_github_p4lang_pi",
+        urls = ["https://github.com/p4lang/PI/archive/%s.zip" % PI_COMMIT],
+        strip_prefix = "PI-%s/proto" % PI_COMMIT,
+        build_file = "//tools/build/bazel:pi_BUILD"
     )
diff --git a/tools/build/bazel/p4runtime_BUILD b/tools/build/bazel/p4runtime_BUILD
new file mode 100644
index 0000000..4ade336
--- /dev/null
+++ b/tools/build/bazel/p4runtime_BUILD
@@ -0,0 +1,56 @@
+package(default_visibility = ["//visibility:public"])
+
+load("@com_google_protobuf//:protobuf.bzl", "internal_copied_filegroup")
+load("@io_grpc_grpc_java//:java_grpc_library.bzl", "java_grpc_library")
+
+proto_library(
+    name = "p4data_proto",
+    srcs = ["p4/v1/p4data.proto"],
+)
+
+proto_library(
+    name = "p4types_proto",
+    srcs = ["p4/config/v1/p4types.proto"],
+)
+
+proto_library(
+    name = "p4info_proto",
+    srcs = ["p4/config/v1/p4info.proto"],
+    deps = [
+        ":p4types_proto",
+        "@com_google_protobuf//:any_proto"
+    ],
+)
+
+proto_library(
+    name = "p4runtime_proto",
+    srcs = ["p4/v1/p4runtime.proto"],
+    deps = [
+        ":p4info_proto",
+        ":p4data_proto",
+        "@com_github_googleapis//:status_proto",
+        "@com_google_protobuf//:any_proto",
+    ],
+)
+
+java_proto_library(
+    name = "p4data_java_proto_native",
+    deps = [":p4data_proto"],
+)
+
+java_proto_library(
+    name = "p4info_java_proto_native",
+    deps = [":p4info_proto"],
+)
+
+java_proto_library(
+    name = "p4runtime_java_proto_native",
+    deps = [":p4runtime_proto"],
+)
+
+java_grpc_library(
+    name = "p4runtime_java_grpc_native",
+    srcs = [":p4runtime_proto"],
+    deps = [":p4runtime_java_proto_native"],
+)
+
diff --git a/tools/build/bazel/pi_BUILD b/tools/build/bazel/pi_BUILD
new file mode 100644
index 0000000..307df5e
--- /dev/null
+++ b/tools/build/bazel/pi_BUILD
@@ -0,0 +1,12 @@
+package(default_visibility = ["//visibility:public"])
+
+proto_library(
+    name = "p4config_proto",
+    srcs = ["p4/tmp/p4config.proto"],
+)
+
+java_proto_library(
+    name = "p4config_java_proto_native",
+    deps = [":p4config_proto"],
+    visibility = ["//visibility:public"],
+)
diff --git a/tools/build/bazel/protobuf_workspace.bzl b/tools/build/bazel/protobuf_workspace.bzl
new file mode 100644
index 0000000..1932b57
--- /dev/null
+++ b/tools/build/bazel/protobuf_workspace.bzl
@@ -0,0 +1,13 @@
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+PROTOBUF_VER = "3.6.1"
+SHA = "0a4c6d0678eb2f063df332cff1a41647ef692c067b5cfb19e51bca778e79d9e0"
+
+def generate_protobuf():
+    http_archive(
+        name = "com_google_protobuf",
+        urls = ["https://github.com/google/protobuf/releases/download/v%s/protobuf-all-%s.zip"
+            % (PROTOBUF_VER, PROTOBUF_VER)],
+        sha256 = SHA,
+        strip_prefix = "protobuf-" + PROTOBUF_VER,
+    )