use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpSrcCaseValue in project openflowplugin by opendaylight.
the class UdpSrcConvertorTest method testConvert1.
@Test
public void testConvert1() throws Exception {
final UdpSrcValuesBuilder udpSrcValuesBuilder = new UdpSrcValuesBuilder().setMask(2).setPort(DEFAULT_PORT);
final UdpSrcCaseValueBuilder udpSrcCaseValueBuilder = new UdpSrcCaseValueBuilder().setUdpSrcValues(udpSrcValuesBuilder.build());
final UdpSrcCaseValue udpSrcCaseValue = udpSrcCaseValueBuilder.build();
when(matchEntry.getMatchEntryValue()).thenReturn(udpSrcCaseValue);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = udpSrcConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfUdpSrc().getMask());
Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfUdpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpSrcKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = udpSrcConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfUdpSrc().getMask());
Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfUdpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpSrcKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = udpSrcConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfUdpSrc().getMask());
Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfUdpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpSrcKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = udpSrcConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
Assert.assertEquals(Integer.valueOf(2), ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfUdpSrc().getMask());
Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfUdpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfUdpSrcKey.class);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpSrcCaseValue in project openflowplugin by opendaylight.
the class UdpSrcConvertor method convert.
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
UdpSrcCaseValue udpSrcCaseValue = (UdpSrcCaseValue) input.getMatchEntryValue();
NxmOfUdpSrcBuilder udpSrcBuilder = new NxmOfUdpSrcBuilder();
udpSrcBuilder.setPort(udpSrcCaseValue.getUdpSrcValues().getPort());
udpSrcBuilder.setMask(udpSrcCaseValue.getUdpSrcValues().getMask());
return resolveAugmentation(udpSrcBuilder.build(), path, NxmOfUdpSrcKey.class);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpSrcCaseValue in project openflowplugin by opendaylight.
the class UdpSrcCodecTest method deserializeTest.
@Test
public void deserializeTest() {
createBuffer(buffer);
input = udpSrcCodec.deserialize(buffer);
final UdpSrcCaseValue result = (UdpSrcCaseValue) input.getMatchEntryValue();
assertEquals(Nxm0Class.class, input.getOxmClass());
assertEquals(NxmOfUdpSrc.class, input.getOxmMatchField());
assertEquals(true, input.isHasMask());
assertEquals(1, result.getUdpSrcValues().getPort().getValue().shortValue());
assertEquals(0xffff, result.getUdpSrcValues().getMask().shortValue() & 0xffff);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpSrcCaseValue in project openflowplugin by opendaylight.
the class UdpSrcCodec method serialize.
@Override
public void serialize(MatchEntry input, ByteBuf outBuffer) {
serializeHeader(input, outBuffer);
UdpSrcCaseValue udpSrcCase = (UdpSrcCaseValue) input.getMatchEntryValue();
outBuffer.writeShort(udpSrcCase.getUdpSrcValues().getPort().getValue());
outBuffer.writeShort(udpSrcCase.getUdpSrcValues().getMask());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpSrcCaseValue in project openflowplugin by opendaylight.
the class UdpSrcConvertorTest method testConvert.
@Test
public void testConvert() throws Exception {
final MatchEntry converted = udpSrcConvertor.convert(extension);
Assert.assertEquals(Integer.valueOf(1), ((UdpSrcCaseValue) converted.getMatchEntryValue()).getUdpSrcValues().getMask());
Assert.assertEquals(DEFAULT_PORT, ((UdpSrcCaseValue) converted.getMatchEntryValue()).getUdpSrcValues().getPort());
}
Aggregations