use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpDstCaseValue in project openflowplugin by opendaylight.
the class TcpDstConvertorTest method testConvert1.
@Test
public void testConvert1() throws Exception {
final TcpDstValuesBuilder tcpDstValuesBuilder = new TcpDstValuesBuilder().setMask(2).setPort(DEFAULT_PORT);
final TcpDstCaseValueBuilder tcpDstCaseValueBuilder = new TcpDstCaseValueBuilder().setTcpDstValues(tcpDstValuesBuilder.build());
final TcpDstCaseValue tcpDstCaseValue = tcpDstCaseValueBuilder.build();
when(matchEntry.getMatchEntryValue()).thenReturn(tcpDstCaseValue);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = tcpDstConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
Assert.assertEquals(2, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfTcpDst().getMask().intValue());
Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfTcpDst().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpDstKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = tcpDstConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
Assert.assertEquals(2, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfTcpDst().getMask().intValue());
Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfTcpDst().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpDstKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = tcpDstConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
Assert.assertEquals(2, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfTcpDst().getMask().intValue());
Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfTcpDst().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpDstKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = tcpDstConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
Assert.assertEquals(2, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfTcpDst().getMask().intValue());
Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfTcpDst().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpDstKey.class);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpDstCaseValue in project openflowplugin by opendaylight.
the class TcpDstConvertorTest method testConvert.
@Test
public void testConvert() throws Exception {
final MatchEntry converted = tcpDstConvertor.convert(extension);
Assert.assertEquals(1, ((TcpDstCaseValue) converted.getMatchEntryValue()).getTcpDstValues().getMask().intValue());
Assert.assertEquals(DEFAULT_PORT, ((TcpDstCaseValue) converted.getMatchEntryValue()).getTcpDstValues().getPort());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpDstCaseValue in project openflowplugin by opendaylight.
the class TcpDstCodecTest method deserializeTest.
@Test
public void deserializeTest() {
createBuffer(buffer);
input = tcpDstCodec.deserialize(buffer);
final TcpDstCaseValue result = (TcpDstCaseValue) input.getMatchEntryValue();
assertEquals(Nxm0Class.class, input.getOxmClass());
assertEquals(NxmOfTcpDst.class, input.getOxmMatchField());
assertEquals(true, input.isHasMask());
assertEquals(1, result.getTcpDstValues().getPort().getValue().shortValue());
assertEquals(0xffff, result.getTcpDstValues().getMask().shortValue() & 0xffff);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpDstCaseValue in project openflowplugin by opendaylight.
the class TcpDstCodec method serialize.
@Override
public void serialize(MatchEntry input, ByteBuf outBuffer) {
serializeHeader(input, outBuffer);
TcpDstCaseValue tcpDstCase = (TcpDstCaseValue) input.getMatchEntryValue();
outBuffer.writeShort(tcpDstCase.getTcpDstValues().getPort().getValue());
outBuffer.writeShort(tcpDstCase.getTcpDstValues().getMask());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpDstCaseValue in project openflowplugin by opendaylight.
the class TcpDstConvertor method convert.
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
TcpDstCaseValue tcpDstCaseValue = (TcpDstCaseValue) input.getMatchEntryValue();
NxmOfTcpDstBuilder tcpDstBuilder = new NxmOfTcpDstBuilder();
tcpDstBuilder.setPort(tcpDstCaseValue.getTcpDstValues().getPort());
tcpDstBuilder.setMask(tcpDstCaseValue.getTcpDstValues().getMask());
return resolveAugmentation(tcpDstBuilder.build(), path, NxmOfTcpDstKey.class);
}
Aggregations