Fixed deps and bundles for BMv2 drivers, P4Runtime and gRPC protocols

Change-Id: I96ad0e1e1021897544e41d02304a9f8240c1eb15
diff --git a/protocols/grpc/api/BUCK b/protocols/grpc/api/BUCK
index 66efde3..f0c8fd3 100644
--- a/protocols/grpc/api/BUCK
+++ b/protocols/grpc/api/BUCK
@@ -1,12 +1,11 @@
+GRPC_VER = '1.3.0'
+
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
-    '//lib:grpc-core-1.3.0',
-    '//lib:grpc-protobuf-1.3.0',
-    '//lib:grpc-stub-1.3.0',
-    '//lib:grpc-netty-1.3.0',
-    '//lib:grpc-auth-1.3.0',
+    '//incubator/grpc-dependencies:grpc-core-repkg-' + GRPC_VER,
+    '//lib:grpc-stub-' + GRPC_VER,
 ]
 
-osgi_jar_with_tests (
+osgi_jar (
     deps = COMPILE_DEPS,
 )
diff --git a/protocols/grpc/ctl/BUCK b/protocols/grpc/ctl/BUCK
index 18e0411..d6cab68 100644
--- a/protocols/grpc/ctl/BUCK
+++ b/protocols/grpc/ctl/BUCK
@@ -1,22 +1,16 @@
+PROTOC_VER = '3.0.2'
+GRPC_VER = '1.3.0'
+
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//protocols/grpc/api:onos-protocols-grpc-api',
     '//protocols/grpc/proto:onos-protocols-grpc-proto',
-    '//lib:grpc-core-1.3.0',
-    '//lib:grpc-protobuf-1.3.0',
-    '//lib:grpc-stub-1.3.0',
-    '//lib:grpc-netty-1.3.0',
-    '//lib:grpc-auth-1.3.0',
-    '//lib:protobuf-java-3.0.2',
+    '//incubator/grpc-dependencies:grpc-core-repkg-' + GRPC_VER,
+    '//lib:grpc-stub-' + GRPC_VER,
+    '//lib:protobuf-java-' + PROTOC_VER,
 ]
 
-TEST_DEPS = [
-    '//lib:TEST_ADAPTERS',
-    '//utils/osgi:onlab-osgi-tests',
-]
-
-osgi_jar_with_tests (
+osgi_jar (
     deps = COMPILE_DEPS,
-    test_deps = TEST_DEPS,
 )
 
diff --git a/protocols/grpc/proto/BUCK b/protocols/grpc/proto/BUCK
index f354b39..b1be821 100644
--- a/protocols/grpc/proto/BUCK
+++ b/protocols/grpc/proto/BUCK
@@ -5,7 +5,6 @@
 PROTOC_VER = '3.0.2'
 GRPC_VER = '1.3.0'
 
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//incubator/grpc-dependencies:grpc-core-repkg-' + GRPC_VER,
@@ -14,7 +13,6 @@
     '//lib:protobuf-java-' + PROTOC_VER,
 ]
 
