Search in sources :

Example 6 with QueueProperty

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty in project openflowplugin by opendaylight.

the class QueueGetConfigReplyMessageFactoryTest method createPropertiesList.

private static List<QueueProperty> createPropertiesList() {
    final List<QueueProperty> propertiesList = new ArrayList<>();
    QueuePropertyBuilder pb = new QueuePropertyBuilder();
    pb.setProperty(QueueProperties.forValue(2));
    RateQueuePropertyBuilder rateBuilder = new RateQueuePropertyBuilder();
    rateBuilder.setRate(5);
    pb.addAugmentation(RateQueueProperty.class, rateBuilder.build());
    propertiesList.add(pb.build());
    return propertiesList;
}
Also used : 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)

Example 7 with QueueProperty

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty in project openflowplugin by opendaylight.

the class QueueGetConfigReplyMessageFactoryTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    GetQueueConfigOutputBuilder builder = new GetQueueConfigOutputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
    builder.setPort(new PortNumber(0x00010203L));
    builder.setQueues(createQueuesList());
    GetQueueConfigOutput message = builder.build();
    ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer();
    factory.serialize(message, serializedBuffer);
    BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 80);
    Assert.assertEquals("Wrong port", message.getPort().getValue().longValue(), serializedBuffer.readInt());
    serializedBuffer.skipBytes(PADDING);
    Assert.assertEquals("Wrong queue Id", message.getQueues().get(0).getQueueId().getValue().longValue(), serializedBuffer.readInt());
    Assert.assertEquals("Wrong port", message.getQueues().get(0).getPort().getValue().longValue(), serializedBuffer.readInt());
    Assert.assertEquals("Wrong length", 32, serializedBuffer.readShort());
    serializedBuffer.skipBytes(QUEUE_PADDING);
    List<QueueProperty> properties = message.getQueues().get(0).getQueueProperty();
    Assert.assertEquals("Wrong property", properties.get(0).getProperty().getIntValue(), serializedBuffer.readShort());
    Assert.assertEquals("Wrong property length", 16, serializedBuffer.readShort());
    serializedBuffer.skipBytes(PROPERTY_HEADER_PADDING);
    RateQueueProperty rateQueueProperty = properties.get(0).getAugmentation(RateQueueProperty.class);
    Assert.assertEquals("Wrong rate", rateQueueProperty.getRate().intValue(), serializedBuffer.readShort());
    serializedBuffer.skipBytes(PROPERTY_RATE_PADDING);
    Assert.assertEquals("Wrong queue Id", message.getQueues().get(1).getQueueId().getValue().longValue(), serializedBuffer.readInt());
    Assert.assertEquals("Wrong queue Id", message.getQueues().get(1).getPort().getValue().longValue(), serializedBuffer.readInt());
    Assert.assertEquals("Wrong length", 32, serializedBuffer.readShort());
    serializedBuffer.skipBytes(QUEUE_PADDING);
    List<QueueProperty> propertiesTwo = message.getQueues().get(1).getQueueProperty();
    Assert.assertEquals("Wrong property", propertiesTwo.get(0).getProperty().getIntValue(), serializedBuffer.readShort());
    Assert.assertEquals("Wrong property length", 16, serializedBuffer.readShort());
    serializedBuffer.skipBytes(PROPERTY_HEADER_PADDING);
    RateQueueProperty rateQueuePropertyTwo = propertiesTwo.get(0).getAugmentation(RateQueueProperty.class);
    Assert.assertEquals("Wrong rate", rateQueuePropertyTwo.getRate().intValue(), serializedBuffer.readShort());
    serializedBuffer.skipBytes(PROPERTY_RATE_PADDING);
}
Also used : GetQueueConfigOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput) RateQueueProperty(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.RateQueueProperty) GetQueueConfigOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutputBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) ByteBuf(io.netty.buffer.ByteBuf) 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) Test(org.junit.Test)

