merged and rebased with 3717
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / ActionConvertor.java
index 76d1ac6e74f7ae7dba011c14822446c912e899a7..89b8a9032614ff048265037a450c05d7bb06b8ad 100644 (file)
@@ -3,8 +3,8 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.opendaylight.controller.sal.core.NodeConnector.NodeConnectorIDType;
 import org.opendaylight.openflowjava.protocol.api.util.BinContent;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
 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;
@@ -30,51 +30,62 @@ 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.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.copy.ttl.in._case.CopyTtlIn;
+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.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.DecMplsTtl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.mpls.ttl._case.DecMplsTtlBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstAction;
+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.ttl.action._case.SetNwTtlAction;
+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.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;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcAction;
+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;
@@ -87,6 +98,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002
 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;
@@ -175,6 +190,26 @@ public final class ActionConvertor {
             else if (action instanceof ExperimenterAction)
                 actionsList.add(SalToOFExperimenter(action, actionsListBuilder));
 
+            // 1.0 Actions
+            else if (action instanceof SetVlanIdActionCase)
+                actionsList.add(SalToOFSetVlanId(action, actionsListBuilder, version));
+            else if (action instanceof SetVlanPcpActionCase)
+                actionsList.add(SalToOFSetVlanpcp(action, actionsListBuilder, version));
+            else if (action instanceof StripVlanActionCase)
+                actionsList.add(SalToOFStripVlan(action, actionsListBuilder, version));
+            else if (action instanceof SetDlSrcActionCase)
+                actionsList.add(SalToOFSetDlSrc(action, actionsListBuilder, version));
+            else if (action instanceof SetDlDstActionCase)
+                actionsList.add(SalToOFSetDlDst(action, actionsListBuilder, version));
+            else if (action instanceof SetNwSrcActionCase)
+                actionsList.add(SalToOFSetNwSrc(action, actionsListBuilder, version));
+            else if (action instanceof SetNwDstActionCase)
+                actionsList.add(SalToOFSetNwDst(action, actionsListBuilder, version));
+            else if (action instanceof SetTpSrcActionCase)
+                actionsList.add(SalToOFSetTpSrc(action, actionsListBuilder, version));
+            else if (action instanceof SetTpDstActionCase)
+                actionsList.add(SalToOFSetTpDst(action, actionsListBuilder, version));
+
         }
         return actionsList;
 
@@ -185,7 +220,8 @@ public final class ActionConvertor {
             ActionsListBuilder actionsListBuilder) {
 
         SetFieldCase setFieldCase = (SetFieldCase) action;
-        org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match match = setFieldCase.getSetField();
+        org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match match = setFieldCase
+                .getSetField();
 
         List<MatchEntries> matchEntries = MatchConvertor.toMatch(match);
 
@@ -206,7 +242,8 @@ public final class ActionConvertor {
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
             ActionsListBuilder actionsListBuilder) {
         ActionBuilder actionBuilder = new ActionBuilder();
-        actionBuilder.setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl.class);
+        actionBuilder
+                .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl.class);
 
         return emtpyAction(actionBuilder, actionsListBuilder);
     }
@@ -216,10 +253,11 @@ public final class ActionConvertor {
             ActionsListBuilder actionsListBuilder) {
         ActionBuilder actionBuilder = new ActionBuilder();
         PushMplsActionCase pushMplsActionCase = (PushMplsActionCase) action;
-        
+
         actionBuilder.setType(PushMpls.class);
 
-        return SalToOFPushAction(pushMplsActionCase.getPushMplsAction().getEthernetType(), actionBuilder, actionsListBuilder);
+        return SalToOFPushAction(pushMplsActionCase.getPushMplsAction().getEthernetType(), actionBuilder,
+                actionsListBuilder);
 
     }
 
