Integrating SegmentRoutingManager with distributed Match Action Framework
diff --git a/src/main/java/net/floodlightcontroller/core/IOF13Switch.java b/src/main/java/net/floodlightcontroller/core/IOF13Switch.java
index e3cd0d8..1dbfc1c 100644
--- a/src/main/java/net/floodlightcontroller/core/IOF13Switch.java
+++ b/src/main/java/net/floodlightcontroller/core/IOF13Switch.java
@@ -63,7 +63,13 @@
     public class NeighborSet {
         public enum groupPktType {
             IP_OUTGOING,
-            MPLS_OUTGOING
+            MPLS_OUTGOING;
+
+            /**
+             * Default constructor for Kryo deserialization.
+             */
+            @Deprecated
+            groupPktType(){}
         };
 
         Set<Dpid> dpids;
@@ -71,6 +77,15 @@
         groupPktType outPktType;
 
         /**
+         * Default constructor for Kryo deserialization.
+         */
+        public NeighborSet() {
+            this.edgeLabel = -1;
+            this.outPktType = groupPktType.IP_OUTGOING;
+            this.dpids = new HashSet<Dpid>();
+        }
+
+        /**
          * Constructor
          *
          * @param dpids A variable number of Dpids represention neighbor
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java b/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java
index 5d280ae..cea1996 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java
@@ -41,9 +41,13 @@
 import net.onrc.onos.core.intent.Path;
 import net.onrc.onos.core.main.config.IConfigInfoService;
 import net.onrc.onos.core.matchaction.MatchAction;
+import net.onrc.onos.core.matchaction.MatchActionFloodlightService;
 import net.onrc.onos.core.matchaction.MatchActionId;
 import net.onrc.onos.core.matchaction.MatchActionOperationEntry;
+import net.onrc.onos.core.matchaction.MatchActionOperations;
 import net.onrc.onos.core.matchaction.MatchActionOperations.Operator;
+import net.onrc.onos.core.matchaction.MatchActionOperationsId;
+import net.onrc.onos.core.matchaction.MatchActionService;
 import net.onrc.onos.core.matchaction.action.Action;
 import net.onrc.onos.core.matchaction.action.CopyTtlInAction;
 import net.onrc.onos.core.matchaction.action.CopyTtlOutAction;
@@ -77,6 +81,7 @@
 import net.onrc.onos.core.topology.TopologyEvents;
 import net.onrc.onos.core.util.Dpid;
 import net.onrc.onos.core.util.IPv4Net;
+import net.onrc.onos.core.util.IdGenerator;
 import net.onrc.onos.core.util.PortNumber;
 import net.onrc.onos.core.util.SwitchPort;
 
@@ -97,6 +102,7 @@
 
     private ITopologyService topologyService;
     private IPacketService packetService;
+    private MatchActionService matchActionService;
     private MutableTopology mutableTopology;
     private ConcurrentLinkedQueue<IPv4> ipPacketQueue;
     private IRestApiService restApi;
@@ -129,7 +135,9 @@
     private int numOfEvents = 0;
     private int numOfEventProcess = 0;
     private int numOfPopulation = 0;
-    private long matchActionId = 0L;
+    // private long matchActionId = 0L;
+    private IdGenerator<MatchActionId> maIdGenerator;
+    private IdGenerator<MatchActionOperationsId> maoIdGenerator;
 
     private final int DELAY_TO_ADD_LINK = 10;
     private final int MAX_NUM_LABELS = 3;
@@ -171,6 +179,9 @@
         l.add(IFlowPusherService.class);
         l.add(ITopologyService.class);
         l.add(IRestApiService.class);
+        // l.add(MatchActionModule.class);
+        // l.add(MatchActionComponent.class);
+        l.add(MatchActionFloodlightService.class);
 
         return l;
 
@@ -192,6 +203,7 @@
         linksToAdd = new HashMap<String, LinkData>();
         topologyEventQueue = new ConcurrentLinkedQueue<TopologyEvents>();
         packetService = context.getServiceImpl(IPacketService.class);
+        matchActionService = context.getServiceImpl(MatchActionFloodlightService.class);
         restApi = context.getServiceImpl(IRestApiService.class);
         policyTable = new HashMap<String, SegmentRoutingPolicy>();
         tunnelTable = new HashMap<String, SegmentRoutingTunnel>();
@@ -201,11 +213,13 @@
         packetService.registerPacketListener(this);
         topologyService.addListener(this, false);
 
-
     }
 
     @Override
     public void startUp(FloodlightModuleContext context) throws FloodlightModuleException {
+        maIdGenerator = matchActionService.getMatchActionIdGenerator();
+        maoIdGenerator = matchActionService.getMatchActionOperationsIdGenerator();
+
         ScheduledExecutorService ses = threadPool.getScheduledExecutor();
         restApi.addRestletRoutable(new SegmentRoutingWebRoutable());
 
@@ -759,6 +773,12 @@
 
     }
 
+    public void executeMatchActionOpEntry(MatchActionOperationEntry maEntry) {
+        MatchActionOperations mao = new MatchActionOperations(maoIdGenerator.getNewId());
+        mao.addOperation(maEntry);
+        matchActionService.executeOperations(mao);
+    }
+
     /**
      * Push the MPLS rule for Adjacency ID
      *
@@ -807,23 +827,24 @@
             actions.add(groupAction);
         }
 
-        MatchAction matchAction = new MatchAction(new MatchActionId(matchActionId++),
-                new SwitchPort((long) 0, (short) 0), mplsMatch, actions);
+        MatchAction matchAction = new MatchAction(maIdGenerator.getNewId(),
+                new SwitchPort(sw.getDpid().value(), (short) 0), mplsMatch, actions);
         Operator operator = Operator.ADD;
         MatchActionOperationEntry maEntry =
                 new MatchActionOperationEntry(operator, matchAction);
+        executeMatchActionOpEntry(maEntry);
 
-        IOF13Switch sw13 = (IOF13Switch) floodlightProvider.getMasterSwitch(
-                sw.getDpid().value());
+        /* IOF13Switch sw13 = (IOF13Switch) floodlightProvider.getMasterSwitch(
+                 sw.getDpid().value());
 
-        if (sw13 != null) {
-            try {
-                //printMatchActionOperationEntry(sw, maEntry);
-                sw13.pushFlow(maEntry);
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
+         if (sw13 != null) {
+             try {
+                 //printMatchActionOperationEntry(sw, maEntry);
+                 sw13.pushFlow(maEntry);
+             } catch (IOException e) {
+                 e.printStackTrace();
+             }
+         }*/
     }
 
     /**
@@ -961,6 +982,14 @@
         }
 
         if (!entries.isEmpty()) {
+            MatchActionOperations mao = new MatchActionOperations(
+                    maoIdGenerator.getNewId());
+            for (MatchActionOperationEntry maEntry : entries)
+                mao.addOperation(maEntry);
+            matchActionService.executeOperations(mao);
+        }
+
+        /*if (!entries.isEmpty()) {
             IOF13Switch sw13 = (IOF13Switch) floodlightProvider.getMasterSwitch(
                     targetSw.getDpid().value());
 
@@ -971,7 +1000,7 @@
                     e.printStackTrace();
                 }
             }
-        }
+        }*/
 
     }
 
