Fix PiGroupTranslatorImpl producing action profile members with ID 0

which is invalid in P4Runtime. This was observed when using action
profile group IDs with the last 2 bytes set to zeros, e.g. 0xec3b0000.
Now we generate the member ID as the hash of the group ID and the bucket
index, also adding a check for member IDs to be different than 0.

Change-Id: Id9fdf21d9704930703c3020b049cb19dafb1e590
diff --git a/core/net/src/main/java/org/onosproject/net/pi/impl/PiGroupTranslatorImpl.java b/core/net/src/main/java/org/onosproject/net/pi/impl/PiGroupTranslatorImpl.java
index 14e2b5c..42a29a8 100644
--- a/core/net/src/main/java/org/onosproject/net/pi/impl/PiGroupTranslatorImpl.java
+++ b/core/net/src/main/java/org/onosproject/net/pi/impl/PiGroupTranslatorImpl.java
@@ -34,7 +34,7 @@
 import org.onosproject.net.pi.runtime.PiTableAction;
 import org.onosproject.net.pi.service.PiTranslationException;
 
-import java.nio.ByteBuffer;
+import java.util.Objects;
 import java.util.Set;
 
 import static java.lang.String.format;
@@ -133,11 +133,12 @@
             Hack: Statically derive member ID by combining groupId and position
             of the bucket in the list.
              */
-            final ByteBuffer bb = ByteBuffer.allocate(4)
-                    .putShort((short) (group.id().id() & 0xffff))
-                    .putShort(bucketIdx);
-            bb.rewind();
-            final int memberId = bb.getInt();
+            final int memberId = Objects.hash(group.id(), bucketIdx);
+            if (memberId == 0) {
+                throw new PiTranslationException(
+                        "GroupBucket produces PiActionProfileMember " +
+                                "with invalid ID 0");
+            }
             bucketIdx++;
 
             final PiTableAction tableAction = translateTreatment(