Bug-5543 - Bo: Update JUnit tests part 5 72/40672/3
authormiroslav.macko <miroslav.macko@pantheon.tech>
Wed, 22 Jun 2016 10:28:41 +0000 (12:28 +0200)
committermiroslav.macko <miroslav.macko@pantheon.tech>
Mon, 27 Jun 2016 12:01:21 +0000 (14:01 +0200)
Added tests for openflowplugin-extension-nicira

Change-Id: I7665dab9bd9646cdd38c9b303c53c121f9a8d8b6
Signed-off-by: miroslav.macko <miroslav.macko@pantheon.tech>
extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/ConntrackConvertorTest.java
extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/ResubmitConvertorTest.java [new file with mode: 0644]
extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/SetNshc1ConvertorTest.java [new file with mode: 0644]
extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/SetNshc2ConvertorTest.java [new file with mode: 0644]
extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/SetNshc3ConvertorTest.java [new file with mode: 0644]
extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/SetNshc4ConvertorTest.java [new file with mode: 0644]

index bac69c998d2edea630b80786467f56e3a3abbf1b..0b4eb8a60d735ced42daa35898b4210e6ae4a874 100644 (file)
@@ -89,22 +89,22 @@ public class ConntrackConvertorTest {
 
         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().getRecircTable().intValue());
         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().getRecircTable().intValue());
         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().getRecircTable().intValue());
         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().getRecircTable().intValue());
         Assert.assertEquals(1, ((NxActionConntrackNotifGroupDescStatsUpdatedCase) action3).getNxConntrack().getFlags().intValue());
 
     }
diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/ResubmitConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/ResubmitConvertorTest.java
new file mode 100644 (file)
index 0000000..8d142e3
--- /dev/null
@@ -0,0 +1,96 @@
+/**
+ * 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.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.ActionResubmit;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.resubmit.grouping.NxActionResubmit;
+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.NxActionResubmitNotifFlowsStatisticsUpdateApplyActionsCase;
+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.NxActionResubmitNotifFlowsStatisticsUpdateWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.group.desc.stats.updated.group.desc.stats.buckets.bucket.action.action.NxActionResubmitNotifGroupDescStatsUpdatedCase;
+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.NxActionResubmitNodesNodeTableFlowWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.resubmit.grouping.NxResubmit;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test for {@link ResubmitConvertor}.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class ResubmitConvertorTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(ResubmitConvertorTest.class);
+
+    @Mock
+    private NxActionResubmitNodesNodeTableFlowWriteActionsCase actionsCase;
+
+    @Mock
+    private Action action;
+
+    private ResubmitConvertor resubmitConvertor;
+
+    @Before
+    public void setUp() throws Exception {
+        final NxResubmit nxResubmit = Mockito.mock(NxResubmit.class);
+        when(actionsCase.getNxResubmit()).thenReturn(nxResubmit);
+        when(nxResubmit.getInPort()).thenReturn(1);
+        when(nxResubmit.getTable()).thenReturn((short) 2);
+
+        final ActionResubmit actionResubmit = Mockito.mock(ActionResubmit.class);
+        final NxActionResubmit nxActionResubmit = Mockito.mock(NxActionResubmit.class);
+        when(nxActionResubmit.getInPort()).thenReturn(3);
+        when(nxActionResubmit.getTable()).thenReturn((short) 4);
+        when(actionResubmit.getNxActionResubmit()).thenReturn(nxActionResubmit);
+        when(action.getActionChoice()).thenReturn(actionResubmit);
+
+        resubmitConvertor = new ResubmitConvertor();
+    }
+
+    @Test
+    public void testConvert() throws Exception {
+        final ActionResubmit actionResubmit = (ActionResubmit) resubmitConvertor.convert(actionsCase).getActionChoice();
+        Assert.assertEquals(1, actionResubmit.getNxActionResubmit().getInPort().intValue());
+        Assert.assertEquals(2, actionResubmit.getNxActionResubmit().getTable().intValue());
+    }
+
+    @Test
+    public void testConvert1() throws Exception {
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult
+                = resubmitConvertor.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
+                = resubmitConvertor.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
+                = resubmitConvertor.convert(action, ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult3
+                = resubmitConvertor.convert(action, ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION);
+
+        Assert.assertEquals(3, ((NxActionResubmitNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxResubmit().getInPort().intValue());
+        Assert.assertEquals(4, ((NxActionResubmitNotifFlowsStatisticsUpdateApplyActionsCase) actionResult).getNxResubmit().getTable().intValue());
+
+        Assert.assertEquals(3, ((NxActionResubmitNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxResubmit().getInPort().intValue());
+        Assert.assertEquals(4, ((NxActionResubmitNotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxResubmit().getTable().intValue());
+
+        Assert.assertEquals(3, ((NxActionResubmitNotifGroupDescStatsUpdatedCase) actionResult2).getNxResubmit().getInPort().intValue());
+        Assert.assertEquals(4, ((NxActionResubmitNotifGroupDescStatsUpdatedCase) actionResult2).getNxResubmit().getTable().intValue());
+
+        Assert.assertEquals(3, ((NxActionResubmitNodesNodeTableFlowWriteActionsCase) actionResult3).getNxResubmit().getInPort().intValue());
+        Assert.assertEquals(4, ((NxActionResubmitNodesNodeTableFlowWriteActionsCase) actionResult3).getNxResubmit().getTable().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/SetNshc1ConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/SetNshc1ConvertorTest.java
new file mode 100644 (file)
index 0000000..bba0edf
--- /dev/null
@@ -0,0 +1,86 @@
+/**
+ * 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.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.ActionSetNshc1;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.set.nshc._1.grouping.NxActionSetNshc1;
+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.NxActionSetNshc1NotifFlowsStatisticsUpdateApplyActionsCase;
+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.NxActionSetNshc1NotifFlowsStatisticsUpdateWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.group.desc.stats.updated.group.desc.stats.buckets.bucket.action.action.NxActionSetNshc1NotifGroupDescStatsUpdatedCase;
+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.NxActionSetNshc1NodesNodeTableFlowWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.set.nshc._1.grouping.NxSetNshc1;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test for {@link SetNshc1Convertor}.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class SetNshc1ConvertorTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(SetNshc1ConvertorTest.class);
+
+    @Mock
+    private NxActionSetNshc1NodesNodeTableFlowWriteActionsCase actionsCase;
+
+    @Mock
+    private Action action;
+
+    private SetNshc1Convertor setNshc1Convertor;
+
+    @Before
+    public void setUp() throws Exception {
+        final NxSetNshc1 nxSetNshc1 = Mockito.mock(NxSetNshc1.class);
+        when(actionsCase.getNxSetNshc1()).thenReturn(nxSetNshc1);
+        when(nxSetNshc1.getNshc()).thenReturn(1L);
+
+        final ActionSetNshc1 actionSetNshc1 = Mockito.mock(ActionSetNshc1.class);
+        final NxActionSetNshc1 nxActionSetNshc1 = Mockito.mock(NxActionSetNshc1.class);
+        when(nxActionSetNshc1.getNshc()).thenReturn(3L);
+        when(actionSetNshc1.getNxActionSetNshc1()).thenReturn(nxActionSetNshc1);
+        when(action.getActionChoice()).thenReturn(actionSetNshc1);
+
+        setNshc1Convertor = new SetNshc1Convertor();
+    }
+
+    @Test
+    public void testConvert() throws Exception {
+        final ActionSetNshc1 actionSetNshc1 = (ActionSetNshc1) setNshc1Convertor.convert(actionsCase).getActionChoice();
+        Assert.assertEquals(Long.valueOf(1L), actionSetNshc1.getNxActionSetNshc1().getNshc());
+    }
+
+    @Test
+    public void testConvert1() throws Exception {
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult
+                = setNshc1Convertor.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 actionResult1
+                = setNshc1Convertor.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
+                = setNshc1Convertor.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 actionResult3
+                = setNshc1Convertor.convert(action, ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+
+        Assert.assertEquals(Long.valueOf(3), ((NxActionSetNshc1NodesNodeTableFlowWriteActionsCase) actionResult).getNxSetNshc1().getNshc());
+        Assert.assertEquals(Long.valueOf(3), ((NxActionSetNshc1NotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxSetNshc1().getNshc());
+        Assert.assertEquals(Long.valueOf(3), ((NxActionSetNshc1NotifFlowsStatisticsUpdateApplyActionsCase) actionResult2).getNxSetNshc1().getNshc());
+        Assert.assertEquals(Long.valueOf(3), ((NxActionSetNshc1NotifGroupDescStatsUpdatedCase) actionResult3).getNxSetNshc1().getNshc());
+    }
+
+}
\ No newline at end of file
diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/SetNshc2ConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/SetNshc2ConvertorTest.java
new file mode 100644 (file)
index 0000000..b25c51a
--- /dev/null
@@ -0,0 +1,84 @@
+/**
+ * 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.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.ActionSetNshc2;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.set.nshc._2.grouping.NxActionSetNshc2;
+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.NxActionSetNshc2NotifFlowsStatisticsUpdateApplyActionsCase;
+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.NxActionSetNshc2NotifFlowsStatisticsUpdateWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.group.desc.stats.updated.group.desc.stats.buckets.bucket.action.action.NxActionSetNshc2NotifGroupDescStatsUpdatedCase;
+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.NxActionSetNshc2NodesNodeTableFlowWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.set.nshc._2.grouping.NxSetNshc2;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test for {@link SetNshc2Convertor}.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class SetNshc2ConvertorTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(SetNshc2ConvertorTest.class);
+
+    @Mock
+    private NxActionSetNshc2NodesNodeTableFlowWriteActionsCase actionsCase;
+    @Mock
+    private Action action;
+    private SetNshc2Convertor setNshc2Convertor;
+
+    @Before
+    public void setUp() throws Exception {
+        final NxSetNshc2 nxSetNshc2 = Mockito.mock(NxSetNshc2.class);
+        when(actionsCase.getNxSetNshc2()).thenReturn(nxSetNshc2);
+        when(nxSetNshc2.getNshc()).thenReturn(1L);
+
+        final ActionSetNshc2 actionSetNshc2 = Mockito.mock(ActionSetNshc2.class);
+        final NxActionSetNshc2 nxActionSetNshc2 = Mockito.mock(NxActionSetNshc2.class);
+        when(nxActionSetNshc2.getNshc()).thenReturn(3L);
+        when(actionSetNshc2.getNxActionSetNshc2()).thenReturn(nxActionSetNshc2);
+        when(action.getActionChoice()).thenReturn(actionSetNshc2);
+
+        setNshc2Convertor = new SetNshc2Convertor();
+    }
+
+    @Test
+    public void testConvert() throws Exception {
+        final ActionSetNshc2 actionSetNshc2 = (ActionSetNshc2) setNshc2Convertor.convert(actionsCase).getActionChoice();
+        Assert.assertEquals(Long.valueOf(1L), actionSetNshc2.getNxActionSetNshc2().getNshc());
+    }
+
+    @Test
+    public void testConvert1() throws Exception {
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult
+                = setNshc2Convertor.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 actionResult1
+                = setNshc2Convertor.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
+                = setNshc2Convertor.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 actionResult3
+                = setNshc2Convertor.convert(action, ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+
+        Assert.assertEquals(Long.valueOf(3), ((NxActionSetNshc2NodesNodeTableFlowWriteActionsCase) actionResult).getNxSetNshc2().getNshc());
+        Assert.assertEquals(Long.valueOf(3), ((NxActionSetNshc2NotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxSetNshc2().getNshc());
+        Assert.assertEquals(Long.valueOf(3), ((NxActionSetNshc2NotifFlowsStatisticsUpdateApplyActionsCase) actionResult2).getNxSetNshc2().getNshc());
+        Assert.assertEquals(Long.valueOf(3), ((NxActionSetNshc2NotifGroupDescStatsUpdatedCase) actionResult3).getNxSetNshc2().getNshc());
+    }
+
+}
\ No newline at end of file
diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/SetNshc3ConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/SetNshc3ConvertorTest.java
new file mode 100644 (file)
index 0000000..f5bf2fa
--- /dev/null
@@ -0,0 +1,84 @@
+/**
+ * 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.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.ActionSetNshc3;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.set.nshc._3.grouping.NxActionSetNshc3;
+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.NxActionSetNshc3NotifFlowsStatisticsUpdateApplyActionsCase;
+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.NxActionSetNshc3NotifFlowsStatisticsUpdateWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.group.desc.stats.updated.group.desc.stats.buckets.bucket.action.action.NxActionSetNshc3NotifGroupDescStatsUpdatedCase;
+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.NxActionSetNshc3NodesNodeTableFlowWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.set.nshc._3.grouping.NxSetNshc3;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test for {@link SetNshc3Convertor}.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class SetNshc3ConvertorTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(SetNshc3ConvertorTest.class);
+
+    @Mock
+    private NxActionSetNshc3NodesNodeTableFlowWriteActionsCase actionsCase;
+    @Mock
+    private Action action;
+    private SetNshc3Convertor setNshc3Convertor;
+
+    @Before
+    public void setUp() throws Exception {
+        final NxSetNshc3 nxSetNshc3 = Mockito.mock(NxSetNshc3.class);
+        when(actionsCase.getNxSetNshc3()).thenReturn(nxSetNshc3);
+        when(nxSetNshc3.getNshc()).thenReturn(1L);
+
+        final ActionSetNshc3 actionSetNshc3 = Mockito.mock(ActionSetNshc3.class);
+        final NxActionSetNshc3 nxActionSetNshc3 = Mockito.mock(NxActionSetNshc3.class);
+        when(nxActionSetNshc3.getNshc()).thenReturn(3L);
+        when(actionSetNshc3.getNxActionSetNshc3()).thenReturn(nxActionSetNshc3);
+        when(action.getActionChoice()).thenReturn(actionSetNshc3);
+
+        setNshc3Convertor = new SetNshc3Convertor();
+    }
+
+    @Test
+    public void testConvert() throws Exception {
+        final ActionSetNshc3 actionSetNshc3 = (ActionSetNshc3) setNshc3Convertor.convert(actionsCase).getActionChoice();
+        Assert.assertEquals(Long.valueOf(1L), actionSetNshc3.getNxActionSetNshc3().getNshc());
+    }
+
+    @Test
+    public void testConvert1() throws Exception {
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult
+                = setNshc3Convertor.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 actionResult1
+                = setNshc3Convertor.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
+                = setNshc3Convertor.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 actionResult3
+                = setNshc3Convertor.convert(action, ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+
+        Assert.assertEquals(Long.valueOf(3), ((NxActionSetNshc3NodesNodeTableFlowWriteActionsCase) actionResult).getNxSetNshc3().getNshc());
+        Assert.assertEquals(Long.valueOf(3), ((NxActionSetNshc3NotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxSetNshc3().getNshc());
+        Assert.assertEquals(Long.valueOf(3), ((NxActionSetNshc3NotifFlowsStatisticsUpdateApplyActionsCase) actionResult2).getNxSetNshc3().getNshc());
+        Assert.assertEquals(Long.valueOf(3), ((NxActionSetNshc3NotifGroupDescStatsUpdatedCase) actionResult3).getNxSetNshc3().getNshc());
+    }
+
+}
\ No newline at end of file
diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/SetNshc4ConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/SetNshc4ConvertorTest.java
new file mode 100644 (file)
index 0000000..4c19b87
--- /dev/null
@@ -0,0 +1,83 @@
+/**
+ * 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.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.ActionSetNshc4;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.set.nshc._4.grouping.NxActionSetNshc4;
+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.NxActionSetNshc4NotifFlowsStatisticsUpdateApplyActionsCase;
+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.NxActionSetNshc4NotifFlowsStatisticsUpdateWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.group.desc.stats.updated.group.desc.stats.buckets.bucket.action.action.NxActionSetNshc4NotifGroupDescStatsUpdatedCase;
+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.NxActionSetNshc4NodesNodeTableFlowWriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.set.nshc._4.grouping.NxSetNshc4;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Test for {@link SetNshc4Convertor}.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class SetNshc4ConvertorTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(SetNshc4ConvertorTest.class);
+
+    @Mock
+    private NxActionSetNshc4NodesNodeTableFlowWriteActionsCase actionsCase;
+    @Mock
+    private Action action;
+    private SetNshc4Convertor setNshc4Convertor;
+
+    @Before
+    public void setUp() throws Exception {
+        final NxSetNshc4 nxSetNshc4 = Mockito.mock(NxSetNshc4.class);
+        when(actionsCase.getNxSetNshc4()).thenReturn(nxSetNshc4);
+        when(nxSetNshc4.getNshc()).thenReturn(1L);
+
+        final ActionSetNshc4 actionSetNshc4 = Mockito.mock(ActionSetNshc4.class);
+        final NxActionSetNshc4 nxActionSetNshc4 = Mockito.mock(NxActionSetNshc4.class);
+        when(nxActionSetNshc4.getNshc()).thenReturn(3L);
+        when(actionSetNshc4.getNxActionSetNshc4()).thenReturn(nxActionSetNshc4);
+        when(action.getActionChoice()).thenReturn(actionSetNshc4);
+
+        setNshc4Convertor = new SetNshc4Convertor();
+    }
+
+    @Test
+    public void testConvert() throws Exception {
+        final ActionSetNshc4 actionSetNshc4 = (ActionSetNshc4) setNshc4Convertor.convert(actionsCase).getActionChoice();
+        Assert.assertEquals(Long.valueOf(1L), actionSetNshc4.getNxActionSetNshc4().getNshc());
+    }
+
+    @Test
+    public void testConvert1() throws Exception {
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionResult
+                = setNshc4Convertor.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 actionResult1
+                = setNshc4Convertor.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
+                = setNshc4Convertor.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 actionResult3
+                = setNshc4Convertor.convert(action, ActionPath.GROUPDESCSTATSUPDATED_GROUPDESCSTATS_BUCKETS_BUCKET_ACTION);
+
+        Assert.assertEquals(Long.valueOf(3), ((NxActionSetNshc4NodesNodeTableFlowWriteActionsCase) actionResult).getNxSetNshc4().getNshc());
+        Assert.assertEquals(Long.valueOf(3), ((NxActionSetNshc4NotifFlowsStatisticsUpdateWriteActionsCase) actionResult1).getNxSetNshc4().getNshc());
+        Assert.assertEquals(Long.valueOf(3), ((NxActionSetNshc4NotifFlowsStatisticsUpdateApplyActionsCase) actionResult2).getNxSetNshc4().getNshc());
+        Assert.assertEquals(Long.valueOf(3), ((NxActionSetNshc4NotifGroupDescStatsUpdatedCase) actionResult3).getNxSetNshc4().getNshc());
+    }
+}
\ No newline at end of file