Bumped supported revisions of P4 tools

Includes:
- Use new P4Runtime "v1" package names
- Removed VALID match
- New table entry priority spec (1 is min priority, not 0)
- Fixed p4c-bm2-ss to include arch flag
- Re-compiled P4 programs with more recent p4c (with updated p4info)

Change-Id: I05908f40eda0f0c755009268fd261fb8bcc9be35
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 9a01a82..20f39df 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
@@ -21,10 +21,10 @@
 import org.onosproject.net.pi.model.PiPipeconf;
 import org.onosproject.net.pi.runtime.PiActionGroup;
 import org.onosproject.net.pi.runtime.PiActionGroupId;
-import p4.P4RuntimeOuterClass.ActionProfileGroup;
-import p4.P4RuntimeOuterClass.ActionProfileGroup.Member;
-import p4.P4RuntimeOuterClass.ActionProfileMember;
-import p4.config.P4InfoOuterClass;
+import p4.v1.P4RuntimeOuterClass.ActionProfileGroup;
+import p4.v1.P4RuntimeOuterClass.ActionProfileGroup.Member;
+import p4.v1.P4RuntimeOuterClass.ActionProfileMember;
+import p4.config.v1.P4InfoOuterClass;
 
 import java.util.Collection;
 import java.util.Map;
@@ -34,7 +34,8 @@
 /**
  * Encoder/Decoder for action profile group.
  */
