use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyMeterConfig in project openflowplugin by opendaylight.
the class MultipartReplyMeterConfigDeserializerTest method deserializeDrop.
@Test
public void deserializeDrop() throws Exception {
ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();
writeCommonAtributes(buffer);
buffer.writeShort(OFPMBTDROP);
buffer.writeShort(SUB_ITEM);
buffer.writeInt(DROP_RATE);
buffer.writeInt(DROP_BURST_SIZE);
buffer.writeZero(PADDING_IN_METER_BAND_DROP_HEADER);
final MultipartReplyMeterConfig reply = (MultipartReplyMeterConfig) deserializeMultipart(buffer);
assertEquals(METER_ID, reply.getMeterConfigStats().get(0).getMeterId().getValue().intValue());
assertEquals(FLAGS, reply.getMeterConfigStats().get(0).getFlags());
final Drop drop = (Drop) reply.getMeterConfigStats().get(0).getMeterBandHeaders().getMeterBandHeader().get(0).getBandType();
assertEquals(DROP_RATE, drop.getDropRate().intValue());
assertEquals(DROP_BURST_SIZE, drop.getDropBurstSize().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyMeterConfig in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method testMultipartReplyMeterConfigBody.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testMultipartReplyMeterConfigBody() {
ByteBuf bb = BufferHelper.buildBuffer("00 0A 00 01 00 00 00 00 " + // len
"00 28 " + // flags
"00 0A " + // meterId
"00 00 00 09 " + // meterBandDrop.type
"00 01 " + // meterBandDrop.len
"00 10 " + // meterBandDrop.rate
"00 00 00 11 " + // meterBandDrop.burstSize
"00 00 00 20 " + // meterBandDrop.pad
"00 00 00 00 " + // meterBandDscp.type
"00 02 " + // meterBandDscp.len
"00 10 " + // meterBandDscp.rate
"00 00 00 11 " + // meterBandDscp.burstSize
"00 00 00 20 " + // meterBandDscp.precLevel
"04 " + // meterBandDscp.pad
"00 00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(multipartFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 10, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", true, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyMeterConfigCase messageCase = (MultipartReplyMeterConfigCase) builtByFactory.getMultipartReplyBody();
MultipartReplyMeterConfig message = messageCase.getMultipartReplyMeterConfig();
Assert.assertEquals("Wrong flags", new MeterFlags(false, false, true, true), message.getMeterConfig().get(0).getFlags());
Assert.assertEquals("Wrong meterId", 9, message.getMeterConfig().get(0).getMeterId().getValue().intValue());
MeterBandDropCase dropCase = (MeterBandDropCase) message.getMeterConfig().get(0).getBands().get(0).getMeterBand();
MeterBandDrop meterBandDrop = dropCase.getMeterBandDrop();
Assert.assertEquals("Wrong meterBandDrop.type", 1, meterBandDrop.getType().getIntValue());
Assert.assertEquals("Wrong meterBandDrop.rate", 17, meterBandDrop.getRate().intValue());
Assert.assertEquals("Wrong meterBandDrop.burstSize", 32, meterBandDrop.getBurstSize().intValue());
MeterBandDscpRemarkCase dscpCase = (MeterBandDscpRemarkCase) message.getMeterConfig().get(0).getBands().get(1).getMeterBand();
MeterBandDscpRemark meterBandDscp = dscpCase.getMeterBandDscpRemark();
Assert.assertEquals("Wrong meterBandDscp.type", 2, meterBandDscp.getType().getIntValue());
Assert.assertEquals("Wrong meterBandDscp.rate", 17, meterBandDscp.getRate().intValue());
Assert.assertEquals("Wrong meterBandDscp.burstSize", 32, meterBandDscp.getBurstSize().intValue());
Assert.assertEquals("Wrong meterBandDscp.precLevel", 4, meterBandDscp.getPrecLevel().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyMeterConfig in project openflowplugin by opendaylight.
the class MultipartReplyMeterConfigDeserializerTest method deserializeDscp.
@Test
public void deserializeDscp() throws Exception {
ByteBuf buffer = UnpooledByteBufAllocator.DEFAULT.buffer();
writeCommonAtributes(buffer);
buffer.writeShort(OFPMBTDSCP);
buffer.writeShort(SUB_ITEM);
buffer.writeInt(DSCP_REMARK_RATE);
buffer.writeInt(DSCP_REMARK_BURST_SIZE);
buffer.writeByte(PREC_LEVEL);
buffer.writeZero(PADDING_IN_METER_BAND_DSCP_HEADER);
final MultipartReplyMeterConfig reply = (MultipartReplyMeterConfig) deserializeMultipart(buffer);
final DscpRemark dscpRemark = (DscpRemark) reply.getMeterConfigStats().get(0).getMeterBandHeaders().getMeterBandHeader().get(0).getBandType();
assertEquals(DSCP_REMARK_RATE, dscpRemark.getDscpRemarkRate().intValue());
assertEquals(DSCP_REMARK_BURST_SIZE, dscpRemark.getDscpRemarkBurstSize().intValue());
assertEquals(PREC_LEVEL, dscpRemark.getPrecLevel().byteValue());
}
Aggregations