Various improvements to PI group handling

- Moved group translation logic to core service
- Removed dependency on KRYO
- Fixed bug where tratments with PI instructions where not supported if
	an interpreter was present
- Fixed bug where action profile name was not found during protobuf
	encoding (always perform P4Info lookup by name and alias)
- Improved reading of members by issuing one big request for all
	groups

Change-Id: Ifcf8380b09293e70be15cf4999bd2845caf5d01e
diff --git a/core/api/src/main/java/org/onosproject/net/pi/runtime/PiGroupKey.java b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiGroupKey.java
new file mode 100644
index 0000000..598f3e7
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/pi/runtime/PiGroupKey.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2017-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.net.pi.runtime;
+
+import com.google.common.base.Objects;
+import org.onosproject.net.group.GroupKey;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Implementation of GroupKey for the case of a protocol-independent pipeline.
+ */
+public final class PiGroupKey implements GroupKey {
+
+    private final PiTableId tableId;
+    private final PiActionProfileId piActionProfileId;
+    private final int groupId;
+
+    /**
+     * Returns a new group key for the given table ID, action profile ID, and group ID.
+     *
+     * @param tableId           table ID
+     * @param piActionProfileId action profile ID
+     * @param groupId           group ID
+     */
+    public PiGroupKey(PiTableId tableId, PiActionProfileId piActionProfileId, int groupId) {
+        this.tableId = checkNotNull(tableId);
+        this.piActionProfileId = checkNotNull(piActionProfileId);
+        this.groupId = groupId;
+    }
+
+    /**
+     * Returns the table ID defined by this key.
+     *
+     * @return table ID
+     */
+    public PiTableId tableId() {
+        return tableId;
+    }
+
+    /**
+     * Returns the group ID defined by this key.
+     *
+     * @return group ID
+     */
+    public int groupId() {
+        return groupId;
+    }
+
+    /**
+     * Returns the action profile ID defined by this key.
+     *
+     * @return action profile ID
+     */
+    public PiActionProfileId actionProfileId() {
+        return piActionProfileId;
+    }
+
+    @Override
+    public byte[] key() {
+        return toString().getBytes();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (!(o instanceof PiGroupKey)) {
+            return false;
+        }
+        PiGroupKey that = (PiGroupKey) o;
+        return groupId == that.groupId &&
+                Objects.equal(tableId, that.tableId) &&
+                Objects.equal(piActionProfileId, that.piActionProfileId);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(tableId, piActionProfileId, groupId);
+    }
+
+    @Override
+    public String toString() {
+        return tableId.id() + "-" + piActionProfileId.id() + "-" + String.valueOf(groupId);
+    }
+}