Various fixes to get a P4Runtime demo that works

Change-Id: Icab512fceeb6ec0faf1b402c1e325e055cdb2caf
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/DefaultPacketIn.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/DefaultPacketIn.java
new file mode 100644
index 0000000..2085505
--- /dev/null
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/DefaultPacketIn.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * 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.p4runtime.ctl;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.pi.runtime.PiPacketOperation;
+import org.onosproject.p4runtime.api.P4RuntimePacketIn;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Default implementation of a packet-in in P4Runtime.
+ */
+final class DefaultPacketIn implements P4RuntimePacketIn {
+
+    private final DeviceId deviceId;
+    private final PiPacketOperation operation;
+
+    DefaultPacketIn(DeviceId deviceId, PiPacketOperation operation) {
+        this.deviceId = checkNotNull(deviceId);
+        this.operation = checkNotNull(operation);
+    }
+
+    @Override
+    public DeviceId deviceId() {
+        return deviceId;
+    }
+
+    @Override
+    public PiPacketOperation packetOperation() {
+        return operation;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        DefaultPacketIn that = (DefaultPacketIn) o;
+        return Objects.equal(deviceId, that.deviceId) &&
+                Objects.equal(operation, that.operation);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(deviceId, operation);
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(this)
+                .add("deviceId", deviceId)
+                .add("operation", operation)
+                .toString();
+    }
+}