-
 grpc_jar(
     proto_match_patterns = ["*.proto"],
     proto_paths = ["$ONOS_ROOT/protocols/grpc/proto/"],
diff --git a/protocols/p4runtime/api/BUCK b/protocols/p4runtime/api/BUCK
index 21506be..b7d1869 100644
--- a/protocols/p4runtime/api/BUCK
+++ b/protocols/p4runtime/api/BUCK
@@ -1,6 +1,8 @@
+GRPC_VER = '1.3.0'
+
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
-    '//incubator/grpc-dependencies:grpc-core-repkg-1.3.0',
+    '//incubator/grpc-dependencies:grpc-core-repkg-' + GRPC_VER,
 ]
 
 TEST_DEPS = [
diff --git a/protocols/p4runtime/ctl/BUCK b/protocols/p4runtime/ctl/BUCK
index 7fb3b4c..27e102a 100644
--- a/protocols/p4runtime/ctl/BUCK
+++ b/protocols/p4runtime/ctl/BUCK
@@ -1,12 +1,15 @@
+GRPC_VER = '1.3.0'
+PROTOBUF_VER = '3.0.2'
+
 GRPC_DEPS = [
-    '//incubator/grpc-dependencies:grpc-core-repkg-1.3.0',
-    '//lib:grpc-protobuf-1.3.0',
-    '//lib:grpc-protobuf-lite-1.3.0',
-    '//lib:grpc-stub-1.3.0',
-    '//lib:grpc-netty-1.3.0',
-    '//lib:grpc-auth-1.3.0',
+    '//incubator/grpc-dependencies:grpc-core-repkg-' + GRPC_VER,
+    '//lib:grpc-protobuf-' + GRPC_VER,
+    '//lib:grpc-protobuf-lite-' + GRPC_VER,
+    '//lib:grpc-stub-' + GRPC_VER,
+    '//lib:grpc-netty-' + GRPC_VER,
+    '//lib:grpc-auth-' + GRPC_VER,
     '//lib:google-instrumentation-0.3.0',
-    '//lib:protobuf-java-3.0.2',
+    '//lib:protobuf-java-' + PROTOBUF_VER,
     # Lazily adding all netty-related packages.
     # Some of them might not be necessary.
     '//lib:netty',
@@ -34,13 +37,6 @@
     '//incubator/bmv2/model:onos-incubator-bmv2-model',
 ]
 
-BUNDLES = [
-    '//protocols/grpc/api:onos-protocols-grpc-api',
-    '//protocols/p4runtime/api:onos-protocols-p4runtime-api',
-    '//protocols/p4runtime/proto:onos-protocols-p4runtime-proto'
-] + GRPC_DEPS
-
-
 osgi_jar_with_tests(
     deps = COMPILE_DEPS,
     test_deps = TEST_DEPS,
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4InfoBrowser.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4InfoBrowser.java
index 3c27468..b24bc70 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4InfoBrowser.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4InfoBrowser.java
@@ -31,7 +31,6 @@
 import p4.config.P4InfoOuterClass.Preamble;
 import p4.config.P4InfoOuterClass.Table;
 
-import javax.annotation.Nullable;
 import java.util.Map;
 
 import static com.google.common.base.Preconditions.checkArgument;
@@ -239,14 +238,14 @@
         }
 
         /**
-         * Adds the given entity identified by the given name, alias and id.
+         * Adds the given entity identified by the given name, alias (nullable) and id.
          *
          * @param name   entity name
-         * @param alias  entity alias
+         * @param alias  entity alias or null
          * @param id     entity id
          * @param entity entity message
          */
-        void add(String name, @Nullable String alias, int id, T entity) {
+        void add(String name, String alias, int id, T entity) {
             checkNotNull(name);
             checkArgument(!name.isEmpty(), "Name cannot be empty");
             checkNotNull(entity);
diff --git a/protocols/p4runtime/proto/BUCK b/protocols/p4runtime/proto/BUCK
index 33c46f4..ee185d4 100644
--- a/protocols/p4runtime/proto/BUCK
+++ b/protocols/p4runtime/proto/BUCK
@@ -18,20 +18,20 @@
     '/proto/p4/tmp/p4config.proto',
 ]
 
-COMPILE_DEPS = [
-'//lib:CORE_DEPS',
-'//incubator/grpc-dependencies:grpc-core-repkg-' + P4RT_GRPC_VER,
-'//lib:grpc-stub-' + P4RT_GRPC_VER,
-'//lib:grpc-protobuf-' + P4RT_GRPC_VER,
-'//lib:protobuf-java-' + P4RT_PROTOC_VER,
+COMPILE_DEPS =[
+    '//lib:CORE_DEPS',
+    '//incubator/grpc-dependencies:grpc-core-repkg-' + P4RT_GRPC_VER,
+    '//lib:grpc-stub-' + P4RT_GRPC_VER,
+    '//lib:grpc-protobuf-' + P4RT_GRPC_VER,
+    '//lib:protobuf-java-' + P4RT_PROTOC_VER,
 ]
 
 genrule(
     name = 'p4lang-pi-repo-' + PI_COMMIT,
     bash = 'git clone --quiet ' + PI_BASEURL + ' $OUT > /dev/null && '
-    + 'cd $OUT && '
-    + 'git checkout --quiet -b buck-build ' + PI_COMMIT + ' > /dev/null && '
-    + 'git submodule update --quiet --init --recursive > /dev/null',
+            + 'cd $OUT && '
+            + 'git checkout --quiet -b buck-build ' + PI_COMMIT + ' > /dev/null && '
+            + 'git submodule update --quiet --init --recursive > /dev/null',
     out = 'repo',
 )