@@ -1033,8 +1062,8 @@
         }
         actions.add(groupAction);
 
-        MatchAction matchAction = new MatchAction(new MatchActionId(matchActionId++),
-                new SwitchPort((long) 0, (short) 0), ipMatch, actions);
+        MatchAction matchAction = new MatchAction(maIdGenerator.getNewId(),
+                new SwitchPort(sw.getDpid().value(), (short) 0), ipMatch, actions);
 
         Operator operator = null;
         if (modified)
@@ -1045,21 +1074,22 @@
         MatchActionOperationEntry maEntry =
                 new MatchActionOperationEntry(operator, matchAction);
 
-        IOF13Switch sw13 = (IOF13Switch) floodlightProvider.getMasterSwitch(sw.getDpid().value());
         //        getSwId(sw.getDpid().toString()));
 
-        if (sw13 != null) {
-            try {
-                //printMatchActionOperationEntry(sw, maEntry);
-                if (entries != null)
-                    entries.add(maEntry);
-                else
+        if (entries != null)
+            entries.add(maEntry);
+        else {
+            executeMatchActionOpEntry(maEntry);
+            /*IOF13Switch sw13 = (IOF13Switch)
+                    floodlightProvider.getMasterSwitch(sw.getDpid().value());
+            if (sw13 != null) {
+                try {
                     sw13.pushFlow(maEntry);
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }*/
         }
-
     }
 
     /**
@@ -1097,7 +1127,12 @@
             maEntries.add(buildMAEntry(sw, mplsLabel, fwdSws, false, true));
             maEntries.add(buildMAEntry(sw, mplsLabel, fwdSws, false, false));
         }
-        IOF13Switch sw13 = (IOF13Switch) floodlightProvider.getMasterSwitch(
+        MatchActionOperations mao = new MatchActionOperations(
+                maoIdGenerator.getNewId());
+        for (MatchActionOperationEntry maEntry : maEntries)
+            mao.addOperation(maEntry);
+        matchActionService.executeOperations(mao);
+        /*IOF13Switch sw13 = (IOF13Switch) floodlightProvider.getMasterSwitch(
                 sw.getDpid().value());
 
         if (sw13 != null) {
@@ -1107,7 +1142,7 @@
             } catch (IOException e) {
                 e.printStackTrace();
             }
-        }
+        }*/
     }
 
 
