use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValue in project openflowplugin by opendaylight.
the class UdpDstConvertorTest method testConvert1.
@Test
public void testConvert1() throws Exception {
final UdpDstValuesBuilder udpDstValuesBuilder = new UdpDstValuesBuilder().setMask(2).setPort(DEFAULT_PORT);
final UdpDstCaseValueBuilder udpDstCaseValueBuilder = new UdpDstCaseValueBuilder().setUdpDstValues(udpDstValuesBuilder.build());
final UdpDstCaseValue udpDstCaseValue = udpDstCaseValueBuilder.build();
when(matchEntry.getMatchEntryValue()).thenReturn(udpDstCaseValue);
final ExtensionAugment<? extends Augmentation<Extension>> 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<? extends Augmentation<Extension>> 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<? extends Augmentation<Extension>> 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<? extends Augmentation<Extension>> 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);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValue in project openflowplugin by opendaylight.
the class UdpDstConvertor method convert.
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
UdpDstCaseValue udpDstCaseValue = (UdpDstCaseValue) input.getMatchEntryValue();
NxmOfUdpDstBuilder udpDstBuilder = new NxmOfUdpDstBuilder();
udpDstBuilder.setPort(udpDstCaseValue.getUdpDstValues().getPort());
udpDstBuilder.setMask(udpDstCaseValue.getUdpDstValues().getMask());
return resolveAugmentation(udpDstBuilder.build(), path, NxmOfUdpDstKey.class);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValue in project openflowplugin by opendaylight.
the class UdpDstCodecTest method deserializeTest.
@Test
public void deserializeTest() {
createBuffer(buffer);
input = udpDstCodec.deserialize(buffer);
final UdpDstCaseValue result = (UdpDstCaseValue) input.getMatchEntryValue();
assertEquals(Nxm0Class.class, input.getOxmClass());
assertEquals(NxmOfUdpDst.class, input.getOxmMatchField());
assertEquals(true, input.isHasMask());
assertEquals(1, result.getUdpDstValues().getPort().getValue().shortValue());
assertEquals(0xffff, result.getUdpDstValues().getMask().shortValue() & 0xffff);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValue in project openflowplugin by opendaylight.
the class UdpDstCodec method serialize.
@Override
public void serialize(MatchEntry input, ByteBuf outBuffer) {
serializeHeader(input, outBuffer);
UdpDstCaseValue udpDstCase = (UdpDstCaseValue) input.getMatchEntryValue();
outBuffer.writeShort(udpDstCase.getUdpDstValues().getPort().getValue());
outBuffer.writeShort(udpDstCase.getUdpDstValues().getMask());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValue in project openflowplugin by opendaylight.
the class UdpDstConvertorTest method testConvert.
@Test
public void testConvert() throws Exception {
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());
}
Aggregations