@@ -230,7 +268,8 @@ public final class ActionConvertor {
         PushPbbActionCase pushPbbActionCase = (PushPbbActionCase) action;
         actionBuilder.setType(PushPbb.class);
 
-        return SalToOFPushAction(pushPbbActionCase.getPushPbbAction().getEthernetType(), actionBuilder, actionsListBuilder);
+        return SalToOFPushAction(pushPbbActionCase.getPushPbbAction().getEthernetType(), actionBuilder,
+                actionsListBuilder);
     }
 
     private static ActionsList SalToOFPushVlanAction(
@@ -282,7 +321,8 @@ public final class ActionConvertor {
         PopMplsActionCase popMplsActionCase = (PopMplsActionCase) action;
         actionBuilder.setType(PopMpls.class);
 
-        return SalToOFPushAction(popMplsActionCase.getPopMplsAction().getEthernetType(), actionBuilder, actionsListBuilder);
+        return SalToOFPushAction(popMplsActionCase.getPopMplsAction().getEthernetType(), actionBuilder,
+                actionsListBuilder);
     }
 
     private static ActionsList SalToOFPopVlan(
@@ -319,6 +359,216 @@ public final class ActionConvertor {
 
     }
 
+    private static ActionsList SalToOFSetVlanId(
+            org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
+            ActionsListBuilder actionsListBuilder, short version) {
+
+        if (version == OF10) {
+            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();
+        } else {
+            logger.error("Unknown Action Type for the Version", version);
+            return null;
+        }
+
+    }
+
+    private static ActionsList SalToOFSetVlanpcp(
+            org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
+            ActionsListBuilder actionsListBuilder, short version) {
+
+        if (version == OF10) {
+            ActionBuilder actionBuilder = new ActionBuilder();
+            SetVlanPcpActionCase setvlanpcpcase = (SetVlanPcpActionCase) action;
+            SetVlanPcpAction setvlanpcpaction = setvlanpcpcase.getSetVlanPcpAction();
+
+            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();
+        } 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) {
+
+        if (version == OF10) {
+            ActionBuilder actionBuilder = new ActionBuilder();
+            actionBuilder
+                    .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.StripVlan.class);
+
+            return emtpyAction(actionBuilder, actionsListBuilder);
+        } else {
+            logger.error("Unknown Action Type for the Version", version);
+            return null;
+        }
+
+    }
+
+    private static ActionsList SalToOFSetDlSrc(
+            org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
+            ActionsListBuilder actionsListBuilder, short version) {
+
+        if (version == OF10) {
+            ActionBuilder actionBuilder = new ActionBuilder();
+            SetDlSrcActionCase setdlsrccase = (SetDlSrcActionCase) action;
+            SetDlSrcAction setdlsrcaction = setdlsrccase.getSetDlSrcAction();
+
+            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();
+        } else {
+            logger.error("Unknown Action Type for the Version", version);
+            return null;
+        }
+
+    }
+
+    private static ActionsList SalToOFSetDlDst(
+            org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
+            ActionsListBuilder actionsListBuilder, short version) {
+
+        if (version == OF10) {
+            ActionBuilder actionBuilder = new ActionBuilder();
+            SetDlDstActionCase setdldstcase = (SetDlDstActionCase) action;
+            SetDlDstAction setdldstaction = setdldstcase.getSetDlDstAction();
+
+            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();
+        } else {
+            logger.error("Unknown Action Type for the Version", version);
+            return null;
+        }
+
+    }
+
+    private static ActionsList SalToOFSetNwSrc(
+            org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
+            ActionsListBuilder actionsListBuilder, short version) {
+
+        if (version == OF10) {
+            ActionBuilder actionBuilder = new ActionBuilder();
+            SetNwSrcActionCase setnwsrccase = (SetNwSrcActionCase) action;
+            SetNwSrcAction setnwsrcaction = setnwsrccase.getSetNwSrcAction();
+
+            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);
+            return null;
+        }
+
+    }
+
+    private static ActionsList SalToOFSetNwDst(
+            org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
+            ActionsListBuilder actionsListBuilder, short version) {
+
+        if (version == OF10) {
+            ActionBuilder actionBuilder = new ActionBuilder();
+            SetNwDstActionCase setnwdstcase = (SetNwDstActionCase) action;
+            SetNwDstAction setnwdstaction = setnwdstcase.getSetNwDstAction();
+
+            IpAddressActionBuilder ipvaddress = new IpAddressActionBuilder();
+            ipvaddress.setIpAddress((Ipv4Address) setnwdstaction.getAddress());
+            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();
+
+        } else {
+            logger.error("Unknown Action Type for the Version", version);
+            return null;
+        }
+
+    }
+
+    private static ActionsList SalToOFSetTpSrc(
+            org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
+            ActionsListBuilder actionsListBuilder, short version) {
+
+        if (version == OF10) {
+            ActionBuilder actionBuilder = new ActionBuilder();
+            SetTpSrcActionCase settpsrccase = (SetTpSrcActionCase) action;
+            SetTpSrcAction settpsrcaction = settpsrccase.getSetTpSrcAction();
+
+            PortActionBuilder settpsrc = new PortActionBuilder();
+            PortNumber port = new PortNumber(settpsrcaction.getPort().getValue().longValue());
+            settpsrc.setPort(port);
+
+            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;
+        }
+
+    }
+
+    private static ActionsList SalToOFSetTpDst(
+            org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
+            ActionsListBuilder actionsListBuilder, short version) {
+
+        if (version == OF10) {
+            ActionBuilder actionBuilder = new ActionBuilder();
+
+            SetTpDstActionCase settpdstcase = (SetTpDstActionCase) action;
+            SetTpDstAction settpdstaction = settpdstcase.getSetTpDstAction();
+            PortActionBuilder settpdst = new PortActionBuilder();
+            PortNumber port = new PortNumber(settpdstaction.getPort().getValue().longValue());
+            settpdst.setPort(port);
+
+            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;
+        }
+
+    }
+
     private static ActionsList SalToOFGroupAction(
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action,
             ActionsListBuilder actionsListBuilder) {
@@ -361,7 +611,6 @@ public final class ActionConvertor {
 
         SetMplsTtlActionCase mplsTtlActionCase = (SetMplsTtlActionCase) action;
         SetMplsTtlAction mplsTtlAction = mplsTtlActionCase.getSetMplsTtlAction();
-        
 
         MplsTtlActionBuilder mplsTtlActionBuilder = new MplsTtlActionBuilder();
         mplsTtlActionBuilder.setMplsTtl(mplsTtlAction.getMplsTtl()/* SAL */);
@@ -406,52 +655,78 @@ public final class ActionConvertor {
         actionBuilder.addAugmentation(MaxLengthAction.class, maxLenActionBuilder.build());
 
         Uri uri = outputAction.getOutputNodeConnector();
-        if (uri.getValue() == NodeConnectorIDType.ALL) {
-            if (version >= OF13) {
+
+        if (version >= OF13) {
+            if (uri.getValue().equals(OutputPortValues.CONTROLLER.toString())) {
+                portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.CONTROLLER
+                        .getIntValue())));
+            }
+            if (uri.getValue().equals(OutputPortValues.ALL.toString())) {
                 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.ALL.getIntValue())));
+            }
+            if (uri.getValue().equals(OutputPortValues.ANY.toString())) {
+                portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.ANY.getIntValue())));
 