@@ -1362,9 +1397,9 @@
      *
      * @return MatchAction ID
      */
-    public long getNextMatchActionID() {
-        return this.matchActionId++;
-    }
+    // public long getNextMatchActionID() {
+    // return this.matchActionId++;
+    // }
 
     /**
      * Get ports for the adjacency SID given
@@ -1558,8 +1593,8 @@
             actions.add(groupAction);
         }
 
-        MatchAction matchAction = new MatchAction(new MatchActionId(matchActionId++),
-                new SwitchPort((long) 0, (short) 0), mplsMatch, actions);
+        MatchAction matchAction = new MatchAction(maIdGenerator.getNewId(),
+                new SwitchPort(sw.getDpid().value(), (short) 0), mplsMatch, actions);
         Operator operator = Operator.ADD;
         MatchActionOperationEntry maEntry =
                 new MatchActionOperationEntry(operator, matchAction);
@@ -1891,7 +1926,7 @@
     }
 
     public MatchActionId getMatchActionId() {
-        return new MatchActionId(matchActionId++);
+        return maIdGenerator.getNewId();
     }
 
     // ************************************
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingPolicyTunnel.java b/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingPolicyTunnel.java
index 8e9a576..c3f3428 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingPolicyTunnel.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingPolicyTunnel.java
@@ -7,7 +7,6 @@
 import net.floodlightcontroller.core.IOF13Switch;
 import net.onrc.onos.apps.segmentrouting.SegmentRoutingTunnel.TunnelRouteInfo;
 import net.onrc.onos.core.matchaction.MatchAction;
-import net.onrc.onos.core.matchaction.MatchActionId;
 import net.onrc.onos.core.matchaction.MatchActionOperationEntry;
 import net.onrc.onos.core.matchaction.MatchActionOperations.Operator;
 import net.onrc.onos.core.matchaction.action.Action;
@@ -26,8 +25,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.esotericsoftware.minlog.Log;
-
 public class SegmentRoutingPolicyTunnel extends SegmentRoutingPolicy {
 
     private static final Logger log = LoggerFactory
@@ -84,14 +81,15 @@
                 actions.add(groupAction);
             }
 
-            MatchAction matchAction = new MatchAction(new MatchActionId(
-                    srManager.getNextMatchActionID()),
+            MatchAction matchAction = new MatchAction(
+                    srManager.getMatchActionId(),
                     new SwitchPort((long) 0, (short) 0), match, priority,
                     actions);
             MatchActionOperationEntry maEntry =
                     new MatchActionOperationEntry(Operator.ADD, matchAction);
+            srManager.executeMatchActionOpEntry(maEntry);
 
-            IOF13Switch sw13 = srManager.getIOF13Switch(route.getSrcSwDpid());
+            /*IOF13Switch sw13 = srManager.getIOF13Switch(route.getSrcSwDpid());
 
             if (sw13 != null) {
                 srManager.printMatchActionOperationEntry(sw13, maEntry);
@@ -105,7 +103,7 @@
             else {
                 Log.warn("Cannot find the target switch {}", route.getSrcSwDpid());
                 return false;
-            }
+            }*/
         }
 
         return true;
