Search in sources :

Example 56 with MatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.MatchBuilder in project openflowplugin by opendaylight.

the class Ipv4SourceEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    final boolean hasMask = processHeader(message);
    final Ipv4Address address = ByteBufUtils.readIetfIpv4Address(message);
    if (hasMask) {
        final byte[] mask = OxmDeserializerHelper.convertMask(message, EncodeConstants.GROUPS_IN_IPV4_ADDRESS);
        if (IpConversionUtil.isArbitraryBitMask(mask)) {
            setArbitraryMatch(builder, address, mask);
        } else {
            setPrefixMatch(builder, address, mask);
        }
    } else {
        setPrefixMatch(builder, address, null);
    }
}
Also used : Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 57 with MatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.MatchBuilder in project openflowplugin by opendaylight.

the class Ipv6ExtHeaderEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    final boolean hasMask = processHeader(message);
    final Ipv6ExtHeaderBuilder extHeaderBuilder = new Ipv6ExtHeaderBuilder().setIpv6Exthdr(message.readUnsignedShort());
    if (hasMask) {
        final byte[] mask = OxmDeserializerHelper.convertMask(message, EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
        extHeaderBuilder.setIpv6ExthdrMask(ByteUtil.bytesToUnsignedShort(mask));
    }
    if (Objects.isNull(builder.getLayer3Match())) {
        builder.setLayer3Match(new Ipv6MatchBuilder().setIpv6ExtHeader(extHeaderBuilder.build()).build());
    } else if (Ipv6Match.class.isInstance(builder.getLayer3Match()) && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6ExtHeader())) {
        final Ipv6Match match = Ipv6Match.class.cast(builder.getLayer3Match());
        builder.setLayer3Match(new Ipv6MatchBuilder(match).setIpv6ExtHeader(extHeaderBuilder.build()).build());
    } else {
        throwErrorOnMalformed(builder, "layer3Match", "ipv6ExtHeader");
    }
}
Also used : Ipv6Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match) Ipv6ExtHeaderBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6ExtHeaderBuilder) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder)

Example 58 with MatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.MatchBuilder in project openflowplugin by opendaylight.

the class Ipv6NdTllEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    processHeader(message);
    final MacAddress address = OxmDeserializerHelper.convertMacAddress(message);
    if (Objects.isNull(builder.getLayer3Match())) {
        builder.setLayer3Match(new Ipv6MatchBuilder().setIpv6NdTll(address).build());
    } else if (Ipv6Match.class.isInstance(builder.getLayer3Match()) && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6NdTll())) {
        final Ipv6Match match = Ipv6Match.class.cast(builder.getLayer3Match());
        builder.setLayer3Match(new Ipv6MatchBuilder(match).setIpv6NdTll(address).build());
    } else {
        throwErrorOnMalformed(builder, "layer3Match", "ipv6NdTll");
    }
}
Also used : Ipv6Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder)

Example 59 with MatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.MatchBuilder in project openflowplugin by opendaylight.

the class MatchDeserializer method deserializeHeader.

@Override
public Match deserializeHeader(ByteBuf inBuffer) {
    final MatchBuilder builder = new MatchBuilder();
    deserializeEntry(inBuffer, builder);
    return builder.build();
}
Also used : MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)

Example 60 with MatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.packet.received.MatchBuilder in project openflowplugin by opendaylight.

the class MatchDeserializer method deserialize.

@Override
public Match deserialize(ByteBuf inBuffer) {
    if (inBuffer.readableBytes() <= 0) {
        return null;
    }
    final MatchBuilder builder = new MatchBuilder();
    // OFP do not have any method to differentiate between OXM and standard match, so we do not care about type
    inBuffer.readUnsignedShort();
    final int length = inBuffer.readUnsignedShort();
    final int startIndex = inBuffer.readerIndex();
    final int entriesLength = length - 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
    while (inBuffer.readerIndex() - startIndex < entriesLength) {
        deserializeEntry(inBuffer, builder);
    }
    int paddingRemainder = length % EncodeConstants.PADDING;
    if (paddingRemainder != 0) {
        inBuffer.skipBytes(EncodeConstants.PADDING - paddingRemainder);
    }
    return builder.build();
}
Also used : MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)

Aggregations

MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)220 Test (org.junit.Test)135 EthernetMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)90 Ipv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder)84 Ipv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder)80 IpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder)69 ArrayList (java.util.ArrayList)65 ArpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder)63 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)56 Icmpv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder)55 VlanMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder)54 TcpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder)53 TunnelIpv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder)52 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)51 Icmpv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder)51 UdpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder)51 BigInteger (java.math.BigInteger)46 SctpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder)44 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)42 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)40