X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2Ftranslator%2FFlowRemovedTranslatorTest.java;h=5fa15e094b6a8cd326f89cb5104c366614c6aa50;hb=6e2627630ebabb37526133a13deeb62adcc85d35;hp=a695ef097017dbdde2df959cea31b6d0ac9061cd;hpb=e2c1cba548652d138e61afd1a845378060d104aa;p=openflowplugin.git diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/FlowRemovedTranslatorTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/FlowRemovedTranslatorTest.java index a695ef0970..5fa15e094b 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/FlowRemovedTranslatorTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/FlowRemovedTranslatorTest.java @@ -20,6 +20,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext; +import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo; import org.opendaylight.openflowplugin.api.openflow.device.DeviceState; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; @@ -52,6 +53,9 @@ public class FlowRemovedTranslatorTest { @Mock private DeviceState deviceState; + @Mock + private DeviceInfo deviceInfo; + @Mock private GetFeaturesOutput features; @@ -69,15 +73,14 @@ public class FlowRemovedTranslatorTest { translatorV10 = new FlowRemovedV10Translator(); when(deviceContext.getDeviceState()).thenReturn(deviceState); - when(deviceState.getNodeInstanceIdentifier()).thenReturn(nodeId); - when(deviceState.getFeatures()).thenReturn(features); + when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeId); when(features.getDatapathId()).thenReturn(BigInteger.TEN); } @Test public void testTranslate() throws Exception { org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved flowRemovedMessage = buildMessage(false); - final FlowRemoved flowRemoved = translator.translate(flowRemovedMessage, deviceState, null); + final FlowRemoved flowRemoved = translator.translate(flowRemovedMessage, deviceInfo, null); assertEquals(flowRemovedMessage.getCookie(), flowRemoved.getCookie().getValue()); assertEquals(flowRemovedMessage.getPriority(), flowRemoved.getPriority()); @@ -87,25 +90,25 @@ public class FlowRemovedTranslatorTest { @Test public void testTranslateV10() throws Exception { org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved flowRemovedMessage = buildMessage(true); - final FlowRemoved flowRemoved = translatorV10.translate(flowRemovedMessage, deviceState, null); + final FlowRemoved flowRemoved = translatorV10.translate(flowRemovedMessage, deviceInfo, null); assertEquals(flowRemovedMessage.getCookie(), flowRemoved.getCookie().getValue()); assertEquals(flowRemovedMessage.getPriority(), flowRemoved.getPriority()); - assertEquals((long)flowRemovedMessage.getTableId().getValue(), (long)flowRemoved.getTableId()); + assertEquals((short)0, flowRemoved.getTableId().shortValue()); } private org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved buildMessage(boolean isV10) { FlowRemovedMessageBuilder builder = new FlowRemovedMessageBuilder() .setCookie(BigInteger.ONE) - .setPriority(1) - .setTableId(new TableId(42l)); + .setPriority(1); if (isV10) { builder.setMatchV10(new MatchV10Builder().setWildcards(flowWildcards).build()); } else { - builder.setMatch(new MatchBuilder().setMatchEntry(Collections.emptyList()).build()); + builder.setMatch(new MatchBuilder().setMatchEntry(Collections.emptyList()).build()) + .setTableId(new TableId(42l)); } return builder.build(); } -} \ No newline at end of file +}