Search in sources :

Example 61 with Message

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

the class DecMplsTtlActionDeserializer method deserialize.

@Override
public Action deserialize(ByteBuf message) {
    processHeader(message);
    message.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);
    return new DecMplsTtlCaseBuilder().setDecMplsTtl(new DecMplsTtlBuilder().build()).build();
}
Also used : DecMplsTtlBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.mpls.ttl._case.DecMplsTtlBuilder) DecMplsTtlCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCaseBuilder)

Example 62 with Message

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

the class MultipartReplyMessageFactory method serializeFlowBody.

private void serializeFlowBody(final MultipartReplyBody body, final ByteBuf outBuffer, final MultipartReplyMessage message) {
    MultipartReplyFlowCase flowCase = (MultipartReplyFlowCase) body;
    MultipartReplyFlow flow = flowCase.getMultipartReplyFlow();
    for (FlowStats flowStats : flow.getFlowStats()) {
        ByteBuf flowStatsBuff = UnpooledByteBufAllocator.DEFAULT.buffer();
        flowStatsBuff.writeShort(EncodeConstants.EMPTY_LENGTH);
        flowStatsBuff.writeByte((byte) flowStats.getTableId().longValue());
        flowStatsBuff.writeZero(FLOW_STATS_PADDING_1);
        flowStatsBuff.writeInt(flowStats.getDurationSec().intValue());
        flowStatsBuff.writeInt(flowStats.getDurationNsec().intValue());
        flowStatsBuff.writeShort(flowStats.getPriority());
        flowStatsBuff.writeShort(flowStats.getIdleTimeout());
        flowStatsBuff.writeShort(flowStats.getHardTimeout());
        flowStatsBuff.writeZero(FLOW_STATS_PADDING_2);
        flowStatsBuff.writeLong(flowStats.getCookie().longValue());
        flowStatsBuff.writeLong(flowStats.getPacketCount().longValue());
        flowStatsBuff.writeLong(flowStats.getByteCount().longValue());
        OFSerializer<Match> matchSerializer = registry.<Match, OFSerializer<Match>>getSerializer(new MessageTypeKey<>(message.getVersion(), Match.class));
        matchSerializer.serialize(flowStats.getMatch(), flowStatsBuff);
        ListSerializer.serializeList(flowStats.getInstruction(), TypeKeyMakerFactory.createInstructionKeyMaker(message.getVersion()), registry, flowStatsBuff);
        flowStatsBuff.setShort(FLOW_STATS_LENGTH_INDEX, flowStatsBuff.readableBytes());
        outBuffer.writeBytes(flowStatsBuff);
    }
}
Also used : FlowStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats) OFSerializer(org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer) MultipartReplyFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow) MultipartReplyFlowCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase) ByteBuf(io.netty.buffer.ByteBuf) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match)

Example 63 with Message

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

the class QueueGetConfigReplyMessageFactory method serialize.

@Override
public void serialize(GetQueueConfigOutput message, ByteBuf outBuffer) {
    ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH);
    outBuffer.writeInt(message.getPort().getValue().intValue());
    outBuffer.writeZero(PADDING);
    for (Queues queue : message.getQueues()) {
        ByteBuf queueBuff = UnpooledByteBufAllocator.DEFAULT.buffer();
        queueBuff.writeInt(queue.getQueueId().getValue().intValue());
        queueBuff.writeInt(queue.getPort().getValue().intValue());
        queueBuff.writeShort(EncodeConstants.EMPTY_LENGTH);
        queueBuff.writeZero(QUEUE_PADDING);
        for (QueueProperty property : queue.getQueueProperty()) {
            ByteBuf propertyBuff = UnpooledByteBufAllocator.DEFAULT.buffer();
            propertyBuff.writeShort(property.getProperty().getIntValue());
            propertyBuff.writeShort(EncodeConstants.EMPTY_LENGTH);
            propertyBuff.writeZero(PROPERTY_HEADER_PADDING);
            switch(property.getProperty()) {
                case OFPQTMINRATE:
                case OFPQTMAXRATE:
                    serializeRateBody(property.getAugmentation(RateQueueProperty.class), propertyBuff);
                    break;
                case OFPQTEXPERIMENTER:
                    serializeExperimenterBody(property.getAugmentation(ExperimenterIdQueueProperty.class), propertyBuff);
                    break;
                default:
                    break;
            }
            propertyBuff.setShort(PROPERTY_LENGTH_INDEX, propertyBuff.readableBytes());
            queueBuff.writeBytes(propertyBuff);
        }
        queueBuff.setShort(QUEUE_LENGTH_INDEX, queueBuff.readableBytes());
        outBuffer.writeBytes(queueBuff);
    }
    ByteBufUtils.updateOFHeaderLength(outBuffer);
}
Also used : RateQueueProperty(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.RateQueueProperty) ExperimenterIdQueueProperty(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdQueueProperty) Queues(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.get.config.reply.Queues) ByteBuf(io.netty.buffer.ByteBuf) QueueProperty(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty) ExperimenterIdQueueProperty(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdQueueProperty) RateQueueProperty(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.RateQueueProperty)

Example 64 with Message

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

the class TcpDestinationPortEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    processHeader(message);
    final int port = message.readUnsignedShort();
    if (Objects.isNull(builder.getLayer4Match())) {
        builder.setLayer4Match(new TcpMatchBuilder().setTcpDestinationPort(new PortNumber(port)).build());
    } else if (TcpMatch.class.isInstance(builder.getLayer4Match()) && Objects.isNull(TcpMatch.class.cast(builder.getLayer4Match()).getTcpDestinationPort())) {
        builder.setLayer4Match(new TcpMatchBuilder(TcpMatch.class.cast(builder.getLayer4Match())).setTcpDestinationPort(new PortNumber(port)).build());
    } else {
        throwErrorOnMalformed(builder, "layer4Match", "tcpDestinationPort");
    }
}
Also used : TcpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch) TcpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)

Example 65 with Message

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

the class VlanPcpEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    processHeader(message);
    final short pcp = message.readUnsignedByte();
    if (Objects.isNull(builder.getVlanMatch())) {
        builder.setVlanMatch(new VlanMatchBuilder().setVlanPcp(new VlanPcp(pcp)).build());
    } else if (Objects.isNull(builder.getVlanMatch().getVlanPcp())) {
        builder.setVlanMatch(new VlanMatchBuilder(builder.getVlanMatch()).setVlanPcp(new VlanPcp(pcp)).build());
    } else {
        throwErrorOnMalformed(builder, "vlanMatch", "vlanPcp");
    }
}
Also used : VlanPcp(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp) VlanMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder)

Aggregations

Test (org.junit.Test)202 ByteBuf (io.netty.buffer.ByteBuf)184 ArrayList (java.util.ArrayList)109 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)37 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 PCEPDeserializerException (org.opendaylight.protocol.pcep.spi.PCEPDeserializerException)21 Update (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update)21 List (java.util.List)18 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)18 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)17 Object (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object)17 Message (org.eclipse.bpmn2.Message)16 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)15 Message (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message)15