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 test.
/**
* Testing {@link QueueGetConfigReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 00 00 03 00 00 00 00 00 00 00 01 00 00 00 03 00 20 00 00 00 00 " + "00 00 00 02 00 10 00 00 00 00 00 05 00 00 00 00 00 00");
GetQueueConfigOutput builtByFactory = BufferHelper.deserialize(queueFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong port", 3L, builtByFactory.getPort().getValue().longValue());
Assert.assertEquals("Wrong queues", builtByFactory.getQueues(), createQueuesList());
}
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 createQueuesList.
private static List<Queues> createQueuesList(ByteBuf input) {
List<Queues> queuesList = new ArrayList<>();
while (input.readableBytes() > 0) {
QueuesBuilder queueBuilder = new QueuesBuilder();
queueBuilder.setQueueId(new QueueId(input.readUnsignedInt()));
int length = input.readUnsignedShort();
input.skipBytes(PADDING_IN_PACKET_QUEUE_HEADER);
queueBuilder.setQueueProperty(createPropertiesList(input, length - PACKET_QUEUE_HEADER_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 QueueGetConfigReplyMessageFactoryMultiTest method test.
/**
* Testing of {@link QueueGetConfigReplyMessageFactory} for correct
* translation into POJO.
*/
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer(// port
"00 01 02 03 " + // padding
"00 00 00 00 " + // queueId
"00 00 00 01 " + // port
"00 00 00 01 " + // length
"00 20 " + // pad
"00 00 00 00 00 00 " + // property
"00 02 " + // length
"00 10 " + // pad
"00 00 00 00 " + // rate
"00 05 " + // pad
"00 00 00 00 00 00 " + // queueId
"00 00 00 02 " + // port
"00 00 00 02 " + // length
"00 20 " + // pad
"00 00 00 00 00 00 " + // property
"00 02 " + // length
"00 10 " + // pad
"00 00 00 00 " + // rate
"00 05 " + // pad
"00 00 00 00 00 00");
GetQueueConfigOutput builtByFactory = BufferHelper.deserialize(queueFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong port", 66051L, builtByFactory.getPort().getValue().longValue());
Assert.assertEquals("Wrong queues", createQueuesList(), builtByFactory.getQueues());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.get.config.reply.Queues in project openflowplugin by opendaylight.
the class QueueGetConfigReplyMessageFactoryMultiTest 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;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.get.config.reply.Queues in project openflowplugin by opendaylight.
the class OF10QueueGetConfigReplyMessageFactoryTest method test.
/**
* Testing of {@link OF10QueueGetConfigReplyMessageFactory} for correct
* translation into POJO.
*/
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 01 00 00 00 00 00 00 " + "00 00 00 08 00 10 00 00 00 00 00 08 00 00 00 00 " + "00 00 00 02 00 28 00 00 00 01 00 10 00 00 00 00 00 20 00 00 00 00 00 00 " + "00 01 00 10 00 00 00 00 00 30 00 00 00 00 00 00");
GetQueueConfigOutput builtByFactory = BufferHelper.deserialize(queueFactory, bb);
BufferHelper.checkHeaderV10(builtByFactory);
Assert.assertEquals("Wrong port", 1, builtByFactory.getPort().getValue().intValue());
Assert.assertEquals("Wrong queues size", 2, builtByFactory.getQueues().size());
Queues queue1 = builtByFactory.getQueues().get(0);
Queues queue2 = builtByFactory.getQueues().get(1);
Assert.assertEquals("Wrong queueId", 8, queue1.getQueueId().getValue().intValue());
Assert.assertEquals("Wrong queue - # properties", 1, queue1.getQueueProperty().size());
Assert.assertEquals("Wrong queue - wrong property", QueueProperties.OFPQTNONE, queue1.getQueueProperty().get(0).getProperty());
Assert.assertEquals("Wrong queueId", 2, queue2.getQueueId().getValue().intValue());
Assert.assertEquals("Wrong queue - # properties", 2, queue2.getQueueProperty().size());
Assert.assertEquals("Wrong queue - wrong property", QueueProperties.OFPQTMINRATE, queue2.getQueueProperty().get(0).getProperty());
Assert.assertEquals("Wrong queue - wrong property", QueueProperties.OFPQTMINRATE, queue2.getQueueProperty().get(1).getProperty());
RateQueueProperty rate1 = queue2.getQueueProperty().get(0).getAugmentation(RateQueueProperty.class);
RateQueueProperty rate2 = queue2.getQueueProperty().get(1).getAugmentation(RateQueueProperty.class);
Assert.assertEquals("Wrong queue - wrong property rate", 32, rate1.getRate().intValue());
Assert.assertEquals("Wrong queue - wrong property rate", 48, rate2.getRate().intValue());
}
Aggregations