diff --git a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiCounterCellId.java b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiCounterCellId.java
index da8a882..4b9a70e 100644
--- a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiCounterCellId.java
+++ b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiCounterCellId.java
@@ -35,8 +35,8 @@
     private final long index;
     private final PiTableEntry tableEntry;
 
-    private PiCounterCellId(PiCounterId counterId, PiCounterType counterType, long index,
-                            PiTableEntry tableEntry) {
+    private PiCounterCellId(PiCounterId counterId, PiCounterType counterType,
+                            long index, PiTableEntry tableEntry) {
         this.counterId = counterId;
         this.counterType = counterType;
         this.index = index;
@@ -44,7 +44,9 @@
     }
 
     /**
-     * Returns the identifier of the counter instance where this cell is contained.
+     * Returns the identifier of the counter instance where this cell is
+     * contained. Meaningful only if the counter is of type {@link
+     * PiCounterType#INDIRECT}.
      *
      * @return counter identifier
      */
@@ -62,8 +64,8 @@
     }
 
     /**
-     * Returns the counter index to which this cell ID is associated. Meaningful only if the counter is of type {@link
-     * PiCounterType#INDIRECT}.
+     * Returns the counter index to which this cell ID is associated. Meaningful
+     * only if the counter is of type {@link PiCounterType#INDIRECT}.
      *
      * @return counter index
      */
@@ -72,8 +74,9 @@
     }
 
     /**
-     * Returns the table entry to which this cell ID is associated. Meaningful only if the counter is of type {@link
-     * PiCounterType#DIRECT}, otherwise returns null.
+     * Returns the table entry to which this cell ID is associated. Meaningful
+     * only if the counter is of type {@link PiCounterType#DIRECT}, otherwise
+     * returns null.
      *
      * @return PI table entry or null
      */
@@ -82,16 +85,15 @@
     }
 
     /**
-     * Return a direct counter cell ID for the given counter ID and table entry.
+     * Return a direct counter cell ID for the given counter ID and table
+     * entry.
      *
-     * @param counterId  counter ID
      * @param tableEntry table entry
      * @return counter cell ID
      */
-    public static PiCounterCellId ofDirect(PiCounterId counterId, PiTableEntry tableEntry) {
-        checkNotNull(counterId);
+    public static PiCounterCellId ofDirect(PiTableEntry tableEntry) {
         checkNotNull(tableEntry);
-        return new PiCounterCellId(counterId, PiCounterType.DIRECT, -1, tableEntry);
+        return new PiCounterCellId(null, PiCounterType.DIRECT, -1, tableEntry);
     }
 
     /**
@@ -129,7 +131,8 @@
 
     @Override
     public String toString() {
-        return counterId.toString() + ':'
-                + (counterType == PiCounterType.DIRECT ? tableEntry.toString() : String.valueOf(index));
+        return counterType == PiCounterType.DIRECT
+                ? tableEntry.toString()
+                : counterId.toString() + ':' + String.valueOf(index);
     }
 }
diff --git a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiMeterCellId.java b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiMeterCellId.java
index 09cf7bf..34af8bf 100644
--- a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiMeterCellId.java
+++ b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiMeterCellId.java
@@ -46,6 +46,7 @@
 
     /**
      * Returns the identifier of the meter instance where this cell is contained.
+     * Meaningful only if the meter is of type {@link PiMeterType#DIRECT}, otherwise returns null.
      *
      * @return meter identifier
      */
@@ -90,14 +91,12 @@
     /**
      * Return a direct meter cell ID for the given meter ID and table entry.
      *
-     * @param meterId  meter ID
      * @param tableEntry table entry
      * @return meter cell ID
      */
-    public static PiMeterCellId ofDirect(PiMeterId meterId, PiTableEntry tableEntry) {
-        checkNotNull(meterId);
+    public static PiMeterCellId ofDirect(PiTableEntry tableEntry) {
         checkNotNull(tableEntry);
-        return new PiMeterCellId(meterId, PiMeterType.DIRECT, -1, tableEntry);
+        return new PiMeterCellId(null, PiMeterType.DIRECT, -1, tableEntry);
     }
 
     /**
@@ -135,7 +134,8 @@
 
     @Override
     public String toString() {
-        return meterId.toString() + ':'
-                + (meterType == PiMeterType.DIRECT ? tableEntry.toString() : String.valueOf(index));
+        return meterType == PiMeterType.DIRECT
+                ? tableEntry.toString()
+                : meterId.toString() + ':' + String.valueOf(index);
     }
 }
diff --git a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiTableEntry.java b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiTableEntry.java
index 18b31f2..7b8797a 100644
--- a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiTableEntry.java
+++ b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiTableEntry.java
@@ -32,8 +32,6 @@
 @Beta
 public final class PiTableEntry implements PiEntity {
 
-    public static final PiTableEntry EMTPY = new PiTableEntry();
-
     private static final int NO_PRIORITY = -1;
     private static final double NO_TIMEOUT = -1;
 
@@ -44,15 +42,6 @@
     private final int priority;
     private final double timeout;
 
-    private PiTableEntry() {
-        this.tableId = null;
-        this.matchKey = null;
-        this.tableAction = null;
-        this.cookie = 0;
-        this.priority = NO_PRIORITY;
-        this.timeout = NO_TIMEOUT;
-    }
-
     private PiTableEntry(PiTableId tableId, PiMatchKey matchKey,
                          PiTableAction tableAction, long cookie, int priority, double timeout) {
         this.tableId = tableId;
diff --git a/core/api/src/test/java/org/onosproject/net/pi/runtime/PiCounterCellDataTest.java b/core/api/src/test/java/org/onosproject/net/pi/runtime/PiCounterCellDataTest.java
index 4104050..6676470 100644
--- a/core/api/src/test/java/org/onosproject/net/pi/runtime/PiCounterCellDataTest.java
+++ b/core/api/src/test/java/org/onosproject/net/pi/runtime/PiCounterCellDataTest.java
@@ -19,7 +19,6 @@
 import com.google.common.testing.EqualsTester;
 import org.junit.Test;
 import org.onosproject.net.pi.model.PiActionId;
-import org.onosproject.net.pi.model.PiCounterId;
 import org.onosproject.net.pi.model.PiTableId;
 
 import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
@@ -30,9 +29,6 @@
  */
 public class PiCounterCellDataTest {
 
-    private static final PiCounterId PI_COUNTER_ID_1 = PiCounterId.of("Name1");
-    private static final PiCounterId PI_COUNTER_ID_2 = PiCounterId.of("Name2");
-
     private static final PiTableEntry PI_TABLE_ENTRY_1 = PiTableEntry.builder()
             .forTable(PiTableId.of("T10"))
             .withCookie(0xac)
@@ -49,9 +45,9 @@
             .build();
 
     private static final PiCounterCellId PI_COUNTER_CELL_ID_1 =
-            PiCounterCellId.ofDirect(PI_COUNTER_ID_1, PI_TABLE_ENTRY_1);
+            PiCounterCellId.ofDirect(PI_TABLE_ENTRY_1);
     private static final PiCounterCellId PI_COUNTER_CELL_ID_2 =
-            PiCounterCellId.ofDirect(PI_COUNTER_ID_2, PI_TABLE_ENTRY_2);
+            PiCounterCellId.ofDirect(PI_TABLE_ENTRY_2);
 
     private static final long PACKETS_1 = 10;
     private static final long PACKETS_2 = 20;
@@ -83,4 +79,4 @@
                 .addEqualityGroup(PI_COUNTER_CELL_DATA_2)
                 .testEquals();
     }
-}
\ No newline at end of file
+}
diff --git a/core/api/src/test/java/org/onosproject/net/pi/runtime/PiTableEntryTest.java b/core/api/src/test/java/org/onosproject/net/pi/runtime/PiTableEntryTest.java
index 0b451e8..087eb77 100644
--- a/core/api/src/test/java/org/onosproject/net/pi/runtime/PiTableEntryTest.java
+++ b/core/api/src/test/java/org/onosproject/net/pi/runtime/PiTableEntryTest.java
@@ -81,16 +81,6 @@
     }
 
     /**
-     * Tests equality of the empty table entry.
-     */
-    @Test
-    public void testEmptyEquals() {
-        new EqualsTester()
-                .addEqualityGroup(PiTableEntry.EMTPY, PiTableEntry.EMTPY)
-                .testEquals();
-    }
-
-    /**
      * Tests creation of a DefaultFlowRule using a FlowRule constructor.
      */
     @Test
diff --git a/core/net/src/main/java/org/onosproject/net/pi/impl/PiFlowRuleTranslatorImpl.java b/core/net/src/main/java/org/onosproject/net/pi/impl/PiFlowRuleTranslatorImpl.java
index 85c763c..f22fdde 100644
--- a/core/net/src/main/java/org/onosproject/net/pi/impl/PiFlowRuleTranslatorImpl.java
+++ b/core/net/src/main/java/org/onosproject/net/pi/impl/PiFlowRuleTranslatorImpl.java
@@ -59,6 +59,7 @@
 
 import static java.lang.String.format;
 import static org.onlab.util.ImmutableByteSequence.ByteSequenceTrimException;
+import static org.onlab.util.ImmutableByteSequence.prefixOnes;
 import static org.onosproject.net.flow.criteria.Criterion.Type.PROTOCOL_INDEPENDENT;
 import static org.onosproject.net.pi.impl.CriterionTranslatorHelper.translateCriterion;
 import static org.onosproject.net.pi.impl.PiUtils.getInterpreterOrNull;
@@ -128,7 +129,17 @@
         }
 
         if (needPriority) {
-            tableEntryBuilder.withPriority(rule.priority());
+            // In the P4 world 0 is the highest priority, in ONOS the lowest one.
+            // FIXME: move priority conversion to the P4Runtime driver
+            final int newPriority;
+            if (rule.priority() > MAX_PI_PRIORITY) {
+                log.warn("Flow rule priority too big, setting translated priority to max value {}: {}",
+                         MAX_PI_PRIORITY, rule);
+                newPriority = 0;
+            } else {
+                newPriority = MAX_PI_PRIORITY - rule.priority();
+            }
+            tableEntryBuilder.withPriority(newPriority);
         }
 
         if (!rule.isPermanent()) {
@@ -290,7 +301,6 @@
             PiMatchFieldId fieldId = fieldModel.id();
 
             int bitWidth = fieldModel.bitWidth();
-            int fieldByteWidth = (int) Math.ceil((double) bitWidth / 8);
 
             Optional<Criterion.Type> criterionType =
                     interpreter == null
@@ -304,17 +314,8 @@
                 // Can ignore if the match is ternary or LPM.
                 switch (fieldModel.matchType()) {
                     case TERNARY:
-                        // Wildcard the whole field.
-                        fieldMatches.put(fieldId, new PiTernaryFieldMatch(
-                                fieldId,
-                                ImmutableByteSequence.ofZeros(fieldByteWidth),
-                                ImmutableByteSequence.ofZeros(fieldByteWidth)));
-                        break;
                     case LPM:
-                        // LPM with prefix 0
-                        fieldMatches.put(fieldId, new PiLpmFieldMatch(fieldId,
-                                                                      ImmutableByteSequence.ofZeros(fieldByteWidth),
-                                                                      0));
+                        // Skip field.
                         break;
                     // FIXME: Can we handle the case of RANGE or VALID match?
                     default:
@@ -404,7 +405,9 @@
         /*
         Here we try to be robust against wrong size fields with the goal of having PiCriterion independent of the
         pipeline model. We duplicate the field match, fitting the byte sequences to the bit-width specified in the
-        model. This operation is expensive when performed for each field match of each flow rule, but should be
+        model. We also normalize ternary (and LPM) field matches by setting to 0 unused bits, as required by P4Runtime.
+
+        These operations are expensive when performed for each field match of each flow rule, but should be
         mitigated by the translation cache provided by PiFlowRuleTranslationServiceImpl.
         */
 
@@ -414,9 +417,12 @@
                     return new PiExactFieldMatch(fieldMatch.fieldId(),
                                                  ((PiExactFieldMatch) fieldMatch).value().fit(modelBitWidth));
                 case TERNARY:
-                    return new PiTernaryFieldMatch(fieldMatch.fieldId(),
-                                                   ((PiTernaryFieldMatch) fieldMatch).value().fit(modelBitWidth),
-                                                   ((PiTernaryFieldMatch) fieldMatch).mask().fit(modelBitWidth));
+                    PiTernaryFieldMatch ternField = (PiTernaryFieldMatch) fieldMatch;
+                    ImmutableByteSequence ternMask = ternField.mask().fit(modelBitWidth);
+                    ImmutableByteSequence ternValue = ternField.value()
+                            .fit(modelBitWidth)
+                            .bitwiseAnd(ternMask);
+                    return new PiTernaryFieldMatch(fieldMatch.fieldId(), ternValue, ternMask);
                 case LPM:
                     PiLpmFieldMatch lpmfield = (PiLpmFieldMatch) fieldMatch;
                     if (lpmfield.prefixLength() > modelBitWidth) {
@@ -424,9 +430,13 @@
                                 "Invalid prefix length for LPM field '%s', found %d but field has bit-width %d",
                                 fieldMatch.fieldId(), lpmfield.prefixLength(), modelBitWidth));
                     }
