New P4RuntimeClient implementation that supports batching and error reporting

The new client API supports batching and provides detailed response for
write requests (e.g. if entity already exists when inserting), which was
not possible with the old one.

This patch includes:
- New more efficient implementation of P4RuntimeClient (no more locking,
use native gRPC executor, use stub deadlines)
- Ported all codecs to new AbstractCodec-based implementation (needed to
implement codec cache in the future)
- Uses batching in P4RuntimeFlowRuleProgrammable and
P4RuntimeGroupActionProgrammable
- Minor changes to PI framework runtime classes

Change-Id: I3fac42057bb4e1389d761006a32600c786598683
diff --git a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/mirror/P4RuntimeMirror.java b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/mirror/P4RuntimeMirror.java
index d62bbb8..bee8c51 100644
--- a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/mirror/P4RuntimeMirror.java
+++ b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/mirror/P4RuntimeMirror.java
@@ -21,9 +21,9 @@
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.pi.runtime.PiEntity;
 import org.onosproject.net.pi.runtime.PiHandle;
+import org.onosproject.p4runtime.api.P4RuntimeWriteClient;
 
 import java.util.Collection;
-import java.util.Map;
 
 /**
  * Service to keep track of the device state for a given class of PI entities.
@@ -75,15 +75,6 @@
     void remove(H handle);
 
     /**
-     * Returns a map of handles and corresponding PI entities for the given
-     * device.
-     *
-     * @param deviceId device ID
-     * @return map of handles and corresponding PI entities
-     */
-    Map<H, E> deviceHandleMap(DeviceId deviceId);
-
-    /**
      * Stores the given annotations associating it to the given handle.
      *
      * @param handle      handle
@@ -101,10 +92,18 @@
     Annotations annotations(H handle);
 
     /**
-     * Synchronizes the state of the given device ID with the given handle map.
-     *
-     * @param deviceId  device ID
-     * @param handleMap handle map
+     * Synchronizes the state of the given device ID with the given collection
+     * of PI entities.
+     * @param deviceId device ID
+     * @param entities collection of PI entities
      */
-    void sync(DeviceId deviceId, Map<H, E> handleMap);
+    void sync(DeviceId deviceId, Collection<E> entities);
+
+    /**
+     * Uses the given P4Runtime write response to update the state of this
+     * mirror.
+     *
+     * @param response P4Runtime write response
+     */
+    void replayWriteResponse(P4RuntimeWriteClient.WriteResponse response);
 }