X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=extension%2Fopenflowplugin-extension-nicira%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fextension%2Fvendor%2Fnicira%2Fconvertor%2Fmatch%2FUdpDstConvertorTest.java;h=08b8734900f8b7f3fe609db9a0a896af872287fc;hb=137e4d7d86e8f402f3d52fd0fa162792f9ff60eb;hp=c43ad74de9e3c3df526f3f1fb9a564505824132a;hpb=864f9b901d0afa8267f8d91de83ebca978fb3553;p=openflowplugin.git diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/UdpDstConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/UdpDstConvertorTest.java index c43ad74de9..08b8734900 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/UdpDstConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/UdpDstConvertorTest.java @@ -25,10 +25,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValue; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValueBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlow; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlowBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketIn; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemoved; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifUpdateFlowStats; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifUpdateFlowStatsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcGetFlowStats; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfUdpDstKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.udp.dst.grouping.NxmOfUdpDstBuilder; import org.opendaylight.yangtools.yang.binding.Augmentation; @@ -52,20 +53,24 @@ public class UdpDstConvertorTest { final NxmOfUdpDstBuilder nxmOfUdpDstBuilder = new NxmOfUdpDstBuilder() .setMask(1) .setPort(DEFAULT_PORT); - final NxAugMatchNotifUpdateFlowStatsBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNotifUpdateFlowStatsBuilder(); + final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = + new NxAugMatchNodesNodeTableFlowBuilder(); nxAugMatchNotifUpdateFlowStatsBuilder.setNxmOfUdpDst(nxmOfUdpDstBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build(); - when(extension.getAugmentation(Matchers.>>any())).thenReturn(extensionAugmentation); + when(extension.augmentation(Matchers.>>any())) + .thenReturn(extensionAugmentation); udpDstConvertor = new UdpDstConvertor(); } @Test public void testConvert() throws Exception { - final MatchEntry matchEntry = udpDstConvertor.convert(extension); - Assert.assertEquals(Integer.valueOf(1), ((UdpDstCaseValue)matchEntry.getMatchEntryValue()).getUdpDstValues().getMask()); - Assert.assertEquals(DEFAULT_PORT, ((UdpDstCaseValue)matchEntry.getMatchEntryValue()).getUdpDstValues().getPort()); + final MatchEntry converted = udpDstConvertor.convert(extension); + Assert.assertEquals(Integer.valueOf(1), + ((UdpDstCaseValue) converted.getMatchEntryValue()).getUdpDstValues().getMask()); + Assert.assertEquals(DEFAULT_PORT, + ((UdpDstCaseValue) converted.getMatchEntryValue()).getUdpDstValues().getPort()); } @Test @@ -80,20 +85,37 @@ public class UdpDstConvertorTest { when(matchEntry.getMatchEntryValue()).thenReturn(udpDstCaseValue); - final ExtensionAugment> extensionAugment = udpDstConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH); - Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmOfUdpDst().getMask()); - Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmOfUdpDst().getPort()); + final ExtensionAugment> extensionAugment = udpDstConvertor.convert(matchEntry, + MatchPath.PACKET_RECEIVED_MATCH); + Assert.assertEquals(Integer.valueOf(2), + ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfUdpDst().getMask()); + Assert.assertEquals(DEFAULT_PORT, + ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfUdpDst().getPort()); Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpDstKey.class); - final ExtensionAugment> extensionAugment1 = udpDstConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH); - Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmOfUdpDst().getMask()); - Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmOfUdpDst().getPort()); + final ExtensionAugment> extensionAugment1 = udpDstConvertor + .convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH); + Assert.assertEquals(Integer.valueOf(2), + ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfUdpDst() + .getMask()); + Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()) + .getNxmOfUdpDst().getPort()); Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpDstKey.class); - final ExtensionAugment> extensionAugment2 = udpDstConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH); - Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchNotifUpdateFlowStats)extensionAugment2.getAugmentationObject()).getNxmOfUdpDst().getMask()); - Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifUpdateFlowStats)extensionAugment2.getAugmentationObject()).getNxmOfUdpDst().getPort()); + final ExtensionAugment> extensionAugment2 = udpDstConvertor + .convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH); + Assert.assertEquals(Integer.valueOf(2), + ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfUdpDst().getMask()); + Assert.assertEquals(DEFAULT_PORT, + ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfUdpDst().getPort()); Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpDstKey.class); - } + final ExtensionAugment> extensionAugment3 = udpDstConvertor + .convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH); + Assert.assertEquals(Integer.valueOf(2), + ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfUdpDst().getMask()); + Assert.assertEquals(DEFAULT_PORT, + ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfUdpDst().getPort()); + Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpDstKey.class); + } }