[SDFAB-356] Extend P4RuntimeMeterProgrammable and Codecs to support reset scenario

Change-Id: Ifad0b296568d3f78b2aa792fa63f2f81fa80ebae
diff --git a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiMeterCellConfig.java b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiMeterCellConfig.java
index f13e276..e62482b 100644
--- a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiMeterCellConfig.java
+++ b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiMeterCellConfig.java
@@ -24,6 +24,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
 import static com.google.common.base.Preconditions.checkNotNull;
@@ -66,6 +67,35 @@
         return piMeterBands;
     }
 
+    /**
+     * Check if the config represents a modify operation.
+     *
+     * @return true if there are exactly 2 bands
+     */
+    public boolean isModify() {
+        return piMeterBands.size() == 2;
+    }
+
+    /**
+     * Check if the config represents a reset operation.
+     *
+     * @return true if there is no band.
+     */
+    public boolean isReset() {
+        return piMeterBands.isEmpty();
+    }
+
+    /**
+     * Returns a PiMeterCellConfig with no bands.
+     * Used to reset a PI meter cell.
+     *
+     * @param piMeterCellId the PiMeterCellId need to be reset
+     * @return a PiMeterCellConfig with no bands
+     */
+    public static PiMeterCellConfig reset(PiMeterCellId piMeterCellId) {
+        return new PiMeterCellConfig(piMeterCellId, Collections.emptyList());
+    }
+
     @Override
     public PiEntityType piEntityType() {
         return PiEntityType.METER_CELL_CONFIG;