-            } else if (version == OF10) {
-                portAction.setPort(new PortNumber((long) PortNumberValuesV10.ALL.getIntValue()));
+            }
+            if (uri.getValue().equals(OutputPortValues.FLOOD.toString())) {
+                portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.FLOOD.getIntValue())));
 
             }
-        }
-        if (uri.getValue() == NodeConnectorIDType.SWSTACK) {
-            if (version >= OF13) {
+            if (uri.getValue().equals(OutputPortValues.INPORT.toString())) {
+                portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.INPORT.getIntValue())));
+
+            }
+            if (uri.getValue().equals(OutputPortValues.LOCAL.toString())) {
                 portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.LOCAL.getIntValue())));
 
-            } else if (version == OF10) {
-                portAction.setPort(new PortNumber((long) PortNumberValuesV10.LOCAL.getIntValue()));
+            }
+            if (uri.getValue().equals(OutputPortValues.NORMAL.toString())) {
+                portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.NORMAL.getIntValue())));
 
             }
-        }
+            if (uri.getValue().equals(OutputPortValues.TABLE.toString())) {
+                portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.TABLE.getIntValue())));
 
-        if ((uri.getValue() == NodeConnectorIDType.HWPATH) || (uri.getValue() == NodeConnectorIDType.ONEPK)
-                || (uri.getValue() == NodeConnectorIDType.ONEPK2OPENFLOW)
-                || (uri.getValue() == NodeConnectorIDType.ONEPK2PCEP)
-                || (uri.getValue() == NodeConnectorIDType.OPENFLOW)
-                || (uri.getValue() == NodeConnectorIDType.OPENFLOW2ONEPK)
-                || (uri.getValue() == NodeConnectorIDType.OPENFLOW2PCEP)
-                || (uri.getValue() == NodeConnectorIDType.PCEP) || (uri.getValue() == NodeConnectorIDType.PCEP2ONEPK)
-                || (uri.getValue() == NodeConnectorIDType.PCEP2OPENFLOW)
-                || (uri.getValue() == NodeConnectorIDType.PRODUCTION)) {
-            if (version >= OF13) {
-                portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.NORMAL.getIntValue())));
+            }
+            if (uri.getValue().equals(OutputPortValues.NONE.toString())) {
+                logger.error("Unknown Port Type for the Version");
+            }
+        } else if (version == OF10) {
 
-            } else if (version == OF10) {
-                portAction.setPort(new PortNumber((long) PortNumberValuesV10.NORMAL.getIntValue()));
+            if (uri.getValue().equals(OutputPortValues.CONTROLLER.toString())) {
+                portAction.setPort(new PortNumber((long) PortNumberValuesV10.CONTROLLER.getIntValue()));
+            }
+            if (uri.getValue().equals(OutputPortValues.ALL.toString())) {
+                portAction.setPort(new PortNumber((long) PortNumberValuesV10.ALL.getIntValue()));
             }
-        }
 