@@ -120,8 +118,8 @@
         groupAction.setGroupId(gropuId);
         actions.add(groupAction);
 
-        MatchAction matchAction = new MatchAction(new MatchActionId(
-                srManager.getNextMatchActionID()),
+        MatchAction matchAction = new MatchAction(
+                srManager.getMatchActionId(),
                 new SwitchPort((long) 0, (short) 0), match, priority,
                 actions);
         MatchActionOperationEntry maEntry =
diff --git a/src/main/java/net/onrc/onos/core/matchaction/MatchActionComponent.java b/src/main/java/net/onrc/onos/core/matchaction/MatchActionComponent.java
index 387ef28..4fe8811 100644
--- a/src/main/java/net/onrc/onos/core/matchaction/MatchActionComponent.java
+++ b/src/main/java/net/onrc/onos/core/matchaction/MatchActionComponent.java
@@ -1,5 +1,6 @@
 package net.onrc.onos.core.matchaction;
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.EventListener;
 import java.util.HashMap;
@@ -14,6 +15,8 @@
 import java.util.concurrent.ExecutionException;
 
 import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.IOF13Switch;
+import net.floodlightcontroller.core.IOFSwitch;
 import net.floodlightcontroller.core.internal.OFMessageFuture;
 import net.floodlightcontroller.core.module.IFloodlightService;
 import net.onrc.onos.api.flowmanager.ConflictDetectionPolicy;
@@ -354,15 +357,32 @@
                 }
             }
 
-            // push flow entries to switches
-            pusher.pushMatchActions(installSet);
-
             // insert a barrier after each phase on each modifiedSwitch
             // wait for confirmation messages before proceeding
             List<Pair<Dpid, OFMessageFuture<OFBarrierReply>>> barriers = new ArrayList<>();
