Search in sources :

Example 66 with MatchBuilder

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

the class Ipv6SourceEntryDeserializer method deserializeEntry.

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

Example 67 with MatchBuilder

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

the class MetadataEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    final boolean hasMask = processHeader(message);
    final Metadata metadata = builder.getMetadata();
    final byte[] metaByte = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
    message.readBytes(metaByte);
    final MetadataBuilder metadataBuilder = new MetadataBuilder().setMetadata(new BigInteger(1, metaByte));
    if (hasMask) {
        final byte[] metaMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(metaMask);
        metadataBuilder.setMetadataMask(new BigInteger(1, metaMask));
    }
    if (Objects.isNull(metadata)) {
        builder.setMetadata(metadataBuilder.build());
    } else {
        throwErrorOnMalformed(builder, "metadata");
    }
}
Also used : MetadataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.MetadataBuilder) Metadata(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Metadata) BigInteger(java.math.BigInteger)

Example 68 with MatchBuilder

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

the class PbbEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    final boolean hasMask = processHeader(message);
    final long pbb = message.readUnsignedMedium();
    final PbbBuilder pbbBuilder = new PbbBuilder().setPbbIsid(pbb);
    if (hasMask) {
        pbbBuilder.setPbbMask((long) message.readUnsignedMedium());
    }
    if (Objects.isNull(builder.getProtocolMatchFields())) {
        builder.setProtocolMatchFields(new ProtocolMatchFieldsBuilder().setPbb(pbbBuilder.build()).build());
    } else if (Objects.isNull(builder.getProtocolMatchFields().getPbb())) {
        builder.setProtocolMatchFields(new ProtocolMatchFieldsBuilder(builder.getProtocolMatchFields()).setPbb(pbbBuilder.build()).build());
    } else {
        throwErrorOnMalformed(builder, "protocolMatchFields", "pbb");
    }
}
Also used : ProtocolMatchFieldsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder) PbbBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.protocol.match.fields.PbbBuilder)

Example 69 with MatchBuilder

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

the class TcpFlagsEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    final boolean hasMask = processHeader(message);
    // Just skip experimenter ID for now, not used
    message.readUnsignedInt();
    final TcpFlagsMatchBuilder tcpFlagsBuilder = new TcpFlagsMatchBuilder().setTcpFlags(message.readUnsignedShort());
    if (hasMask) {
        tcpFlagsBuilder.setTcpFlagsMask(message.readUnsignedShort());
    }
    if (Objects.isNull(builder.getTcpFlagsMatch())) {
        builder.setTcpFlagsMatch(tcpFlagsBuilder.build());
    } else {
        throwErrorOnMalformed(builder, "tcpFlagsMatch");
    }
}
Also used : TcpFlagsMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagsMatchBuilder)

Example 70 with MatchBuilder

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

the class TunnelIdEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    final boolean hasMask = processHeader(message);
    final byte[] tunnelId = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
    message.readBytes(tunnelId);
    final TunnelBuilder tunnelBuilder = new TunnelBuilder().setTunnelId(new BigInteger(1, tunnelId));
    if (hasMask) {
        final byte[] tunnelMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(tunnelMask);
        tunnelBuilder.setTunnelMask(new BigInteger(1, tunnelMask));
    }
    if (Objects.isNull(builder.getTunnel())) {
        builder.setTunnel(tunnelBuilder.build());
    } else {
        throwErrorOnMalformed(builder, "tunnel");
    }
}
Also used : BigInteger(java.math.BigInteger) TunnelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TunnelBuilder)

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