-        if (uri.getValue() == NodeConnectorIDType.CONTROLLER) {
+            if (uri.getValue().equals(OutputPortValues.FLOOD.toString())) {
+                portAction.setPort(new PortNumber((long) PortNumberValuesV10.FLOOD.getIntValue()));
 
-            if (version >= OF13) {
-                portAction.setPort(new PortNumber(BinContent.intToUnsignedLong(PortNumberValues.CONTROLLER
-                        .getIntValue())));
+            }
 
-            } else if (version == OF10) {
-                portAction.setPort(new PortNumber((long) PortNumberValuesV10.CONTROLLER.getIntValue()));
+            if (uri.getValue().equals(OutputPortValues.INPORT.toString())) {
+                portAction.setPort(new PortNumber((long) PortNumberValuesV10.INPORT.getIntValue()));
 
             }
+            if (uri.getValue().equals(OutputPortValues.LOCAL.toString())) {
+                portAction.setPort(new PortNumber((long) PortNumberValuesV10.LOCAL.getIntValue()));
+
+            }
+            if (uri.getValue().equals(OutputPortValues.NORMAL.toString())) {
+                portAction.setPort(new PortNumber((long) PortNumberValuesV10.NORMAL.getIntValue()));
+
+            }
+            if (uri.getValue().equals(OutputPortValues.TABLE.toString())) {
+                portAction.setPort(new PortNumber((long) PortNumberValuesV10.TABLE.getIntValue()));
+
+            }
+            if (uri.getValue().equals(OutputPortValues.NONE.toString())) {
+                portAction.setPort(new PortNumber((long) PortNumberValuesV10.NONE.getIntValue()));
+            }
+            if (uri.getValue().equals(OutputPortValues.ANY.toString())) {
+                logger.error("Unknown Port Type for the Version");
+            }
         }
 
         actionBuilder
@@ -459,6 +734,7 @@ public final class ActionConvertor {
         actionBuilder.addAugmentation(PortAction.class, portAction.build());
         actionsListBuilder.setAction(actionBuilder.build());
         return actionsListBuilder.build();
+
     }
 
     /**
@@ -476,59 +752,70 @@ public final class ActionConvertor {
             org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.Action action = actionDesc
                     .getAction();
 
-            if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output.class))
+            if (action.getType().equals(
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output.class))
                 bucketActions.add(ofToSALOutputAction(action));
-            else if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group.class))
+            else if (action.getType().equals(
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group.class))
                 bucketActions.add(ofToSALGroupAction(action));
-            else if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut.class)){
+            else if (action.getType().equals(
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut.class)) {
                 CopyTtlOutBuilder copyTtlOutaction = new CopyTtlOutBuilder();
                 bucketActions.add(new CopyTtlOutCaseBuilder().setCopyTtlOut(copyTtlOutaction.build()).build());
-            }
-            else if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn.class)){
+            } else if (action.getType().equals(
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn.class)) {
                 CopyTtlInBuilder copyTtlInaction = new CopyTtlInBuilder();
                 bucketActions.add(new CopyTtlInCaseBuilder().setCopyTtlIn(copyTtlInaction.build()).build());
-            }
-            else if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl.class))
+            } else if (action.getType().equals(
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl.class))
                 bucketActions.add(ofToSALSetMplsTtl(action));
-            else if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl.class)){
+            else if (action.getType().equals(
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl.class)) {
                 DecMplsTtlBuilder decMplsTtl = new DecMplsTtlBuilder();
                 bucketActions.add(new DecMplsTtlCaseBuilder().setDecMplsTtl(decMplsTtl.build()).build());
-            }
-            else if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan.class))
+            } else if (action.getType().equals(
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan.class))
                 bucketActions.add(ofToSALPushVlanAction(action));
-            else if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan.class)){
+            else if (action.getType().equals(
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan.class)) {
                 PopVlanActionBuilder popVlan = new PopVlanActionBuilder();
                 bucketActions.add(new PopVlanActionCaseBuilder().setPopVlanAction(popVlan.build()).build());
-            }
-            else if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls.class)){
+            } else if (action.getType().equals(
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls.class)) {
                 PushMplsActionBuilder pushMpls = new PushMplsActionBuilder();
                 bucketActions.add(new PushMplsActionCaseBuilder().setPushMplsAction(pushMpls.build()).build());
-            }
-            else if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls.class)){
+            } else if (action.getType().equals(
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls.class)) {
                 PopMplsActionBuilder popMpls = new PopMplsActionBuilder();
                 bucketActions.add(new PopMplsActionCaseBuilder().setPopMplsAction(popMpls.build()).build());
-            }
-            else if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue.class))
+            } else if (action.getType().equals(
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue.class))
                 bucketActions.add(ofToSALSetQueue(action));
 
-            else if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl.class))
+            else if (action.getType().equals(
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl.class))
                 bucketActions.add(ofToSALSetNwTtl(action));
-            else if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl.class)){
+            else if (action.getType().equals(
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl.class)) {
                 DecNwTtlBuilder decNwTtl = new DecNwTtlBuilder();
                 bucketActions.add(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl.build()).build());
-            }
-            else if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class))
-                bucketActions.add(new SetFieldCaseBuilder().setSetField(MatchConvertor.ofToSALSetField(action)).build());
+            } else if (action.getType().equals(
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class))
+                bucketActions
+                        .add(new SetFieldCaseBuilder().setSetField(MatchConvertor.ofToSALSetField(action)).build());
 
-            else if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb.class))
+            else if (action.getType().equals(
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb.class))
                 bucketActions.add(ofToSALPushPbbAction(action));
-            else if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb.class)){
+            else if (action.getType().equals(
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb.class)) {
                 PopPbbActionBuilder popPbb = new PopPbbActionBuilder();
                 bucketActions.add(new PopPbbActionCaseBuilder().setPopPbbAction(popPbb.build()).build());
-            }
-            else if (action.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter.class)){
-                //bucketActions.add(ofToSALExperimenter(action));
-                // TODO: Need to explore/discuss on how to handle experimenter case.
+            } else if (action.getType().equals(
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter.class)) {
+                // bucketActions.add(ofToSALExperimenter(action));
+                // TODO: Need to explore/discuss on how to handle experimenter
+                // case.
             }
 
         }