BUG-956 deadlock by rpc invocation - phase2
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / ActionConvertor.java
index 2ddf5ccbf557317aa15b2bf1248fb2f02e1dfbc5..bd99edfdbcdb4ab666188814a1b2e1a7c114a1b2 100644 (file)
@@ -1,55 +1,24 @@
+/**
+ * Copyright (c) 2014 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor: hema.gopalkrishnan@ericsson.com
+ */
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.opendaylight.openflowjava.protocol.api.util.BinContent;
 import org.opendaylight.openflowplugin.openflow.md.OFConstants;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionSetNwDstReactor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.ActionSetNwSrcReactor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchConvertorImpl;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchReactor;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopPbbActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopPbbActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.StripVlanActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.*;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.in._case.CopyTtlInBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.out._case.CopyTtlOutBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.mpls.ttl._case.DecMplsTtlBuilder;
@@ -69,8 +38,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.tos.action._case.SetNwTosAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.queue.action._case.SetQueueAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.queue.action._case.SetQueueActionBuilder;
@@ -79,54 +47,28 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.pcp.action._case.SetVlanPcpAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.OutputPortValues;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.ActionsList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.ActionsListBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumberValues;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumberValuesV10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * @author usha@ericsson Action List:This class takes data from SAL layer and
  *         converts into OF Data
