import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.get.config.reply.QueuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueueProperty;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.queue.property.header.QueuePropertyBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
/**
* Unit tests for QueueGetConfigReplyMessageFactory.
SerializerRegistry registry = new SerializerRegistryImpl();
registry.init();
factory = registry
- .getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, GetQueueConfigOutput.class));
+ .getSerializer(new MessageTypeKey<>(EncodeConstants.OF_VERSION_1_3, GetQueueConfigOutput.class));
}
@Test
public void testSerialize() throws Exception {
GetQueueConfigOutputBuilder builder = new GetQueueConfigOutputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
- builder.setPort(new PortNumber(0x00010203L));
+ builder.setPort(new PortNumber(Uint32.valueOf(0x00010203)));
builder.setQueues(createQueuesList());
GetQueueConfigOutput message = builder.build();
serializedBuffer.readShort());
Assert.assertEquals("Wrong property length", 16, serializedBuffer.readShort());
serializedBuffer.skipBytes(PROPERTY_HEADER_PADDING);
- RateQueueProperty rateQueueProperty = properties.get(0).getAugmentation(RateQueueProperty.class);
+ RateQueueProperty rateQueueProperty = properties.get(0).augmentation(RateQueueProperty.class);
Assert.assertEquals("Wrong rate", rateQueueProperty.getRate().intValue(), serializedBuffer.readShort());
serializedBuffer.skipBytes(PROPERTY_RATE_PADDING);
serializedBuffer.readShort());
Assert.assertEquals("Wrong property length", 16, serializedBuffer.readShort());
serializedBuffer.skipBytes(PROPERTY_HEADER_PADDING);
- RateQueueProperty rateQueuePropertyTwo = propertiesTwo.get(0).getAugmentation(RateQueueProperty.class);
+ RateQueueProperty rateQueuePropertyTwo = propertiesTwo.get(0).augmentation(RateQueueProperty.class);
Assert.assertEquals("Wrong rate", rateQueuePropertyTwo.getRate().intValue(), serializedBuffer.readShort());
serializedBuffer.skipBytes(PROPERTY_RATE_PADDING);
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());
+ queuesList.add(new QueuesBuilder()
+ .setQueueId(new QueueId(Uint32.valueOf(i)))
+ .setPort(new PortNumber(Uint32.valueOf(i)))
+ .setQueueProperty(createPropertiesList())
+ .build());
}
return queuesList;
}
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());
+ propertiesList.add(new QueuePropertyBuilder()
+ .setProperty(QueueProperties.forValue(2))
+ .addAugmentation(new RateQueuePropertyBuilder().setRate(Uint16.valueOf(5)).build())
+ .build());
return propertiesList;
}
}