Search in sources :

Example 6 with MultipartReplyMeterConfig

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter.config._case.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());
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) MultipartReplyMeterConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyMeterConfig) Drop(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.Drop) Test(org.junit.Test)

Example 7 with MultipartReplyMeterConfig

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter.config._case.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());
}
Also used : MultipartReplyMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage) MeterFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterFlags) MeterBandDrop(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.drop._case.MeterBandDrop) MultipartReplyMeterConfigCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterConfigCase) ByteBuf(io.netty.buffer.ByteBuf) MeterBandDscpRemarkCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDscpRemarkCase) MeterBandDscpRemark(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.dscp.remark._case.MeterBandDscpRemark) MultipartReplyMeterConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter.config._case.MultipartReplyMeterConfig) MeterBandDropCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDropCase) Test(org.junit.Test)

Example 8 with MultipartReplyMeterConfig

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter.config._case.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());
}
Also used : DscpRemark(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.DscpRemark) ByteBuf(io.netty.buffer.ByteBuf) MultipartReplyMeterConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyMeterConfig) Test(org.junit.Test)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)6 MultipartReplyMeterConfigCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterConfigCase)6 MultipartReplyMeterConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter.config._case.MultipartReplyMeterConfig)6 Test (org.junit.Test)5 MultipartReplyMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage)3 MeterBandDropCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDropCase)3 MeterBandDscpRemarkCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDscpRemarkCase)3 MeterBandDrop (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.drop._case.MeterBandDrop)3 MeterBandDscpRemark (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.dscp.remark._case.MeterBandDscpRemark)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 MultipartReplyMeterConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyMeterConfig)2 MeterFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterFlags)2 MeterConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter.config._case.multipart.reply.meter.config.MeterConfig)2 FlowAndStatisticsMapList (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList)1 MeterConfigStatsUpdatedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterConfigStatsUpdatedBuilder)1 MultipartReplyMeterConfigBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyMeterConfigBuilder)1 Drop (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.Drop)1 DscpRemark (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.DscpRemark)1 MultipartRequestFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags)1