@@ -137,169 +79,165 @@ import org.slf4j.LoggerFactory;
 public final class ActionConvertor {
     private static final Logger logger = LoggerFactory.getLogger(ActionConvertor.class);
     private static final String PREFIX_SEPARATOR = "/";
+    final private static Long MAXPortOF13 = new Long(4294967040L); // 0xffffff00
+    final private static Long MAXPortOF10 = new Long(0xff00);
 
     private ActionConvertor() {
         // NOOP
     }
 
-    public static List<ActionsList> getActionList(
+    /**
+     * Translates SAL actions into OF Library actions
+     * @param actions SAL actions
+     * @param version Openflow protocol version used
+     * @param datapathid
+     * @return OF Library actions
+     */
+    public static List<Action> getActions(
             List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actions,
-            short version)
+            short version, BigInteger datapathid)
 
     {
-        ActionsListBuilder actionsListBuilder = new ActionsListBuilder();
-        List<ActionsList> actionsList = new ArrayList<ActionsList>();
+        List<Action> actionsList = new ArrayList<>();
+        Action ofAction;
 
         for (int actionItem = 0; actionItem < actions.size(); actionItem++) {
+            ofAction = null;
+            ActionBuilder actionBuilder = new ActionBuilder();
 
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action = actions.get(
                     actionItem).getAction();
 
             if (action instanceof OutputActionCase)
-                actionsList.add(salToOFOutputAction(action, actionsListBuilder, version));
+                ofAction = salToOFOutputAction(action, actionBuilder, version);
             else if (action instanceof GroupActionCase)
-                actionsList.add(SalToOFGroupAction(action, actionsListBuilder));
+                ofAction = SalToOFGroupAction(action, actionBuilder);
             else if (action instanceof CopyTtlOutCase)
-                actionsList.add(SalToOFCopyTTLIOut(actionsListBuilder));
+                ofAction = SalToOFCopyTTLIOut(actionBuilder);
             else if (action instanceof CopyTtlInCase)
-                actionsList.add(SalToOFCopyTTLIIn(actionsListBuilder));
+                ofAction = SalToOFCopyTTLIIn(actionBuilder);
             else if (action instanceof SetMplsTtlActionCase)
-                actionsList.add(SalToOFSetMplsTtl(action, actionsListBuilder));
+                ofAction = SalToOFSetMplsTtl(action, actionBuilder);
             else if (action instanceof DecMplsTtlCase)
-                actionsList.add(SalToOFDecMplsTtl(actionsListBuilder));
+                ofAction = SalToOFDecMplsTtl(actionBuilder);
             else if (action instanceof PushVlanActionCase)
-                actionsList.add(SalToOFPushVlanAction(action, actionsListBuilder));
+                ofAction = SalToOFPushVlanAction(action, actionBuilder);
             else if (action instanceof PopVlanActionCase)
-                actionsList.add(SalToOFPopVlan(action, actionsListBuilder));
+                ofAction = SalToOFPopVlan(actionBuilder);
             else if (action instanceof PushMplsActionCase)
-                actionsList.add(SalToOFPushMplsAction(action, actionsListBuilder));
+                ofAction = SalToOFPushMplsAction(action, actionBuilder);
             else if (action instanceof PopMplsActionCase)
-                actionsList.add(SalToOFPopMpls(action, actionsListBuilder));
+                ofAction = SalToOFPopMpls(action, actionBuilder);
             else if (action instanceof SetQueueActionCase)
-                actionsList.add(SalToOFSetQueue(action, actionsListBuilder));
+                ofAction = SalToOFSetQueue(action, actionBuilder);
             else if (action instanceof SetNwTtlActionCase)
-                actionsList.add(SalToOFSetNwTtl(action, actionsListBuilder));
+                ofAction = SalToOFSetNwTtl(action, actionBuilder);
             else if (action instanceof DecNwTtlCase)
-                actionsList.add(SalToOFDecNwTtl(action, actionsListBuilder));
+                ofAction = SalToOFDecNwTtl(actionBuilder);
             else if (action instanceof SetFieldCase)
-                actionsList.add(SalToOFSetField(action, actionsListBuilder, version));
+                ofAction = SalToOFSetField(action, actionBuilder, version, datapathid);
             else if (action instanceof PushPbbActionCase)
-                actionsList.add(SalToOFPushPbbAction(action, actionsListBuilder));
+                ofAction = SalToOFPushPbbAction(action, actionBuilder);
             else if (action instanceof PopPbbActionCase)
-                actionsList.add(SalToOFPopPBB(action, actionsListBuilder));
+                ofAction = SalToOFPopPBB(actionBuilder);
             else if (action instanceof ExperimenterAction)
-                actionsList.add(SalToOFExperimenter(action, actionsListBuilder));
+                ofAction = SalToOFExperimenter(action, actionBuilder);
 
             // 1.0 Actions
             else if (action instanceof SetVlanIdActionCase)
-                actionsList.add(SalToOFSetVlanId(action, actionsListBuilder, version));
+                ofAction = SalToOFSetVlanId(action, actionBuilder, version);
             else if (action instanceof SetVlanPcpActionCase)
-                actionsList.add(SalToOFSetVlanpcp(action, actionsListBuilder, version));
+                ofAction = SalToOFSetVlanpcp(action, actionBuilder, version);
             else if (action instanceof StripVlanActionCase)
-                actionsList.add(SalToOFStripVlan(action, actionsListBuilder, version));
+                ofAction = SalToOFStripVlan(actionBuilder, version);
             else if (action instanceof SetDlSrcActionCase)
-                actionsList.add(SalToOFSetDlSrc(action, actionsListBuilder, version));
+                ofAction = SalToOFSetDlSrc(action, actionBuilder, version);
             else if (action instanceof SetDlDstActionCase)
-                actionsList.add(SalToOFSetDlDst(action, actionsListBuilder, version));
+                ofAction = SalToOFSetDlDst(action, actionBuilder, version);
             else if (action instanceof SetNwSrcActionCase)
-                actionsList.add(SalToOFSetNwSrc(action, actionsListBuilder, version));
+                ofAction = SalToOFSetNwSrc(action, actionBuilder, version);
             else if (action instanceof SetNwDstActionCase)
-                actionsList.add(SalToOFSetNwDst(action, actionsListBuilder, version));
+                ofAction = SalToOFSetNwDst(action, actionBuilder, version);
             else if (action instanceof SetTpSrcActionCase)
-                actionsList.add(SalToOFSetTpSrc(action, actionsListBuilder, version));
+                ofAction = SalToOFSetTpSrc(action, actionBuilder, version);
             else if (action instanceof SetTpDstActionCase)
-                actionsList.add(SalToOFSetTpDst(action, actionsListBuilder, version));
+                ofAction = SalToOFSetTpDst(action, actionBuilder, version);
+            else if (action instanceof SetNwTosActionCase)
+                ofAction = SalToOFSetNwTos(action, actionBuilder, version);
 
+            if (ofAction != null) {
+                actionsList.add(ofAction);
+            }
         }
         return actionsList;
-
     }
 
-    private static ActionsList SalToOFSetField(
+    private static Action SalToOFSetField(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder, short version) {
+            ActionBuilder actionBuilder, short version, BigInteger datapathid) {
 
         SetFieldCase setFieldCase = (SetFieldCase) action;
         org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match match = setFieldCase
                 .getSetField();
 
         OxmFieldsActionBuilder oxmFieldsActionBuilder = new OxmFieldsActionBuilder();
-        MatchReactor.getInstance().convert(match, version, oxmFieldsActionBuilder);
+        MatchReactor.getInstance().convert(match, version, oxmFieldsActionBuilder, datapathid);
 
-        ActionBuilder actionBuilder = new ActionBuilder();
         actionBuilder
                 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class);
 
         actionBuilder.addAugmentation(OxmFieldsAction.class, oxmFieldsActionBuilder.build());
-        actionsListBuilder.setAction(actionBuilder.build());
-        return actionsListBuilder.build();
-
+        return actionBuilder.build();
     }
 
-    private static ActionsList SalToOFDecNwTtl(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder) {
-        ActionBuilder actionBuilder = new ActionBuilder();
+    private static Action SalToOFDecNwTtl(ActionBuilder actionBuilder) {
         actionBuilder
                 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl.class);
-
-        return emtpyAction(actionBuilder, actionsListBuilder);
+        return emtpyAction(actionBuilder);
     }
 
-    private static ActionsList SalToOFPushMplsAction(
+    private static Action SalToOFPushMplsAction(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder) {
-        ActionBuilder actionBuilder = new ActionBuilder();
+            ActionBuilder actionBuilder) {
         PushMplsActionCase pushMplsActionCase = (PushMplsActionCase) action;
-
         actionBuilder.setType(PushMpls.class);
 
-        return SalToOFPushAction(pushMplsActionCase.getPushMplsAction().getEthernetType(), actionBuilder,
-                actionsListBuilder);
-
+        return SalToOFPushAction(pushMplsActionCase.getPushMplsAction().getEthernetType(), actionBuilder);
     }
 
-    private static ActionsList SalToOFPushPbbAction(
+    private static Action SalToOFPushPbbAction(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder) {
-        ActionBuilder actionBuilder = new ActionBuilder();
+            ActionBuilder actionBuilder) {
         PushPbbActionCase pushPbbActionCase = (PushPbbActionCase) action;
         actionBuilder.setType(PushPbb.class);
 
-        return SalToOFPushAction(pushPbbActionCase.getPushPbbAction().getEthernetType(), actionBuilder,
-                actionsListBuilder);
+        return SalToOFPushAction(pushPbbActionCase.getPushPbbAction().getEthernetType(), actionBuilder);
     }
 
-    private static ActionsList SalToOFPushVlanAction(
+    private static Action SalToOFPushVlanAction(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder) {
-        ActionBuilder actionBuilder = new ActionBuilder();
+            ActionBuilder actionBuilder) {
         PushVlanActionCase pushVlanActionCase = (PushVlanActionCase) action;
         PushVlanAction pushVlanAction = pushVlanActionCase.getPushVlanAction();
         actionBuilder.setType(PushVlan.class);
 
-        return SalToOFPushAction(pushVlanAction.getEthernetType(), actionBuilder, actionsListBuilder);
-
+        return SalToOFPushAction(pushVlanAction.getEthernetType(), actionBuilder);
     }
 
-    private static ActionsList SalToOFSetNwTtl(
+    private static Action SalToOFSetNwTtl(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder) {
-        ActionBuilder actionBuilder = new ActionBuilder();
+            ActionBuilder actionBuilder) {
         SetNwTtlActionCase nwTtlActionCase = (SetNwTtlActionCase) action;
         NwTtlActionBuilder nwTtlActionBuilder = new NwTtlActionBuilder();
         nwTtlActionBuilder.setNwTtl(nwTtlActionCase.getSetNwTtlAction().getNwTtl());
         actionBuilder.setType(SetNwTtl.class);
         actionBuilder.addAugmentation(NwTtlAction.class, nwTtlActionBuilder.build());
-        actionsListBuilder.setAction(actionBuilder.build());
-        return actionsListBuilder.build();
-
+        return actionBuilder.build();
     }
 
-    private static ActionsList SalToOFSetQueue(
+    private static Action SalToOFSetQueue(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder) {
-        ActionBuilder actionBuilder = new ActionBuilder();
+            ActionBuilder actionBuilder) {
         SetQueueActionCase setQueueActionCase = (SetQueueActionCase) action;
         SetQueueAction setQueueAction = setQueueActionCase.getSetQueueAction();
 
@@ -308,134 +246,160 @@ public final class ActionConvertor {
         actionBuilder.setType(SetQueue.class);
         actionBuilder.addAugmentation(QueueIdAction.class, queueIdActionBuilder.build());
 
-        actionsListBuilder.setAction(actionBuilder.build());
-        return actionsListBuilder.build();
+        return actionBuilder.build();
     }
 
-    private static ActionsList SalToOFPopMpls(
+    private static Action SalToOFPopMpls(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder) {
-        ActionBuilder actionBuilder = new ActionBuilder();
+            ActionBuilder actionBuilder) {
         PopMplsActionCase popMplsActionCase = (PopMplsActionCase) action;
         actionBuilder.setType(PopMpls.class);
 
-        return SalToOFPushAction(popMplsActionCase.getPopMplsAction().getEthernetType(), actionBuilder,
-                actionsListBuilder);
+        return SalToOFPushAction(popMplsActionCase.getPopMplsAction().getEthernetType(), actionBuilder);
     }
 
-    private static ActionsList SalToOFPopVlan(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder) {
-        ActionBuilder actionBuilder = new ActionBuilder();
+    private static Action SalToOFPopVlan(ActionBuilder actionBuilder) {
         actionBuilder.setType(PopVlan.class);
-
-        return emtpyAction(actionBuilder, actionsListBuilder);
+        return emtpyAction(actionBuilder);
     }
 
-    private static ActionsList SalToOFPopPBB(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder) {
-        ActionBuilder actionBuilder = new ActionBuilder();
+    private static Action SalToOFPopPBB(ActionBuilder actionBuilder) {
         actionBuilder.setType(PopPbb.class);
-        return emtpyAction(actionBuilder, actionsListBuilder);
+        return emtpyAction(actionBuilder);
     }
 
-    private static ActionsList SalToOFExperimenter(
+    private static Action SalToOFExperimenter(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder) {
-
-        ActionBuilder actionBuilder = new ActionBuilder();
+            ActionBuilder actionBuilder) {
         ExperimenterActionBuilder experimenterActionBuilder = new ExperimenterActionBuilder();
         experimenterActionBuilder.setExperimenter(((ExperimenterAction) action).getExperimenter());
         actionBuilder.setType(Experimenter.class);
         actionBuilder
                 .addAugmentation(
                         ExperimenterAction.class,
-                        (Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.Action>) experimenterActionBuilder);
-        actionsListBuilder.setAction(actionBuilder.build());
-        return actionsListBuilder.build();
-
+                        (Augmentation<Action>) experimenterActionBuilder);
+        return actionBuilder.build();
     }
 
-    private static ActionsList SalToOFSetVlanId(
+    private static Action SalToOFSetVlanId(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder, short version) {
+            ActionBuilder actionBuilder, short version) {
+
+        SetVlanIdActionCase setvlanidcase = (SetVlanIdActionCase) action;
+        SetVlanIdAction setvlanidaction = setvlanidcase.getSetVlanIdAction();
 
         if (version == OFConstants.OFP_VERSION_1_0) {
-            ActionBuilder actionBuilder = new ActionBuilder();
-            SetVlanIdActionCase setvlanidcase = (SetVlanIdActionCase) action;
-            SetVlanIdAction setvlanidaction = setvlanidcase.getSetVlanIdAction();
 
             VlanVidActionBuilder vlanidActionBuilder = new VlanVidActionBuilder();
             vlanidActionBuilder.setVlanVid(setvlanidaction.getVlanId().getValue());
             actionBuilder
                     .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid.class);
             actionBuilder.addAugmentation(VlanVidAction.class, vlanidActionBuilder.build());
-            actionsListBuilder.setAction(actionBuilder.build());
-            return actionsListBuilder.build();
+            return actionBuilder.build();
+        } else if (version >= OFConstants.OFP_VERSION_1_3) {
+            OxmFieldsActionBuilder oxmFieldsActionBuilder = new OxmFieldsActionBuilder();
+            actionBuilder
+                    .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class);
+            List<MatchEntries> matchEntriesList = new ArrayList<>();
+            MatchEntriesBuilder matchEntriesBuilder = new MatchEntriesBuilder();
+            matchEntriesBuilder.setOxmClass(OpenflowBasicClass.class);
+            matchEntriesBuilder.setOxmMatchField(VlanVid.class);
+            VlanVidMatchEntryBuilder vlanVidBuilder = new VlanVidMatchEntryBuilder();
+            vlanVidBuilder.setCfiBit(true);
+            vlanVidBuilder.setVlanVid(setvlanidaction.getVlanId().getValue());
+            matchEntriesBuilder.addAugmentation(VlanVidMatchEntry.class, vlanVidBuilder.build());
+            matchEntriesBuilder.setHasMask(false);
+            matchEntriesList.add(matchEntriesBuilder.build());
+            oxmFieldsActionBuilder.setMatchEntries(matchEntriesList);
+            actionBuilder.addAugmentation(OxmFieldsAction.class, oxmFieldsActionBuilder.build());
+            return actionBuilder.build();
         } else {
             logger.error("Unknown Action Type for the Version", version);
             return null;
         }
-
     }
 
-    private static ActionsList SalToOFSetVlanpcp(
+    private static Action SalToOFSetVlanpcp(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder, short version) {
+            ActionBuilder actionBuilder, short version) {
 
-        if (version == OFConstants.OFP_VERSION_1_0) {
-            ActionBuilder actionBuilder = new ActionBuilder();
-            SetVlanPcpActionCase setvlanpcpcase = (SetVlanPcpActionCase) action;
-            SetVlanPcpAction setvlanpcpaction = setvlanpcpcase.getSetVlanPcpAction();
+        SetVlanPcpActionCase setvlanpcpcase = (SetVlanPcpActionCase) action;
+        SetVlanPcpAction setvlanpcpaction = setvlanpcpcase.getSetVlanPcpAction();
 
+        if (version == OFConstants.OFP_VERSION_1_0) {
             VlanPcpActionBuilder vlanpcpActionBuilder = new VlanPcpActionBuilder();
             vlanpcpActionBuilder.setVlanPcp(setvlanpcpaction.getVlanPcp().getValue());
             actionBuilder
                     .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanPcp.class);
             actionBuilder.addAugmentation(VlanPcpAction.class, vlanpcpActionBuilder.build());
-            actionsListBuilder.setAction(actionBuilder.build());
-            return actionsListBuilder.build();
+            return actionBuilder.build();
+        } else if (version >= OFConstants.OFP_VERSION_1_3) {
+            OxmFieldsActionBuilder oxmFieldsActionBuilder = new OxmFieldsActionBuilder();
+            actionBuilder
+                    .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class);
+            List<MatchEntries> matchEntriesList = new ArrayList<>();
+            matchEntriesList.add(MatchConvertorImpl.toOfVlanPcp(setvlanpcpaction.getVlanPcp()));
+            oxmFieldsActionBuilder.setMatchEntries(matchEntriesList);
+            actionBuilder.addAugmentation(OxmFieldsAction.class, oxmFieldsActionBuilder.build());
+            return actionBuilder.build();
         } else {
             logger.error("Unknown Action Type for the Version", version);
             return null;
         }
-
     }
 
-    private static ActionsList SalToOFStripVlan(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder, short version) {
-
+    private static Action SalToOFStripVlan(ActionBuilder actionBuilder, short version) {
         if (version == OFConstants.OFP_VERSION_1_0) {
-            ActionBuilder actionBuilder = new ActionBuilder();
             actionBuilder
                     .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.StripVlan.class);
 
-            return emtpyAction(actionBuilder, actionsListBuilder);
+            return emtpyAction(actionBuilder);
+        } else if (version >= OFConstants.OFP_VERSION_1_3) {
+            OxmFieldsActionBuilder oxmFieldsActionBuilder = new OxmFieldsActionBuilder();
+            actionBuilder
+                    .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class);
+            List<MatchEntries> matchEntriesList = new ArrayList<>();
+            MatchEntriesBuilder matchEntriesBuilder = new MatchEntriesBuilder();
+            matchEntriesBuilder.setOxmClass(OpenflowBasicClass.class);
+            matchEntriesBuilder.setOxmMatchField(VlanVid.class);
+            VlanVidMatchEntryBuilder vlanVidBuilder = new VlanVidMatchEntryBuilder();
+            vlanVidBuilder.setCfiBit(true);
+            vlanVidBuilder.setVlanVid(new Integer(0x0000));
+            matchEntriesBuilder.addAugmentation(VlanVidMatchEntry.class, vlanVidBuilder.build());
+            matchEntriesBuilder.setHasMask(false);
+            matchEntriesList.add(matchEntriesBuilder.build());
+            oxmFieldsActionBuilder.setMatchEntries(matchEntriesList);
+            actionBuilder.addAugmentation(OxmFieldsAction.class, oxmFieldsActionBuilder.build());
+            return actionBuilder.build();
         } else {
             logger.error("Unknown Action Type for the Version", version);
             return null;
         }
-
     }
 
-    private static ActionsList SalToOFSetDlSrc(
+    private static Action SalToOFSetDlSrc(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder, short version) {
+            ActionBuilder actionBuilder, short version) {
 
-        if (version == OFConstants.OFP_VERSION_1_0) {
-            ActionBuilder actionBuilder = new ActionBuilder();
-            SetDlSrcActionCase setdlsrccase = (SetDlSrcActionCase) action;
-            SetDlSrcAction setdlsrcaction = setdlsrccase.getSetDlSrcAction();
+        SetDlSrcActionCase setdlsrccase = (SetDlSrcActionCase) action;
+        SetDlSrcAction setdlsrcaction = setdlsrccase.getSetDlSrcAction();
 
+        if (version == OFConstants.OFP_VERSION_1_0) {
             DlAddressActionBuilder dladdressactionbuilder = new DlAddressActionBuilder();
             dladdressactionbuilder.setDlAddress(setdlsrcaction.getAddress());
             actionBuilder
                     .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc.class);
             actionBuilder.addAugmentation(DlAddressAction.class, dladdressactionbuilder.build());
-            actionsListBuilder.setAction(actionBuilder.build());
-            return actionsListBuilder.build();
+            return actionBuilder.build();
+        } else if (version >= OFConstants.OFP_VERSION_1_3) {
+            OxmFieldsActionBuilder oxmFieldsActionBuilder = new OxmFieldsActionBuilder();
+            actionBuilder
+                    .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class);
+            List<MatchEntries> matchEntriesList = new ArrayList<>();
+            matchEntriesList.add(MatchConvertorImpl.toOfMacAddress(EthSrc.class, setdlsrcaction.getAddress(), null));
+            oxmFieldsActionBuilder.setMatchEntries(matchEntriesList);
+            actionBuilder.addAugmentation(OxmFieldsAction.class, oxmFieldsActionBuilder.build());
+            return actionBuilder.build();
         } else {
             logger.error("Unknown Action Type for the Version", version);
             return null;
@@ -443,22 +407,29 @@ public final class ActionConvertor {
 
     }
 
-    private static ActionsList SalToOFSetDlDst(
+    private static Action SalToOFSetDlDst(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder, short version) {
+            ActionBuilder actionBuilder, short version) {
 
-        if (version == OFConstants.OFP_VERSION_1_0) {
-            ActionBuilder actionBuilder = new ActionBuilder();
-            SetDlDstActionCase setdldstcase = (SetDlDstActionCase) action;
-            SetDlDstAction setdldstaction = setdldstcase.getSetDlDstAction();
+        SetDlDstActionCase setdldstcase = (SetDlDstActionCase) action;
+        SetDlDstAction setdldstaction = setdldstcase.getSetDlDstAction();
 
+        if (version == OFConstants.OFP_VERSION_1_0) {
             DlAddressActionBuilder dladdressactionbuilder = new DlAddressActionBuilder();
             dladdressactionbuilder.setDlAddress(setdldstaction.getAddress());
             actionBuilder
                     .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst.class);
             actionBuilder.addAugmentation(DlAddressAction.class, dladdressactionbuilder.build());
-            actionsListBuilder.setAction(actionBuilder.build());
-            return actionsListBuilder.build();
+            return actionBuilder.build();
+        } else if (version >= OFConstants.OFP_VERSION_1_3) {
+            OxmFieldsActionBuilder oxmFieldsActionBuilder = new OxmFieldsActionBuilder();
+            actionBuilder
+                    .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class);
+            List<MatchEntries> matchEntriesList = new ArrayList<>();
+            matchEntriesList.add(MatchConvertorImpl.toOfMacAddress(EthDst.class, setdldstaction.getAddress(), null));
+            oxmFieldsActionBuilder.setMatchEntries(matchEntriesList);
+            actionBuilder.addAugmentation(OxmFieldsAction.class, oxmFieldsActionBuilder.build());
+            return actionBuilder.build();
         } else {
             logger.error("Unknown Action Type for the Version", version);
             return null;
@@ -466,50 +437,58 @@ public final class ActionConvertor {
 
     }
 
-    private static ActionsList SalToOFSetNwSrc(
+    protected static Action SalToOFSetNwSrc(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder, short version) {
-
-        if (version == OFConstants.OFP_VERSION_1_0) {
-            ActionBuilder actionBuilder = new ActionBuilder();
-            SetNwSrcActionCase setnwsrccase = (SetNwSrcActionCase) action;
-            SetNwSrcAction setnwsrcaction = setnwsrccase.getSetNwSrcAction();
+            ActionBuilder actionBuilder, short version) {
 
-            IpAddressActionBuilder ipvaddress = new IpAddressActionBuilder();
-            ipvaddress.setIpAddress((Ipv4Address) setnwsrcaction.getAddress());
-            actionBuilder
-                    .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwSrc.class);
-            actionBuilder.addAugmentation(
-                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction.class,
-                    ipvaddress.build());
-            actionsListBuilder.setAction(actionBuilder.build());
-            return actionsListBuilder.build();
-        } else {
-            logger.error("Unknown Action Type for the Version", version);
+        try {
+            ActionSetNwSrcReactor.getInstance().convert((SetNwSrcActionCase) action, version, actionBuilder, null);
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
             return null;
         }
+        
+        return actionBuilder.build();
+    }
+
+    protected static Action SalToOFSetNwDst(
+            org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
+            ActionBuilder actionBuilder, short version) {
 
+        try {
+            ActionSetNwDstReactor.getInstance().convert((SetNwDstActionCase) action, version, actionBuilder, null);
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            return null;
+        }
+        
+        return actionBuilder.build();
     }
 
-    private static ActionsList SalToOFSetNwDst(
+    private static Action SalToOFSetNwTos(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder, short version) {
+            ActionBuilder actionBuilder, short version) {
 
-        if (version == OFConstants.OFP_VERSION_1_0) {
-            ActionBuilder actionBuilder = new ActionBuilder();
-            SetNwDstActionCase setnwdstcase = (SetNwDstActionCase) action;
-            SetNwDstAction setnwdstaction = setnwdstcase.getSetNwDstAction();
+        SetNwTosActionCase setnwtoscase = (SetNwTosActionCase) action;
+        SetNwTosAction setnwtosaction = setnwtoscase.getSetNwTosAction();
 
-            IpAddressActionBuilder ipvaddress = new IpAddressActionBuilder();
-            ipvaddress.setIpAddress((Ipv4Address) setnwdstaction.getAddress());
+        if (version == OFConstants.OFP_VERSION_1_0) {
+            NwTosActionBuilder tosBuilder = new NwTosActionBuilder();
+            tosBuilder.setNwTos(setnwtosaction.getTos().shortValue());
+            actionBuilder.addAugmentation(NwTosAction.class, tosBuilder.build());
             actionBuilder
-                    .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwDst.class);
-            actionBuilder.addAugmentation(
-                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction.class,
-                    ipvaddress.build());
-            actionsListBuilder.setAction(actionBuilder.build());
-            return actionsListBuilder.build();
+                    .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTos.class);
 
+            return actionBuilder.build();
+        } else if (version >= OFConstants.OFP_VERSION_1_3) {
+            OxmFieldsActionBuilder oxmFieldsActionBuilder = new OxmFieldsActionBuilder();
+            actionBuilder
+                    .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class);
+            List<MatchEntries> matchEntriesList = new ArrayList<>();
+            matchEntriesList.add(MatchConvertorImpl.toOfIpDscp(new Dscp(setnwtosaction.getTos().shortValue())));
+            oxmFieldsActionBuilder.setMatchEntries(matchEntriesList);
+            actionBuilder.addAugmentation(OxmFieldsAction.class, oxmFieldsActionBuilder.build());
+            return actionBuilder.build();
         } else {
             logger.error("Unknown Action Type for the Version", version);
             return null;
@@ -517,12 +496,11 @@ public final class ActionConvertor {
 
     }
 
-    private static ActionsList SalToOFSetTpSrc(
+    private static Action SalToOFSetTpSrc(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder, short version) {
+            ActionBuilder actionBuilder, short version) {
 
         if (version == OFConstants.OFP_VERSION_1_0) {
-            ActionBuilder actionBuilder = new ActionBuilder();
             SetTpSrcActionCase settpsrccase = (SetTpSrcActionCase) action;
             SetTpSrcAction settpsrcaction = settpsrccase.getSetTpSrcAction();
 
@@ -533,22 +511,17 @@ public final class ActionConvertor {
             actionBuilder
                     .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpSrc.class);
             actionBuilder.addAugmentation(PortAction.class, settpsrc.build());
-            actionsListBuilder.setAction(actionBuilder.build());
-            return actionsListBuilder.build();
-        } else {
-            logger.error("Unknown Action Type for the Version", version);
-            return null;
+            return actionBuilder.build();
         }
-
+        logger.error("Unknown Action Type for the Version", version);
+        return null;
     }
 
-    private static ActionsList SalToOFSetTpDst(
+    private static Action SalToOFSetTpDst(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder, short version) {
+            ActionBuilder actionBuilder, short version) {
 
         if (version == OFConstants.OFP_VERSION_1_0) {
-            ActionBuilder actionBuilder = new ActionBuilder();
-
             SetTpDstActionCase settpdstcase = (SetTpDstActionCase) action;
             SetTpDstAction settpdstaction = settpdstcase.getSetTpDstAction();
             PortActionBuilder settpdst = new PortActionBuilder();
@@ -558,55 +531,44 @@ public final class ActionConvertor {
             actionBuilder
                     .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpDst.class);
             actionBuilder.addAugmentation(PortAction.class, settpdst.build());
-            actionsListBuilder.setAction(actionBuilder.build());
-            return actionsListBuilder.build();
-        } else {
-            logger.error("Unknown Action Type for the Version", version);
-            return null;
+            return actionBuilder.build();
         }
-
+        logger.error("Unknown Action Type for the Version", version);
+        return null;
     }
 
-    private static ActionsList SalToOFGroupAction(
+    private static Action SalToOFGroupAction(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder) {
+            ActionBuilder actionBuilder) {
 
         GroupActionCase groupActionCase = (GroupActionCase) action;
         GroupAction groupAction = groupActionCase.getGroupAction();
 
         GroupIdActionBuilder groupIdBuilder = new GroupIdActionBuilder();
         groupIdBuilder.setGroupId(groupAction.getGroupId());
-        ActionBuilder actionBuilder = new ActionBuilder();
         actionBuilder.setType(Group.class);
         actionBuilder.addAugmentation(GroupIdAction.class, groupIdBuilder.build());
-        actionsListBuilder.setAction(actionBuilder.build());
-        return actionsListBuilder.build();
+        return actionBuilder.build();
     }
 
-    private static ActionsList SalToOFPushAction(Integer ethernetType, ActionBuilder actionBuilder,
-            ActionsListBuilder actionsListBuilder) {
-
+    private static Action SalToOFPushAction(Integer ethernetType, ActionBuilder actionBuilder) {
         EthertypeActionBuilder ethertypeActionBuilder = new EthertypeActionBuilder();
         ethertypeActionBuilder.setEthertype(new EtherType(ethernetType));
 
         /* OF */
         actionBuilder.addAugmentation(EthertypeAction.class, ethertypeActionBuilder.build());
-        actionsListBuilder.setAction(actionBuilder.build());
-        return actionsListBuilder.build();
+        return actionBuilder.build();
     }
 
-    private static ActionsList SalToOFDecMplsTtl(ActionsListBuilder actionsListBuilder) {
-        ActionBuilder actionBuilder = new ActionBuilder();
+    private static Action SalToOFDecMplsTtl(ActionBuilder actionBuilder) {
         actionBuilder
                 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl.class);
-        return emtpyAction(actionBuilder, actionsListBuilder);
+        return emtpyAction(actionBuilder);
     }
 
-    private static ActionsList SalToOFSetMplsTtl(
+    private static Action SalToOFSetMplsTtl(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder) {
-        ActionBuilder actionBuilder = new ActionBuilder();
-
+            ActionBuilder actionBuilder) {
         SetMplsTtlActionCase mplsTtlActionCase = (SetMplsTtlActionCase) action;
         SetMplsTtlAction mplsTtlAction = mplsTtlActionCase.getSetMplsTtlAction();
 
@@ -615,123 +577,110 @@ public final class ActionConvertor {
         /* OF */
         actionBuilder.setType(SetMplsTtl.class);
         actionBuilder.addAugmentation(MplsTtlAction.class, mplsTtlActionBuilder.build());
-        actionsListBuilder.setAction(actionBuilder.build());
-        return actionsListBuilder.build();
+        return actionBuilder.build();
     }
 
-    private static ActionsList SalToOFCopyTTLIIn(ActionsListBuilder actionsListBuilder) {
-        ActionBuilder actionBuilder = new ActionBuilder();
+    private static Action SalToOFCopyTTLIIn(ActionBuilder actionBuilder) {
         actionBuilder
                 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn.class);
-        return emtpyAction(actionBuilder, actionsListBuilder);
+        return emtpyAction(actionBuilder);
     }
 
-    private static ActionsList SalToOFCopyTTLIOut(ActionsListBuilder actionsListBuilder) {
-        ActionBuilder actionBuilder = new ActionBuilder();
+    private static Action SalToOFCopyTTLIOut(ActionBuilder actionBuilder) {
         actionBuilder
                 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut.class);
-        return emtpyAction(actionBuilder, actionsListBuilder);
+        return emtpyAction(actionBuilder);
 
     }
 
-    private static ActionsList emtpyAction(ActionBuilder actionBuilder, ActionsListBuilder actionsListBuilder) {
-
-        actionsListBuilder.setAction(actionBuilder.build());
-        return actionsListBuilder.build();
+    private static Action emtpyAction(ActionBuilder actionBuilder) {
+        return actionBuilder.build();
     }
 
-    private static ActionsList salToOFOutputAction(
+    private static Action salToOFOutputAction(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
-            ActionsListBuilder actionsListBuilder, short version) {
+            ActionBuilder actionBuilder, short version) {
 
         OutputActionCase outputActionCase = ((OutputActionCase) action);
         OutputAction outputAction = outputActionCase.getOutputAction();
         PortActionBuilder portAction = new PortActionBuilder();
         MaxLengthActionBuilder maxLenActionBuilder = new MaxLengthActionBuilder();
-        maxLenActionBuilder.setMaxLength(outputAction.getMaxLength());
-        ActionBuilder actionBuilder = new ActionBuilder();
+        if (outputAction.getMaxLength() != null) {
+            maxLenActionBuilder.setMaxLength(outputAction.getMaxLength());
+        } else {
+            maxLenActionBuilder.setMaxLength(new Integer(0));
+        }
         actionBuilder.addAugmentation(MaxLengthAction.class, maxLenActionBuilder.build());
 
         Uri uri = outputAction.getOutputNodeConnector();
 
         if (version >= OFConstants.OFP_VERSION_1_3) {
+
             if (uri.getValue().equals(OutputPortValues.CONTROLLER.toString())) {
                 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.CONTROLLER
                         .getIntValue())));
-            }
-            if (uri.getValue().equals(OutputPortValues.ALL.toString())) {
+            } else if (uri.getValue().equals(OutputPortValues.ALL.toString())) {
                 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.ALL.getIntValue())));
-            }
-            if (uri.getValue().equals(OutputPortValues.ANY.toString())) {
+            } else if (uri.getValue().equals(OutputPortValues.ANY.toString())) {
                 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.ANY.getIntValue())));
 
-            }
-            if (uri.getValue().equals(OutputPortValues.FLOOD.toString())) {
+            } else if (uri.getValue().equals(OutputPortValues.FLOOD.toString())) {
                 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.FLOOD.getIntValue())));
 
-            }
-            if (uri.getValue().equals(OutputPortValues.INPORT.toString())) {
+            } else if (uri.getValue().equals(OutputPortValues.INPORT.toString())) {
                 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.INPORT.getIntValue())));
 
-            }
-            if (uri.getValue().equals(OutputPortValues.LOCAL.toString())) {
+            } else if (uri.getValue().equals(OutputPortValues.LOCAL.toString())) {
                 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.LOCAL.getIntValue())));
 
-            }
-            if (uri.getValue().equals(OutputPortValues.NORMAL.toString())) {
+            } else if (uri.getValue().equals(OutputPortValues.NORMAL.toString())) {
                 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.NORMAL.getIntValue())));
 
-            }
-            if (uri.getValue().equals(OutputPortValues.TABLE.toString())) {
+            } else if (uri.getValue().equals(OutputPortValues.TABLE.toString())) {
                 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.TABLE.getIntValue())));
 
-            }
-            if (uri.getValue().equals(OutputPortValues.NONE.toString())) {
+            } else if (uri.getValue().equals(OutputPortValues.NONE.toString())) {
                 logger.error("Unknown Port Type for the Version");
+            } else if (InventoryDataServiceUtil.portNumberfromNodeConnectorId(outputAction.getOutputNodeConnector()
+                    .getValue()) < MAXPortOF13) {
+                portAction.setPort(new PortNumber(InventoryDataServiceUtil.portNumberfromNodeConnectorId(outputAction
+                        .getOutputNodeConnector().getValue())));
+            } else {
+                logger.error("Invalid Port for Output Action");
             }
         } else if (version == OFConstants.OFP_VERSION_1_0) {
 
             if (uri.getValue().equals(OutputPortValues.CONTROLLER.toString())) {
                 portAction.setPort(new PortNumber((long) PortNumberValuesV10.CONTROLLER.getIntValue()));
-            }
-            if (uri.getValue().equals(OutputPortValues.ALL.toString())) {
+            } else if (uri.getValue().equals(OutputPortValues.ALL.toString())) {
                 portAction.setPort(new PortNumber((long) PortNumberValuesV10.ALL.getIntValue()));
-            }
-
-            if (uri.getValue().equals(OutputPortValues.FLOOD.toString())) {
+            } else if (uri.getValue().equals(OutputPortValues.FLOOD.toString())) {
                 portAction.setPort(new PortNumber((long) PortNumberValuesV10.FLOOD.getIntValue()));
-
-            }
-
-            if (uri.getValue().equals(OutputPortValues.INPORT.toString())) {
+            } else if (uri.getValue().equals(OutputPortValues.INPORT.toString())) {
                 portAction.setPort(new PortNumber((long) PortNumberValuesV10.INPORT.getIntValue()));
-
-            }
-            if (uri.getValue().equals(OutputPortValues.LOCAL.toString())) {
+            } else if (uri.getValue().equals(OutputPortValues.LOCAL.toString())) {
                 portAction.setPort(new PortNumber((long) PortNumberValuesV10.LOCAL.getIntValue()));
-
-            }
-            if (uri.getValue().equals(OutputPortValues.NORMAL.toString())) {
+            } else if (uri.getValue().equals(OutputPortValues.NORMAL.toString())) {
                 portAction.setPort(new PortNumber((long) PortNumberValuesV10.NORMAL.getIntValue()));
-
-            }
-            if (uri.getValue().equals(OutputPortValues.TABLE.toString())) {
+            } else if (uri.getValue().equals(OutputPortValues.TABLE.toString())) {
                 portAction.setPort(new PortNumber((long) PortNumberValuesV10.TABLE.getIntValue()));
-
-            }
-            if (uri.getValue().equals(OutputPortValues.NONE.toString())) {
+            } else if (uri.getValue().equals(OutputPortValues.NONE.toString())) {
                 portAction.setPort(new PortNumber((long) PortNumberValuesV10.NONE.getIntValue()));
-            }
-            if (uri.getValue().equals(OutputPortValues.ANY.toString())) {
+            } else if (uri.getValue().equals(OutputPortValues.ANY.toString())) {
                 logger.error("Unknown Port Type for the Version");
+            } else if (InventoryDataServiceUtil.portNumberfromNodeConnectorId(outputAction.getOutputNodeConnector()
+                    .getValue()) < MAXPortOF10) {
+                portAction.setPort(new PortNumber(InventoryDataServiceUtil.portNumberfromNodeConnectorId(outputAction
+                        .getOutputNodeConnector().getValue())));
+            } else {
+                logger.error("Invalid Port for Output Action");
             }
         }
 
         actionBuilder
                 .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output.class);
         actionBuilder.addAugmentation(PortAction.class, portAction.build());
