Fix inconsistent update type during concurrent P4Runtime writes

This is achieved by optimistically updating the P4Runtime mirror using
the write request (instead of waiting for a response) and by serializing
building write requests for the same device.

This change requires updating the P4Runtime protocol classes to expose
the content of the write request.

It also includes:
- force member weight to 1 when reading groups (some server
implementation still fails to be compliant to the spec)
- remove unused operation timeout handling in GDP (now all RPCz have a
timeout)

Change-Id: Ib4f99a6085c1283f46a2797e0c883d96954e02e9
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/codec/ActionProfileGroupCodec.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/codec/ActionProfileGroupCodec.java
index 7946394..5110274 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/codec/ActionProfileGroupCodec.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/codec/ActionProfileGroupCodec.java
@@ -91,8 +91,18 @@
                                 .getPreamble().getName()))
                 .withId(PiActionProfileGroupId.of(msg.getGroupId()))
                 .withMaxSize(msg.getMaxSize());
-        msg.getMembersList().forEach(m -> piGroupBuilder.addMember(
-                PiActionProfileMemberId.of(m.getMemberId()), m.getWeight()));
+        msg.getMembersList().forEach(m -> {
+            final int weight;
+            if (m.getWeight() < 1) {
+                log.warn("Decoding group with invalid weight '{}', will set to 1",
+                         m.getWeight());
+                weight = 1;
+            } else {
+                weight = m.getWeight();
+            }
+            piGroupBuilder.addMember(
+                PiActionProfileMemberId.of(m.getMemberId()), weight);
+        });
         return piGroupBuilder.build();
     }
 }