Search in sources :

Example 86 with Message

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message in project openflowplugin by opendaylight.

the class EthernetDestinationEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    final boolean hasMask = processHeader(message);
    final EthernetMatch ethernetMatch = builder.getEthernetMatch();
    final EthernetDestinationBuilder ethernetDestinationBuilder = new EthernetDestinationBuilder();
    ethernetDestinationBuilder.setAddress(OxmDeserializerHelper.convertMacAddress(message));
    if (hasMask) {
        ethernetDestinationBuilder.setMask(OxmDeserializerHelper.convertMacAddress(message));
    }
    if (Objects.isNull(ethernetMatch)) {
        builder.setEthernetMatch(new EthernetMatchBuilder().setEthernetDestination(ethernetDestinationBuilder.build()).build());
    } else if (Objects.isNull(ethernetMatch.getEthernetDestination())) {
        builder.setEthernetMatch(new EthernetMatchBuilder(ethernetMatch).setEthernetDestination(ethernetDestinationBuilder.build()).build());
    } else {
        throwErrorOnMalformed(builder, "ethernetMatch", "ethernetDestination");
    }
}
Also used : EthernetDestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder) EthernetMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)

Example 87 with Message

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message in project openflowplugin by opendaylight.

the class MessageDeserializerInjector method injectDeserializers.

/**
 * Injects message deserializers into provided.
 * {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
 *
 * @param provider OpenflowJava deserializer extension provider
 */
static void injectDeserializers(final DeserializerExtensionProvider provider) {
    // Inject new message deserializers here using injector created by createInjector method
    final Function<Integer, Function<Class<? extends OfHeader>, Consumer<OFDeserializer<? extends OfHeader>>>> injector = createInjector(provider, EncodeConstants.OF13_VERSION_ID);
    injector.apply(10).apply(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketInMessage.class).accept(new PacketInMessageDeserializer());
    injector.apply(19).apply(MultipartReply.class).accept(new MultipartReplyMessageDeserializer());
    injector.apply(27).apply(AsyncConfigMessage.class).accept(new AsyncConfigMessageDeserializer());
}
Also used : OFDeserializer(org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer) PacketInMessageDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.messages.PacketInMessageDeserializer) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply) PacketInMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage) Function(java.util.function.Function) MultipartReplyMessageDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.multipart.MultipartReplyMessageDeserializer) OfHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader) AsyncConfigMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.AsyncConfigMessage) AsyncConfigMessageDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.messages.AsyncConfigMessageDeserializer)

Example 88 with Message

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message in project openflowplugin by opendaylight.

the class Icmpv6TypeEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    processHeader(message);
    final short type = message.readUnsignedByte();
    if (Objects.isNull(builder.getIcmpv6Match())) {
        builder.setIcmpv6Match(new Icmpv6MatchBuilder().setIcmpv6Type(type).build());
    } else if (Objects.isNull(builder.getIcmpv6Match().getIcmpv6Type())) {
        builder.setIcmpv6Match(new Icmpv6MatchBuilder(builder.getIcmpv6Match()).setIcmpv6Type(type).build());
    } else {
        throwErrorOnMalformed(builder, "icmpv6Match", "icmpv6Type");
    }
}
Also used : Icmpv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder)

Example 89 with Message

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message in project openflowplugin by opendaylight.

the class IpProtoEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    processHeader(message);
    final short proto = message.readUnsignedByte();
    if (Objects.isNull(builder.getIpMatch())) {
        builder.setIpMatch(new IpMatchBuilder().setIpProtocol(proto).build());
    } else if (Objects.isNull(builder.getIpMatch().getIpProtocol())) {
        builder.setIpMatch(new IpMatchBuilder(builder.getIpMatch()).setIpProtocol(proto).build());
    } else {
        throwErrorOnMalformed(builder, "ipMatch", "ipProtocol");
    }
}
Also used : IpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder)

Example 90 with Message

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message 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)

Aggregations

Test (org.junit.Test)192 ByteBuf (io.netty.buffer.ByteBuf)179 ArrayList (java.util.ArrayList)84 MultipartReplyMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage)53 MultipartRequestFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags)45 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)44 BigInteger (java.math.BigInteger)40 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)26 MultipartRequestInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput)25 MultipartRequestInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder)25 MultipartReplyMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder)22 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)20 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)18 List (java.util.List)17 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)17 Update (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.Update)17 Message (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message)16 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)15 Message (org.eclipse.bpmn2.Message)13 Counter32 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32)13