[ONOS-7311] and [ONOS-7197] Update ONOS to support most recent version of BMv2 and PI

Change-Id: Ie69cfe1946f3c9241dc7f59a64bd40005a063931
diff --git a/protocols/p4runtime/ctl/BUCK b/protocols/p4runtime/ctl/BUCK
index cb22402..87366f5 100644
--- a/protocols/p4runtime/ctl/BUCK
+++ b/protocols/p4runtime/ctl/BUCK
@@ -1,5 +1,5 @@
 GRPC_VER = '1.3.0'
-PROTOBUF_VER = '3.0.2'
+PROTOBUF_VER = '3.2.0'
 
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/ActionProfileGroupEncoder.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/ActionProfileGroupEncoder.java
index c2a291e..9a01a82 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/ActionProfileGroupEncoder.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/ActionProfileGroupEncoder.java
@@ -17,7 +17,6 @@
 package org.onosproject.p4runtime.ctl;
 
 import com.google.common.collect.Maps;
-import org.onosproject.net.pi.model.PiActionGroupType;
 import org.onosproject.net.pi.model.PiActionProfileId;
 import org.onosproject.net.pi.model.PiPipeconf;
 import org.onosproject.net.pi.runtime.PiActionGroup;
@@ -65,14 +64,6 @@
                         .setGroupId(piActionGroup.id().id())
                         .setActionProfileId(actionProfileId);
 
-        switch (piActionGroup.type()) {
-            case SELECT:
-                actionProfileGroupBuilder.setType(ActionProfileGroup.Type.SELECT);
-                break;
-            default:
-                throw new EncodeException(format("PI action group type %s not supported", piActionGroup.type()));
-        }
-
         piActionGroup.members().forEach(m -> {
             // TODO: currently we don't set "watch" field of member
             Member member = Member.newBuilder()
@@ -115,17 +106,6 @@
                 .withActionProfileId(piActionProfileId)
                 .withId(PiActionGroupId.of(actionProfileGroup.getGroupId()));
 
-        switch (actionProfileGroup.getType()) {
-            case UNSPECIFIED:
-                // FIXME: PI returns unspecified for select groups. Remove this case when PI bug will be fixed.
-            case SELECT:
-                piActionGroupBuilder.withType(PiActionGroupType.SELECT);
-                break;
-            default:
-                throw new EncodeException(format("Action profile type %s is not supported",
-                                                 actionProfileGroup.getType()));
-        }
-
         Map<Integer, Integer> memberWeights = Maps.newHashMap();
         actionProfileGroup.getMembersList().forEach(member -> {
             int weight = member.getWeight();
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeClientImpl.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeClientImpl.java
index 7a89970..bac0bb9 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeClientImpl.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeClientImpl.java
@@ -328,16 +328,16 @@
 
         ForwardingPipelineConfig pipelineConfig = ForwardingPipelineConfig
                 .newBuilder()
-                .setDeviceId(p4DeviceId)
                 .setP4Info(p4Info)
                 .setP4DeviceConfig(p4DeviceConfigMsg.toByteString())
                 .build();
 
         SetForwardingPipelineConfigRequest request = SetForwardingPipelineConfigRequest
                 .newBuilder()
+                .setDeviceId(p4DeviceId)
                 .setElectionId(p4RuntimeElectionId)
                 .setAction(VERIFY_AND_COMMIT)
-                .addConfigs(pipelineConfig)
+                .setConfig(pipelineConfig)
                 .build();
 
         try {
diff --git a/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/P4RuntimeGroupTest.java b/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/P4RuntimeGroupTest.java
index afeb438..6379f8b 100644
--- a/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/P4RuntimeGroupTest.java
+++ b/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/P4RuntimeGroupTest.java
@@ -64,7 +64,6 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-import static org.onosproject.net.pi.model.PiActionGroupType.SELECT;
 import static org.onosproject.net.pi.model.PiPipeconf.ExtensionType.P4_INFO_TEXT;
 import static org.onosproject.p4runtime.api.P4RuntimeClient.WriteOperationType.INSERT;
 import static p4.P4RuntimeOuterClass.Action;
@@ -95,7 +94,6 @@
             .withId(GROUP_ID)
             .addMembers(GROUP_MEMBERS)
             .withActionProfileId(ACT_PROF_ID)
-            .withType(SELECT)
             .build();
     private static final DeviceId DEVICE_ID = DeviceId.deviceId("device:p4runtime:1");
     private static final int P4_DEVICE_ID = 1;
@@ -223,7 +221,6 @@
     public void testReadGroups() throws Exception {
         ActionProfileGroup.Builder group = ActionProfileGroup.newBuilder()
                 .setGroupId(GROUP_ID.id())
-                .setType(ActionProfileGroup.Type.SELECT)
                 .setActionProfileId(P4_INFO_ACT_PROF_ID);
 
         List<ActionProfileMember> members = Lists.newArrayList();
@@ -277,7 +274,6 @@
         PiActionGroup piActionGroup = groups.iterator().next();
         assertEquals(ACT_PROF_ID, piActionGroup.actionProfileId());
         assertEquals(GROUP_ID, piActionGroup.id());
-        assertEquals(SELECT, piActionGroup.type());
         assertEquals(3, piActionGroup.members().size());
         assertTrue(GROUP_MEMBERS.containsAll(piActionGroup.members()));
         assertTrue(piActionGroup.members().containsAll(GROUP_MEMBERS));