Search in sources :

Example 46 with MatchEntryBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder in project openflowplugin by opendaylight.

the class OxmMplsTcSerializerTest method testSerializeHeader.

/**
 * Test correct header serialization.
 */
@Test
public void testSerializeHeader() {
    MatchEntryBuilder builder = prepareMplsTcHeader(false);
    ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
    serializer.serializeHeader(builder.build(), buffer);
    checkHeader(buffer, false);
    assertTrue("Unexpected data", buffer.readableBytes() == 0);
}
Also used : MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 47 with MatchEntryBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder in project openflowplugin by opendaylight.

the class OxmMplsTcSerializerTest method prepareMplsTcMatchEntry.

private static MatchEntryBuilder prepareMplsTcMatchEntry(short value) {
    MatchEntryBuilder builder = prepareMplsTcHeader(false);
    MplsTcCaseBuilder casebuilder = new MplsTcCaseBuilder();
    MplsTcBuilder valueBuilder = new MplsTcBuilder();
    valueBuilder.setTc(value);
    casebuilder.setMplsTc(valueBuilder.build());
    builder.setMatchEntryValue(casebuilder.build());
    return builder;
}
Also used : MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) MplsTcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTcBuilder) MplsTcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.MplsTcCaseBuilder)

Example 48 with MatchEntryBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder in project openflowplugin by opendaylight.

the class OxmTcpDstSerializerTest method prepareMatchEntry.

private static MatchEntryBuilder prepareMatchEntry(int value) {
    MatchEntryBuilder builder = prepareHeader(false);
    TcpDstCaseBuilder casebuilder = new TcpDstCaseBuilder();
    TcpDstBuilder valueBuilder = new TcpDstBuilder();
    valueBuilder.setPort(new PortNumber(value));
    casebuilder.setTcpDst(valueBuilder.build());
    builder.setMatchEntryValue(casebuilder.build());
    return builder;
}
Also used : TcpDstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.dst._case.TcpDstBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) TcpDstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpDstCaseBuilder)

Example 49 with MatchEntryBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder in project openflowplugin by opendaylight.

the class OxmTunnelIdSerializerTest method testSerializeWithoutMask.

/**
 * Test correct serialization.
 */
@Test
public void testSerializeWithoutMask() {
    MatchEntryBuilder builder = prepareMatchEntry(false, new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 });
    ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
    serializer.serialize(builder.build(), buffer);
    checkHeader(buffer, false);
    byte[] address = new byte[8];
    buffer.readBytes(address);
    Assert.assertArrayEquals("Wrong address", new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }, address);
    assertTrue("Unexpected data", buffer.readableBytes() == 0);
}
Also used : MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 50 with MatchEntryBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder in project openflowplugin by opendaylight.

the class OxmTunnelIdSerializerTest method prepareMatchEntry.

private static MatchEntryBuilder prepareMatchEntry(boolean hasMask, byte[] value) {
    final MatchEntryBuilder builder = prepareHeader(hasMask);
    TunnelIdCaseBuilder casebuilder = new TunnelIdCaseBuilder();
    TunnelIdBuilder valueBuilder = new TunnelIdBuilder();
    if (hasMask) {
        valueBuilder.setMask(new byte[] { 30, 30, 25, 25, 15, 15, 0, 0 });
    }
    valueBuilder.setTunnelId(value);
    casebuilder.setTunnelId(valueBuilder.build());
    builder.setMatchEntryValue(casebuilder.build());
    return builder;
}
Also used : TunnelIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tunnel.id._case.TunnelIdBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) TunnelIdCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TunnelIdCaseBuilder)

Aggregations

MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)376 Test (org.junit.Test)129 ByteBuf (io.netty.buffer.ByteBuf)107 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)60 ArrayList (java.util.ArrayList)58 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder)31 BigInteger (java.math.BigInteger)25 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)23 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)20 PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)20 VersionDatapathIdConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)18 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)17 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)17 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match)17 ArpMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatch)14 Ipv6Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match)14 SetFieldActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.field._case.SetFieldActionBuilder)14 Ipv4DstCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv4DstCaseBuilder)14 Ipv4DstBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv4.dst._case.Ipv4DstBuilder)14 SctpMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch)13