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();
}
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);
}
}
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);
}
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");
}
}
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");
}
}
Aggregations