+                    ImmutableByteSequence lpmMask = prefixOnes(modelBitWidth * Byte.SIZE,
+                                                               lpmfield.prefixLength());
+                    ImmutableByteSequence lpmValue = lpmfield.value()
+                            .fit(modelBitWidth)
+                            .bitwiseAnd(lpmMask);
                     return new PiLpmFieldMatch(fieldMatch.fieldId(),
-                                               lpmfield.value().fit(modelBitWidth),
-                                               lpmfield.prefixLength());
+                                               lpmValue, lpmfield.prefixLength());
                 case RANGE:
                     return new PiRangeFieldMatch(fieldMatch.fieldId(),
                                                  ((PiRangeFieldMatch) fieldMatch).lowValue().fit(modelBitWidth),
diff --git a/core/net/src/test/java/org/onosproject/net/pi/impl/PiTranslatorServiceTest.java b/core/net/src/test/java/org/onosproject/net/pi/impl/PiTranslatorServiceTest.java
index 9af6745..e55ec25 100644
--- a/core/net/src/test/java/org/onosproject/net/pi/impl/PiTranslatorServiceTest.java
+++ b/core/net/src/test/java/org/onosproject/net/pi/impl/PiTranslatorServiceTest.java
@@ -182,7 +182,6 @@
                 .addEqualityGroup(entry1, entry2)
                 .testEquals();
 
-        int numMatchParams = pipeconf.pipelineModel().table(TBL_TABLE0_ID).get().matchFields().size();
         // parse values stored in entry1
         PiTernaryFieldMatch inPortParam = (PiTernaryFieldMatch) entry1.matchKey().fieldMatch(HDR_IN_PORT_ID).get();
         PiTernaryFieldMatch ethDstParam = (PiTernaryFieldMatch) entry1.matchKey().fieldMatch(HDR_ETH_DST_ID).get();
@@ -191,10 +190,6 @@
         Optional<Double> expectedTimeout = pipeconf.pipelineModel().table(TBL_TABLE0_ID).get().supportsAging()
                 ? Optional.of((double) rule1.timeout()) : Optional.empty();
 
-        // check that the number of parameters in the entry is the same as the number of table keys
-        assertThat("Incorrect number of match parameters",
-                   entry1.matchKey().fieldMatches().size(), is(equalTo(numMatchParams)));
-
         // check that values stored in entry are the same used for the flow rule
         assertThat("Incorrect inPort match param value",
                    inPortParam.value().asReadOnlyBuffer().getShort(), is(equalTo(inPort)));
diff --git a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeFlowRuleProgrammable.java b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeFlowRuleProgrammable.java
index bcc298d..352eca8 100644
--- a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeFlowRuleProgrammable.java
+++ b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/P4RuntimeFlowRuleProgrammable.java
@@ -56,7 +56,6 @@
 import java.util.stream.Collectors;
 
 import static com.google.common.collect.Lists.newArrayList;
-import static java.util.Collections.singleton;
 import static org.onosproject.drivers.p4runtime.P4RuntimeFlowRuleProgrammable.Operation.APPLY;
 import static org.onosproject.drivers.p4runtime.P4RuntimeFlowRuleProgrammable.Operation.REMOVE;
 import static org.onosproject.net.flow.FlowEntry.FlowEntryState.ADDED;
@@ -78,8 +77,8 @@
     private static final String DELETE_BEFORE_UPDATE = "tableDeleteBeforeUpdate";
     private static final boolean DEFAULT_DELETE_BEFORE_UPDATE = false;
 
-    // If true, we ignore re-installing rules that already exist the
-    // device, i.e. same match key and action.
+    // If true, we ignore re-installing rules that already exist in the
+    // device mirror, i.e. same match key and action.
     private static final String IGNORE_SAME_ENTRY_UPDATE = "tableIgnoreSameEntryUpdate";
     private static final boolean DEFAULT_IGNORE_SAME_ENTRY_UPDATE = false;
 
@@ -233,7 +232,7 @@
 
         if (cellData != null) {
             return new DefaultFlowEntry(translatedEntity.get().original(),
-                                        ADDED, timedEntry.lifeSec(), cellData.bytes(),
+                                        ADDED, timedEntry.lifeSec(), cellData.packets(),
                                         cellData.bytes());
         } else {
             return new DefaultFlowEntry(translatedEntity.get().original(),
@@ -397,11 +396,14 @@
         try {
             if (driverBoolProperty(READ_ALL_DIRECT_COUNTERS,
                                    DEFAULT_READ_ALL_DIRECT_COUNTERS)) {
-                cellDatas = client.readAllCounterCells(
-                        singleton(counterId), pipeconf).get();
+                // FIXME: re-implement reading all counters ONOS-7595, or
+                // (even better) read counters when dumping table entries ONOS-7596
+                // cellDatas = client.readAllCounterCells(
+                //        singleton(counterId), pipeconf).get();
+                cellDatas = Collections.emptyList();
             } else {
                 Set<PiCounterCellId> cellIds = tableEntries.stream()
-                        .map(entry -> PiCounterCellId.ofDirect(counterId, entry))
+                        .map(PiCounterCellId::ofDirect)
                         .collect(Collectors.toSet());
                 cellDatas = client.readCounterCells(cellIds, pipeconf).get();
             }
diff --git a/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicConstants.java b/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicConstants.java
index b6ee3c2..0ef19bf 100644
--- a/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicConstants.java
+++ b/pipelines/basic/src/main/java/org/onosproject/pipelines/basic/BasicConstants.java
@@ -31,48 +31,75 @@
 
     // TODO: constants could be auto-generated starting from the P4info.
 
-    private static final String TABLE0_CONTROL = "table0_control";
-    private static final String WCMP_CONTROL = "wcmp_control";
-
-    // Header field IDs
-    public static final String DOT =  ".";
+    public static final String DOT = ".";
+    private static final String INGRESS = "ingress";
+    private static final String EGRESS = "egress";
+    private static final String TABLE0_CTRL = INGRESS + DOT + "table0_control";
+    private static final String WCMP_CTRL = INGRESS + DOT + "wcmp_control";
+    private static final String PORT_COUNT_INGRESS_CTRL = INGRESS + DOT + "port_counters_ingress";
+    private static final String PORT_COUNT_EGRESS_CTRL = EGRESS + DOT + "port_counters_egress";
     public static final String HDR = "hdr";
     public static final String ETHERNET = "ethernet";
     public static final String IPV4 = "ipv4";
     public static final String LOCAL_METADATA = "local_metadata";
     public static final String STANDARD_METADATA = "standard_metadata";
-    public static final PiMatchFieldId HDR_IN_PORT_ID = PiMatchFieldId.of(STANDARD_METADATA + DOT + "ingress_port");
-    public static final PiMatchFieldId HDR_ETH_DST_ID = PiMatchFieldId.of(HDR + DOT + ETHERNET + DOT + "dst_addr");
-    public static final PiMatchFieldId HDR_ETH_SRC_ID = PiMatchFieldId.of(HDR + DOT + ETHERNET + DOT + "src_addr");
-    public static final PiMatchFieldId HDR_ETH_TYPE_ID = PiMatchFieldId.of(HDR + DOT + ETHERNET + DOT + "ether_type");
-    public static final PiMatchFieldId HDR_IPV4_DST_ID = PiMatchFieldId.of(HDR + DOT + IPV4 + DOT + "dst_addr");
-    public static final PiMatchFieldId HDR_IPV4_SRC_ID = PiMatchFieldId.of(HDR + DOT + IPV4 + DOT + "src_addr");
-    public static final PiMatchFieldId HDR_NEXT_HOP_ID = PiMatchFieldId.of(LOCAL_METADATA + DOT + "next_hop_id");
-    public static final PiMatchFieldId HDR_SELECTOR_ID = PiMatchFieldId.of(LOCAL_METADATA + DOT + "selector");
+
+    // Header field IDs
+
+    public static final PiMatchFieldId HDR_IN_PORT_ID =
+            PiMatchFieldId.of(STANDARD_METADATA + DOT + "ingress_port");
+    public static final PiMatchFieldId HDR_ETH_DST_ID =
+            PiMatchFieldId.of(HDR + DOT + ETHERNET + DOT + "dst_addr");
+    public static final PiMatchFieldId HDR_ETH_SRC_ID =
+            PiMatchFieldId.of(HDR + DOT + ETHERNET + DOT + "src_addr");
+    public static final PiMatchFieldId HDR_ETH_TYPE_ID =
+            PiMatchFieldId.of(HDR + DOT + ETHERNET + DOT + "ether_type");
+    public static final PiMatchFieldId HDR_IPV4_DST_ID =
+            PiMatchFieldId.of(HDR + DOT + IPV4 + DOT + "dst_addr");
+    public static final PiMatchFieldId HDR_IPV4_SRC_ID =
+            PiMatchFieldId.of(HDR + DOT + IPV4 + DOT + "src_addr");
+    public static final PiMatchFieldId HDR_NEXT_HOP_ID =
+            PiMatchFieldId.of(LOCAL_METADATA + DOT + "next_hop_id");
+    public static final PiMatchFieldId HDR_SELECTOR_ID =
+            PiMatchFieldId.of(LOCAL_METADATA + DOT + "selector");
     // Table IDs
-    public static final PiTableId TBL_TABLE0_ID = PiTableId.of(TABLE0_CONTROL + DOT  + "table0");
-    public static final PiTableId TBL_WCMP_TABLE_ID = PiTableId.of(WCMP_CONTROL + DOT  + "wcmp_table");
+    public static final PiTableId TBL_TABLE0_ID =
+            PiTableId.of(TABLE0_CTRL + DOT + "table0");
+    public static final PiTableId TBL_WCMP_TABLE_ID =
+            PiTableId.of(WCMP_CTRL + DOT + "wcmp_table");
     // Counter IDs
     public static final PiCounterId CNT_EGRESS_PORT_COUNTER_ID =
-            PiCounterId.of("port_counters_egress.egress_port_counter");
+            PiCounterId.of(PORT_COUNT_EGRESS_CTRL + DOT + "egress_port_counter");
     public static final PiCounterId CNT_INGRESS_PORT_COUNTER_ID =
-            PiCounterId.of("port_counters_ingress.ingress_port_counter");
-    public static final PiCounterId CNT_TABLE0_ID = PiCounterId.of(TABLE0_CONTROL + DOT  + "table0_counter");
-    public static final PiCounterId CNT_WCMP_TABLE_ID = PiCounterId.of(WCMP_CONTROL + DOT  + "wcmp_table_counter");
+            PiCounterId.of(PORT_COUNT_INGRESS_CTRL + DOT + "ingress_port_counter");
+    public static final PiCounterId CNT_TABLE0_ID =
+            PiCounterId.of(TABLE0_CTRL + DOT + "table0_counter");
+    public static final PiCounterId CNT_WCMP_TABLE_ID =
+            PiCounterId.of(WCMP_CTRL + DOT + "wcmp_table_counter");
     // Action IDs
-    public static final PiActionId ACT_NOACTION_ID = PiActionId.of("NoAction");
-    public static final PiActionId ACT_DROP_ID = PiActionId.of("_drop");
-    public static final PiActionId ACT_SET_EGRESS_PORT_ID = PiActionId.of("set_egress_port");
-    public static final PiActionId ACT_SET_NEXT_HOP_ID = PiActionId.of(TABLE0_CONTROL + DOT  + "set_next_hop_id");
-    public static final PiActionId ACT_SEND_TO_CPU_ID = PiActionId.of("send_to_cpu");
+    public static final PiActionId ACT_NOACTION_ID =
+            PiActionId.of("NoAction");
+    public static final PiActionId ACT_DROP_ID =
+            PiActionId.of("_drop");
+    public static final PiActionId ACT_SET_EGRESS_PORT_ID =
+            PiActionId.of("set_egress_port");
+    public static final PiActionId ACT_SET_NEXT_HOP_ID =
+            PiActionId.of(TABLE0_CTRL + DOT + "set_next_hop_id");
+    public static final PiActionId ACT_SEND_TO_CPU_ID =
+            PiActionId.of("send_to_cpu");
     // Action Param IDs
-    public static final PiActionParamId ACT_PRM_PORT_ID = PiActionParamId.of("port");
-    public static final PiActionParamId ACT_PRM_NEXT_HOP_ID = PiActionParamId.of("next_hop_id");
+    public static final PiActionParamId ACT_PRM_PORT_ID =
+            PiActionParamId.of("port");
+    public static final PiActionParamId ACT_PRM_NEXT_HOP_ID =
+            PiActionParamId.of("next_hop_id");
     // Action Profile IDs
-    public static final PiActionProfileId ACT_PRF_WCMP_SELECTOR_ID = PiActionProfileId.of("wcmp_control.wcmp_selector");
+    public static final PiActionProfileId ACT_PRF_WCMP_SELECTOR_ID =
+            PiActionProfileId.of(WCMP_CTRL + DOT + "wcmp_selector");
     // Packet Metadata IDs
-    public static final PiControlMetadataId PKT_META_EGRESS_PORT_ID = PiControlMetadataId.of("egress_port");
-    public static final PiControlMetadataId PKT_META_INGRESS_PORT_ID = PiControlMetadataId.of("ingress_port");
+    public static final PiControlMetadataId PKT_META_EGRESS_PORT_ID =
+            PiControlMetadataId.of("egress_port");
+    public static final PiControlMetadataId PKT_META_INGRESS_PORT_ID =
+            PiControlMetadataId.of("ingress_port");
     // Bitwidths
     public static final int PORT_BITWIDTH = 9;
 
diff --git a/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.json b/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.json
index b90e0d6..e9378ef 100644
--- a/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.json
+++ b/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.json
@@ -112,12 +112,14 @@
         ["deq_timedelta", 32, false],
         ["deq_qdepth", 19, false],
         ["ingress_global_timestamp", 48, false],
+        ["egress_global_timestamp", 48, false],
         ["lf_field_list", 32, false],
         ["mcast_grp", 16, false],
-        ["resubmit_flag", 1, false],
+        ["resubmit_flag", 32, false],
         ["egress_rid", 16, false],
         ["checksum_error", 1, false],
-        ["_padding_1", 4, false]
+        ["recirculate_flag", 32, false],
+        ["_padding_1", 5, false]
       ]
     }
   ],
@@ -214,6 +216,7 @@
           "parser_ops" : [],
           "transitions" : [
             {
+              "type" : "hexstr",
               "value" : "0x00ff",
               "mask" : null,
               "next_state" : "parse_packet_out"
@@ -270,6 +273,7 @@
           ],
           "transitions" : [
             {
+              "type" : "hexstr",
               "value" : "0x0800",
               "mask" : null,
               "next_state" : "parse_ipv4"
@@ -303,11 +307,13 @@
           ],
           "transitions" : [
             {
+              "type" : "hexstr",
               "value" : "0x06",
               "mask" : null,
               "next_state" : "parse_tcp"
             },
             {
+              "type" : "hexstr",
               "value" : "0x11",
               "mask" : null,
               "next_state" : "parse_udp"
@@ -426,6 +432,7 @@
       ]
     }
   ],
+  "parse_vsets" : [],
   "deparsers" : [
     {
       "name" : "deparser",
@@ -441,7 +448,7 @@
   ],
   "meter_arrays" : [
     {
-      "name" : "port_meters_ingress.ingress_port_meter",
+      "name" : "ingress.port_meters_ingress.ingress_port_meter",
       "id" : 0,
       "source_info" : {
         "filename" : "include/port_meters.p4",
@@ -455,7 +462,7 @@
       "type" : "bytes"
     },
     {
-      "name" : "host_meter_control.host_meter",
+      "name" : "ingress.host_meter_control.host_meter",
       "id" : 1,
       "source_info" : {
         "filename" : "include/host_meter_table.p4",
@@ -467,11 +474,11 @@
       "rate_count" : 2,
       "type" : "bytes",
       "size" : 1024,
-      "binding" : "host_meter_control.host_meter_table",
+      "binding" : "ingress.host_meter_control.host_meter_table",
       "result_target" : ["scalars", "local_metadata_t.meter_tag"]
     },
     {
-      "name" : "port_meters_egress.egress_port_meter",
+      "name" : "egress.port_meters_egress.egress_port_meter",
       "id" : 2,
       "source_info" : {
         "filename" : "include/port_meters.p4",
@@ -487,7 +494,7 @@
   ],
   "counter_arrays" : [
     {
-      "name" : "port_counters_ingress.ingress_port_counter",
+      "name" : "ingress.port_counters_ingress.ingress_port_counter",
       "id" : 0,
       "source_info" : {
         "filename" : "include/port_counters.p4",
@@ -499,19 +506,19 @@
       "is_direct" : false
     },
     {
-      "name" : "table0_control.table0_counter",
+      "name" : "ingress.table0_control.table0_counter",
       "id" : 1,
       "is_direct" : true,
-      "binding" : "table0_control.table0"
+      "binding" : "ingress.table0_control.table0"
     },
     {
-      "name" : "wcmp_control.wcmp_table_counter",
+      "name" : "ingress.wcmp_control.wcmp_table_counter",
       "id" : 2,
       "is_direct" : true,
-      "binding" : "wcmp_control.wcmp_table"
+      "binding" : "ingress.wcmp_control.wcmp_table"
     },
     {
-      "name" : "port_counters_egress.egress_port_counter",
+      "name" : "egress.port_counters_egress.egress_port_counter",
       "id" : 3,
       "source_info" : {
         "filename" : "include/port_counters.p4",
@@ -645,7 +652,7 @@
       "primitives" : []
     },
     {
-      "name" : "table0_control.set_next_hop_id",
+      "name" : "ingress.table0_control.set_next_hop_id",
       "id" : 6,
       "runtime_data" : [
         {
@@ -676,7 +683,7 @@
       ]
     },
     {
-      "name" : "host_meter_control.read_meter",
+      "name" : "ingress.host_meter_control.read_meter",
       "id" : 7,
       "runtime_data" : [],
       "primitives" : []
@@ -734,7 +741,7 @@
           "parameters" : [
             {
               "type" : "counter_array",
-              "value" : "port_counters_ingress.ingress_port_counter"
+              "value" : "ingress.port_counters_ingress.ingress_port_counter"
             },
             {
               "type" : "field",
@@ -779,7 +786,7 @@
           "parameters" : [
             {
               "type" : "meter_array",
-              "value" : "port_meters_ingress.ingress_port_meter"
+              "value" : "ingress.port_meters_ingress.ingress_port_meter"
             },
             {
               "type" : "field",
@@ -1052,7 +1059,7 @@
           "parameters" : [
             {
               "type" : "counter_array",
-              "value" : "port_counters_egress.egress_port_counter"
+              "value" : "egress.port_counters_egress.egress_port_counter"
             },
             {
               "type" : "field",
@@ -1097,7 +1104,7 @@
           "parameters" : [
             {
               "type" : "meter_array",
-              "value" : "port_meters_egress.egress_port_meter"
+              "value" : "egress.port_meters_egress.egress_port_meter"
             },
             {
               "type" : "field",
@@ -1241,7 +1248,7 @@
           }
         },
         {
-          "name" : "table0_control.table0",
+          "name" : "ingress.table0_control.table0",
           "id" : 3,
           "source_info" : {
             "filename" : "include/table0.p4",
@@ -1252,46 +1259,55 @@
           "key" : [
             {
               "match_type" : "ternary",
+              "name" : "standard_metadata.ingress_port",
               "target" : ["standard_metadata", "ingress_port"],
               "mask" : null
             },
             {
               "match_type" : "ternary",
+              "name" : "hdr.ethernet.src_addr",
               "target" : ["ethernet", "src_addr"],
               "mask" : null
             },
             {
               "match_type" : "ternary",
+              "name" : "hdr.ethernet.dst_addr",
               "target" : ["ethernet", "dst_addr"],
               "mask" : null
             },
             {
               "match_type" : "ternary",
+              "name" : "hdr.ethernet.ether_type",
               "target" : ["ethernet", "ether_type"],
               "mask" : null
             },
             {
               "match_type" : "ternary",
+              "name" : "hdr.ipv4.src_addr",
               "target" : ["ipv4", "src_addr"],
               "mask" : null
             },
             {
               "match_type" : "ternary",
+              "name" : "hdr.ipv4.dst_addr",
               "target" : ["ipv4", "dst_addr"],
               "mask" : null
             },
             {
               "match_type" : "ternary",
+              "name" : "hdr.ipv4.protocol",
               "target" : ["ipv4", "protocol"],
               "mask" : null
             },
             {
               "match_type" : "ternary",
+              "name" : "local_metadata.l4_src_port",
               "target" : ["scalars", "local_metadata_t.l4_src_port"],
               "mask" : null
             },
             {
               "match_type" : "ternary",
+              "name" : "local_metadata.l4_dst_port",
               "target" : ["scalars", "local_metadata_t.l4_dst_port"],
               "mask" : null
             }
@@ -1303,13 +1319,13 @@
           "support_timeout" : false,
           "direct_meters" : null,
           "action_ids" : [0, 2, 6, 3],
-          "actions" : ["set_egress_port", "send_to_cpu", "table0_control.set_next_hop_id", "_drop"],
-          "base_default_next" : "host_meter_control.host_meter_table",
+          "actions" : ["set_egress_port", "send_to_cpu", "ingress.table0_control.set_next_hop_id", "_drop"],
+          "base_default_next" : "ingress.host_meter_control.host_meter_table",
           "next_tables" : {
-            "set_egress_port" : "host_meter_control.host_meter_table",
-            "send_to_cpu" : "host_meter_control.host_meter_table",
-            "table0_control.set_next_hop_id" : "host_meter_control.host_meter_table",
-            "_drop" : "host_meter_control.host_meter_table"
+            "set_egress_port" : "ingress.host_meter_control.host_meter_table",
+            "send_to_cpu" : "ingress.host_meter_control.host_meter_table",
+            "ingress.table0_control.set_next_hop_id" : "ingress.host_meter_control.host_meter_table",
+            "_drop" : "ingress.host_meter_control.host_meter_table"
           },
           "default_entry" : {
             "action_id" : 3,
@@ -1319,7 +1335,7 @@
           }
         },
         {
-          "name" : "host_meter_control.host_meter_table",
+          "name" : "ingress.host_meter_control.host_meter_table",
           "id" : 4,
           "source_info" : {
             "filename" : "include/host_meter_table.p4",
@@ -1330,6 +1346,7 @@
           "key" : [
             {
               "match_type" : "lpm",
+              "name" : "hdr.ethernet.src_addr",
               "target" : ["ethernet", "src_addr"],
               "mask" : null
             }
@@ -1339,9 +1356,9 @@
           "max_size" : 1024,
           "with_counters" : false,
           "support_timeout" : false,
-          "direct_meters" : "host_meter_control.host_meter",
+          "direct_meters" : "ingress.host_meter_control.host_meter",
           "action_ids" : [7, 4],
-          "actions" : ["host_meter_control.read_meter", "NoAction"],
+          "actions" : ["ingress.host_meter_control.read_meter", "NoAction"],
           "base_default_next" : null,
           "next_tables" : {
             "__HIT__" : "tbl_act_2",
@@ -1470,7 +1487,7 @@
           }
         },
         {
-          "name" : "wcmp_control.wcmp_table",
+          "name" : "ingress.wcmp_control.wcmp_table",
           "id" : 10,
           "source_info" : {
             "filename" : "include/wcmp.p4",
@@ -1481,13 +1498,14 @@
           "key" : [
             {
               "match_type" : "exact",
+              "name" : "local_metadata.next_hop_id",
               "target" : ["scalars", "local_metadata_t.next_hop_id"],
               "mask" : null
             }
           ],
           "match_type" : "exact",
           "type" : "indirect_ws",
-          "action_profile" : "wcmp_control.wcmp_selector",
+          "action_profile" : "ingress.wcmp_control.wcmp_selector",
           "max_size" : 1024,
           "with_counters" : true,
           "support_timeout" : false,
@@ -1503,7 +1521,7 @@
       ],
       "action_profiles" : [
         {
-          "name" : "wcmp_control.wcmp_selector",
+          "name" : "ingress.wcmp_control.wcmp_selector",
           "id" : 0,
           "max_size" : 64,
           "selector" : {
@@ -1584,7 +1602,7 @@
             }
           },
           "true_next" : "tbl_act_1",
-          "false_next" : "table0_control.table0"
+          "false_next" : "ingress.table0_control.table0"
         },
         {
           "name" : "node_11",
@@ -1651,7 +1669,7 @@
             }
           },
           "false_next" : null,
-          "true_next" : "wcmp_control.wcmp_table"
+          "true_next" : "ingress.wcmp_control.wcmp_table"
         }
       ]
     },
@@ -1818,6 +1836,10 @@
       ["standard_metadata", "ingress_global_timestamp"]
     ],
     [
+      "intrinsic_metadata.egress_global_timestamp",
+      ["standard_metadata", "egress_global_timestamp"]
+    ],
+    [
       "intrinsic_metadata.lf_field_list",
       ["standard_metadata", "lf_field_list"]
     ],
@@ -1832,6 +1854,10 @@
     [
       "intrinsic_metadata.egress_rid",
       ["standard_metadata", "egress_rid"]
+    ],
+    [
+      "intrinsic_metadata.recirculate_flag",
+      ["standard_metadata", "recirculate_flag"]
     ]
   ]
 }
\ No newline at end of file
diff --git a/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.p4info b/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.p4info
index 9ec66ba..8d39c13 100644
--- a/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.p4info
+++ b/pipelines/basic/src/main/resources/p4c-out/bmv2/basic.p4info
@@ -1,7 +1,7 @@
 tables {
   preamble {
-    id: 33571508
-    name: "table0_control.table0"
+    id: 33561568
+    name: "ingress.table0_control.table0"
     alias: "table0"
   }
   match_fields {
@@ -65,19 +65,19 @@
     id: 16829080
   }
   action_refs {
-    id: 16802895
+    id: 16777316
   }
   action_refs {
     id: 16784184
   }
   const_default_action_id: 16784184
-  direct_resource_ids: 302046050
+  direct_resource_ids: 302038973
   size: 1024
 }
 tables {
   preamble {
-    id: 33597882
-    name: "host_meter_control.host_meter_table"
+    id: 33571781
+    name: "ingress.host_meter_control.host_meter_table"
     alias: "host_meter_table"
   }
   match_fields {
@@ -87,18 +87,18 @@
     match_type: LPM
   }
   action_refs {
-    id: 16832719
+    id: 16823832
   }
   action_refs {
     id: 16800567
   }
-  direct_resource_ids: 318776014
+  direct_resource_ids: 318783457
   size: 1024
 }
 tables {
   preamble {
-    id: 33592597
-    name: "wcmp_control.wcmp_table"
+    id: 33594717
+    name: "ingress.wcmp_control.wcmp_table"
     alias: "wcmp_table"
   }
   match_fields {
@@ -114,8 +114,8 @@
     id: 16800567
     annotations: "@defaultonly()"
   }
-  implementation_id: 285259294
-  direct_resource_ids: 302001091
+  implementation_id: 285253634
+  direct_resource_ids: 302034578
   size: 1024
 }
 actions {
@@ -153,8 +153,8 @@
 }
 actions {
   preamble {
-    id: 16802895
-    name: "table0_control.set_next_hop_id"
+    id: 16777316
+    name: "ingress.table0_control.set_next_hop_id"
     alias: "set_next_hop_id"
   }
   params {
@@ -165,25 +165,25 @@
 }
 actions {
   preamble {
-    id: 16832719
-    name: "host_meter_control.read_meter"
+    id: 16823832
+    name: "ingress.host_meter_control.read_meter"
     alias: "read_meter"
   }
 }
 action_profiles {
   preamble {
-    id: 285259294
-    name: "wcmp_control.wcmp_selector"
+    id: 285253634
+    name: "ingress.wcmp_control.wcmp_selector"
     alias: "wcmp_selector"
   }
-  table_ids: 33592597
+  table_ids: 33594717
   with_selector: true
   size: 64
 }
 counters {
   preamble {
-    id: 302012579
-    name: "port_counters_ingress.ingress_port_counter"
+    id: 302004684
+    name: "ingress.port_counters_ingress.ingress_port_counter"
     alias: "ingress_port_counter"
   }
   spec {
@@ -193,8 +193,8 @@
 }
 counters {
   preamble {
-    id: 302012501
-    name: "port_counters_egress.egress_port_counter"
+    id: 302040487
+    name: "egress.port_counters_egress.egress_port_counter"
     alias: "egress_port_counter"
   }
   spec {
@@ -204,30 +204,30 @@
 }
 direct_counters {
   preamble {
-    id: 302046050
-    name: "table0_control.table0_counter"
+    id: 302038973
+    name: "ingress.table0_control.table0_counter"
     alias: "table0_counter"
   }
   spec {
     unit: BOTH
   }
-  direct_table_id: 33571508
+  direct_table_id: 33561568
 }
 direct_counters {
   preamble {
-    id: 302001091
-    name: "wcmp_control.wcmp_table_counter"
+    id: 302034578
+    name: "ingress.wcmp_control.wcmp_table_counter"
     alias: "wcmp_table_counter"
   }
   spec {
     unit: BOTH
   }
-  direct_table_id: 33592597
+  direct_table_id: 33594717
 }
 meters {
   preamble {
-    id: 318770010
-    name: "port_meters_ingress.ingress_port_meter"
+    id: 318803935
+    name: "ingress.port_meters_ingress.ingress_port_meter"
     alias: "ingress_port_meter"
   }
   spec {
@@ -237,8 +237,8 @@
 }
 meters {
   preamble {
-    id: 318779497
-    name: "port_meters_egress.egress_port_meter"
+    id: 318792425
+    name: "egress.port_meters_egress.egress_port_meter"
     alias: "egress_port_meter"
   }
   spec {
@@ -248,14 +248,14 @@
 }
 direct_meters {
   preamble {
-    id: 318776014
-    name: "host_meter_control.host_meter"
+    id: 318783457
+    name: "ingress.host_meter_control.host_meter"
     alias: "host_meter"
   }
   spec {
     unit: BYTES
   }
-  direct_table_id: 33597882
+  direct_table_id: 33571781
 }
 controller_packet_metadata {
   preamble {
diff --git a/protocols/p4runtime/api/src/main/java/org/onosproject/p4runtime/api/P4RuntimeClient.java b/protocols/p4runtime/api/src/main/java/org/onosproject/p4runtime/api/P4RuntimeClient.java
index 91254cf..67f9fcf 100644
--- a/protocols/p4runtime/api/src/main/java/org/onosproject/p4runtime/api/P4RuntimeClient.java
+++ b/protocols/p4runtime/api/src/main/java/org/onosproject/p4runtime/api/P4RuntimeClient.java
@@ -17,18 +17,18 @@
 package org.onosproject.p4runtime.api;
 
 import com.google.common.annotations.Beta;
-import org.onosproject.net.pi.model.PiPipeconf;
-import org.onosproject.net.pi.runtime.PiActionGroup;
 import org.onosproject.net.pi.model.PiActionProfileId;
+import org.onosproject.net.pi.model.PiCounterId;
+import org.onosproject.net.pi.model.PiMeterId;
+import org.onosproject.net.pi.model.PiPipeconf;
+import org.onosproject.net.pi.model.PiTableId;
+import org.onosproject.net.pi.runtime.PiActionGroup;
 import org.onosproject.net.pi.runtime.PiCounterCellData;
 import org.onosproject.net.pi.runtime.PiCounterCellId;
-import org.onosproject.net.pi.model.PiCounterId;
 import org.onosproject.net.pi.runtime.PiMeterCellConfig;
 import org.onosproject.net.pi.runtime.PiMeterCellId;
-import org.onosproject.net.pi.model.PiMeterId;
 import org.onosproject.net.pi.runtime.PiPacketOperation;
 import org.onosproject.net.pi.runtime.PiTableEntry;
-import org.onosproject.net.pi.model.PiTableId;
 
 import java.nio.ByteBuffer;
 import java.util.Collection;
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 df4e72f..17bff76 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
@@ -19,27 +19,31 @@
 import org.onosproject.net.pi.model.PiCounterId;
 import org.onosproject.net.pi.model.PiCounterType;
 import org.onosproject.net.pi.model.PiPipeconf;
+import org.onosproject.net.pi.model.PiTableId;
 import org.onosproject.net.pi.runtime.PiCounterCellData;
 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 java.util.Collection;
-import java.util.Map;
+import java.util.Collections;
 import java.util.Objects;
 import java.util.stream.Collectors;
 
 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;
 
 /**
- * Encoder/decoder of PI counter IDs to counter entry protobuf messages, and vice versa.
+ * Encoder/decoder of PI counter IDs to counter entry protobuf messages, and
+ * vice versa.
  */
 final class CounterEntryCodec {
 
@@ -50,27 +54,32 @@
     }
 
     /**
-     * Returns a collection of P4Runtime entity protobuf messages describing both counter or direct counter entries,
-     * encoded from the given collection of PI counter cell identifiers, for the given pipeconf. If a PI counter cell
-     * identifier cannot be encoded, it is skipped, hence the returned collection might have different size than the
-     * input one.
-     * <p>
-     * This method takes as parameter also a map between numeric P4Info IDs and PI counter IDs, that will be populated
-     * during the process and that is then needed to aid in the decode process.
+     * Returns a collection of P4Runtime entity protobuf messages describing
+     * both counter or direct counter entries, encoded from the given collection
+     * of PI counter cell identifiers, for the given pipeconf. If a PI counter
+     * cell identifier cannot be encoded, it is skipped, hence the returned
+     * collection might have different size than the input one.
      *
-     * @param cellIds      counter cell identifiers
-     * @param counterIdMap counter ID map (empty, it will be populated during this method execution)
-     * @param pipeconf     pipeconf
-     * @return collection of entity messages describing both counter or direct counter entries
+     * @param cellIds  counter cell identifiers
+     * @param pipeconf pipeconf
+     * @return collection of entity messages describing both counter or direct
+     * counter entries
      */
     static Collection<Entity> encodePiCounterCellIds(Collection<PiCounterCellId> cellIds,
-                                                     Map<Integer, PiCounterId> counterIdMap,
                                                      PiPipeconf pipeconf) {
+
+        final P4InfoBrowser browser = PipeconfHelper.getP4InfoBrowser(pipeconf);
+
+        if (browser == null) {
+            log.error("Unable to get a P4Info browser for pipeconf {}", pipeconf.id());
+            return Collections.emptyList();
+        }
+
         return cellIds
                 .stream()
                 .map(cellId -> {
                     try {
-                        return encodePiCounterCellId(cellId, counterIdMap, pipeconf);
+                        return encodePiCounterCellId(cellId, pipeconf, browser);
                     } catch (P4InfoBrowser.NotFoundException | EncodeException e) {
                         log.warn("Unable to encode PI counter cell id: {}", e.getMessage());
                         return null;
@@ -81,28 +90,33 @@
     }
 
     /**
-     * Returns a collection of PI counter cell data, decoded from the given P4Runtime entity protobuf messages
-     * describing both counter or direct counter entries, for the given counter ID map (populated by {@link
-     * #encodePiCounterCellIds(Collection, Map, PiPipeconf)}), and pipeconf. If an entity message cannot be encoded, it
-     * is skipped, hence the returned collection might have different size than the input one.
+     * Returns a collection of P4Runtime entity protobuf messages to be used in
+     * requests to read all cells from the given counter identifiers. Works for
+     * both indirect or direct counters. If a PI counter identifier cannot be
+     * encoded, it is skipped, hence the returned collection might have
+     * different size than the input one.
      *
-     * @param entities     P4Runtime entity messages
-     * @param counterIdMap counter ID map (previously populated)
-     * @param pipeconf     pipeconf
-     * @return collection of PI counter cell data
+     * @param counterIds counter identifiers
+     * @param pipeconf   pipeconf
+     * @return collection of entity messages
      */
-    static Collection<PiCounterCellData> decodeCounterEntities(Collection<Entity> entities,
-                                                               Map<Integer, PiCounterId> counterIdMap,
-                                                               PiPipeconf pipeconf) {
-        return entities
+    static Collection<Entity> readAllCellsEntities(Collection<PiCounterId> counterIds,
+                                                   PiPipeconf pipeconf) {
+        final P4InfoBrowser browser = PipeconfHelper.getP4InfoBrowser(pipeconf);
+
+        if (browser == null) {
+            log.error("Unable to get a P4Info browser for pipeconf {}", pipeconf.id());
+            return Collections.emptyList();
+        }
+
+        return counterIds
                 .stream()
-                .filter(entity -> entity.getEntityCase() == COUNTER_ENTRY ||
-                        entity.getEntityCase() == DIRECT_COUNTER_ENTRY)
-                .map(entity -> {
+                .map(counterId -> {
                     try {
-                        return decodeCounterEntity(entity, counterIdMap, pipeconf);
-                    } catch (EncodeException | P4InfoBrowser.NotFoundException e) {
-                        log.warn("Unable to decode counter entity message: {}", e.getMessage());
+                        return readAllCellsEntity(counterId, pipeconf, browser);
+                    } catch (P4InfoBrowser.NotFoundException | EncodeException e) {
+                        log.warn("Unable to encode counter ID to read-all-cells entity: {}",
+                                 e.getMessage());
                         return null;
                     }
                 })
@@ -110,95 +124,160 @@
                 .collect(Collectors.toList());
     }
 
-    private static Entity encodePiCounterCellId(PiCounterCellId cellId, Map<Integer, PiCounterId> counterIdMap,
-                                                PiPipeconf pipeconf)
-            throws P4InfoBrowser.NotFoundException, EncodeException {
+    /**
+     * Returns a collection of PI counter cell data, decoded from the given
+     * P4Runtime entity protobuf messages describing both counter or direct
+     * counter entries, and pipeconf. If an entity message cannot be encoded, it
+     * is skipped, hence the returned collection might have different size than
+     * the input one.
+     *
+     * @param entities P4Runtime entity messages
+     * @param pipeconf pipeconf
+     * @return collection of PI counter cell data
+     */
+    static Collection<PiCounterCellData> decodeCounterEntities(Collection<Entity> entities,
+                                                               PiPipeconf pipeconf) {
 
         final P4InfoBrowser browser = PipeconfHelper.getP4InfoBrowser(pipeconf);
 
+        if (browser == null) {
+            log.error("Unable to get a P4Info browser for pipeconf {}", pipeconf.id());
+            return Collections.emptyList();
+        }
+
+        return entities
+                .stream()
+                .filter(entity -> entity.getEntityCase() == COUNTER_ENTRY ||
+                        entity.getEntityCase() == DIRECT_COUNTER_ENTRY)
+                .map(entity -> {
+                    try {
+                        return decodeCounterEntity(entity, pipeconf, browser);
+                    } catch (EncodeException | P4InfoBrowser.NotFoundException e) {
+                        log.warn("Unable to decode counter entity message: {}",
+                                 e.getMessage());
+                        return null;
+                    }
+                })
+                .filter(Objects::nonNull)
+                .collect(Collectors.toList());
+    }
+
+    private static Entity encodePiCounterCellId(PiCounterCellId cellId,
+                                                PiPipeconf pipeconf,
+                                                P4InfoBrowser browser)
+            throws P4InfoBrowser.NotFoundException, EncodeException {
+
         int counterId;
         Entity entity;
         // Encode PI cell ID into entity message and add to read request.
         switch (cellId.counterType()) {
             case INDIRECT:
-                counterId = browser.counters().getByName(cellId.counterId().id()).getPreamble().getId();
-                entity = Entity.newBuilder().setCounterEntry(CounterEntry.newBuilder()
-                                                                     .setCounterId(counterId)
-                                                                     .setIndex(cellId.index())
-                                                                     .build())
+                counterId = browser.counters()
+                        .getByName(cellId.counterId().id())
+                        .getPreamble()
+                        .getId();
+                entity = Entity.newBuilder()
+                        .setCounterEntry(
+                                CounterEntry.newBuilder()
+                                        .setCounterId(counterId)
+                                        .setIndex(indexMsg(cellId.index()))
+                                        .build())
                         .build();
                 break;
             case DIRECT:
-                counterId = browser.directCounters().getByName(cellId.counterId().id()).getPreamble().getId();
-                DirectCounterEntry.Builder entryBuilder = DirectCounterEntry.newBuilder().setCounterId(counterId);
-                if (!cellId.tableEntry().equals(PiTableEntry.EMTPY)) {
-                    entryBuilder.setTableEntry(TableEntryEncoder.encode(cellId.tableEntry(), pipeconf));
-                }
-                entity = Entity.newBuilder().setDirectCounterEntry(entryBuilder.build()).build();
+                DirectCounterEntry.Builder entryBuilder = DirectCounterEntry.newBuilder();
+                entryBuilder.setTableEntry(
+                        TableEntryEncoder.encode(cellId.tableEntry(), pipeconf));
+                entity = Entity.newBuilder()
+                        .setDirectCounterEntry(entryBuilder.build())
+                        .build();
                 break;
             default:
-                throw new EncodeException(format("Unrecognized PI counter cell ID type '%s'", cellId.counterType()));
+                throw new EncodeException(format(
+                        "Unrecognized PI counter cell ID type '%s'",
+                        cellId.counterType()));
         }
-        counterIdMap.put(counterId, cellId.counterId());
 
         return entity;
     }
 
-    private static PiCounterCellData decodeCounterEntity(Entity entity, Map<Integer, PiCounterId> counterIdMap,
-                                                         PiPipeconf pipeconf)
+    private static Entity readAllCellsEntity(PiCounterId counterId,
+                                             PiPipeconf pipeconf,
+                                             P4InfoBrowser browser)
+            throws P4InfoBrowser.NotFoundException, EncodeException {
+
+        if (!pipeconf.pipelineModel().counter(counterId).isPresent()) {
+            throw new EncodeException(format(
+                    "not such counter '%s' in pipeline model", counterId));
+        }
+        final PiCounterType counterType = pipeconf.pipelineModel()
+                .counter(counterId).get().counterType();
+
+        switch (counterType) {
+            case INDIRECT:
+                final int p4InfoCounterId = browser.counters()
+                        .getByName(counterId.id())
+                        .getPreamble().getId();
+                return Entity.newBuilder().setCounterEntry(
+                        P4RuntimeOuterClass.CounterEntry.newBuilder()
+                                // Index unset to read all cells
+                                .setCounterId(p4InfoCounterId)
+                                .build())
+                        .build();
+            case DIRECT:
+                final PiTableId tableId = pipeconf.pipelineModel()
+                        .counter(counterId).get().table();
+                if (tableId == null) {
+                    throw new EncodeException(format(
+                            "null table for direct counter '%s'", counterId));
+                }
+                final int p4TableId = browser.tables().getByName(tableId.id())
+                        .getPreamble().getId();
+                return Entity.newBuilder().setDirectCounterEntry(
+                        P4RuntimeOuterClass.DirectCounterEntry.newBuilder()
+                                .setTableEntry(
+                                        // Match unset to read all cells
+                                        P4RuntimeOuterClass.TableEntry.newBuilder()
+                                                .setTableId(p4TableId)
+                                                .build())
+                                .build())
+                        .build();
+            default:
+                throw new EncodeException(format(
+                        "unrecognized PI counter type '%s'", counterType));
+        }
+    }
+
+    private static PiCounterCellData decodeCounterEntity(Entity entity,
+                                                         PiPipeconf pipeconf,
+                                                         P4InfoBrowser browser)
             throws EncodeException, P4InfoBrowser.NotFoundException {
 
-        int counterId;
         CounterData counterData;
-
-        if (entity.getEntityCase() == COUNTER_ENTRY) {
-            counterId = entity.getCounterEntry().getCounterId();
-            counterData = entity.getCounterEntry().getData();
-        } else {
-            counterId = entity.getDirectCounterEntry().getCounterId();
-            counterData = entity.getDirectCounterEntry().getData();
-        }
-
-        // Process only counter IDs that were requested in the first place.
-        if (!counterIdMap.containsKey(counterId)) {
-            throw new EncodeException(format("Unrecognized counter ID '%s'", counterId));
-        }
-
-        PiCounterId piCounterId = counterIdMap.get(counterId);
-
-        if (!pipeconf.pipelineModel().counter(piCounterId).isPresent()) {
-            throw new EncodeException(format(
-                    "Unable to find counter '%s' in pipeline model", counterId));
-        }
-        PiCounterType piCounterType = pipeconf.pipelineModel().counter(piCounterId).get().counterType();
-
-        // Compute PI cell ID.
         PiCounterCellId piCellId;
 
-        switch (piCounterType) {
-            case INDIRECT:
-                if (entity.getEntityCase() != COUNTER_ENTRY) {
-                    throw new EncodeException(format(
-                            "Counter ID '%s' is indirect, but processed entity is %s",
-                            piCounterId, entity.getEntityCase()));
-                }
-                piCellId = PiCounterCellId.ofIndirect(piCounterId,
-                                                      entity.getCounterEntry().getIndex());
-                break;
-            case DIRECT:
-                if (entity.getEntityCase() != DIRECT_COUNTER_ENTRY) {
-                    throw new EncodeException(format(
-                            "Counter ID '%s' is direct, but processed entity is %s",
-                            piCounterId, entity.getEntityCase()));
-                }
-                PiTableEntry piTableEntry = TableEntryEncoder.decode(entity.getDirectCounterEntry().getTableEntry(),
-                                                                     pipeconf);
-                piCellId = PiCounterCellId.ofDirect(piCounterId, piTableEntry);
-                break;
-            default:
-                throw new EncodeException(format("Unrecognized PI counter ID type '%s'", piCounterType));
+        if (entity.getEntityCase() == COUNTER_ENTRY) {
+            String counterName = browser.counters()
+                    .getById(entity.getCounterEntry().getCounterId())
+                    .getPreamble()
+                    .getName();
+            piCellId = PiCounterCellId.ofIndirect(
+                    PiCounterId.of(counterName),
+                    entity.getCounterEntry().getIndex().getIndex());
+            counterData = entity.getCounterEntry().getData();
+        } else if (entity.getEntityCase() == DIRECT_COUNTER_ENTRY) {
+            PiTableEntry piTableEntry = TableEntryEncoder.decode(
+                    entity.getDirectCounterEntry().getTableEntry(), pipeconf);
+            piCellId = PiCounterCellId.ofDirect(piTableEntry);
+            counterData = entity.getDirectCounterEntry().getData();
+        } else {
+            throw new EncodeException(format(
+                    "Unrecognized entity type '%s' in P4Runtime message",
+                    entity.getEntityCase().name()));
         }
 
-        return new PiCounterCellData(piCellId, counterData.getPacketCount(), counterData.getByteCount());
+        return new PiCounterCellData(piCellId,
+                                     counterData.getPacketCount(),
+                                     counterData.getByteCount());
     }
 }
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 9019613..fc60dcd 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
@@ -16,30 +16,35 @@
 
 package org.onosproject.p4runtime.ctl;
 
+import org.onosproject.net.pi.model.PiMeterId;
 import org.onosproject.net.pi.model.PiMeterType;
 import org.onosproject.net.pi.model.PiPipeconf;
+import org.onosproject.net.pi.model.PiTableId;
 import org.onosproject.net.pi.runtime.PiMeterBand;
 import org.onosproject.net.pi.runtime.PiMeterCellConfig;
 import org.onosproject.net.pi.runtime.PiMeterCellId;
-import org.onosproject.net.pi.model.PiMeterId;
 import org.onosproject.net.pi.runtime.PiTableEntry;
 import org.slf4j.Logger;
-import p4.P4RuntimeOuterClass.MeterConfig;
-import p4.P4RuntimeOuterClass.MeterEntry;
+import p4.P4RuntimeOuterClass;
 import p4.P4RuntimeOuterClass.DirectMeterEntry;
 import p4.P4RuntimeOuterClass.Entity;
+import p4.P4RuntimeOuterClass.MeterConfig;
+import p4.P4RuntimeOuterClass.MeterEntry;
 
 import java.util.Collection;
-import java.util.Map;
+import java.util.Collections;
 import java.util.Objects;
 import java.util.stream.Collectors;
 
 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.*;
+import static p4.P4RuntimeOuterClass.Entity.EntityCase.DIRECT_METER_ENTRY;
+import static p4.P4RuntimeOuterClass.Entity.EntityCase.METER_ENTRY;
 
 /**
- * Encoder/decoder of PI meter cell configurations to meter entry protobuf messages, and vice versa.
+ * Encoder/decoder of PI meter cell configurations to meter entry protobuf
+ * messages, and vice versa.
  */
 final class MeterEntryCodec {
 
@@ -50,27 +55,31 @@
     }
 
     /**
-     * Returns a collection of P4Runtime entity protobuf messages describing both meter or direct meter entries,
-     * encoded from the given collection of PI meter cell configurations, for the given pipeconf. If a PI meter cell
-     * configurations cannot be encoded, it is skipped, hence the returned collection might have different size than the
-     * input one.
-     * <p>
-     * This method takes as parameter also a map between numeric P4Info IDs and PI meter IDs, that will be populated
-     * during the process and that is then needed to aid in the decode process.
+     * Returns a collection of P4Runtime entity protobuf messages describing
+     * both meter or direct meter entries, encoded from the given collection of
+     * PI meter cell configurations, for the given pipeconf. If a PI meter cell
+     * configurations cannot be encoded, it is skipped, hence the returned
+     * collection might have different size than the input one.
      *
-     * @param cellConfigs  meter cell configurations
-     * @param meterIdMap   meter ID map (empty, it will be populated during this method execution)
-     * @param pipeconf     pipeconf
-     * @return collection of entity messages describing both meter or direct meter entries
+     * @param cellConfigs meter cell configurations
+     * @param pipeconf    pipeconf
+     * @return collection of entity messages describing both meter or direct
+     * meter entries
      */
     static Collection<Entity> encodePiMeterCellConfigs(Collection<PiMeterCellConfig> cellConfigs,
-                                                       Map<Integer, PiMeterId> meterIdMap,
                                                        PiPipeconf pipeconf) {
+        final P4InfoBrowser browser = PipeconfHelper.getP4InfoBrowser(pipeconf);
+
+        if (browser == null) {
+            log.error("Unable to get a P4Info browser for pipeconf {}", pipeconf.id());
+            return Collections.emptyList();
+        }
+
         return cellConfigs
                 .stream()
                 .map(cellConfig -> {
                     try {
-                        return encodePiMeterCellConfig(cellConfig, meterIdMap, pipeconf);
+                        return encodePiMeterCellConfig(cellConfig, pipeconf, browser);
                     } catch (P4InfoBrowser.NotFoundException | EncodeException e) {
                         log.warn("Unable to encode PI meter cell id: {}", e.getMessage());
                         log.debug("exception", e);
@@ -82,26 +91,67 @@
     }
 
     /**
-     * Returns a collection of PI meter cell configurations, decoded from the given P4Runtime entity protobuf messages
-     * describing both meter or direct meter entries, for the given meter ID map (populated by {@link
-     * #encodePiMeterCellConfigs(Collection, Map, PiPipeconf)}), and pipeconf. If an entity message cannot be encoded,
-     * it is skipped, hence the returned collection might have different size than the input one.
+     * Returns a collection of P4Runtime entity protobuf messages to be used in
+     * requests to read all cells from the given meter identifiers. Works for
+     * both indirect or direct meters. If a PI meter identifier cannot be
+     * encoded, it is skipped, hence the returned collection might have
+     * different size than the input one.
      *
-     * @param entities     P4Runtime entity messages
-     * @param meterIdMap   meter ID map (previously populated)
-     * @param pipeconf     pipeconf
+     * @param meterIds meter identifiers
+     * @param pipeconf pipeconf
+     * @return collection of entity messages
+     */
+    static Collection<Entity> readAllCellsEntities(Collection<PiMeterId> meterIds,
+                                                   PiPipeconf pipeconf) {
+        final P4InfoBrowser browser = PipeconfHelper.getP4InfoBrowser(pipeconf);
+
+        if (browser == null) {
+            log.error("Unable to get a P4Info browser for pipeconf {}", pipeconf.id());
+            return Collections.emptyList();
+        }
+
+        return meterIds
+                .stream()
+                .map(meterId -> {
+                    try {
+                        return readAllCellsEntity(meterId, pipeconf, browser);
+                    } catch (P4InfoBrowser.NotFoundException | EncodeException e) {
+                        log.warn("Unable to encode meter ID to read-all-cells entity: {}",
+                                 e.getMessage());
+                        return null;
+                    }
+                })
+                .filter(Objects::nonNull)
+                .collect(Collectors.toList());
+    }
+
+    /**
+     * Returns a collection of PI meter cell configurations, decoded from the
+     * given P4Runtime entity protobuf messages describing both meter or direct
+     * meter entries, and pipeconf. If an entity message cannot be encoded, it
+     * is skipped, hence the returned collection might have different size than
+     * the input one.
+     *
+     * @param entities P4Runtime entity messages
+     * @param pipeconf pipeconf
      * @return collection of PI meter cell data
      */
     static Collection<PiMeterCellConfig> decodeMeterEntities(Collection<Entity> entities,
-                                                               Map<Integer, PiMeterId> meterIdMap,
-                                                               PiPipeconf pipeconf) {
+                                                             PiPipeconf pipeconf) {
+        final P4InfoBrowser browser = PipeconfHelper.getP4InfoBrowser(pipeconf);
+
+        if (browser == null) {
+            log.error("Unable to get a P4Info browser for pipeconf {}", pipeconf.id());
+            return Collections.emptyList();
+        }
+
         return entities
                 .stream()
                 .filter(entity -> entity.getEntityCase() == METER_ENTRY ||
                         entity.getEntityCase() == DIRECT_METER_ENTRY)
                 .map(entity -> {
                     try {
-                        return decodeMeterEntity(entity, meterIdMap, pipeconf);
+                        return decodeMeterEntity(entity, pipeconf, browser);
                     } catch (EncodeException | P4InfoBrowser.NotFoundException e) {
                         log.warn("Unable to decode meter entity message: {}", e.getMessage());
                         return null;
@@ -111,23 +161,23 @@
                 .collect(Collectors.toList());
     }
 
-    private static Entity encodePiMeterCellConfig(PiMeterCellConfig config, Map<Integer, PiMeterId> meterIdMap,
-                                                  PiPipeconf pipeconf)
+    private static Entity encodePiMeterCellConfig(PiMeterCellConfig config,
+                                                  PiPipeconf pipeconf,
+                                                  P4InfoBrowser browser)
             throws P4InfoBrowser.NotFoundException, EncodeException {
 
-        final P4InfoBrowser browser = PipeconfHelper.getP4InfoBrowser(pipeconf);
-
         int meterId;
         Entity entity;
-        //The band with bigger burst is peak if rate of them is equal,
-        //if bands are not specificed, using default value(0).
-        long cir = 0;
-        long cburst = 0;
-        long pir = 0;
-        long pburst = 0;
-        PiMeterBand[] bands = config.meterBands().toArray(new PiMeterBand[config.meterBands().size()]);
+        MeterConfig meterConfig;
+
+        PiMeterBand[] bands = config.meterBands()
+                .toArray(new PiMeterBand[config.meterBands().size()]);
         if (bands.length == 2) {
-            if (bands[0].rate() > bands[1].rate()) {
+            long cir, cburst, pir, pburst;
+            // The band with bigger burst is peak if rate of them is equal.
+            if (bands[0].rate() > bands[1].rate() ||
+                    (bands[0].rate() == bands[1].rate() &&
+                            bands[0].burst() >= bands[1].burst())) {
                 cir = bands[1].rate();
                 cburst = bands[1].burst();
                 pir = bands[0].rate();
@@ -138,105 +188,133 @@
                 pir = bands[1].rate();
                 pburst = bands[1].burst();
             }
+            meterConfig = MeterConfig.newBuilder()
+                    .setCir(cir)
+                    .setCburst(cburst)
+                    .setPir(pir)
+                    .setPburst(pburst)
+                    .build();
+        } else if (bands.length == 0) {
+            // When reading meter cells.
+            meterConfig = null;
+        } else {
+            throw new EncodeException("number of meter bands should be either 2 or 0");
         }
 
-        // Encode PI cell ID into entity message and add to read request.
         switch (config.cellId().meterType()) {
             case INDIRECT:
-                meterId = browser.meters().getByName(config.cellId().meterId().id()).getPreamble().getId();
-                entity = Entity.newBuilder().setMeterEntry(MeterEntry
-                                                                   .newBuilder().setMeterId(meterId)
-                                                                   .setIndex(config.cellId().index())
-                                                                   .setConfig(MeterConfig.newBuilder()
-                                                                                      .setCir(cir)
-                                                                                      .setCburst(cburst)
-                                                                                      .setPir(pir)
-                                                                                      .setPburst(pburst)
-                                                                                      .build())
-                                                                   .build())
-                        .build();
+                meterId = browser.meters()
+                        .getByName(config.cellId().meterId().id())
+                        .getPreamble().getId();
+                MeterEntry.Builder indEntryBuilder = MeterEntry.newBuilder()
+                        .setMeterId(meterId)
+                        .setIndex(indexMsg(config.cellId().index()));
+                if (meterConfig != null) {
+                    indEntryBuilder.setConfig(meterConfig);
+                }
+                entity = Entity.newBuilder()
+                        .setMeterEntry(indEntryBuilder.build()).build();
                 break;
             case DIRECT:
-                meterId = browser.directMeters().getByName(config.cellId().meterId().id()).getPreamble().getId();
-                DirectMeterEntry.Builder entryBuilder = DirectMeterEntry.newBuilder()
-                        .setMeterId(meterId)
-                        .setConfig(MeterConfig.newBuilder()
-                                           .setCir(cir)
-                                           .setCburst(cburst)
-                                           .setPir(pir)
-                                           .setPburst(pburst)
-                                           .build());
-
-                if (!config.cellId().tableEntry().equals(PiTableEntry.EMTPY)) {
-                    entryBuilder.setTableEntry(TableEntryEncoder.encode(config.cellId().tableEntry(), pipeconf));
+                DirectMeterEntry.Builder dirEntryBuilder = DirectMeterEntry.newBuilder()
+                        .setTableEntry(TableEntryEncoder.encode(
+                                config.cellId().tableEntry(), pipeconf));
+                if (meterConfig != null) {
+                    dirEntryBuilder.setConfig(meterConfig);
                 }
-                entity = Entity.newBuilder().setDirectMeterEntry(entryBuilder.build()).build();
+                entity = Entity.newBuilder()
+                        .setDirectMeterEntry(dirEntryBuilder.build()).build();
                 break;
             default:
-                throw new EncodeException(format("Unrecognized PI meter cell ID type '%s'",
+                throw new EncodeException(format("unrecognized PI meter type '%s'",
                                                  config.cellId().meterType()));
         }
-        meterIdMap.put(meterId, config.cellId().meterId());
 
         return entity;
     }
 
-    private static PiMeterCellConfig decodeMeterEntity(Entity entity, Map<Integer, PiMeterId> meterIdMap,
-                                                         PiPipeconf pipeconf)
+    private static Entity readAllCellsEntity(PiMeterId meterId,
+                                             PiPipeconf pipeconf,
+                                             P4InfoBrowser browser)
+            throws P4InfoBrowser.NotFoundException, EncodeException {
+
+        if (!pipeconf.pipelineModel().meter(meterId).isPresent()) {
+            throw new EncodeException(format(
+                    "not such meter '%s' in pipeline model", meterId));
+        }
+        final PiMeterType meterType = pipeconf.pipelineModel()
+                .meter(meterId).get().meterType();
+
+        switch (meterType) {
+            case INDIRECT:
+                final int p4InfoMeterId = browser.meters()
+                        .getByName(meterId.id())
+                        .getPreamble().getId();
+                return Entity.newBuilder().setMeterEntry(
+                        P4RuntimeOuterClass.MeterEntry.newBuilder()
+                                // Index unset to read all cells
+                                .setMeterId(p4InfoMeterId)
+                                .build())
+                        .build();
+            case DIRECT:
+                final PiTableId tableId = pipeconf.pipelineModel()
+                        .meter(meterId).get().table();
+                if (tableId == null) {
+                    throw new EncodeException(format(
+                            "null table for direct meter '%s'", meterId));
+                }
+                final int p4TableId = browser.tables().getByName(tableId.id())
+                        .getPreamble().getId();
+                return Entity.newBuilder().setDirectMeterEntry(
+                        P4RuntimeOuterClass.DirectMeterEntry.newBuilder()
+                                .setTableEntry(
+                                        // Match unset to read all cells
+                                        P4RuntimeOuterClass.TableEntry.newBuilder()
+                                                .setTableId(p4TableId)
+                                                .build())
+                                .build())
+                        .build();
+            default:
+                throw new EncodeException(format(
+                        "unrecognized PI meter type '%s'", meterType));
+        }
+    }
+
+    private static PiMeterCellConfig decodeMeterEntity(Entity entity,
+                                                       PiPipeconf pipeconf,
+                                                       P4InfoBrowser browser)
             throws EncodeException, P4InfoBrowser.NotFoundException {
 
-        int meterId;
         MeterConfig meterConfig;
-
-        if (entity.getEntityCase() == METER_ENTRY) {
-            meterId = entity.getMeterEntry().getMeterId();
-            meterConfig = entity.getMeterEntry().getConfig();
-        } else {
-            meterId = entity.getDirectMeterEntry().getMeterId();
-            meterConfig = entity.getDirectMeterEntry().getConfig();
-        }
-
-        // Process only meter IDs that were requested in the first place.
-        if (!meterIdMap.containsKey(meterId)) {
-            throw new EncodeException(format("Unrecognized meter ID '%s'", meterId));
-        }
-
-        PiMeterId piMeterId = meterIdMap.get(meterId);
-        if (!pipeconf.pipelineModel().meter(piMeterId).isPresent()) {
-            throw new EncodeException(format("Unable to find meter '%s' in pipeline model",  meterId));
-        }
-
-        PiMeterType piMeterType = pipeconf.pipelineModel().meter(piMeterId).get().meterType();
-        // Compute PI cell ID.
         PiMeterCellId piCellId;
 
-        switch (piMeterType) {
-            case INDIRECT:
-                if (entity.getEntityCase() != METER_ENTRY) {
-                    throw new EncodeException(format(
-                            "Meter ID '%s' is indirect, but processed entity is %s",
-                            piMeterId, entity.getEntityCase()));
-                }
-                piCellId = PiMeterCellId.ofIndirect(piMeterId, entity.getMeterEntry().getIndex());
-                break;
-            case DIRECT:
-                if (entity.getEntityCase() != DIRECT_METER_ENTRY) {
-                    throw new EncodeException(format(
-                            "Meter ID '%s' is direct, but processed entity is %s",
-                            piMeterId, entity.getEntityCase()));
-                }
-                PiTableEntry piTableEntry = TableEntryEncoder.decode(entity.getDirectMeterEntry().getTableEntry(),
-                                                                     pipeconf);
-                piCellId = PiMeterCellId.ofDirect(piMeterId, piTableEntry);
-                break;
-            default:
-                throw new EncodeException(format("Unrecognized PI meter ID type '%s'", piMeterType));
+        if (entity.getEntityCase() == METER_ENTRY) {
+            String meterName = browser.meters()
+                    .getById(entity.getCounterEntry().getCounterId())
+                    .getPreamble()
+                    .getName();
+            piCellId = PiMeterCellId.ofIndirect(
+                    PiMeterId.of(meterName),
+                    entity.getMeterEntry().getIndex().getIndex());
+            meterConfig = entity.getMeterEntry().getConfig();
+        } else if (entity.getEntityCase() == DIRECT_METER_ENTRY) {
+            PiTableEntry piTableEntry = TableEntryEncoder.decode(
+                    entity.getDirectMeterEntry().getTableEntry(),
+                    pipeconf);
+            piCellId = PiMeterCellId.ofDirect(piTableEntry);
+            meterConfig = entity.getDirectMeterEntry().getConfig();
+        } else {
+            throw new EncodeException(format(
+                    "unrecognized entity type '%s' in P4Runtime message",
+                    entity.getEntityCase().name()));
         }
 
-        PiMeterCellConfig.Builder builder = PiMeterCellConfig.builder();
-        builder.withMeterBand(new PiMeterBand(meterConfig.getCir(), meterConfig.getCburst()));
-        builder.withMeterBand(new PiMeterBand(meterConfig.getPir(), meterConfig.getPburst()));
-
-        return builder.withMeterCellId(piCellId).build();
+        return PiMeterCellConfig.builder()
+                .withMeterCellId(piCellId)
+                .withMeterBand(new PiMeterBand(meterConfig.getCir(),
+                                               meterConfig.getCburst()))
+                .withMeterBand(new PiMeterBand(meterConfig.getPir(),
+                                               meterConfig.getPburst()))
+                .build();
     }
-}
\ No newline at end of file
+}
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 609c5c5..e8b4e21 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
@@ -21,7 +21,6 @@
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Multimap;
-import com.google.common.collect.Sets;
 import com.google.protobuf.ByteString;
 import com.google.protobuf.InvalidProtocolBufferException;
 import io.grpc.Context;
@@ -36,7 +35,7 @@
 import org.onosproject.net.MastershipRole;
 import org.onosproject.net.pi.model.PiActionProfileId;
 import org.onosproject.net.pi.model.PiCounterId;
-import org.onosproject.net.pi.model.PiCounterType;
+import org.onosproject.net.pi.model.PiMeterId;
 import org.onosproject.net.pi.model.PiPipeconf;
 import org.onosproject.net.pi.model.PiTableId;
 import org.onosproject.net.pi.runtime.PiActionGroup;
@@ -46,8 +45,6 @@
 import org.onosproject.net.pi.runtime.PiEntity;
 import org.onosproject.net.pi.runtime.PiMeterCellConfig;
 import org.onosproject.net.pi.runtime.PiMeterCellId;
-import org.onosproject.net.pi.model.PiMeterType;
-import org.onosproject.net.pi.model.PiMeterId;
 import org.onosproject.net.pi.runtime.PiPacketOperation;
 import org.onosproject.net.pi.runtime.PiTableEntry;
 import org.onosproject.net.pi.service.PiPipeconfService;
@@ -131,8 +128,6 @@
     private Map<Uint128, CompletableFuture<Boolean>> arbitrationUpdateMap = Maps.newConcurrentMap();
     protected Uint128 p4RuntimeElectionId;
 
-    private static final long DEFAULT_INDEX = 0;
-
     /**
      * Default constructor.
      *
@@ -219,39 +214,8 @@
     @Override
     public CompletableFuture<Collection<PiCounterCellData>> readAllCounterCells(Set<PiCounterId> counterIds,
                                                                                 PiPipeconf pipeconf) {
-
-        /*
-        From p4runtime.proto, the scope of a ReadRequest is defined as follows:
-        CounterEntry:
-            - All counter cells for all meters if counter_id = 0 (default).
-            - All counter cells for given counter_id if index = 0 (default).
-        DirectCounterEntry:
-            - All counter cells for all meters if counter_id = 0 (default).
-            - All counter cells for given counter_id if table_entry.match is empty.
-         */
-
-        Set<PiCounterCellId> cellIds = Sets.newHashSet();
-
-        for (PiCounterId counterId : counterIds) {
-            if (!pipeconf.pipelineModel().counter(counterId).isPresent()) {
-                log.warn("Unable to find counter '{}' in pipeline model",  counterId);
-                continue;
-            }
-            PiCounterType counterType = pipeconf.pipelineModel().counter(counterId).get().counterType();
-            switch (counterType) {
-                case INDIRECT:
-                    cellIds.add(PiCounterCellId.ofIndirect(counterId, 0));
-                    break;
-                case DIRECT:
-                    cellIds.add(PiCounterCellId.ofDirect(counterId, PiTableEntry.EMTPY));
-                    break;
-                default:
-                    log.warn("Unrecognized PI counter type '{}'", counterType);
-            }
-        }
-
-        return supplyInContext(() -> doReadCounterCells(cellIds, pipeconf),
-                               "readAllCounterCells-" + cellIds.hashCode());
+        return supplyInContext(() -> doReadAllCounterCells(counterIds, pipeconf),
+                               "readAllCounterCells-" + counterIds.hashCode());
     }
 
     @Override
@@ -297,34 +261,8 @@
     @Override
     public CompletableFuture<Collection<PiMeterCellConfig>> readAllMeterCells(Set<PiMeterId> meterIds,
                                                                                 PiPipeconf pipeconf) {
-
-        /*
-        From p4runtime.proto, the scope of a ReadRequest is defined as follows:
-        MeterEntry:
-            - All meter cells for all meters if meter_id = 0 (default).
-            - All meter cells for given meter_id if index = 0 (default).
-        DirectCounterEntry:
-            - All meter cells for all meters if meter_id = 0 (default).
-            - All meter cells for given meter_id if table_entry.match is empty.
-         */
-
-        Set<PiMeterCellId> cellIds = Sets.newHashSet();
-        for (PiMeterId meterId : meterIds) {
-            PiMeterType meterType = pipeconf.pipelineModel().meter(meterId).get().meterType();
-            switch (meterType) {
-                case INDIRECT:
-                    cellIds.add(PiMeterCellId.ofIndirect(meterId, DEFAULT_INDEX));
-                    break;
-                case DIRECT:
-                    cellIds.add(PiMeterCellId.ofDirect(meterId, PiTableEntry.EMTPY));
-                    break;
-                default:
-                    log.warn("Unrecognized PI meter type '{}'", meterType);
-            }
-        }
-
-        return supplyInContext(() -> doReadMeterCells(cellIds, pipeconf),
-                               "readAllMeterCells-" + cellIds.hashCode());
+        return supplyInContext(() -> doReadAllMeterCells(meterIds, pipeconf),
+                               "readAllMeterCells-" + meterIds.hashCode());
     }
 
     /* Blocking method implementations below */
@@ -416,7 +354,7 @@
             return true;
         }
 
-        Collection<Update> updateMsgs = null;
+        Collection<Update> updateMsgs;
         try {
             updateMsgs = TableEntryEncoder.encode(piTableEntries, pipeconf)
                     .stream()
@@ -566,20 +504,32 @@
         controller.postEvent(event);
     }
 
-    private Collection<PiCounterCellData> doReadCounterCells(Collection<PiCounterCellId> cellIds, PiPipeconf pipeconf) {
+    private Collection<PiCounterCellData> doReadAllCounterCells(
+            Collection<PiCounterId> counterIds, PiPipeconf pipeconf) {
+        return doReadCounterEntities(
+                CounterEntryCodec.readAllCellsEntities(counterIds, pipeconf),
+                pipeconf);
+    }
 
-        // We use this map to remember the original PI counter IDs of the returned response.
-        final Map<Integer, PiCounterId> counterIdMap = Maps.newHashMap();
+    private Collection<PiCounterCellData> doReadCounterCells(
+            Collection<PiCounterCellId> cellIds, PiPipeconf pipeconf) {
+        return doReadCounterEntities(
+                CounterEntryCodec.encodePiCounterCellIds(cellIds, pipeconf),
+                pipeconf);
+    }
+
+    private Collection<PiCounterCellData> doReadCounterEntities(
+            Collection<Entity> counterEntities, PiPipeconf pipeconf) {
+
+        if (counterEntities.size() == 0) {
+            return Collections.emptyList();
+        }
 
         final ReadRequest request = ReadRequest.newBuilder()
                 .setDeviceId(p4DeviceId)
-                .addAllEntities(CounterEntryCodec.encodePiCounterCellIds(cellIds, counterIdMap, pipeconf))
+                .addAllEntities(counterEntities)
                 .build();
 
-        if (request.getEntitiesList().size() == 0) {
-            return Collections.emptyList();
-        }
-
         final Iterable<ReadResponse> responses;
         try {
             responses = () -> blockingStub.read(request);
@@ -593,7 +543,7 @@
                 .flatMap(List::stream)
                 .collect(Collectors.toList());
 
-        return CounterEntryCodec.decodeCounterEntities(entities, counterIdMap, pipeconf);
+        return CounterEntryCodec.decodeCounterEntities(entities, pipeconf);
     }
 
     private boolean doWriteActionGroupMembers(PiActionGroup group, WriteOperationType opType, PiPipeconf pipeconf) {
@@ -789,47 +739,60 @@
         }
     }
 
-    private Collection<PiMeterCellConfig> doReadMeterCells(Collection<PiMeterCellId> cellIds, PiPipeconf pipeconf) {
+    private Collection<PiMeterCellConfig> doReadAllMeterCells(
+            Collection<PiMeterId> meterIds, PiPipeconf pipeconf) {
+        return doReadMeterEntities(MeterEntryCodec.readAllCellsEntities(
+                meterIds, pipeconf), pipeconf);
+    }
 
-        // We use this map to remember the original PI meter IDs of the returned response.
-        Map<Integer, PiMeterId> meterIdMap = Maps.newHashMap();
-        Collection<PiMeterCellConfig> piMeterCellConfigs = cellIds.stream()
+    private Collection<PiMeterCellConfig> doReadMeterCells(
+            Collection<PiMeterCellId> cellIds, PiPipeconf pipeconf) {
+
+        final Collection<PiMeterCellConfig> piMeterCellConfigs = cellIds.stream()
                 .map(cellId -> PiMeterCellConfig.builder()
-                        .withMeterCellId(cellId).build())
+                        .withMeterCellId(cellId)
+                        .build())
                 .collect(Collectors.toList());
 
+        return doReadMeterEntities(MeterEntryCodec.encodePiMeterCellConfigs(
+                piMeterCellConfigs, pipeconf), pipeconf);
+    }
+
+    private Collection<PiMeterCellConfig> doReadMeterEntities(
+            Collection<Entity> entitiesToRead, PiPipeconf pipeconf) {
+
+        if (entitiesToRead.size() == 0) {
+            return Collections.emptyList();
+        }
+
         final ReadRequest request = ReadRequest.newBuilder()
                 .setDeviceId(p4DeviceId)
-                .addAllEntities(MeterEntryCodec.encodePiMeterCellConfigs(piMeterCellConfigs, meterIdMap, pipeconf))
+                .addAllEntities(entitiesToRead)
                 .build();
 
-        if (request.getEntitiesList().size() == 0) {
-            return Collections.emptyList();
-        }
-
         final Iterable<ReadResponse> responses;
         try {
             responses = () -> blockingStub.read(request);
         } catch (StatusRuntimeException e) {
-            log.warn("Unable to read meters config: {}", e.getMessage());
+            log.warn("Unable to read meter cells: {}", e.getMessage());
             log.debug("exception", e);
             return Collections.emptyList();
         }
 
-        List<Entity> entities = StreamSupport.stream(responses.spliterator(), false)
+        List<Entity> responseEntities = StreamSupport
+                .stream(responses.spliterator(), false)
                 .map(ReadResponse::getEntitiesList)
                 .flatMap(List::stream)
                 .collect(Collectors.toList());
 
-        return MeterEntryCodec.decodeMeterEntities(entities, meterIdMap, pipeconf);
+        return MeterEntryCodec.decodeMeterEntities(responseEntities, pipeconf);
     }
 
     private boolean doWriteMeterCells(Collection<PiMeterCellConfig> cellIds, PiPipeconf pipeconf) {
 
-        final Map<Integer, PiMeterId> meterIdMap = Maps.newHashMap();
         WriteRequest.Builder writeRequestBuilder = WriteRequest.newBuilder();
 
-        Collection<Update> updateMsgs = MeterEntryCodec.encodePiMeterCellConfigs(cellIds, meterIdMap, pipeconf)
+        Collection<Update> updateMsgs = MeterEntryCodec.encodePiMeterCellConfigs(cellIds, pipeconf)
                 .stream()
                 .map(meterEntryMsg ->
                              Update.newBuilder()
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 411e1fb..25ef153 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,6 +17,7 @@
 package org.onosproject.p4runtime.ctl;
 
 import com.google.protobuf.ByteString;
+import p4.P4RuntimeOuterClass;
 
 import static java.lang.String.format;
 
@@ -48,4 +49,8 @@
                     entityDescr, bitWidth, prefixLength));
         }
     }
+
+    static P4RuntimeOuterClass.Index indexMsg(long index) {
+        return P4RuntimeOuterClass.Index.newBuilder().setIndex(index).build();
+    }
 }
diff --git a/protocols/p4runtime/proto/BUCK b/protocols/p4runtime/proto/BUCK
index 53db8a5..aa3d8d3 100644
--- a/protocols/p4runtime/proto/BUCK
+++ b/protocols/p4runtime/proto/BUCK
@@ -5,12 +5,13 @@
 PROTOBUF_VER = '3.2.0'
 GRPC_VER = '1.3.1'
 
-PI_COMMIT = '13d611a9c655938676ebcde2bd5653b461f46ca7'
+PI_COMMIT = '219b3d67299ec09b49f433d7341049256ab5f512'
 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/google/rpc/status.proto',
diff --git a/tools/dev/p4vm/install-p4-tools.sh b/tools/dev/p4vm/install-p4-tools.sh
index 7c57e8d..8625daa 100755
--- a/tools/dev/p4vm/install-p4-tools.sh
+++ b/tools/dev/p4vm/install-p4-tools.sh
@@ -15,9 +15,9 @@
 set -e
 
 BUILD_DIR=~/p4tools
-BMV2_COMMIT="3f1d8d7893d7cf1657285c8aacbb4af5c6d22620"
-PI_COMMIT="0325da7746efe192935e8969fd08eed68d654c98"
-P4C_COMMIT="4c0d629ce2492294ff4108c910f8e6be44112c68"
+BMV2_COMMIT="7e25eeb19d01eee1a8e982dc7ee90ee438c10a05"
+PI_COMMIT="219b3d67299ec09b49f433d7341049256ab5f512"
+P4C_COMMIT="48a57a6ae4f96961b74bd13f6bdeac5add7bb815"
 PROTOBUF_COMMIT="tags/v3.2.0"
 GRPC_COMMIT="tags/v1.3.2"
 LIBYANG_COMMIT="v0.14-r1"
