Search in sources :

Example 1 with UdpDstCaseValue

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);
}
Also used : Extension(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension) NxAugMatchNotifSwitchFlowRemoved(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemoved) NxAugMatchNodesNodeTableFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlow) UdpDstCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValue) NxAugMatchRpcGetFlowStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcGetFlowStats) UdpDstValuesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.udp.dst.grouping.UdpDstValuesBuilder) NxAugMatchNotifPacketIn(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketIn) UdpDstCaseValueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValueBuilder) Test(org.junit.Test)

Example 2 with UdpDstCaseValue

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);
}
Also used : UdpDstCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValue) NxmOfUdpDstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.udp.dst.grouping.NxmOfUdpDstBuilder)

Example 3 with UdpDstCaseValue

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);
}
Also used : UdpDstCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValue) Test(org.junit.Test)

Example 4 with UdpDstCaseValue

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());
}
Also used : UdpDstCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValue)

Example 5 with UdpDstCaseValue

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());
}
Also used : MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) UdpDstCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValue) Test(org.junit.Test)

Aggregations

UdpDstCaseValue (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValue)5 Test (org.junit.Test)3 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)1 UdpDstValuesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.udp.dst.grouping.UdpDstValuesBuilder)1 UdpDstCaseValueBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValueBuilder)1 Extension (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension)1 NxAugMatchNodesNodeTableFlow (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNodesNodeTableFlow)1 NxAugMatchNotifPacketIn (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketIn)1 NxAugMatchNotifSwitchFlowRemoved (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemoved)1 NxAugMatchRpcGetFlowStats (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcGetFlowStats)1 NxmOfUdpDstBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.udp.dst.grouping.NxmOfUdpDstBuilder)1