-public final class ActionProfileGroupEncoder {
+final class ActionProfileGroupEncoder {
+
     private ActionProfileGroupEncoder() {
         // hide default constructor
     }
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/ActionProfileMemberEncoder.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/ActionProfileMemberEncoder.java
index 7170eba..ba31e69 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/ActionProfileMemberEncoder.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/ActionProfileMemberEncoder.java
@@ -20,9 +20,9 @@
 import org.onosproject.net.pi.model.PiPipeconf;
 import org.onosproject.net.pi.runtime.PiActionGroupMember;
 import org.onosproject.net.pi.runtime.PiActionGroupMemberId;
-import p4.P4RuntimeOuterClass;
-import p4.P4RuntimeOuterClass.ActionProfileMember;
-import p4.config.P4InfoOuterClass;
+import p4.config.v1.P4InfoOuterClass;
+import p4.v1.P4RuntimeOuterClass;
+import p4.v1.P4RuntimeOuterClass.ActionProfileMember;
 
 import static java.lang.String.format;
 import static org.onosproject.p4runtime.ctl.TableEntryEncoder.decodeActionMsg;
@@ -39,20 +39,13 @@
     /**
      * Encode a PiActionGroupMember to a ActionProfileMember.
      *
-     * @param group the PI action group of members
-     * @param member the member to encode
-     * @param pipeconf the pipeconf
-     * @return encoded member
-     */
-    /**
-     * Encode a PiActionGroupMember to a ActionProfileMember.
-     *
      * @param profileId the PI action group profile ID of members
-     * @param member the member to encode
-     * @param pipeconf the pipeconf, as encode spec
+     * @param member    the member to encode
+     * @param pipeconf  the pipeconf, as encode spec
      * @return encoded member
-     * @throws P4InfoBrowser.NotFoundException can't find action profile from P4Info browser
-     * @throws EncodeException can't find P4Info from pipeconf
+     * @throws P4InfoBrowser.NotFoundException can't find action profile from
+     *                                         P4Info browser
+     * @throws EncodeException                 can't find P4Info from pipeconf
      */
     static ActionProfileMember encode(PiActionProfileId profileId,
                                       PiActionGroupMember member,
@@ -88,12 +81,14 @@
     /**
      * Decode an action profile member to PI action group member.
      *
-     * @param member the action profile member
-     * @param weight the weight of the member
+     * @param member   the action profile member
+     * @param weight   the weight of the member
      * @param pipeconf the pipeconf, as decode spec
      * @return decoded PI action group member
-     * @throws P4InfoBrowser.NotFoundException can't find definition of action from P4 info
-     * @throws EncodeException can't get P4 info browser from pipeconf
+     * @throws P4InfoBrowser.NotFoundException can't find definition of action
+     *                                         from P4 info
+     * @throws EncodeException                 can't get P4 info browser from
+     *                                         pipeconf
      */
     static PiActionGroupMember decode(ActionProfileMember member,
                                       int weight,
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/CounterEntryCodec.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/CounterEntryCodec.java
index 17bff76..ec50c68 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/CounterEntryCodec.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/CounterEntryCodec.java
@@ -24,11 +24,11 @@
 import org.onosproject.net.pi.runtime.PiCounterCellId;
 import org.onosproject.net.pi.runtime.PiTableEntry;
 import org.slf4j.Logger;
-import p4.P4RuntimeOuterClass;
-import p4.P4RuntimeOuterClass.CounterData;
-import p4.P4RuntimeOuterClass.CounterEntry;
-import p4.P4RuntimeOuterClass.DirectCounterEntry;
-import p4.P4RuntimeOuterClass.Entity;
+import p4.v1.P4RuntimeOuterClass;
+import p4.v1.P4RuntimeOuterClass.CounterData;
+import p4.v1.P4RuntimeOuterClass.CounterEntry;
+import p4.v1.P4RuntimeOuterClass.DirectCounterEntry;
+import p4.v1.P4RuntimeOuterClass.Entity;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -38,8 +38,8 @@
 import static java.lang.String.format;
 import static org.onosproject.p4runtime.ctl.P4RuntimeUtils.indexMsg;
 import static org.slf4j.LoggerFactory.getLogger;
-import static p4.P4RuntimeOuterClass.Entity.EntityCase.COUNTER_ENTRY;
-import static p4.P4RuntimeOuterClass.Entity.EntityCase.DIRECT_COUNTER_ENTRY;
+import static p4.v1.P4RuntimeOuterClass.Entity.EntityCase.COUNTER_ENTRY;
+import static p4.v1.P4RuntimeOuterClass.Entity.EntityCase.DIRECT_COUNTER_ENTRY;
 
 /**
  * Encoder/decoder of PI counter IDs to counter entry protobuf messages, and
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/DefaultArbitration.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/DefaultArbitration.java
index 8c83bee..e8b8658 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/DefaultArbitration.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/DefaultArbitration.java
@@ -19,7 +19,7 @@
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.MastershipRole;
 import org.onosproject.p4runtime.api.P4RuntimeEventSubject;
-import p4.P4RuntimeOuterClass.Uint128;
+import p4.v1.P4RuntimeOuterClass.Uint128;
 
 /**
  * Default implementation of arbitration in P4Runtime.
@@ -36,7 +36,7 @@
      * @param role       the role
      * @param electionId the election id
      */
-    public DefaultArbitration(DeviceId deviceId, MastershipRole role, Uint128 electionId) {
+     DefaultArbitration(DeviceId deviceId, MastershipRole role, Uint128 electionId) {
         this.deviceId = deviceId;
         this.role = role;
         this.electionId = electionId;
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/MeterEntryCodec.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/MeterEntryCodec.java
index a830f6d..12379fd 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/MeterEntryCodec.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/MeterEntryCodec.java
@@ -25,11 +25,11 @@
 import org.onosproject.net.pi.runtime.PiMeterCellId;
 import org.onosproject.net.pi.runtime.PiTableEntry;
 import org.slf4j.Logger;
-import p4.P4RuntimeOuterClass;
-import p4.P4RuntimeOuterClass.DirectMeterEntry;
-import p4.P4RuntimeOuterClass.Entity;
-import p4.P4RuntimeOuterClass.MeterConfig;
-import p4.P4RuntimeOuterClass.MeterEntry;
+import p4.v1.P4RuntimeOuterClass;
+import p4.v1.P4RuntimeOuterClass.DirectMeterEntry;
+import p4.v1.P4RuntimeOuterClass.Entity;
+import p4.v1.P4RuntimeOuterClass.MeterConfig;
+import p4.v1.P4RuntimeOuterClass.MeterEntry;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -39,8 +39,8 @@
 import static java.lang.String.format;
 import static org.onosproject.p4runtime.ctl.P4RuntimeUtils.indexMsg;
 import static org.slf4j.LoggerFactory.getLogger;
-import static p4.P4RuntimeOuterClass.Entity.EntityCase.DIRECT_METER_ENTRY;
-import static p4.P4RuntimeOuterClass.Entity.EntityCase.METER_ENTRY;
+import static p4.v1.P4RuntimeOuterClass.Entity.EntityCase.DIRECT_METER_ENTRY;
+import static p4.v1.P4RuntimeOuterClass.Entity.EntityCase.METER_ENTRY;
 
 /**
  * Encoder/decoder of PI meter cell configurations to meter entry protobuf
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4DataCodec.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4DataCodec.java
index 5b0a2c5..551bf5c 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4DataCodec.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4DataCodec.java
@@ -18,9 +18,9 @@
 
 import com.google.protobuf.ByteString;
 import org.onlab.util.ImmutableByteSequence;
+import org.onosproject.net.pi.model.PiData;
 import org.onosproject.net.pi.runtime.data.PiBitString;
 import org.onosproject.net.pi.runtime.data.PiBool;
-import org.onosproject.net.pi.model.PiData;
 import org.onosproject.net.pi.runtime.data.PiEnumString;
 import org.onosproject.net.pi.runtime.data.PiErrorString;
 import org.onosproject.net.pi.runtime.data.PiHeader;
@@ -29,13 +29,16 @@
 import org.onosproject.net.pi.runtime.data.PiHeaderUnionStack;
 import org.onosproject.net.pi.runtime.data.PiStruct;
 import org.onosproject.net.pi.runtime.data.PiTuple;
-import org.slf4j.Logger;
-import p4.P4Types;
 
 import java.util.List;
 import java.util.stream.Collectors;
 
-import static org.slf4j.LoggerFactory.getLogger;
+import static p4.v1.P4DataOuterClass.P4Data;
+import static p4.v1.P4DataOuterClass.P4Header;
+import static p4.v1.P4DataOuterClass.P4HeaderStack;
+import static p4.v1.P4DataOuterClass.P4HeaderUnion;
+import static p4.v1.P4DataOuterClass.P4HeaderUnionStack;
+import static p4.v1.P4DataOuterClass.P4StructLike;
 
 /**
  * Encoder/decoder of PI Data entry to P4 Data entry protobuf
@@ -43,14 +46,12 @@
  */
 final class P4DataCodec {
 
-    private static final Logger log = getLogger(P4DataCodec.class);
-
     private P4DataCodec() {
         // Hides constructor.
     }
 
-    private static P4Types.P4Header encodeHeader(PiHeader piHeader) {
-        P4Types.P4Header.Builder builder = P4Types.P4Header.newBuilder();
+    private static P4Header encodeHeader(PiHeader piHeader) {
+        P4Header.Builder builder = P4Header.newBuilder();
         int i = 0;
         for (ImmutableByteSequence bitString : piHeader.bitStrings()) {
             builder.setBitstrings(i, ByteString.copyFrom(bitString.asArray()));
@@ -59,7 +60,7 @@
         return builder.setIsValid(piHeader.isValid()).build();
     }
 
-    private static PiHeader decodeHeader(P4Types.P4Header p4Header) {
+    private static PiHeader decodeHeader(P4Header p4Header) {
         List<ImmutableByteSequence> bitStrings = p4Header.getBitstringsList().stream()
                 .map(bit -> ImmutableByteSequence.copyFrom(bit.asReadOnlyByteBuffer()))
                 .collect(Collectors.toList());
@@ -67,9 +68,9 @@
         return PiHeader.of(p4Header.getIsValid(), bitStrings);
     }
 
-    private static P4Types.P4HeaderUnion encodeHeaderUnion(PiHeaderUnion headerUnion) {
+    private static P4HeaderUnion encodeHeaderUnion(PiHeaderUnion headerUnion) {
 
-        P4Types.P4HeaderUnion.Builder builder = P4Types.P4HeaderUnion.newBuilder();
+        P4HeaderUnion.Builder builder = P4HeaderUnion.newBuilder();
         if (headerUnion.isValid()) {
             builder.setValidHeader(encodeHeader(headerUnion.header()));
             builder.setValidHeaderName(headerUnion.headerName());
@@ -82,45 +83,45 @@
         return builder.build();
     }
 
-    private static PiHeaderUnion decodeHeaderUnion(P4Types.P4HeaderUnion p4HeaderUnion) {
+    private static PiHeaderUnion decodeHeaderUnion(P4HeaderUnion p4HeaderUnion) {
 
         return PiHeaderUnion.of(p4HeaderUnion.getValidHeaderName(),
                                 decodeHeader(p4HeaderUnion.getValidHeader()));
     }
 
-    private static P4Types.P4StructLike encodeStruct(PiStruct piStruct) {
-        P4Types.P4StructLike.Builder builder = P4Types.P4StructLike.newBuilder();
+    private static P4StructLike encodeStruct(PiStruct piStruct) {
+        P4StructLike.Builder builder = P4StructLike.newBuilder();
         builder.addAllMembers(piStruct.struct().stream()
-                                      .map(piData -> encodeP4Data(piData))
+                                      .map(P4DataCodec::encodeP4Data)
                                       .collect(Collectors.toList()));
         return builder.build();
     }
 
-    private static PiStruct decodeStruct(P4Types.P4StructLike p4StructLike) {
+    private static PiStruct decodeStruct(P4StructLike p4StructLike) {
 
         return PiStruct.of(p4StructLike.getMembersList().stream()
-                                   .map(p4Data -> decodeP4Data(p4Data))
+                                   .map(P4DataCodec::decodeP4Data)
                                    .collect(Collectors.toList()));
     }
 
-    private static P4Types.P4StructLike encodeTuple(PiTuple piTuple) {
-        P4Types.P4StructLike.Builder builder = P4Types.P4StructLike.newBuilder();
+    private static P4StructLike encodeTuple(PiTuple piTuple) {
+        P4StructLike.Builder builder = P4StructLike.newBuilder();
         builder.addAllMembers(piTuple.tuple().stream()
-                                      .map(piData -> encodeP4Data(piData))
+                                      .map(P4DataCodec::encodeP4Data)
                                       .collect(Collectors.toList()));
         return builder.build();
     }
 
-    private static PiTuple decodeTuple(P4Types.P4StructLike p4StructLike) {
+    private static PiTuple decodeTuple(P4StructLike p4StructLike) {
 
         return PiTuple.of(p4StructLike.getMembersList().stream()
-                                  .map(p4Data -> decodeP4Data(p4Data))
+                                  .map(P4DataCodec::decodeP4Data)
                                   .collect(Collectors.toList()));
     }
 
-    static P4Types.P4Data encodeP4Data(PiData piData) {
+    static P4Data encodeP4Data(PiData piData) {
 
-        P4Types.P4Data.Builder builder = P4Types.P4Data.newBuilder();
+        P4Data.Builder builder = P4Data.newBuilder();
         switch (piData.type()) {
             case BITSTRING:
                 builder.setBitstring(ByteString.copyFrom(((PiBitString) piData).bitString().asArray()));
@@ -144,7 +145,7 @@
                 builder.setHeader(encodeHeader((PiHeader) piData));
                 break;
             case HEADERSTACK:
-                P4Types.P4HeaderStack.Builder headerStack =  P4Types.P4HeaderStack.newBuilder();
+                P4HeaderStack.Builder headerStack =  P4HeaderStack.newBuilder();
                 int i = 0;
                 for (PiHeader header : ((PiHeaderStack) piData).headers()) {
                     headerStack.setEntries(i, encodeHeader(header));
@@ -156,7 +157,7 @@
                 builder.setHeaderUnion(encodeHeaderUnion((PiHeaderUnion) piData));
                 break;
             case HEADERUNIONSTACK:
-                P4Types.P4HeaderUnionStack.Builder headerUnionStack =  P4Types.P4HeaderUnionStack.newBuilder();
+                P4HeaderUnionStack.Builder headerUnionStack =  P4HeaderUnionStack.newBuilder();
                 int j = 0;
                 for (PiHeaderUnion headerUnion : ((PiHeaderUnionStack) piData).headerUnions()) {
                     headerUnionStack.setEntries(j, encodeHeaderUnion(headerUnion));
@@ -171,7 +172,7 @@
         return builder.build();
     }
 
-    static PiData decodeP4Data(P4Types.P4Data p4Data) {
+    static PiData decodeP4Data(P4Data p4Data) {
         PiData piData = null;
 
         switch (p4Data.getDataCase()) {
@@ -195,13 +196,13 @@
                 break;
             case HEADER_STACK:
                 piData = PiHeaderStack.of(p4Data.getHeaderStack().getEntriesList().stream()
-                                                  .map(p4header -> decodeHeader(p4header))
+                                                  .map(P4DataCodec::decodeHeader)
                                                   .collect(Collectors.toList()));
                 break;
             case HEADER_UNION_STACK:
                 piData = PiHeaderUnionStack.of(p4Data.getHeaderUnionStack()
                                                        .getEntriesList().stream()
-                                                       .map(p4HeaderUnion -> decodeHeaderUnion(p4HeaderUnion))
+                                                       .map(P4DataCodec::decodeHeaderUnion)
                                                        .collect(Collectors.toList()));
                 break;
             case ENUM:
@@ -218,4 +219,4 @@
 
         return piData;
     }
-}
\ No newline at end of file
+}
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 055b0c3..801ce36 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
@@ -19,17 +19,17 @@
 
 import com.google.common.collect.Maps;
 import com.google.protobuf.Message;
-import p4.config.P4InfoOuterClass.Action;
-import p4.config.P4InfoOuterClass.ActionProfile;
-import p4.config.P4InfoOuterClass.ControllerPacketMetadata;
-import p4.config.P4InfoOuterClass.Counter;
-import p4.config.P4InfoOuterClass.DirectCounter;
-import p4.config.P4InfoOuterClass.DirectMeter;
-import p4.config.P4InfoOuterClass.MatchField;
-import p4.config.P4InfoOuterClass.Meter;
-import p4.config.P4InfoOuterClass.P4Info;
-import p4.config.P4InfoOuterClass.Preamble;
-import p4.config.P4InfoOuterClass.Table;
+import p4.config.v1.P4InfoOuterClass.Action;
+import p4.config.v1.P4InfoOuterClass.ActionProfile;
+import p4.config.v1.P4InfoOuterClass.ControllerPacketMetadata;
+import p4.config.v1.P4InfoOuterClass.Counter;
+import p4.config.v1.P4InfoOuterClass.DirectCounter;
+import p4.config.v1.P4InfoOuterClass.DirectMeter;
+import p4.config.v1.P4InfoOuterClass.MatchField;
+import p4.config.v1.P4InfoOuterClass.Meter;
+import p4.config.v1.P4InfoOuterClass.P4Info;
+import p4.config.v1.P4InfoOuterClass.Preamble;
+import p4.config.v1.P4InfoOuterClass.Table;
 
 import java.util.Map;
 
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 624c41c..43d01e5 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
@@ -52,24 +52,24 @@
 import org.onosproject.p4runtime.api.P4RuntimeClient;
 import org.onosproject.p4runtime.api.P4RuntimeEvent;
 import org.slf4j.Logger;
-import p4.P4RuntimeGrpc;
-import p4.P4RuntimeOuterClass;
-import p4.P4RuntimeOuterClass.ActionProfileGroup;
-import p4.P4RuntimeOuterClass.ActionProfileMember;
-import p4.P4RuntimeOuterClass.Entity;
-import p4.P4RuntimeOuterClass.ForwardingPipelineConfig;
-import p4.P4RuntimeOuterClass.MasterArbitrationUpdate;
-import p4.P4RuntimeOuterClass.PacketIn;
-import p4.P4RuntimeOuterClass.ReadRequest;
-import p4.P4RuntimeOuterClass.ReadResponse;
-import p4.P4RuntimeOuterClass.SetForwardingPipelineConfigRequest;
-import p4.P4RuntimeOuterClass.StreamMessageRequest;
-import p4.P4RuntimeOuterClass.StreamMessageResponse;
-import p4.P4RuntimeOuterClass.TableEntry;
-import p4.P4RuntimeOuterClass.Uint128;
-import p4.P4RuntimeOuterClass.Update;
-import p4.P4RuntimeOuterClass.WriteRequest;
-import p4.config.P4InfoOuterClass.P4Info;
+import p4.v1.P4RuntimeGrpc;
+import p4.v1.P4RuntimeOuterClass;
+import p4.v1.P4RuntimeOuterClass.ActionProfileGroup;
+import p4.v1.P4RuntimeOuterClass.ActionProfileMember;
+import p4.v1.P4RuntimeOuterClass.Entity;
+import p4.v1.P4RuntimeOuterClass.ForwardingPipelineConfig;
+import p4.v1.P4RuntimeOuterClass.MasterArbitrationUpdate;
+import p4.v1.P4RuntimeOuterClass.PacketIn;
+import p4.v1.P4RuntimeOuterClass.ReadRequest;
+import p4.v1.P4RuntimeOuterClass.ReadResponse;
+import p4.v1.P4RuntimeOuterClass.SetForwardingPipelineConfigRequest;
+import p4.v1.P4RuntimeOuterClass.StreamMessageRequest;
+import p4.v1.P4RuntimeOuterClass.StreamMessageResponse;
+import p4.v1.P4RuntimeOuterClass.TableEntry;
+import p4.v1.P4RuntimeOuterClass.Uint128;
+import p4.v1.P4RuntimeOuterClass.Update;
+import p4.v1.P4RuntimeOuterClass.WriteRequest;
+import p4.config.v1.P4InfoOuterClass.P4Info;
 import p4.tmp.P4Config;
 
 import java.nio.ByteBuffer;
@@ -96,11 +96,11 @@
 import static java.lang.String.format;
 import static org.onlab.util.Tools.groupedThreads;
 import static org.slf4j.LoggerFactory.getLogger;
-import static p4.P4RuntimeOuterClass.Entity.EntityCase.ACTION_PROFILE_GROUP;
-import static p4.P4RuntimeOuterClass.Entity.EntityCase.ACTION_PROFILE_MEMBER;
-import static p4.P4RuntimeOuterClass.Entity.EntityCase.TABLE_ENTRY;
-import static p4.P4RuntimeOuterClass.PacketOut;
-import static p4.P4RuntimeOuterClass.SetForwardingPipelineConfigRequest.Action.VERIFY_AND_COMMIT;
+import static p4.v1.P4RuntimeOuterClass.Entity.EntityCase.ACTION_PROFILE_GROUP;
+import static p4.v1.P4RuntimeOuterClass.Entity.EntityCase.ACTION_PROFILE_MEMBER;
+import static p4.v1.P4RuntimeOuterClass.Entity.EntityCase.TABLE_ENTRY;
+import static p4.v1.P4RuntimeOuterClass.PacketOut;
+import static p4.v1.P4RuntimeOuterClass.SetForwardingPipelineConfigRequest.Action.VERIFY_AND_COMMIT;
 
 /**
  * Implementation of a P4Runtime client.
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeUtils.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeUtils.java
index 25ef153..5dafe2b 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeUtils.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/P4RuntimeUtils.java
@@ -17,14 +17,14 @@
 package org.onosproject.p4runtime.ctl;
 
 import com.google.protobuf.ByteString;
-import p4.P4RuntimeOuterClass;
+import p4.v1.P4RuntimeOuterClass;
 
 import static java.lang.String.format;
 
 /**
  * Utilities for P4 runtime control.
  */
-public final class P4RuntimeUtils {
+final class P4RuntimeUtils {
 
     private P4RuntimeUtils() {
         // Hide default construction
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/PacketIOCodec.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/PacketIOCodec.java
index 485689f..726e092 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/PacketIOCodec.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/PacketIOCodec.java
@@ -25,7 +25,7 @@
 import org.onosproject.net.pi.runtime.PiControlMetadata;
 import org.onosproject.net.pi.runtime.PiPacketOperation;
 import org.slf4j.Logger;
-import p4.config.P4InfoOuterClass;
+import p4.config.v1.P4InfoOuterClass;
 
 import java.util.Collections;
 import java.util.List;
@@ -35,9 +35,9 @@
 import static org.onlab.util.ImmutableByteSequence.copyFrom;
 import static org.onosproject.p4runtime.ctl.P4InfoBrowser.NotFoundException;
 import static org.slf4j.LoggerFactory.getLogger;
-import static p4.P4RuntimeOuterClass.PacketIn;
-import static p4.P4RuntimeOuterClass.PacketMetadata;
-import static p4.P4RuntimeOuterClass.PacketOut;
+import static p4.v1.P4RuntimeOuterClass.PacketIn;
+import static p4.v1.P4RuntimeOuterClass.PacketMetadata;
+import static p4.v1.P4RuntimeOuterClass.PacketOut;
 
 /**
  * Encoder of packet metadata, from ONOS Pi* format, to P4Runtime protobuf messages, and vice versa.
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/PipeconfHelper.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/PipeconfHelper.java
index a49fdd8..85fa2a8 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/PipeconfHelper.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/PipeconfHelper.java
@@ -24,7 +24,7 @@
 import org.onosproject.net.pi.model.PiPipeconf;
 import org.onosproject.net.pi.model.PiPipeconfId;
 import org.slf4j.Logger;
-import p4.config.P4InfoOuterClass.P4Info;
+import p4.config.v1.P4InfoOuterClass.P4Info;
 
 import java.io.IOException;
 import java.io.InputStream;
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/TableEntryEncoder.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/TableEntryEncoder.java
index 647b9cd..505b4cb 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/TableEntryEncoder.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/TableEntryEncoder.java
@@ -37,13 +37,12 @@
 import org.onosproject.net.pi.runtime.PiTableAction;
 import org.onosproject.net.pi.runtime.PiTableEntry;
 import org.onosproject.net.pi.runtime.PiTernaryFieldMatch;
-import org.onosproject.net.pi.runtime.PiValidFieldMatch;
 import org.slf4j.Logger;
-import p4.P4RuntimeOuterClass.Action;
-import p4.P4RuntimeOuterClass.FieldMatch;
-import p4.P4RuntimeOuterClass.TableAction;
-import p4.P4RuntimeOuterClass.TableEntry;
-import p4.config.P4InfoOuterClass;
+import p4.v1.P4RuntimeOuterClass.Action;
+import p4.v1.P4RuntimeOuterClass.FieldMatch;
+import p4.v1.P4RuntimeOuterClass.TableAction;
+import p4.v1.P4RuntimeOuterClass.TableEntry;
+import p4.config.v1.P4InfoOuterClass;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -348,13 +347,6 @@
                                 .setLow(rangeLowValue)
                                 .build())
                         .build();
-            case VALID:
-                PiValidFieldMatch validMatch = (PiValidFieldMatch) piFieldMatch;
-                return fieldMatchMsgBuilder.setValid(
-                        FieldMatch.Valid.newBuilder()
-                                .setValue(validMatch.isValid())
-                                .build())
-                        .build();
             default:
                 throw new EncodeException(format(
                         "Building of match type %s not implemented", piFieldMatch.type()));
@@ -422,9 +414,6 @@
                 ImmutableByteSequence rangeHighValue = copyFrom(rangeFieldMatch.getHigh().asReadOnlyByteBuffer());
                 ImmutableByteSequence rangeLowValue = copyFrom(rangeFieldMatch.getLow().asReadOnlyByteBuffer());
                 return new PiRangeFieldMatch(headerFieldId, rangeLowValue, rangeHighValue);
-            case VALID:
-                FieldMatch.Valid validFieldMatch = fieldMatchMsg.getValid();
-                return new PiValidFieldMatch(headerFieldId, validFieldMatch.getValue());
             default:
                 throw new EncodeException(format(
                         "Decoding of field match type '%s' not implemented", typeCase.name()));
diff --git a/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/MockP4RuntimeServer.java b/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/MockP4RuntimeServer.java
index 4773458..99b60c4 100644
--- a/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/MockP4RuntimeServer.java
+++ b/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/MockP4RuntimeServer.java
@@ -18,17 +18,17 @@
 
 import com.google.common.collect.Lists;
 import io.grpc.stub.StreamObserver;
-import p4.P4RuntimeGrpc;
-import p4.P4RuntimeOuterClass;
-import p4.P4RuntimeOuterClass.GetForwardingPipelineConfigRequest;
-import p4.P4RuntimeOuterClass.GetForwardingPipelineConfigResponse;
-import p4.P4RuntimeOuterClass.ReadRequest;
-import p4.P4RuntimeOuterClass.ReadResponse;
-import p4.P4RuntimeOuterClass.SetForwardingPipelineConfigRequest;
-import p4.P4RuntimeOuterClass.SetForwardingPipelineConfigResponse;
-import p4.P4RuntimeOuterClass.StreamMessageResponse;
-import p4.P4RuntimeOuterClass.WriteRequest;
-import p4.P4RuntimeOuterClass.WriteResponse;
+import p4.v1.P4RuntimeGrpc;
+import p4.v1.P4RuntimeOuterClass;
+import p4.v1.P4RuntimeOuterClass.GetForwardingPipelineConfigRequest;
+import p4.v1.P4RuntimeOuterClass.GetForwardingPipelineConfigResponse;
+import p4.v1.P4RuntimeOuterClass.ReadRequest;
+import p4.v1.P4RuntimeOuterClass.ReadResponse;
+import p4.v1.P4RuntimeOuterClass.SetForwardingPipelineConfigRequest;
+import p4.v1.P4RuntimeOuterClass.SetForwardingPipelineConfigResponse;
+import p4.v1.P4RuntimeOuterClass.StreamMessageResponse;
+import p4.v1.P4RuntimeOuterClass.WriteRequest;
+import p4.v1.P4RuntimeOuterClass.WriteResponse;
 
 import java.util.Collection;
 import java.util.List;
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 25d0e00..1e83577 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
@@ -45,12 +45,12 @@
 import org.onosproject.net.pi.runtime.PiActionGroupMember;
 import org.onosproject.net.pi.runtime.PiActionGroupMemberId;
 import org.onosproject.net.pi.runtime.PiActionParam;
-import p4.P4RuntimeOuterClass.ActionProfileGroup;
-import p4.P4RuntimeOuterClass.ActionProfileMember;
-import p4.P4RuntimeOuterClass.Entity;
-import p4.P4RuntimeOuterClass.Uint128;
-import p4.P4RuntimeOuterClass.Update;
-import p4.P4RuntimeOuterClass.WriteRequest;
+import p4.v1.P4RuntimeOuterClass.ActionProfileGroup;
+import p4.v1.P4RuntimeOuterClass.ActionProfileMember;
+import p4.v1.P4RuntimeOuterClass.Entity;
+import p4.v1.P4RuntimeOuterClass.Uint128;
+import p4.v1.P4RuntimeOuterClass.Update;
+import p4.v1.P4RuntimeOuterClass.WriteRequest;
 
 import java.io.IOException;
 import java.net.URL;
@@ -66,8 +66,8 @@
 import static org.junit.Assert.assertTrue;
 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;
-import static p4.P4RuntimeOuterClass.ReadResponse;
+import static p4.v1.P4RuntimeOuterClass.Action;
+import static p4.v1.P4RuntimeOuterClass.ReadResponse;
 
 /**
  * Tests for P4 Runtime Action Profile Group support.
diff --git a/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/TableEntryEncoderTest.java b/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/TableEntryEncoderTest.java
index 709873e..0799108 100644
--- a/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/TableEntryEncoderTest.java
+++ b/protocols/p4runtime/ctl/src/test/java/org/onosproject/p4runtime/ctl/TableEntryEncoderTest.java
@@ -36,8 +36,8 @@
 import org.onosproject.net.pi.runtime.PiMatchKey;
 import org.onosproject.net.pi.runtime.PiTableEntry;
 import org.onosproject.net.pi.runtime.PiTernaryFieldMatch;
-import p4.P4RuntimeOuterClass.Action;
-import p4.P4RuntimeOuterClass.TableEntry;
+import p4.v1.P4RuntimeOuterClass.Action;
+import p4.v1.P4RuntimeOuterClass.TableEntry;
 
 import java.net.URL;
 import java.util.Collection;
@@ -71,7 +71,6 @@
     private static final String INGRESS_PORT = "ingress_port";
     private static final String ETHER_TYPE = "etherType";
     private static final String ECMP_GROUP_ID = "ecmp_group_id";
-    private static final String ECMP_ACT_PROFILE = "ecmp_selector";
 
     private final Random rand = new Random();
     private final URL p4InfoUrl = this.getClass().getResource("/test.p4info");
diff --git a/protocols/p4runtime/model/src/main/java/org/onosproject/p4runtime/model/P4InfoParser.java b/protocols/p4runtime/model/src/main/java/org/onosproject/p4runtime/model/P4InfoParser.java
index f8d6082..e60f25f 100644
--- a/protocols/p4runtime/model/src/main/java/org/onosproject/p4runtime/model/P4InfoParser.java
+++ b/protocols/p4runtime/model/src/main/java/org/onosproject/p4runtime/model/P4InfoParser.java
@@ -47,20 +47,20 @@
 import org.onosproject.net.pi.model.PiTableId;
 import org.onosproject.net.pi.model.PiTableModel;
 import org.onosproject.net.pi.model.PiTableType;
-import p4.config.P4InfoOuterClass;
-import p4.config.P4InfoOuterClass.Action;
-import p4.config.P4InfoOuterClass.ActionProfile;
-import p4.config.P4InfoOuterClass.ActionRef;
-import p4.config.P4InfoOuterClass.ControllerPacketMetadata;
-import p4.config.P4InfoOuterClass.Counter;
-import p4.config.P4InfoOuterClass.CounterSpec;
-import p4.config.P4InfoOuterClass.DirectCounter;
-import p4.config.P4InfoOuterClass.DirectMeter;
-import p4.config.P4InfoOuterClass.MatchField;
-import p4.config.P4InfoOuterClass.Meter;
-import p4.config.P4InfoOuterClass.MeterSpec;
-import p4.config.P4InfoOuterClass.P4Info;
-import p4.config.P4InfoOuterClass.Table;
+import p4.config.v1.P4InfoOuterClass;
+import p4.config.v1.P4InfoOuterClass.Action;
+import p4.config.v1.P4InfoOuterClass.ActionProfile;
+import p4.config.v1.P4InfoOuterClass.ActionRef;
+import p4.config.v1.P4InfoOuterClass.ControllerPacketMetadata;
+import p4.config.v1.P4InfoOuterClass.Counter;
+import p4.config.v1.P4InfoOuterClass.CounterSpec;
+import p4.config.v1.P4InfoOuterClass.DirectCounter;
+import p4.config.v1.P4InfoOuterClass.DirectMeter;
+import p4.config.v1.P4InfoOuterClass.MatchField;
+import p4.config.v1.P4InfoOuterClass.Meter;
+import p4.config.v1.P4InfoOuterClass.MeterSpec;
+import p4.config.v1.P4InfoOuterClass.P4Info;
+import p4.config.v1.P4InfoOuterClass.Table;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -103,7 +103,6 @@
 
     private static final Map<MatchField.MatchType, PiMatchType> MATCH_TYPE_MAP =
             new ImmutableMap.Builder<MatchField.MatchType, PiMatchType>()
-                    .put(MatchField.MatchType.VALID, PiMatchType.VALID)
                     .put(MatchField.MatchType.EXACT, PiMatchType.EXACT)
                     .put(MatchField.MatchType.LPM, PiMatchType.LPM)
                     .put(MatchField.MatchType.TERNARY, PiMatchType.TERNARY)
@@ -211,7 +210,8 @@
                             tableMsg.getSize(),
                             tableCounterMapBuilder.build(),
                             tableMeterMapBuilder.build(),
-                            tableMsg.getWithEntryTimeout(),
+                            !tableMsg.getIdleTimeoutBehavior()
+                                    .equals(Table.IdleTimeoutBehavior.NO_TIMEOUT),
                             tableFieldMapBuilder.build(),
                             tableActionMapBuilder.build(),
                             actionMap.get(tableMsg.getConstDefaultActionId()),
@@ -307,8 +307,7 @@
         return meterMap;
     }
 
-    private static Map<Integer, PiRegisterModel> parseRegisters(P4Info p4info)
-            throws P4InfoParserException {
+    private static Map<Integer, PiRegisterModel> parseRegisters(P4Info p4info) {
         final Map<Integer, PiRegisterModel> registerMap = Maps.newHashMap();
         for (P4InfoOuterClass.Register registerMsg : p4info.getRegistersList()) {
             registerMap.put(registerMsg.getPreamble().getId(),
diff --git a/protocols/p4runtime/model/src/test/java/org/onosproject/p4runtime/model/P4InfoParserTest.java b/protocols/p4runtime/model/src/test/java/org/onosproject/p4runtime/model/P4InfoParserTest.java
index 452a7a7..e23a49c 100644
--- a/protocols/p4runtime/model/src/test/java/org/onosproject/p4runtime/model/P4InfoParserTest.java
+++ b/protocols/p4runtime/model/src/test/java/org/onosproject/p4runtime/model/P4InfoParserTest.java
@@ -22,6 +22,7 @@
 import com.google.protobuf.TextFormat;
 import org.hamcrest.collection.IsIterableContainingInAnyOrder;
 import org.hamcrest.collection.IsIterableContainingInOrder;
+import org.junit.Assert;
 import org.junit.Test;
 import org.onosproject.net.pi.model.PiActionId;
 import org.onosproject.net.pi.model.PiActionModel;
@@ -40,22 +41,23 @@
 import org.onosproject.net.pi.model.PiPipelineModel;
 import org.onosproject.net.pi.model.PiTableId;
 import org.onosproject.net.pi.model.PiTableModel;
-import p4.config.P4InfoOuterClass.Table;
-import p4.config.P4InfoOuterClass.P4Info;
-import p4.config.P4InfoOuterClass.MatchField;
-import p4.config.P4InfoOuterClass.ActionRef;
+import p4.config.v1.P4InfoOuterClass.ActionRef;
+import p4.config.v1.P4InfoOuterClass.MatchField;
+import p4.config.v1.P4InfoOuterClass.P4Info;
+import p4.config.v1.P4InfoOuterClass.Table;
 
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.*;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
 import static org.hamcrest.core.IsNull.notNullValue;
 
 /**
@@ -69,8 +71,6 @@
     private static final Long DEFAULT_MAX_TABLE_SIZE = 1024L;
     private static final Long DEFAULT_MAX_ACTION_PROFILE_SIZE = 64L;
 
-    public P4InfoParserTest() throws MalformedURLException { }
-
     /**
      * Tests parse method.
      * @throws Exception if equality group objects dose not match as expected
@@ -116,15 +116,14 @@
         List<PiMatchFieldModel> piMatchFieldList = new ArrayList<>();
 
         for (MatchField matchFieldIter : matchFieldList) {
-            int matchTypeNumber = matchFieldIter.getMatchType().getNumber();
-            PiMatchType piMatchType = PiMatchType.VALID;
-            switch (matchTypeNumber) {
-                case 1: piMatchType = PiMatchType.VALID; break;
-                case 2: piMatchType = PiMatchType.EXACT; break;
-                case 3: piMatchType = PiMatchType.LPM; break;
-                case 4: piMatchType = piMatchType.TERNARY; break;
-                case 5: piMatchType = piMatchType.RANGE; break;
-                default: piMatchType = PiMatchType.VALID; break;
+            MatchField.MatchType matchType = matchFieldIter.getMatchType();
+            PiMatchType piMatchType;
+            switch (matchType) {
+                case EXACT: piMatchType = PiMatchType.EXACT; break;
+                case LPM: piMatchType = PiMatchType.LPM; break;
+                case TERNARY: piMatchType = PiMatchType.TERNARY; break;
+                case RANGE: piMatchType = PiMatchType.RANGE; break;
+                default: Assert.fail(); return;
             }
             piMatchFieldList.add(new P4MatchFieldModel(PiMatchFieldId.of(matchFieldIter.getName()),
                                                        matchFieldIter.getBitwidth(), piMatchType));
diff --git a/protocols/p4runtime/proto/BUCK b/protocols/p4runtime/proto/BUCK
index aa3d8d3..2f8c07f 100644
--- a/protocols/p4runtime/proto/BUCK
+++ b/protocols/p4runtime/proto/BUCK
@@ -5,18 +5,19 @@
 PROTOBUF_VER = '3.2.0'
 GRPC_VER = '1.3.1'
 
-PI_COMMIT = '219b3d67299ec09b49f433d7341049256ab5f512'
+PI_COMMIT = '59c940916b4f5b182f33b4788d8c410972eaecce'
 PI_BASEURL = 'https://github.com/p4lang/PI.git'
 
 # Wondering which .proto files to build? Check p4runtime's Makefile:
 # https://github.com/p4lang/PI/blob/master/proto/Makefile.am
 PROTO_SRCS = [
-    '/proto/p4/p4types.proto',
-    '/proto/p4/p4runtime.proto',
-    '/proto/p4/config/p4info.proto',
+    '/proto/p4/v1/p4runtime.proto',
+    '/proto/p4/v1/p4data.proto',
+    '/proto/p4/config/v1/p4info.proto',
+    '/proto/p4/config/v1/p4types.proto',
+    '/proto/p4/tmp/p4config.proto',
     '/proto/google/rpc/status.proto',
     '/proto/google/rpc/code.proto',
-    '/proto/p4/tmp/p4config.proto',
 ]
 
 COMPILE_DEPS =[