X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=openflowplugin-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2Ftranslator%2FFlowRemovedTranslatorTest.java;h=fec15b653a420ebbeb5e329021c75e67c69ad07f;hb=b4f4b4b702e2ccd8a7c62fd2a5c184c5b1cbe665;hp=d3e95982193122398c65b6cd178982502ff927a1;hpb=7bc04367dae6c4acfef928a358e3f3869cb453af;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 d3e9598219..fec15b653a 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 @@ -21,11 +21,14 @@ 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.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager; +import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowRemovedReason; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry; @@ -37,7 +40,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; /** - * Test of {@link AggregatedFlowStatisticsTranslator} + * Test of {@link AggregatedFlowStatisticsTranslator}. */ @RunWith(MockitoJUnitRunner.class) public class FlowRemovedTranslatorTest { @@ -61,24 +64,22 @@ public class FlowRemovedTranslatorTest { @Mock private FlowWildcardsV10 flowWildcards; - private KeyedInstanceIdentifier nodeId; - @Before public void setUp() throws Exception { - nodeId = InstanceIdentifier.create(Nodes.class) + final KeyedInstanceIdentifier nodeId = InstanceIdentifier.create(Nodes.class) .child(Node.class, new NodeKey(new NodeId("dummyNodeId"))); - translator = new FlowRemovedTranslator(); - translatorV10 = new FlowRemovedV10Translator(); + final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager(); + translator = new FlowRemovedTranslator(convertorManager); + translatorV10 = new FlowRemovedV10Translator(convertorManager); - when(deviceContext.getDeviceState()).thenReturn(deviceState); 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); + org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved flowRemovedMessage = + buildMessage(false); final FlowRemoved flowRemoved = translator.translate(flowRemovedMessage, deviceInfo, null); assertEquals(flowRemovedMessage.getCookie(), flowRemoved.getCookie().getValue()); @@ -88,7 +89,8 @@ public class FlowRemovedTranslatorTest { @Test public void testTranslateV10() throws Exception { - org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved flowRemovedMessage = buildMessage(true); + org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved flowRemovedMessage = + buildMessage(true); final FlowRemoved flowRemoved = translatorV10.translate(flowRemovedMessage, deviceInfo, null); assertEquals(flowRemovedMessage.getCookie(), flowRemoved.getCookie().getValue()); @@ -96,9 +98,11 @@ public class FlowRemovedTranslatorTest { assertEquals((short)0, flowRemoved.getTableId().shortValue()); } - private org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved buildMessage(boolean isV10) { + private org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved + buildMessage(boolean isV10) { FlowRemovedMessageBuilder builder = new FlowRemovedMessageBuilder() .setCookie(BigInteger.ONE) + .setReason(FlowRemovedReason.OFPRRGROUPDELETE) .setPriority(1); if (isV10) {