Search in sources :

Example 6 with OFDeserializer

use of org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer in project openflowplugin by opendaylight.

the class MessageDeserializerInjector method injectLegacyDeserializers.

@VisibleForTesting
static void injectLegacyDeserializers(final DeserializerExtensionProvider provider) {
    final Function<Integer, Function<Class<? extends OfHeader>, Consumer<OFDeserializer<? extends OfHeader>>>> injector = createInjector(provider, EncodeConstants.OF13_VERSION_ID);
    injector.apply(14).apply(FlowMessage.class).accept(new FlowMessageDeserializer());
    injector.apply(15).apply(GroupMessage.class).accept(new GroupMessageDeserializer());
    injector.apply(29).apply(MeterMessage.class).accept(new MeterMessageDeserializer());
    injector.apply(16).apply(PortMessage.class).accept(new PortMessageDeserializer());
}
Also used : OFDeserializer(org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer) MeterMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterMessage) GroupMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupMessage) GroupMessageDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.messages.GroupMessageDeserializer) FlowMessageDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.messages.FlowMessageDeserializer) Function(java.util.function.Function) PortMessageDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.messages.PortMessageDeserializer) PortMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortMessage) OfHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader) MeterMessageDeserializer(org.opendaylight.openflowplugin.impl.protocol.deserialization.messages.MeterMessageDeserializer) FlowMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowMessage) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 7 with OFDeserializer

use of org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer in project openflowplugin by opendaylight.

the class QueueGetConfigReplyMessageFactory method createPropertiesList.

private List<QueueProperty> createPropertiesList(ByteBuf input, int length) {
    int propertiesLength = length;
    List<QueueProperty> propertiesList = new ArrayList<>();
    while (propertiesLength > 0) {
        int propertyStartIndex = input.readerIndex();
        QueuePropertyBuilder propertiesBuilder = new QueuePropertyBuilder();
        QueueProperties property = QueueProperties.forValue(input.readUnsignedShort());
        propertiesBuilder.setProperty(property);
        int currentPropertyLength = input.readUnsignedShort();
        propertiesLength -= currentPropertyLength;
        input.skipBytes(PADDING_IN_QUEUE_PROPERTY_HEADER);
        if (property.equals(QueueProperties.OFPQTMINRATE) || property.equals(QueueProperties.OFPQTMAXRATE)) {
            RateQueuePropertyBuilder rateBuilder = new RateQueuePropertyBuilder();
            rateBuilder.setRate(input.readUnsignedShort());
            propertiesBuilder.addAugmentation(RateQueueProperty.class, rateBuilder.build());
            input.skipBytes(PADDING_IN_RATE_QUEUE_PROPERTY);
        } else if (property.equals(QueueProperties.OFPQTEXPERIMENTER)) {
            long expId = input.readUnsignedInt();
            input.readerIndex(propertyStartIndex);
            OFDeserializer<QueueProperty> deserializer = registry.getDeserializer(ExperimenterDeserializerKeyFactory.createQueuePropertyDeserializerKey(EncodeConstants.OF13_VERSION_ID, expId));
            propertiesList.add(deserializer.deserialize(input));
            continue;
        }
        propertiesList.add(propertiesBuilder.build());
    }
    return propertiesList;
}
Also used : OFDeserializer(org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer) QueueProperties(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueProperties) RateQueuePropertyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.RateQueuePropertyBuilder) ArrayList(java.util.ArrayList) RateQueuePropertyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.RateQueuePropertyBuilder) QueuePropertyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueuePropertyBuilder) QueueProperty(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty) RateQueueProperty(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.RateQueueProperty)

Aggregations

OFDeserializer (org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer)7 Function (java.util.function.Function)3 ArrayList (java.util.ArrayList)2 OfHeader (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ActionDeserializerKey (org.opendaylight.openflowjava.protocol.api.keys.ActionDeserializerKey)1 ExperimenterActionDeserializerKey (org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionDeserializerKey)1 ExperimenterIdDeserializerKey (org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdDeserializerKey)1 ExperimenterIdTypeDeserializerKey (org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdTypeDeserializerKey)1 MessageCodeKey (org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey)1 MessageTypeKey (org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey)1 MessageCodeExperimenterKey (org.opendaylight.openflowplugin.api.openflow.protocol.deserialization.MessageCodeExperimenterKey)1 ConvertorMessageFromOFJava (org.opendaylight.openflowplugin.extension.api.ConvertorMessageFromOFJava)1 ConversionException (org.opendaylight.openflowplugin.extension.api.exception.ConversionException)1 ActionPath (org.opendaylight.openflowplugin.extension.api.path.ActionPath)1 ApplyActionsInstructionDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction.ApplyActionsInstructionDeserializer)1 ClearActionsInstructionDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction.ClearActionsInstructionDeserializer)1 GoToTableInstructionDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction.GoToTableInstructionDeserializer)1 MeterInstructionDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction.MeterInstructionDeserializer)1 WriteActionsInstructionDeserializer (org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction.WriteActionsInstructionDeserializer)1