use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterFeaturesCase in project openflowplugin by opendaylight.
the class MultipartReplyMeterFeaturesTest method testMultipartReplyMeterFeatures2.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testMultipartReplyMeterFeatures2() {
ByteBuf bb = BufferHelper.buildBuffer(//
"00 0B 00 01 00 00 00 00 " + // maxMeter
"00 00 00 09 " + // bandTypes
"00 00 00 00 " + // capabilities
"00 00 00 00 " + // maxBands, maxColor, padding
"03 04 00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 11, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyMeterFeaturesCase messageCase = (MultipartReplyMeterFeaturesCase) builtByFactory.getMultipartReplyBody();
MultipartReplyMeterFeatures message = messageCase.getMultipartReplyMeterFeatures();
Assert.assertEquals("Wrong maxMeter", 9, message.getMaxMeter().intValue());
Assert.assertEquals("Wrong bandTypes", new MeterBandTypeBitmap(false, false), message.getBandTypes());
Assert.assertEquals("Wrong capabilities", new MeterFlags(false, false, false, false), message.getCapabilities());
Assert.assertEquals("Wrong maxBands", 3, message.getMaxBands().intValue());
Assert.assertEquals("Wrong maxColor", 4, message.getMaxColor().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterFeaturesCase in project openflowplugin by opendaylight.
the class MeterFeaturesService method transformToNotification.
@Override
public MeterFeaturesUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
final int mpSize = result.size();
Preconditions.checkArgument(mpSize == 1, "unexpected (!=1) mp-reply size received: {}", mpSize);
MeterFeaturesUpdatedBuilder notification = new MeterFeaturesUpdatedBuilder();
notification.setId(getDeviceInfo().getNodeId());
notification.setMoreReplies(Boolean.FALSE);
notification.setTransactionId(emulatedTxId);
MultipartReplyMeterFeaturesCase caseBody = (MultipartReplyMeterFeaturesCase) result.get(0).getMultipartReplyBody();
MultipartReplyMeterFeatures replyBody = caseBody.getMultipartReplyMeterFeatures();
notification.setMaxBands(replyBody.getMaxBands());
notification.setMaxColor(replyBody.getMaxColor());
notification.setMaxMeter(new Counter32(replyBody.getMaxMeter()));
notification.setMeterCapabilitiesSupported(extractMeterCapabilities(replyBody.getCapabilities()));
notification.setMeterBandSupported(extractSupportedMeterBand(replyBody, replyBody.getBandTypes()));
return notification.build();
}
Aggregations