+            int i=0;
             for (Dpid dpid : modifiedSwitches) {
-                barriers.add(Pair.of(dpid, pusher.barrierAsync(dpid)));
+                IOFSwitch sw = provider.getMasterSwitch(dpid.value());
+                if ((sw != null) && (sw instanceof IOF13Switch)) {
+                    try {
+                        ((IOF13Switch) sw).pushFlows(installSet);
+                        barriers.add(Pair.of(dpid,
+                                (OFMessageFuture<OFBarrierReply>) sw.sendBarrier()));
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                }
+                else {
+                    if (i == 0) {
+                        // push flow entries to switches
+                        pusher.pushMatchActions(installSet);
+                        i = 1;
+                    }
+
+                    barriers.add(Pair.of(dpid, pusher.barrierAsync(dpid)));
+                }
             }
+
             List<SwitchResult> switchResults = new ArrayList<>();
             for (Pair<Dpid, OFMessageFuture<OFBarrierReply>> pair : barriers) {
                 Dpid dpid = pair.getLeft();
diff --git a/src/main/java/net/onrc/onos/core/matchaction/action/DecMplsTtlAction.java b/src/main/java/net/onrc/onos/core/matchaction/action/DecMplsTtlAction.java
index 02cfeec..5f19a1f 100644
--- a/src/main/java/net/onrc/onos/core/matchaction/action/DecMplsTtlAction.java
+++ b/src/main/java/net/onrc/onos/core/matchaction/action/DecMplsTtlAction.java
@@ -3,6 +3,14 @@
 public class DecMplsTtlAction implements Action {
     private final int dec;
 
+    /**
+     * Default constructor for Kryo deserialization.
+     */
+    @Deprecated
+    public DecMplsTtlAction() {
+        this.dec = 0;
+    }
+
     public DecMplsTtlAction(int d) {
         this.dec = d;
     }
diff --git a/src/main/java/net/onrc/onos/core/matchaction/action/DecNwTtlAction.java b/src/main/java/net/onrc/onos/core/matchaction/action/DecNwTtlAction.java
index 5770ea2..6109a59 100644
--- a/src/main/java/net/onrc/onos/core/matchaction/action/DecNwTtlAction.java
+++ b/src/main/java/net/onrc/onos/core/matchaction/action/DecNwTtlAction.java
@@ -3,6 +3,14 @@
 public class DecNwTtlAction implements Action {
     private final int dec;
 
+    /**
+     * Default constructor for Kryo deserialization.
+     */
+    @Deprecated
+    public DecNwTtlAction() {
+        this.dec = 0;
+    }
+
     public DecNwTtlAction(int d) {
         this.dec = d;
     }
diff --git a/src/main/java/net/onrc/onos/core/matchaction/action/PopMplsAction.java b/src/main/java/net/onrc/onos/core/matchaction/action/PopMplsAction.java
index 38f5617..69b6e67 100644
--- a/src/main/java/net/onrc/onos/core/matchaction/action/PopMplsAction.java
+++ b/src/main/java/net/onrc/onos/core/matchaction/action/PopMplsAction.java
@@ -3,13 +3,21 @@
 import org.projectfloodlight.openflow.types.EthType;
 
 public class PopMplsAction implements Action {
-    private final EthType ethtype;
+    private final int ethtype;
+
+    /**
+     * Default constructor for Kryo deserialization.
+     */
+    @Deprecated
+    public PopMplsAction() {
+        this.ethtype = EthType.IPv4.getValue();
+    }
 
     public PopMplsAction(EthType ethtype) {
-        this.ethtype = ethtype;
+        this.ethtype = ethtype.getValue();
     }
 
     public EthType getEthType() {
-        return ethtype;
+        return EthType.of(ethtype);
     }
 }
diff --git a/src/main/java/net/onrc/onos/core/matchaction/action/SetDAAction.java b/src/main/java/net/onrc/onos/core/matchaction/action/SetDAAction.java
index 8209ec0..c04fda7 100644
--- a/src/main/java/net/onrc/onos/core/matchaction/action/SetDAAction.java
+++ b/src/main/java/net/onrc/onos/core/matchaction/action/SetDAAction.java
@@ -1,19 +1,33 @@
 package net.onrc.onos.core.matchaction.action;
 
+import net.floodlightcontroller.util.MACAddress;
+
 import org.projectfloodlight.openflow.types.MacAddress;
 
 public class SetDAAction implements Action {
-    MacAddress macAddress;
+    /* Changing OF MacAddress type to ONOS MACAddress to facilitate
+     * kyro serialization though APIs still use OF MacAddress
+     */
+    // MacAddress macAddress;
+    MACAddress macAddress;
+
+    /**
+     * Default constructor for Kryo deserialization.
+     */
+    @Deprecated
+    public SetDAAction() {
+        this.macAddress = null;
+    }
 
     public SetDAAction(MacAddress macAddress) {
-        this.macAddress = macAddress;
+        this.macAddress = MACAddress.valueOf(macAddress.getLong());
     }
 
     public MacAddress getAddress() {
-        return this.macAddress;
+        return MacAddress.of(this.macAddress.toLong());
     }
 
     public void setAddress(MacAddress macAddress) {
-        this.macAddress = macAddress;
+        this.macAddress = MACAddress.valueOf(macAddress.getLong());
     }
 }
diff --git a/src/main/java/net/onrc/onos/core/matchaction/action/SetMplsBosAction.java b/src/main/java/net/onrc/onos/core/matchaction/action/SetMplsBosAction.java
index 610fc2d..c919d79 100644
--- a/src/main/java/net/onrc/onos/core/matchaction/action/SetMplsBosAction.java
+++ b/src/main/java/net/onrc/onos/core/matchaction/action/SetMplsBosAction.java
@@ -3,6 +3,14 @@
 public class SetMplsBosAction implements Action {
     private final boolean mplsBos;
 
+    /**
+     * Default constructor for Kryo deserialization.
+     */
+    @Deprecated
+    public SetMplsBosAction() {
+        mplsBos = true;
+    }
+
     public SetMplsBosAction(boolean setBos) {
         mplsBos = setBos;
     }
diff --git a/src/main/java/net/onrc/onos/core/matchaction/action/SetMplsIdAction.java b/src/main/java/net/onrc/onos/core/matchaction/action/SetMplsIdAction.java
index 14a39c8..d4943fc 100644
--- a/src/main/java/net/onrc/onos/core/matchaction/action/SetMplsIdAction.java
+++ b/src/main/java/net/onrc/onos/core/matchaction/action/SetMplsIdAction.java
@@ -3,6 +3,14 @@
 public class SetMplsIdAction implements Action {
     private final int mplsId;
 
+    /**
+     * Default constructor for Kryo deserialization.
+     */
+    @Deprecated
+    public SetMplsIdAction() {
+        this.mplsId = -1;
+    }
+
     public SetMplsIdAction(int id) {
         this.mplsId = id;
     }
diff --git a/src/main/java/net/onrc/onos/core/matchaction/action/SetSAAction.java b/src/main/java/net/onrc/onos/core/matchaction/action/SetSAAction.java
index 0281746..e59038a 100644
--- a/src/main/java/net/onrc/onos/core/matchaction/action/SetSAAction.java
+++ b/src/main/java/net/onrc/onos/core/matchaction/action/SetSAAction.java
@@ -1,17 +1,31 @@
 package net.onrc.onos.core.matchaction.action;
 
+import net.floodlightcontroller.util.MACAddress;
+
 import org.projectfloodlight.openflow.types.MacAddress;
 
 public class SetSAAction implements Action {
 
-    MacAddress macAddress;
+    /* Changing OF MacAddress type to ONOS MACAddress to facilitate
+     * kyro serialization though APIs still use OF MacAddress
+     */
+    // MacAddress macAddress;
+    MACAddress macAddress;
+
+    /**
+     * Default constructor for Kryo deserialization.
+     */
+    @Deprecated
+    public SetSAAction() {
+        this.macAddress = null;
+    }
 
     public SetSAAction (MacAddress macAddress) {
-        this.macAddress = macAddress;
+        this.macAddress = MACAddress.valueOf(macAddress.getLong());
     }
 
     public MacAddress getAddress() {
-        return this.macAddress;
+        return MacAddress.of(this.macAddress.toLong());
     }
 
 }
diff --git a/src/main/java/net/onrc/onos/core/matchaction/match/Ipv4Match.java b/src/main/java/net/onrc/onos/core/matchaction/match/Ipv4Match.java
index a6d1bff..3bfafa5 100644
--- a/src/main/java/net/onrc/onos/core/matchaction/match/Ipv4Match.java
+++ b/src/main/java/net/onrc/onos/core/matchaction/match/Ipv4Match.java
@@ -7,6 +7,14 @@
 
     IPv4Net dstIp;
 
+    /**
+     * Default constructor for Kryo deserialization.
+     */
+    @Deprecated
+    public Ipv4Match() {
+        this.dstIp = null;
+    }
+
     public Ipv4Match(String ipAddressSlash) {
         this.dstIp = new IPv4Net(ipAddressSlash);
 
diff --git a/src/main/java/net/onrc/onos/core/matchaction/match/MplsMatch.java b/src/main/java/net/onrc/onos/core/matchaction/match/MplsMatch.java
index 96d65f9..5f94f1c 100644
--- a/src/main/java/net/onrc/onos/core/matchaction/match/MplsMatch.java
+++ b/src/main/java/net/onrc/onos/core/matchaction/match/MplsMatch.java
@@ -5,6 +5,15 @@
     private final int mplsLabel;
     private final boolean bos;
 
+    /**
+     * Default constructor for Kryo deserialization.
+     */
+    @Deprecated
+    public MplsMatch() {
+        this.mplsLabel = -1;
+        this.bos = true;
+    }
+
     public MplsMatch(int label, boolean bos) {
         this.mplsLabel = label;
         this.bos = bos;
diff --git a/src/main/java/net/onrc/onos/core/util/serializers/KryoFactory.java b/src/main/java/net/onrc/onos/core/util/serializers/KryoFactory.java
index a19636b..8e9b000 100644
--- a/src/main/java/net/onrc/onos/core/util/serializers/KryoFactory.java
+++ b/src/main/java/net/onrc/onos/core/util/serializers/KryoFactory.java
@@ -14,6 +14,8 @@
 import javax.annotation.concurrent.ThreadSafe;
 
 import net.floodlightcontroller.core.IFloodlightProviderService.Role;
+import net.floodlightcontroller.core.IOF13Switch.NeighborSet;
+import net.floodlightcontroller.core.IOF13Switch.NeighborSet.groupPktType;
 import net.floodlightcontroller.util.MACAddress;
 import net.onrc.onos.api.batchoperation.BatchOperationEntry;
 import net.onrc.onos.api.flowmanager.FlowBatchOperation;
@@ -55,10 +57,23 @@
 import net.onrc.onos.core.matchaction.MatchActionOperationsState;
 import net.onrc.onos.core.matchaction.SwitchResult;
 import net.onrc.onos.core.matchaction.SwitchResultList;
+import net.onrc.onos.core.matchaction.action.CopyTtlInAction;
+import net.onrc.onos.core.matchaction.action.CopyTtlOutAction;
+import net.onrc.onos.core.matchaction.action.DecMplsTtlAction;
+import net.onrc.onos.core.matchaction.action.DecNwTtlAction;
+import net.onrc.onos.core.matchaction.action.GroupAction;
 import net.onrc.onos.core.matchaction.action.ModifyDstMacAction;
 import net.onrc.onos.core.matchaction.action.ModifySrcMacAction;
 import net.onrc.onos.core.matchaction.action.NullAction;
 import net.onrc.onos.core.matchaction.action.OutputAction;
+import net.onrc.onos.core.matchaction.action.PopMplsAction;
+import net.onrc.onos.core.matchaction.action.PushMplsAction;
+import net.onrc.onos.core.matchaction.action.SetDAAction;
+import net.onrc.onos.core.matchaction.action.SetMplsBosAction;
+import net.onrc.onos.core.matchaction.action.SetMplsIdAction;
+import net.onrc.onos.core.matchaction.action.SetSAAction;
+import net.onrc.onos.core.matchaction.match.Ipv4Match;
+import net.onrc.onos.core.matchaction.match.MplsMatch;
 import net.onrc.onos.core.matchaction.match.PacketMatch;
 import net.onrc.onos.core.newintent.IntentCompilationResult;
 import net.onrc.onos.core.newintent.PathFlowIntent;
@@ -66,6 +81,7 @@
 import net.onrc.onos.core.newintent.SingleSrcTreeFlowIntent;
 import net.onrc.onos.core.newintent.TestIntent;
 import net.onrc.onos.core.newintent.TestSubclassIntent;
+import net.onrc.onos.core.packet.MPLS;
 import net.onrc.onos.core.packetservice.BroadcastPacketOutNotification;
 import net.onrc.onos.core.packetservice.PacketOutNotification;
 import net.onrc.onos.core.packetservice.SinglePacketOutNotification;
@@ -197,6 +213,7 @@
         kryo.register(Dpid.class);
         kryo.register(IPv4.class);
         kryo.register(IPv4Net.class);
+        kryo.register(MPLS.class);
         kryo.register(IPv6.class);
         kryo.register(IPv6Net.class);
         kryo.register(byte[].class);
@@ -279,9 +296,22 @@
         kryo.register(MatchAction.class);
         kryo.register(MatchActionId.class);
         kryo.register(PacketMatch.class);
+        kryo.register(Ipv4Match.class);
+        kryo.register(MplsMatch.class);
         kryo.register(OutputAction.class);
         kryo.register(ModifyDstMacAction.class);
         kryo.register(ModifySrcMacAction.class);
+        kryo.register(CopyTtlInAction.class);
+        kryo.register(CopyTtlOutAction.class);
+        kryo.register(DecMplsTtlAction.class);
+        kryo.register(DecNwTtlAction.class);
+        kryo.register(GroupAction.class);
+        kryo.register(PopMplsAction.class);
+        kryo.register(PushMplsAction.class);
+        kryo.register(SetDAAction.class);
+        kryo.register(SetSAAction.class);
+        kryo.register(SetMplsBosAction.class);
+        kryo.register(SetMplsIdAction.class);
         kryo.register(MatchActionOperations.class);
         kryo.register(MatchActionOperations.Operator.class);
         kryo.register(MatchActionOperationsId.class);
@@ -308,6 +338,9 @@
         kryo.register(InetAddress.class);
         kryo.register(Inet4Address.class);
 
+        kryo.register(NeighborSet.class);
+        kryo.register(groupPktType.class);
+
         return kryo;
     }