Example 8 with QueueProperty

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty in project openflowplugin by opendaylight.

the class QueueGetConfigReplyMessageFactoryMultiTest method createPropertiesList.

private static List<QueueProperty> createPropertiesList() {
    final List<QueueProperty> propertiesList = new ArrayList<>();
    QueuePropertyBuilder pb = new QueuePropertyBuilder();
    pb.setProperty(QueueProperties.forValue(2));
    RateQueuePropertyBuilder rateBuilder = new RateQueuePropertyBuilder();
    rateBuilder.setRate(5);
    pb.addAugmentation(RateQueueProperty.class, rateBuilder.build());
    propertiesList.add(pb.build());
    return propertiesList;
}
Also used : 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)

Example 9 with QueueProperty

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty in project openflowplugin by opendaylight.

the class OF10QueueGetConfigReplyMessageFactoryTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    GetQueueConfigOutputBuilder builder = new GetQueueConfigOutputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
    builder.setPort(new PortNumber(1L));
    builder.setQueues(createQueues());
    GetQueueConfigOutput message = builder.build();
    ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer();
    factory.serialize(message, serializedBuffer);
    BufferHelper.checkHeaderV10(serializedBuffer, MESSAGE_TYPE, 40);
    Assert.assertEquals("Wrong port", message.getPort().getValue().longValue(), serializedBuffer.readShort());
    serializedBuffer.skipBytes(6);
    Assert.assertEquals("Wrong queue Id", message.getQueues().get(0).getQueueId().getValue().longValue(), serializedBuffer.readInt());
    Assert.assertEquals("Wrong length", 24, serializedBuffer.readShort());
    serializedBuffer.skipBytes(2);
    List<QueueProperty> properties = message.getQueues().get(0).getQueueProperty();
    Assert.assertEquals("Wrong property", properties.get(0).getProperty().getIntValue(), serializedBuffer.readShort());
    Assert.assertEquals("Wrong property length", 16, serializedBuffer.readShort());
    serializedBuffer.skipBytes(4);
    RateQueueProperty rateQueueProperty = properties.get(0).getAugmentation(RateQueueProperty.class);
    Assert.assertEquals("Wrong rate", rateQueueProperty.getRate().intValue(), serializedBuffer.readShort());
    serializedBuffer.skipBytes(6);
}
Also used : GetQueueConfigOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput) RateQueueProperty(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.RateQueueProperty) GetQueueConfigOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutputBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) ByteBuf(io.netty.buffer.ByteBuf) 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) Test(org.junit.Test)

Example 10 with QueueProperty

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty in project openflowplugin by opendaylight.

the class OF10QueueGetConfigReplyMessageFactoryTest method createPropertiesList.

private static List<QueueProperty> createPropertiesList() {
    final List<QueueProperty> propertiesList = new ArrayList<>();
    QueuePropertyBuilder pb = new QueuePropertyBuilder();
    pb.setProperty(QueueProperties.forValue(1));
    RateQueuePropertyBuilder rateBuilder = new RateQueuePropertyBuilder();
    rateBuilder.setRate(5);
    pb.addAugmentation(RateQueueProperty.class, rateBuilder.build());
    propertiesList.add(pb.build());
    return propertiesList;
}
Also used : 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

RateQueueProperty (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.RateQueueProperty)10 QueueProperty (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty)10 ArrayList (java.util.ArrayList)6 RateQueuePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.RateQueuePropertyBuilder)6 QueuePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueuePropertyBuilder)6 ByteBuf (io.netty.buffer.ByteBuf)4 Test (org.junit.Test)2 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)2 QueueProperties (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.QueueProperties)2 GetQueueConfigOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput)2 GetQueueConfigOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutputBuilder)2 Queues (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.get.config.reply.Queues)2 OFDeserializer (org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer)1 ExperimenterIdQueueProperty (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdQueueProperty)1