Register flow-manager and match-action related classes to KryoFactory.

- The following classes are now registered and available on KryoFactory:
 -- FlowId
 -- Path
 -- Tree
 -- FlowLink
 -- OpticalPathFlow
 -- PacketPathFlow
 -- SingleDstTreeFlow
 -- PacketMatch
 -- OutputAction
 -- ModifyDstMacAction
 -- ModifyDstMacAction
- This task is a preperation for ONOS-1736 and ONOS-1842.

Change-Id: If438f5175e68672e0ce02f56681c35c3be87f0bc
diff --git a/src/main/java/net/onrc/onos/api/flowmanager/Flow.java b/src/main/java/net/onrc/onos/api/flowmanager/Flow.java
index 202511d..8608adb 100644
--- a/src/main/java/net/onrc/onos/api/flowmanager/Flow.java
+++ b/src/main/java/net/onrc/onos/api/flowmanager/Flow.java
@@ -18,6 +18,14 @@
     private final FlowId id;
 
     /**
+     * Default constructor for Kryo deserialization.
+     */
+    @Deprecated
+    protected Flow() {
+        id = null;
+    }
+
+    /**
      * Creates Flow object using specified ID.
      *
      * @param id the ID to be assigned
diff --git a/src/main/java/net/onrc/onos/api/flowmanager/FlowId.java b/src/main/java/net/onrc/onos/api/flowmanager/FlowId.java
index f6d7f8a..b6bb9f0 100644
--- a/src/main/java/net/onrc/onos/api/flowmanager/FlowId.java
+++ b/src/main/java/net/onrc/onos/api/flowmanager/FlowId.java
@@ -11,6 +11,14 @@
     private final long value;
 
     /**
+     * Default constructor for Kryo deserialization.
+     */
+    @Deprecated
+    protected FlowId() {
+        value = 0;
+    }
+
+    /**
      * Creates new instance with string ID.
      * <p>
      * This FlowId instance should be generated with {@link FlowIdGenerator}.
diff --git a/src/main/java/net/onrc/onos/api/flowmanager/FlowLink.java b/src/main/java/net/onrc/onos/api/flowmanager/FlowLink.java
index 2fded10..8b8ad75 100644
--- a/src/main/java/net/onrc/onos/api/flowmanager/FlowLink.java
+++ b/src/main/java/net/onrc/onos/api/flowmanager/FlowLink.java
@@ -1,6 +1,7 @@
 package net.onrc.onos.api.flowmanager;
 
 import com.google.common.base.Objects;
+
 import net.onrc.onos.core.util.Dpid;
 import net.onrc.onos.core.util.PortNumber;
 import net.onrc.onos.core.util.SwitchPort;
@@ -16,6 +17,15 @@
     protected SwitchPort dstSwitchPort;
 
     /**
+     * Default constructor for Kryo deserialization.
+     */
+    @Deprecated
+    protected FlowLink() {
+        srcSwitchPort = null;
+        dstSwitchPort = null;
+    }
+
+    /**
      * Creates new FlowLink object using source/destination switch port pair.
      *
      * @param src The source switch port.
diff --git a/src/main/java/net/onrc/onos/api/flowmanager/OpticalPathFlow.java b/src/main/java/net/onrc/onos/api/flowmanager/OpticalPathFlow.java
index 46bf4e7..51dce43 100644
--- a/src/main/java/net/onrc/onos/api/flowmanager/OpticalPathFlow.java
+++ b/src/main/java/net/onrc/onos/api/flowmanager/OpticalPathFlow.java
@@ -23,6 +23,14 @@
     private final int lambda;
 
     /**
+     * Default constructor for Kryo deserialization.
+     */
+    @Deprecated
+    protected OpticalPathFlow() {
+        lambda = 0;
+    }
+
+    /**
      * Constructor.
      *
      * @param id the ID for this new Flow object
diff --git a/src/main/java/net/onrc/onos/api/flowmanager/PacketPathFlow.java b/src/main/java/net/onrc/onos/api/flowmanager/PacketPathFlow.java
index 42cbd65..37820fb 100644
--- a/src/main/java/net/onrc/onos/api/flowmanager/PacketPathFlow.java
+++ b/src/main/java/net/onrc/onos/api/flowmanager/PacketPathFlow.java
@@ -31,6 +31,16 @@
     private final int idleTimeout;
 
     /**
+     * Default constructor for Kryo deserialization.
+     */
+    @Deprecated
+    protected PacketPathFlow() {
+        match = null;
+        hardTimeout = 0;
+        idleTimeout = 0;
+    }
+
+    /**
      * Constructor.
      *
      * @param id ID for this new Flow object
diff --git a/src/main/java/net/onrc/onos/api/flowmanager/PathFlow.java b/src/main/java/net/onrc/onos/api/flowmanager/PathFlow.java
index 0cc35ce..943140d 100644
--- a/src/main/java/net/onrc/onos/api/flowmanager/PathFlow.java
+++ b/src/main/java/net/onrc/onos/api/flowmanager/PathFlow.java
@@ -2,6 +2,7 @@
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
+import java.util.LinkedList;
 import java.util.List;
 
 import net.onrc.onos.core.matchaction.action.Action;
@@ -16,6 +17,16 @@
     private final List<Action> egressActions;
 
     /**
+     * Default constructor for Kryo deserialization.
+     */
+    @Deprecated
+    protected PathFlow() {
+        ingressPort = null;
+        path = null;
+        egressActions = null;
+    }
+
+    /**
      * Creates the new flow instance.
      *
      * @param id ID for this new PathFlow object
@@ -28,8 +39,8 @@
             PortNumber ingressPort, Path path, List<Action> egressActions) {
         super(id);
         this.ingressPort = checkNotNull(ingressPort);
-        this.path = checkNotNull(path);
-        this.egressActions = checkNotNull(egressActions);
+        this.path = new Path(checkNotNull(path));
+        this.egressActions = new LinkedList<>(checkNotNull(egressActions));
     }
 
     /**
diff --git a/src/main/java/net/onrc/onos/api/flowmanager/SingleDstTreeFlow.java b/src/main/java/net/onrc/onos/api/flowmanager/SingleDstTreeFlow.java
index 6fbed8a..0caef51 100644
--- a/src/main/java/net/onrc/onos/api/flowmanager/SingleDstTreeFlow.java
+++ b/src/main/java/net/onrc/onos/api/flowmanager/SingleDstTreeFlow.java
@@ -7,11 +7,15 @@
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+
 import net.onrc.onos.api.flowmanager.FlowBatchOperation.Operator;
 import net.onrc.onos.core.matchaction.MatchAction;
 import net.onrc.onos.core.matchaction.MatchActionIdGenerator;
@@ -25,9 +29,6 @@
 import net.onrc.onos.core.util.PortNumber;
 import net.onrc.onos.core.util.SwitchPort;
 
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-
 /**
  * A {@link Flow} object expressing the multipoints-to-point tree flow for the
  * packet layer.
@@ -43,6 +44,17 @@
     private final List<Action> egressActions;
 
     /**
+     * Default constructor for Kryo deserialization.
+     */
+    @Deprecated
+    protected SingleDstTreeFlow() {
+        match = null;
+        ingressPorts = null;
+        tree = null;
+        egressActions = null;
+    }
+
+    /**
      * Creates new instance using Tree object.
      *
      * @param id ID for this object
@@ -56,9 +68,9 @@
             Collection<SwitchPort> ingressPorts, Tree tree, List<Action> egressActions) {
         super(id);
         this.match = checkNotNull(match);
-        this.ingressPorts = ImmutableSet.copyOf(checkNotNull(ingressPorts));
+        this.ingressPorts = new HashSet<>(checkNotNull(ingressPorts));
         this.tree = checkNotNull(tree);
-        this.egressActions = ImmutableList.copyOf(checkNotNull(egressActions));
+        this.egressActions = new LinkedList<>(checkNotNull(egressActions));
 
         // TODO: check if the tree is a MP2P tree.
         // TODO: check consistency between ingressPorts and tree topology.
@@ -70,7 +82,7 @@
      * @return the ingress ports of the tree
      */
     public Collection<SwitchPort> getIngressPorts() {
-        return ingressPorts;
+        return ImmutableSet.copyOf(ingressPorts);
     }
 
     /**
@@ -88,7 +100,7 @@
      * @return the list of actions at the egress edge switch
      */
     public List<Action> getEgressActions() {
-        return egressActions;
+        return ImmutableList.copyOf(egressActions);
     }
 
     @Override