Bug-5543 - Bo: Update JUnit tests part 4 64/40664/3
authormiroslav.macko <miroslav.macko@pantheon.tech>
Wed, 22 Jun 2016 09:22:09 +0000 (11:22 +0200)
committermiroslav.macko <miroslav.macko@pantheon.tech>
Mon, 27 Jun 2016 10:43:35 +0000 (12:43 +0200)
Added tests for openflowplugin-extension-nicira

Change-Id: Ife34ae4e8a3e94964a5ca2a92abede8bdfeb842d
Signed-off-by: miroslav.macko <miroslav.macko@pantheon.tech>
extension/openflowplugin-extension-nicira/pom.xml
extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/ConntrackConvertorTest.java [new file with mode: 0644]
extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/MultipathConvertorTest.java [new file with mode: 0644]
extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/OutputRegConvertorTest.java [new file with mode: 0644]
extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/RegLoadConvertorTest.java [new file with mode: 0644]
extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/RegMoveConvertorTest.java [new file with mode: 0644]
extension/openflowplugin-extension-nicira/src/test/resources/log4j.xml [new file with mode: 0644]

index 059538468efd3d842840c1231b7c5e964e04b39a..2e99962e706912d08ec5b995a7dda71047002e82 100644 (file)
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <scope>test</scope>
+        </dependency>
+
     </dependencies>
 
 </project>
diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/ConntrackConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/ConntrackConvertorTest.java
new file mode 100644 (file)
index 0000000..bac69c9
--- /dev/null
@@ -0,0 +1,112 @@
+/**
+ * Copyright (c) 2016 Cisco Systems, Inc. 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
+ */
+
+package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionConntrack;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionConntrackBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.conntrack.grouping.NxActionConntrackBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionConntrackNotifFlowsStatisticsUpdateApplyActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionConntrackNotifFlowsStatisticsUpdateWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.group.desc.stats.updated.group.desc.stats.buckets.bucket.action.action.NxActionConntrackNotifGroupDescStatsUpdatedCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionConntrackNodesNodeTableFlowWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionConntrackNodesNodeTableFlowWriteActionsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.conntrack.grouping.NxConntrackBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test for {@link ConntrackConvertor}.
+ */
+public class ConntrackConvertorTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(ConntrackConvertorTest.class);
+
+    private ConntrackConvertor conntrackConvertor;
+
+    @Before
+    public void setUp() throws Exception {
+        conntrackConvertor = new ConntrackConvertor();
+    }
+
+    @Test
+    public void testConvertToOFJava() throws Exception {
+
+        final NxConntrackBuilder nxConntrackBuilder = new NxConntrackBuilder()
+                .setConntrackZone(1)
+                .setFlags(1)
+                .setRecircTable((short) 1)
+                .setZoneSrc(1L);
+
+        final NxActionConntrackNodesNodeTableFlowWriteActionsCaseBuilder nxActionConntrackBuilder =
+                new NxActionConntrackNodesNodeTableFlowWriteActionsCaseBuilder()
+                        .setNxConntrack(nxConntrackBuilder.build());
+
+        final NxActionConntrackNodesNodeTableFlowWriteActionsCase actionsCase = nxActionConntrackBuilder.build();
+        final ActionConntrack actionConntrack = (ActionConntrack) conntrackConvertor.convert(actionsCase).getActionChoice();
+
+        Assert.assertEquals(actionsCase.getNxConntrack().getConntrackZone(), actionConntrack.getNxActionConntrack().getConntrackZone());
+        Assert.assertEquals(actionsCase.getNxConntrack().getFlags(), actionConntrack.getNxActionConntrack().getFlags());
+        Assert.assertEquals(actionsCase.getNxConntrack().getRecircTable(), actionConntrack.getNxActionConntrack().getRecircTable());
+        Assert.assertEquals(actionsCase.getNxConntrack().getZoneSrc(), actionConntrack.getNxActionConntrack().getZoneSrc());
+    }
+
+    @Test
+    public void testConvertFromOFJava() throws Exception {
+        final NxActionConntrackBuilder nxActionConntrackBuilder = new NxActionConntrackBuilder()
+                .setConntrackZone(1)
+                .setFlags(1)
+                .setRecircTable((short) 1)
+                .setZoneSrc(1L);
+
+        final ActionConntrackBuilder actionConntrackBuilder = new ActionConntrackBuilder()
+                .setNxActionConntrack(nxActionConntrackBuilder.build());
+
+        final ActionBuilder actionBuilder = new ActionBuilder()
+                .setActionChoice(actionConntrackBuilder.build());
+
+        final Action groupingAction = actionBuilder.build();
+
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action
+                = conntrackConvertor.convert(groupingAction, ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action1
+                = conntrackConvertor.convert(groupingAction, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action2
+                = conntrackConvertor.convert(groupingAction, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action3
+                = conntrackConvertor.convert(groupingAction, ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+
+        Assert.assertEquals(1, ((NxActionConntrackNodesNodeTableFlowWriteActionsCase) action).getNxConntrack().getConntrackZone().longValue());
+        Assert.assertEquals(1L, ((NxActionConntrackNodesNodeTableFlowWriteActionsCase) action).getNxConntrack().getZoneSrc().longValue());
+        Assert.assertEquals((short) 1, ((NxActionConntrackNodesNodeTableFlowWriteActionsCase) action).getNxConntrack().getRecircTable().shortValue());
+        Assert.assertEquals(1, ((NxActionConntrackNodesNodeTableFlowWriteActionsCase) action).getNxConntrack().getFlags().intValue());
+
+        Assert.assertEquals(1, ((NxActionConntrackNotifFlowsStatisticsUpdateWriteActionsCase) action1).getNxConntrack().getConntrackZone().longValue());
+        Assert.assertEquals(1L, ((NxActionConntrackNotifFlowsStatisticsUpdateWriteActionsCase) action1).getNxConntrack().getZoneSrc().longValue());
+        Assert.assertEquals((short) 1, ((NxActionConntrackNotifFlowsStatisticsUpdateWriteActionsCase) action1).getNxConntrack().getRecircTable().shortValue());
+        Assert.assertEquals(1, ((NxActionConntrackNotifFlowsStatisticsUpdateWriteActionsCase) action1).getNxConntrack().getFlags().intValue());
+
+        Assert.assertEquals(1, ((NxActionConntrackNotifFlowsStatisticsUpdateApplyActionsCase) action2).getNxConntrack().getConntrackZone().longValue());
+        Assert.assertEquals(1L, ((NxActionConntrackNotifFlowsStatisticsUpdateApplyActionsCase) action2).getNxConntrack().getZoneSrc().longValue());
+        Assert.assertEquals((short) 1, ((NxActionConntrackNotifFlowsStatisticsUpdateApplyActionsCase) action2).getNxConntrack().getRecircTable().shortValue());
+        Assert.assertEquals(1, ((NxActionConntrackNotifFlowsStatisticsUpdateApplyActionsCase) action2).getNxConntrack().getFlags().intValue());
+
+        Assert.assertEquals(1, ((NxActionConntrackNotifGroupDescStatsUpdatedCase) action3).getNxConntrack().getConntrackZone().longValue());
+        Assert.assertEquals(1L, ((NxActionConntrackNotifGroupDescStatsUpdatedCase) action3).getNxConntrack().getZoneSrc().longValue());
+        Assert.assertEquals((short) 1, ((NxActionConntrackNotifGroupDescStatsUpdatedCase) action3).getNxConntrack().getRecircTable().shortValue());
+        Assert.assertEquals(1, ((NxActionConntrackNotifGroupDescStatsUpdatedCase) action3).getNxConntrack().getFlags().intValue());
+
+    }
+
+}
\ No newline at end of file
diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/MultipathConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/MultipathConvertorTest.java
new file mode 100644 (file)
index 0000000..d7b74f9
--- /dev/null
@@ -0,0 +1,125 @@
+/**
+ * Copyright (c) 2016 Cisco Systems, Inc. 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
+ */
+
+package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action;
+
+import static org.mockito.Mockito.when;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.nx.NiciraMatchCodecs;
+import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.OfjNxHashFields;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.OfjNxMpAlgorithm;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionMultipath;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.multipath.grouping.NxActionMultipath;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNspCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionMultipathNotifFlowsStatisticsUpdateApplyActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionMultipathNotifFlowsStatisticsUpdateWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.group.desc.stats.updated.group.desc.stats.buckets.bucket.action.action.NxActionMultipathNotifGroupDescStatsUpdatedCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionMultipathNodesNodeTableFlowWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.multipath.grouping.NxMultipath;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.multipath.grouping.nx.multipath.Dst;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test for {@link MultipathConvertor}.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class MultipathConvertorTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(MultipathConvertorTest.class);
+
+    @Mock
+    private NxActionMultipathNodesNodeTableFlowWriteActionsCase bucketActionsCase;
+
+    @Mock
+    private Action action;
+
+    private MultipathConvertor multipathConvertor;
+
+    @Before
+    public void setUp() throws Exception {
+        final NxMultipath nxMultipath = Mockito.mock(NxMultipath.class);
+        when(bucketActionsCase.getNxMultipath()).thenReturn(nxMultipath);
+
+        final Dst dst = Mockito.mock(Dst.class);
+        when(dst.getStart()).thenReturn(1);
+        when(dst.getEnd()).thenReturn(2);
+
+        final DstNxNspCase dstNxNspCase = Mockito.mock(DstNxNspCase.class);
+        when(dst.getDstChoice()).thenReturn(dstNxNspCase);
+        when(nxMultipath.getFields()).thenReturn(OfjNxHashFields.NXHASHFIELDSETHSRC);
+        when(nxMultipath.getBasis()).thenReturn(2);
+        when(nxMultipath.getAlgorithm()).thenReturn(OfjNxMpAlgorithm.NXMPALGHASHTHRESHOLD);
+        when(nxMultipath.getMaxLink()).thenReturn(2);
+        when(nxMultipath.getArg()).thenReturn(2L);
+        when(nxMultipath.getDst()).thenReturn(dst);
+
+        final ActionMultipath actionMultipath = Mockito.mock(ActionMultipath.class);
+        final NxActionMultipath nxActionMultipath = Mockito.mock(NxActionMultipath.class);
+        when(nxActionMultipath.getDst()).thenReturn(NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong());
+        when(nxActionMultipath.getBasis()).thenReturn(1);
+        when(nxActionMultipath.getAlgorithm()).thenReturn(OfjNxMpAlgorithm.NXMPALGHRW);
+        when(nxActionMultipath.getMaxLink()).thenReturn(2);
+        when(nxActionMultipath.getArg()).thenReturn(2L);
+        when(actionMultipath.getNxActionMultipath()).thenReturn(nxActionMultipath);
+        when(action.getActionChoice()).thenReturn(actionMultipath);
+
+        multipathConvertor = new MultipathConvertor();
+    }
+
+    @Test
+    public void testConvert() throws Exception {
+        final ActionMultipath actionMultipath = (ActionMultipath) multipathConvertor.convert(bucketActionsCase).getActionChoice();
+        Assert.assertEquals(OfjNxHashFields.NXHASHFIELDSETHSRC, actionMultipath.getNxActionMultipath().getFields());
+        Assert.assertEquals(Integer.valueOf(2), actionMultipath.getNxActionMultipath().getBasis());
+        Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHASHTHRESHOLD, actionMultipath.getNxActionMultipath().getAlgorithm());
+        Assert.assertEquals(Integer.valueOf(2), actionMultipath.getNxActionMultipath().getMaxLink());
+        Assert.assertEquals(Long.valueOf(2L), actionMultipath.getNxActionMultipath().getArg());
+    }
+
+    @Test
+    public void testConvert1() throws Exception {
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult
+                = multipathConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult1
+                = multipathConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult2
+                = multipathConvertor.convert(action, ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult3
+                = multipathConvertor.convert(action, ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION);
+
+        Assert.assertEquals(Integer.valueOf(1), ((NxActionMultipathNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxMultipath().getBasis());
+        Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHRW, ((NxActionMultipathNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxMultipath().getAlgorithm());
+        Assert.assertEquals(Long.valueOf(2L), ((NxActionMultipathNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxMultipath().getArg());
+        Assert.assertEquals(Integer.valueOf(2), ((NxActionMultipathNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxMultipath().getMaxLink());
+
+        Assert.assertEquals(Integer.valueOf(1), ((NxActionMultipathNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxMultipath().getBasis());
+        Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHRW, ((NxActionMultipathNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxMultipath().getAlgorithm());
+        Assert.assertEquals(Long.valueOf(2L), ((NxActionMultipathNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxMultipath().getArg());
+        Assert.assertEquals(Integer.valueOf(2), ((NxActionMultipathNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxMultipath().getMaxLink());
+
+        Assert.assertEquals(Integer.valueOf(1), ((NxActionMultipathNotifGroupDescStatsUpdatedCase) actionResult2).getNxMultipath().getBasis());
+        Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHRW, ((NxActionMultipathNotifGroupDescStatsUpdatedCase) actionResult2).getNxMultipath().getAlgorithm());
+        Assert.assertEquals(Long.valueOf(2L), ((NxActionMultipathNotifGroupDescStatsUpdatedCase) actionResult2).getNxMultipath().getArg());
+        Assert.assertEquals(Integer.valueOf(2), ((NxActionMultipathNotifGroupDescStatsUpdatedCase) actionResult2).getNxMultipath().getMaxLink());
+
+        Assert.assertEquals(Integer.valueOf(1), ((NxActionMultipathNodesNodeTableFlowWriteActionsCase) actionResult3).getNxMultipath().getBasis());
+        Assert.assertEquals(OfjNxMpAlgorithm.NXMPALGHRW, ((NxActionMultipathNodesNodeTableFlowWriteActionsCase) actionResult3).getNxMultipath().getAlgorithm());
+        Assert.assertEquals(Long.valueOf(2L), ((NxActionMultipathNodesNodeTableFlowWriteActionsCase) actionResult3).getNxMultipath().getArg());
+        Assert.assertEquals(Integer.valueOf(2), ((NxActionMultipathNodesNodeTableFlowWriteActionsCase) actionResult3).getNxMultipath().getMaxLink());
+    }
+}
\ No newline at end of file
diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/OutputRegConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/OutputRegConvertorTest.java
new file mode 100644 (file)
index 0000000..693f554
--- /dev/null
@@ -0,0 +1,104 @@
+/**
+ * Copyright (c) 2016 Cisco Systems, Inc. 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
+ */
+
+package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action;
+
+import static org.mockito.Mockito.when;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.nx.NiciraMatchCodecs;
+import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.output.reg.grouping.NxActionOutputReg;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionOutputRegNotifFlowsStatisticsUpdateApplyActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionOutputRegNotifFlowsStatisticsUpdateWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.group.desc.stats.updated.group.desc.stats.buckets.bucket.action.action.NxActionOutputRegNotifGroupDescStatsUpdatedCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionOutputRegNodesNodeGroupBucketsBucketActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionOutputRegNodesNodeTableFlowWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.output.reg.grouping.NxOutputReg;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.output.reg.grouping.nx.output.reg.Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunIdCase;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test for {@link OutputRegConvertor}.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class OutputRegConvertorTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(OutputRegConvertorTest.class);
+
+    @Mock
+    private NxActionOutputRegNodesNodeGroupBucketsBucketActionsCase actionsCase;
+
+    @Mock
+    private Action action;
+
+    private OutputRegConvertor outputRegConvertor;
+
+    @Before
+    public void setUp() throws Exception {
+        final NxOutputReg nxOutputReg = Mockito.mock(NxOutputReg.class);
+        final Src src = Mockito.mock(Src.class);
+
+        when(src.getOfsNbits()).thenReturn(1);
+        when(nxOutputReg.getSrc()).thenReturn(src);
+        when(nxOutputReg.getSrc().getSrcChoice()).thenReturn(Mockito.mock(SrcNxTunIdCase.class));
+        when(nxOutputReg.getMaxLen()).thenReturn(2);
+        when(actionsCase.getNxOutputReg()).thenReturn(nxOutputReg);
+
+        final ActionOutputReg actionOutputReg = Mockito.mock(ActionOutputReg.class);
+        final NxActionOutputReg nxActionOutputReg = Mockito.mock(NxActionOutputReg.class);
+        when(nxActionOutputReg.getSrc()).thenReturn(NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong());
+        when(nxActionOutputReg.getMaxLen()).thenReturn(3);
+        when(nxActionOutputReg.getNBits()).thenReturn(4);
+        when(actionOutputReg.getNxActionOutputReg()).thenReturn(nxActionOutputReg);
+        when(action.getActionChoice()).thenReturn(actionOutputReg);
+
+        outputRegConvertor = new OutputRegConvertor();
+    }
+
+    @Test
+    public void testConvert() throws Exception {
+        final ActionOutputReg actionOutputReg = (ActionOutputReg) outputRegConvertor.convert(actionsCase).getActionChoice();
+        Assert.assertEquals(Integer.valueOf(1), actionOutputReg.getNxActionOutputReg().getNBits());
+        Assert.assertEquals(Integer.valueOf(2), actionOutputReg.getNxActionOutputReg().getMaxLen());
+    }
+
+    @Test
+    public void testConvert1() throws Exception {
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult
+                = outputRegConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult1
+                = outputRegConvertor.convert(action, ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult2
+                = outputRegConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult3
+                = outputRegConvertor.convert(action, ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+
+        Assert.assertEquals(Integer.valueOf(3), ((NxActionOutputRegNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxOutputReg().getMaxLen());
+        Assert.assertEquals(Integer.valueOf(4), ((NxActionOutputRegNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxOutputReg().getSrc().getOfsNbits());
+
+        Assert.assertEquals(Integer.valueOf(3), ((NxActionOutputRegNodesNodeTableFlowWriteActionsCase) actionResult1).getNxOutputReg().getMaxLen());
+        Assert.assertEquals(Integer.valueOf(4), ((NxActionOutputRegNodesNodeTableFlowWriteActionsCase) actionResult1).getNxOutputReg().getSrc().getOfsNbits());
+
+        Assert.assertEquals(Integer.valueOf(3), ((NxActionOutputRegNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxOutputReg().getMaxLen());
+        Assert.assertEquals(Integer.valueOf(4), ((NxActionOutputRegNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxOutputReg().getSrc().getOfsNbits());
+
+        Assert.assertEquals(Integer.valueOf(3), ((NxActionOutputRegNotifGroupDescStatsUpdatedCase) actionResult3).getNxOutputReg().getMaxLen());
+        Assert.assertEquals(Integer.valueOf(4), ((NxActionOutputRegNotifGroupDescStatsUpdatedCase) actionResult3).getNxOutputReg().getSrc().getOfsNbits());
+    }
+}
\ No newline at end of file
diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/RegLoadConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/RegLoadConvertorTest.java
new file mode 100644 (file)
index 0000000..789dcee
--- /dev/null
@@ -0,0 +1,112 @@
+/**
+ * Copyright (c) 2016 Cisco Systems, Inc. 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
+ */
+
+package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action;
+
+import static org.mockito.Mockito.when;
+
+import java.math.BigInteger;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.nx.NiciraMatchCodecs;
+import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegLoad;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.load.grouping.NxActionRegLoad;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxTunIdCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegLoadNotifFlowsStatisticsUpdateApplyActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionRegLoadNotifFlowsStatisticsUpdateWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.group.desc.stats.updated.group.desc.stats.buckets.bucket.action.action.NxActionRegLoadNotifGroupDescStatsUpdatedCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.group.buckets.bucket.action.action.NxActionRegLoadNodesNodeGroupBucketsBucketActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionRegLoadNodesNodeTableFlowWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.NxRegLoad;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.nx.reg.load.Dst;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test for {@link RegLoadConvertor}.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class RegLoadConvertorTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RegLoadConvertorTest.class);
+
+    @Mock
+    private NxActionRegLoadNodesNodeGroupBucketsBucketActionsCase actionsCase;
+
+    @Mock
+    private Action action;
+
+    private RegLoadConvertor regLoadConvertor;
+
+    @Before
+    public void setUp() throws Exception {
+        final NxRegLoad nxRegLoad = Mockito.mock(NxRegLoad.class);
+        final Dst dst = Mockito.mock(Dst.class);
+
+        when(dst.getStart()).thenReturn(1);
+        when(dst.getEnd()).thenReturn(2);
+        when(nxRegLoad.getDst()).thenReturn(dst);
+        when(nxRegLoad.getValue()).thenReturn(BigInteger.valueOf(3L));
+        when(nxRegLoad.getDst().getDstChoice()).thenReturn(Mockito.mock(DstNxTunIdCase.class));
+        when(actionsCase.getNxRegLoad()).thenReturn(nxRegLoad);
+
+        final ActionRegLoad actionRegLoad = Mockito.mock(ActionRegLoad.class);
+        final NxActionRegLoad nxActionRegLoad = Mockito.mock(NxActionRegLoad.class);
+        when(nxActionRegLoad.getDst()).thenReturn(NiciraMatchCodecs.ICMP_TYPE_CODEC.getHeaderWithoutHasMask().toLong());
+        when(nxActionRegLoad.getOfsNbits()).thenReturn(4);
+        when(nxActionRegLoad.getValue()).thenReturn(BigInteger.ONE);
+        when(actionRegLoad.getNxActionRegLoad()).thenReturn(nxActionRegLoad);
+        when(action.getActionChoice()).thenReturn(actionRegLoad);
+
+        regLoadConvertor = new RegLoadConvertor();
+    }
+
+    @Test
+    public void testConvert() throws Exception {
+        final ActionRegLoad actionRegLoad = (ActionRegLoad)regLoadConvertor.convert(actionsCase).getActionChoice();
+        Assert.assertEquals(Integer.valueOf(65), actionRegLoad.getNxActionRegLoad().getOfsNbits());
+        Assert.assertEquals(BigInteger.valueOf(3), actionRegLoad.getNxActionRegLoad().getValue());
+    }
+
+    @Test
+    public void testConvert1() throws Exception {
+        org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult
+                = regLoadConvertor.convert(action, ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION);
+        org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult1
+                = regLoadConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+        org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult2
+                = regLoadConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+        org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult3
+                = regLoadConvertor.convert(action, ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+
+        Assert.assertEquals(Integer.valueOf(0), ((NxActionRegLoadNodesNodeTableFlowWriteActionsCase) actionResult).getNxRegLoad().getDst().getStart());
+        Assert.assertEquals(Integer.valueOf(4), ((NxActionRegLoadNodesNodeTableFlowWriteActionsCase) actionResult).getNxRegLoad().getDst().getEnd());
+        Assert.assertEquals(BigInteger.ONE, ((NxActionRegLoadNodesNodeTableFlowWriteActionsCase) actionResult).getNxRegLoad().getValue());
+
+        Assert.assertEquals(Integer.valueOf(0), ((NxActionRegLoadNotifFlowsStatisticsUpdateApplyActionsCase) actionResult1).getNxRegLoad().getDst().getStart());
+        Assert.assertEquals(Integer.valueOf(4), ((NxActionRegLoadNotifFlowsStatisticsUpdateApplyActionsCase) actionResult1).getNxRegLoad().getDst().getEnd());
+        Assert.assertEquals(BigInteger.ONE, ((NxActionRegLoadNotifFlowsStatisticsUpdateApplyActionsCase) actionResult1).getNxRegLoad().getValue());
+
+        Assert.assertEquals(Integer.valueOf(0), ((NxActionRegLoadNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxRegLoad().getDst().getStart());
+        Assert.assertEquals(Integer.valueOf(4), ((NxActionRegLoadNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxRegLoad().getDst().getEnd());
+        Assert.assertEquals(BigInteger.ONE, ((NxActionRegLoadNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxRegLoad().getValue());
+
+        Assert.assertEquals(Integer.valueOf(0), ((NxActionRegLoadNotifGroupDescStatsUpdatedCase) actionResult3).getNxRegLoad().getDst().getStart());
+        Assert.assertEquals(Integer.valueOf(4), ((NxActionRegLoadNotifGroupDescStatsUpdatedCase) actionResult3).getNxRegLoad().getDst().getEnd());
+        Assert.assertEquals(BigInteger.ONE, ((NxActionRegLoadNotifGroupDescStatsUpdatedCase) actionResult3).getNxRegLoad().getValue());
+
+    }
+
+}
\ No newline at end of file
diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/RegMoveConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/RegMoveConvertorTest.java
new file mode 100644 (file)
index 0000000..68bb84f
--- /dev/null
@@ -0,0 +1,283 @@
+/**
+ * Copyright (c) 2016 Cisco Systems, Inc. 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
+ */
+
+package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.action;
+
+import static org.mockito.Mockito.when;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.opendaylight.openflowjava.nx.NiciraMatchCodecs;
+import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMove;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxArpShaCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxArpThaCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNshc1Case;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNshc2Case;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNshc3Case;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNshc4Case;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNsiCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxNspCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxTunIdCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxTunIpv4DstCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxTunIpv4SrcCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfArpOpCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfArpSpaCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfArpTpaCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfEthDstCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfEthSrcCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIcmpTypeCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIpDstCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIpSrcCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegMoveNotifFlowsStatisticsUpdateApplyActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionRegMoveNotifFlowsStatisticsUpdateWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.group.desc.stats.updated.group.desc.stats.buckets.bucket.action.action.NxActionRegMoveNotifGroupDescStatsUpdatedCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nodes.node.table.flow.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionRegMoveNodesNodeTableFlowWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.NxRegMove;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.move.grouping.nx.reg.move.Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxArpShaCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxArpThaCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshc1Case;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshc2Case;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshc3Case;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNshc4Case;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNsiCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxNspCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunIdCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunIpv4DstCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcNxTunIpv4SrcCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfArpOpCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfArpSpaCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfArpTpaCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfEthDstCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfEthSrcCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfEthTypeCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfIpDstCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfIpSrcCase;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test for {@link RegMoveConvertor}.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class RegMoveConvertorTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RegMoveConvertorTest.class);
+
+    @Mock
+    private NxActionRegMoveNotifFlowsStatisticsUpdateApplyActionsCase actionsCase;
+    @Mock
+    private Action action;
+    @Mock
+    private NxRegMove nxRegMove;
+
+    private RegMoveConvertor regMoveConvertor;
+
+
+    @Before
+    public void setUp() throws Exception {
+        final Src src = Mockito.mock(Src.class);
+        final Dst dst = Mockito.mock(Dst.class);
+
+        when(actionsCase.getNxRegMove()).thenReturn(nxRegMove);
+        when(nxRegMove.getSrc()).thenReturn(src);
+        when(nxRegMove.getDst()).thenReturn(dst);
+        when(nxRegMove.getSrc().getStart()).thenReturn(1);
+        when(nxRegMove.getSrc().getEnd()).thenReturn(2);
+        when(nxRegMove.getDst().getStart()).thenReturn(3);
+        when(nxRegMove.getDst().getEnd()).thenReturn(4);
+        when(nxRegMove.getDst().getDstChoice()).thenReturn(Mockito.mock(DstNxTunIdCase.class));
+        when(nxRegMove.getSrc().getSrcChoice()).thenReturn(Mockito.mock(SrcNxTunIdCase.class));
+
+        final ActionRegMove actionRegMove = Mockito.mock(ActionRegMove.class);
+        final NxActionRegMove nxActionRegMove = Mockito.mock(NxActionRegMove.class);
+        when(nxActionRegMove.getSrc()).thenReturn(NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong());
+        when(nxActionRegMove.getDst()).thenReturn(NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong());
+
+        when(nxActionRegMove.getNBits()).thenReturn(7);
+
+        when(actionRegMove.getNxActionRegMove()).thenReturn(nxActionRegMove);
+        when(action.getActionChoice()).thenReturn(actionRegMove);
+
+        regMoveConvertor = new RegMoveConvertor();
+
+    }
+
+    @Test
+    public void testConvert() throws Exception {
+        final ActionRegMove actionRegMove = (ActionRegMove) regMoveConvertor.convert(actionsCase).getActionChoice();
+        Assert.assertEquals(Integer.valueOf(3) ,actionRegMove.getNxActionRegMove().getDstOfs());
+        Assert.assertEquals(Integer.valueOf(2) ,actionRegMove.getNxActionRegMove().getNBits());
+        Assert.assertEquals(Integer.valueOf(1) ,actionRegMove.getNxActionRegMove().getSrcOfs());
+    }
+
+    @Test
+    public void testConvert1() throws Exception {
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult
+                = regMoveConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult1
+                = regMoveConvertor.convert(action, ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult2
+                = regMoveConvertor.convert(action, ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult3
+                = regMoveConvertor.convert(action, ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+
+        Assert.assertEquals(Integer.valueOf(0), ((NxActionRegMoveNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxRegMove().getDst().getStart());
+        Assert.assertEquals(Integer.valueOf(6), ((NxActionRegMoveNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxRegMove().getDst().getEnd());
+        Assert.assertEquals(Integer.valueOf(0), ((NxActionRegMoveNodesNodeTableFlowWriteActionsCase) actionResult1).getNxRegMove().getDst().getStart());
+        Assert.assertEquals(Integer.valueOf(6), ((NxActionRegMoveNodesNodeTableFlowWriteActionsCase) actionResult1).getNxRegMove().getDst().getEnd());
+        Assert.assertEquals(Integer.valueOf(0), ((NxActionRegMoveNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxRegMove().getDst().getStart());
+        Assert.assertEquals(Integer.valueOf(6), ((NxActionRegMoveNotifFlowsStatisticsUpdateWriteActionsCase) actionResult2).getNxRegMove().getDst().getEnd());
+        Assert.assertEquals(Integer.valueOf(0), ((NxActionRegMoveNotifGroupDescStatsUpdatedCase) actionResult3).getNxRegMove().getDst().getStart());
+        Assert.assertEquals(Integer.valueOf(6), ((NxActionRegMoveNotifGroupDescStatsUpdatedCase) actionResult3).getNxRegMove().getDst().getEnd());
+    }
+
+    @Test
+    public void testResolveDst() throws Exception {
+        Assert.assertEquals(NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstNxTunIdCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.ARP_SHA_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstNxArpShaCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.ARP_THA_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstNxArpThaCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.ARP_OP_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstOfArpOpCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.ARP_SPA_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstOfArpSpaCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.ARP_TPA_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstOfArpTpaCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.TUN_IPV4_DST_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstNxTunIpv4DstCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.TUN_IPV4_SRC_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstNxTunIpv4SrcCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.ETH_DST_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstOfEthDstCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.ETH_SRC_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstOfEthSrcCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.NSP_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstNxNspCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.NSI_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstNxNsiCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.NSC1_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstNxNshc1Case.class)));
+        Assert.assertEquals(NiciraMatchCodecs.NSC2_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstNxNshc2Case.class)));
+        Assert.assertEquals(NiciraMatchCodecs.NSC3_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstNxNshc3Case.class)));
+        Assert.assertEquals(NiciraMatchCodecs.NSC4_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstNxNshc4Case.class)));
+        Assert.assertEquals(NiciraMatchCodecs.IP_SRC_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstOfIpSrcCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.IP_DST_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstOfIpDstCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.ICMP_TYPE_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveDst(Mockito.mock(DstOfIcmpTypeCase.class)));
+
+
+    }
+
+    @Test
+    public void testResolveSrc() throws Exception {
+        Assert.assertEquals(NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcNxTunIdCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.ARP_SHA_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcNxArpShaCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.ARP_THA_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcNxArpThaCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.ARP_OP_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcOfArpOpCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.ARP_SPA_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcOfArpSpaCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.ARP_TPA_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcOfArpTpaCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.ETH_DST_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcOfEthDstCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.ETH_SRC_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcOfEthSrcCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.TUN_IPV4_DST_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcNxTunIpv4DstCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.TUN_IPV4_SRC_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcNxTunIpv4SrcCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.NSP_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcNxNspCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.NSI_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcNxNsiCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.NSC1_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcNxNshc1Case.class)));
+        Assert.assertEquals(NiciraMatchCodecs.NSC2_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcNxNshc2Case.class)));
+        Assert.assertEquals(NiciraMatchCodecs.NSC3_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcNxNshc3Case.class)));
+        Assert.assertEquals(NiciraMatchCodecs.NSC4_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcNxNshc4Case.class)));
+        Assert.assertEquals(NiciraMatchCodecs.IP_SRC_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcOfIpSrcCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.IP_DST_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcOfIpDstCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.TUN_IPV4_SRC_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcNxTunIpv4SrcCase.class)));
+        Assert.assertEquals(NiciraMatchCodecs.TUN_IPV4_DST_CODEC.getHeaderWithoutHasMask().toLong(),
+                RegMoveConvertor.resolveSrc(Mockito.mock(SrcNxTunIpv4DstCase.class)));
+    }
+
+    @Test
+    public void testResolveSrc1() throws Exception {
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxTunIdCase);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.ARP_SHA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxArpShaCase);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.ARP_THA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxArpThaCase);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.ARP_OP_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfArpOpCase);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.ARP_SPA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfArpSpaCase);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.ARP_TPA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfArpTpaCase);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.ETH_DST_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfEthDstCase);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.ETH_SRC_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfEthSrcCase);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.ETH_TYPE_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfEthTypeCase);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.TUN_IPV4_DST_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxTunIpv4DstCase);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.TUN_IPV4_SRC_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxTunIpv4SrcCase);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.NSP_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNspCase);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.NSI_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNsiCase);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.NSC1_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNshc1Case);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.NSC2_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNshc2Case);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.NSC3_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNshc3Case);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.NSC4_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcNxNshc4Case);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.IP_DST_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfIpDstCase);
+        Assert.assertTrue(RegMoveConvertor.resolveSrc(NiciraMatchCodecs.IP_SRC_CODEC.getHeaderWithoutHasMask().toLong()) instanceof SrcOfIpSrcCase);
+    }
+
+    @Test
+    public void testResolveDst1() throws Exception {
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxTunIdCase);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.ARP_SHA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxArpShaCase);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.ARP_THA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxArpThaCase);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.ARP_OP_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfArpOpCase);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.ARP_SPA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfArpSpaCase);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.ARP_TPA_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfArpTpaCase);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.ETH_DST_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfEthDstCase);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.ETH_SRC_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfEthSrcCase);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.TUN_IPV4_DST_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxTunIpv4DstCase);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.TUN_IPV4_SRC_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxTunIpv4SrcCase);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.NSP_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNspCase);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.NSI_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNsiCase);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.NSC1_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNshc1Case);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.NSC2_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNshc2Case);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.NSC3_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNshc3Case);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.NSC4_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstNxNshc4Case);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.IP_DST_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfIpDstCase);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.IP_SRC_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfIpSrcCase);
+        Assert.assertTrue(RegMoveConvertor.resolveDst(NiciraMatchCodecs.ICMP_TYPE_CODEC.getHeaderWithoutHasMask().toLong()) instanceof DstOfIcmpTypeCase);
+    }
+
+}
\ No newline at end of file
diff --git a/extension/openflowplugin-extension-nicira/src/test/resources/log4j.xml b/extension/openflowplugin-extension-nicira/src/test/resources/log4j.xml
new file mode 100644 (file)
index 0000000..cc2d455
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright (c) 2015 Cisco Systems, Inc. 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
+  -->
+
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+    <appender name="console" class="org.apache.log4j.ConsoleAppender">
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%-6p %d{HH:mm:ss.SSS} [%10.10t] %30.30c %x - %m%n" />
+        </layout>
+        <!--         <param name="Threshold" value="DEBUG" /> -->
+    </appender>
+
+    <logger name="org.opendaylight.openflowplugin" additivity="false">
+        <level value="DEBUG" />
+        <appender-ref ref="console" />
+    </logger>
+
+    <logger name="org.opendaylight.openflowplugin.impl" additivity="false">
+        <level value="DEBUG" />
+        <appender-ref ref="console" />
+    </logger>
+
+    <logger name="org.opendaylight.openflowplugin.impl.connection" additivity="false">
+        <level value="TRACE" />
+        <appender-ref ref="console" />
+    </logger>
+
+    <logger name="org.opendaylight.openflowplugin.impl.device" additivity="false">
+        <level value="TRACE" />
+        <appender-ref ref="console" />
+    </logger>
+
+    <logger name="org.opendaylight.openflowplugin.openflow.md.core.HandshakeManagerImpl" additivity="false">
+        <level value="TRACE" />
+        <appender-ref ref="console" />
+    </logger>
+
+    <root>
+        <priority value="INFO" />
+        <appender-ref ref="console" />
+    </root>
+</log4j:configuration>