-        actionsListBuilder.setAction(actionBuilder.build());
-        return actionsListBuilder.build();
+        return actionBuilder.build();
 
     }
 
@@ -741,15 +690,11 @@ public final class ActionConvertor {
      * @param actionList
      * @return List of converted SAL Actions.
      */
-    public static List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> toSALBucketActions(
-            List<ActionsList> actionList) {
-
-        List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> bucketActions = new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action>();
-        for (ActionsList actionDesc : actionList) {
-
-            org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.Action action = actionDesc
-                    .getAction();
+    public static List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> toMDSalActions(
+            List<Action> actionList) {
 
+        List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> bucketActions = new ArrayList<>();
+        for (Action action : actionList) {
             if (action.getType().equals(
                     org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output.class))
                 bucketActions.add(ofToSALOutputAction(action));
@@ -828,8 +773,7 @@ public final class ActionConvertor {
      *            action.rev130731.actions.actions.list.Action
      * @return OutputAction
      */
-    public static OutputActionCase ofToSALOutputAction(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.Action action) {
+    public static OutputActionCase ofToSALOutputAction(Action action) {
 
         OutputActionBuilder outputAction = new OutputActionBuilder();
         PortAction port = action.getAugmentation(PortAction.class);
@@ -855,8 +799,7 @@ public final class ActionConvertor {
      * @param action
      * @return GroupAction
      */
-    public static GroupActionCase ofToSALGroupAction(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.Action action) {
+    public static GroupActionCase ofToSALGroupAction(Action action) {
 
         GroupActionBuilder groupAction = new GroupActionBuilder();
 
@@ -873,8 +816,7 @@ public final class ActionConvertor {
      * @param action
      * @return
      */
-    public static SetMplsTtlActionCase ofToSALSetMplsTtl(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.Action action) {
+    public static SetMplsTtlActionCase ofToSALSetMplsTtl(Action action) {
 
         SetMplsTtlActionBuilder mplsTtlAction = new SetMplsTtlActionBuilder();
         MplsTtlAction mplsTtl = action.getAugmentation(MplsTtlAction.class);
@@ -888,13 +830,12 @@ public final class ActionConvertor {
      * @param action
      * @return PushVlanAction
      */
-    public static PushVlanActionCase ofToSALPushVlanAction(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.Action action) {
+    public static PushVlanActionCase ofToSALPushVlanAction(Action action) {
 
         PushVlanActionBuilder pushVlanAction = new PushVlanActionBuilder();
 
         EthertypeAction etherType = action.getAugmentation(EthertypeAction.class);
-        pushVlanAction.setVlanId(new VlanId(etherType.getEthertype().getValue()));
+        pushVlanAction.setEthernetType(etherType.getEthertype().getValue());
 
         return new PushVlanActionCaseBuilder().setPushVlanAction(pushVlanAction.build()).build();
     }
@@ -905,8 +846,7 @@ public final class ActionConvertor {
      * @param action
      * @return SetQueueAction
      */
-    public static SetQueueActionCase ofToSALSetQueue(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.Action action) {
+    public static SetQueueActionCase ofToSALSetQueue(Action action) {
 
         SetQueueActionBuilder setQueueAction = new SetQueueActionBuilder();
 
@@ -922,8 +862,7 @@ public final class ActionConvertor {
      * @param action
      * @return SetNwTtlAction
      */
-    public static SetNwTtlActionCase ofToSALSetNwTtl(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.Action action) {
+    public static SetNwTtlActionCase ofToSALSetNwTtl(Action action) {
 
         SetNwTtlActionBuilder setNwTtl = new SetNwTtlActionBuilder();
         NwTtlAction nwTtl = action.getAugmentation(NwTtlAction.class);
@@ -938,8 +877,7 @@ public final class ActionConvertor {
      * @param action
      * @return PushVlanAction
      */
-    public static PushPbbActionCase ofToSALPushPbbAction(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.Action action) {
+    public static PushPbbActionCase ofToSALPushPbbAction(Action action) {
 
         PushPbbActionBuilder pushPbbAction = new PushPbbActionBuilder();
 
@@ -949,8 +887,7 @@ public final class ActionConvertor {
         return new PushPbbActionCaseBuilder().setPushPbbAction(pushPbbAction.build()).build();
     }
 
-    public static Object ofToSALExperimenter(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.Action action) {
+    public static Object ofToSALExperimenter(Action action) {
 
         ExperimenterAction ExperimenterAction = action.getAugmentation(ExperimenterAction.class);