use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpSrcCaseValue in project openflowplugin by opendaylight.
the class TcpSrcCodecTest method deserializeTest.
@Test
public void deserializeTest() {
createBuffer(buffer);
input = tcpSrcCodec.deserialize(buffer);
final TcpSrcCaseValue result = (TcpSrcCaseValue) input.getMatchEntryValue();
assertEquals(Nxm0Class.class, input.getOxmClass());
assertEquals(NxmOfTcpSrc.class, input.getOxmMatchField());
assertEquals(true, input.isHasMask());
assertEquals(1, result.getTcpSrcValues().getPort().getValue().shortValue());
assertEquals(0xffff, result.getTcpSrcValues().getMask().shortValue() & 0xffff);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpSrcCaseValue in project openflowplugin by opendaylight.
the class TcpSrcConvertor method convert.
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
TcpSrcCaseValue tcpSrcCaseValue = (TcpSrcCaseValue) input.getMatchEntryValue();
NxmOfTcpSrcBuilder tcpSrcBuilder = new NxmOfTcpSrcBuilder();
tcpSrcBuilder.setPort(tcpSrcCaseValue.getTcpSrcValues().getPort());
tcpSrcBuilder.setMask(tcpSrcCaseValue.getTcpSrcValues().getMask());
return resolveAugmentation(tcpSrcBuilder.build(), path, NxmOfTcpSrcKey.class);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpSrcCaseValue in project openflowplugin by opendaylight.
the class TcpSrcCodec method serialize.
@Override
public void serialize(MatchEntry input, ByteBuf outBuffer) {
serializeHeader(input, outBuffer);
TcpSrcCaseValue tcpSrcCase = (TcpSrcCaseValue) input.getMatchEntryValue();
outBuffer.writeShort(tcpSrcCase.getTcpSrcValues().getPort().getValue());
outBuffer.writeShort(tcpSrcCase.getTcpSrcValues().getMask());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpSrcCaseValue in project openflowplugin by opendaylight.
the class TcpSrcConvertorTest method testConvert1.
@Test
public void testConvert1() throws Exception {
final TcpSrcValuesBuilder tcpSrcValuesBuilder = new TcpSrcValuesBuilder().setMask(2).setPort(DEFAULT_PORT);
final TcpSrcCaseValueBuilder tcpSrcCaseValueBuilder = new TcpSrcCaseValueBuilder().setTcpSrcValues(tcpSrcValuesBuilder.build());
final TcpSrcCaseValue tcpSrcCaseValue = tcpSrcCaseValueBuilder.build();
when(matchEntry.getMatchEntryValue()).thenReturn(tcpSrcCaseValue);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment = tcpSrcConvertor.convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH);
Assert.assertEquals(2, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfTcpSrc().getMask().intValue());
Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfTcpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpSrcKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment1 = tcpSrcConvertor.convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH);
Assert.assertEquals(2, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfTcpSrc().getMask().intValue());
Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()).getNxmOfTcpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpSrcKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment2 = tcpSrcConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
Assert.assertEquals(2, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfTcpSrc().getMask().intValue());
Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()).getNxmOfTcpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpSrcKey.class);
final ExtensionAugment<? extends Augmentation<Extension>> extensionAugment3 = tcpSrcConvertor.convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH);
Assert.assertEquals(2, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfTcpSrc().getMask().intValue());
Assert.assertEquals(DEFAULT_PORT, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfTcpSrc().getPort());
Assert.assertEquals(extensionAugment.getKey(), NxmOfTcpSrcKey.class);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpSrcCaseValue in project openflowplugin by opendaylight.
the class TcpSrcConvertorTest method testConvert.
@Test
public void testConvert() throws Exception {
final MatchEntry converted = tcpSrcConvertor.convert(extension);
Assert.assertEquals(1, ((TcpSrcCaseValue) converted.getMatchEntryValue()).getTcpSrcValues().getMask().intValue());
Assert.assertEquals(DEFAULT_PORT, ((TcpSrcCaseValue) converted.getMatchEntryValue()).getTcpSrcValues().getPort());
}
Aggregations