use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.get.config.reply.Queues 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.openflow.protocol.rev130731.queue.get.config.reply.Queues in project openflowplugin by opendaylight.
the class QueueGetConfigReplyMessageFactoryTest method createQueuesList.
private static List<Queues> createQueuesList() {
final List<Queues> queuesList = new ArrayList<>();
QueuesBuilder qb = new QueuesBuilder();
qb.setQueueId(new QueueId(1L));
qb.setPort(new PortNumber(3L));
qb.setQueueProperty(createPropertiesList());
queuesList.add(qb.build());
return queuesList;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.get.config.reply.Queues in project openflowplugin by opendaylight.
the class QueueGetConfigReplyMessageFactory method createQueuesList.
private List<Queues> createQueuesList(ByteBuf input) {
List<Queues> queuesList = new ArrayList<>();
while (input.readableBytes() > 0) {
QueuesBuilder queueBuilder = new QueuesBuilder();
queueBuilder.setQueueId(new QueueId(input.readUnsignedInt()));
queueBuilder.setPort(new PortNumber(input.readUnsignedInt()));
int length = input.readUnsignedShort();
input.skipBytes(PADDING_IN_PACKET_QUEUE_HEADER);
queueBuilder.setQueueProperty(createPropertiesList(input, length - PACKET_QUEUE_LENGTH));
queuesList.add(queueBuilder.build());
}
return queuesList;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.get.config.reply.Queues in project openflowplugin by opendaylight.
the class OF10QueueGetConfigReplyMessageFactory method serialize.
@Override
public void serialize(GetQueueConfigOutput message, ByteBuf outBuffer) {
ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH);
outBuffer.writeShort(message.getPort().getValue().intValue());
outBuffer.writeZero(PADDING);
for (Queues queue : message.getQueues()) {
ByteBuf queueBuff = UnpooledByteBufAllocator.DEFAULT.buffer();
queueBuff.writeInt(queue.getQueueId().getValue().intValue());
queueBuff.writeShort(EncodeConstants.EMPTY_LENGTH);
queueBuff.writeZero(QUEUE_PADDING);
for (QueueProperty queueProperty : queue.getQueueProperty()) {
ByteBuf queuePropertyBuff = UnpooledByteBufAllocator.DEFAULT.buffer();
queuePropertyBuff.writeShort(queueProperty.getProperty().getIntValue());
queuePropertyBuff.writeShort(EncodeConstants.EMPTY_LENGTH);
queuePropertyBuff.writeZero(4);
if (queueProperty.getProperty() == QueueProperties.OFPQTMINRATE) {
RateQueueProperty body = queueProperty.getAugmentation(RateQueueProperty.class);
queuePropertyBuff.writeShort(body.getRate().intValue());
queuePropertyBuff.writeZero(QUEUE_PROPERTY_PADDING);
}
queuePropertyBuff.setShort(QUEUE_PROPERTY_LENGTH_INDEX, queuePropertyBuff.readableBytes());
queueBuff.writeBytes(queuePropertyBuff);
}
queueBuff.setShort(QUEUE_LENGTH_INDEX, queueBuff.readableBytes());
outBuffer.writeBytes(queueBuff);
}
ByteBufUtils.updateOFHeaderLength(outBuffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.get.config.reply.Queues in project openflowplugin by opendaylight.
the class QueueGetConfigReplyMessageFactoryTest method createQueuesList.
private static List<Queues> createQueuesList() {
List<Queues> queuesList = new ArrayList<>();
for (int i = 1; i < 3; i++) {
QueuesBuilder qb = new QueuesBuilder();
qb.setQueueId(new QueueId((long) i));
qb.setPort(new PortNumber((long) i));
qb.setQueueProperty(createPropertiesList());
queuesList.add(qb.build());
}
return queuesList;
}
Aggregations