use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.dscp.remark._case.MeterBandDscpRemarkBuilder in project openflowplugin by opendaylight.
the class MeterConfigStatsResponseConvertorTest method createMeterConfigList.
private List<MeterConfig> createMeterConfigList() {
List<MeterConfig> meterConfigs = new ArrayList<>();
MeterConfigBuilder meterConfigBuilder = new MeterConfigBuilder();
for (int i = 0; i < PRESET_COUNT; i++) {
meterConfigBuilder.setMeterId(new MeterId((long) i));
List<Bands> bandses = new ArrayList<>();
BandsBuilder bandsBuilder = new BandsBuilder();
bandsBuilder.setMeterBand(new MeterBandDropCaseBuilder().setMeterBandDrop(new MeterBandDropBuilder().build()).build());
bandses.add(bandsBuilder.build());
bandsBuilder = new BandsBuilder();
bandsBuilder.setMeterBand(new MeterBandDscpRemarkCaseBuilder().setMeterBandDscpRemark(new MeterBandDscpRemarkBuilder().build()).build());
bandses.add(bandsBuilder.build());
bandsBuilder = new BandsBuilder();
bandsBuilder.setMeterBand(new MockMeterBandBuilder());
bandses.add(bandsBuilder.build());
bandsBuilder = new BandsBuilder();
bandsBuilder.setMeterBand(new MeterBandExperimenterCaseBuilder().setMeterBandExperimenter(new MeterBandExperimenterBuilder().build()).build());
bandses.add(bandsBuilder.build());
meterConfigBuilder.setBands(bandses);
meterConfigBuilder.setFlags(new MeterFlags(true, false, true, false));
meterConfigs.add(meterConfigBuilder.build());
}
return meterConfigs;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.dscp.remark._case.MeterBandDscpRemarkBuilder in project openflowplugin by opendaylight.
the class MeterModInputMessageFactory method deserialize.
@Override
// FB doesn't recognize Objects.requireNonNull
@SuppressFBWarnings("UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
public MeterModInput deserialize(ByteBuf rawMessage) {
Objects.requireNonNull(registry);
MeterModInputBuilder builder = new MeterModInputBuilder();
builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
builder.setXid(rawMessage.readUnsignedInt());
builder.setCommand(MeterModCommand.forValue(rawMessage.readUnsignedShort()));
builder.setFlags(createMeterFlags(rawMessage.readUnsignedShort()));
builder.setMeterId(new MeterId(rawMessage.readUnsignedInt()));
List<Bands> bandsList = new ArrayList<>();
while (rawMessage.readableBytes() > 0) {
BandsBuilder bandsBuilder = new BandsBuilder();
int bandStartIndex = rawMessage.readerIndex();
int bandType = rawMessage.readUnsignedShort();
switch(bandType) {
case 1:
final MeterBandDropCaseBuilder bandDropCaseBuilder = new MeterBandDropCaseBuilder();
MeterBandDropBuilder bandDropBuilder = new MeterBandDropBuilder();
bandDropBuilder.setType(MeterBandType.forValue(bandType));
rawMessage.readUnsignedShort();
bandDropBuilder.setRate(rawMessage.readUnsignedInt());
bandDropBuilder.setBurstSize(rawMessage.readUnsignedInt());
rawMessage.skipBytes(PADDING_IN_METER_BAND_DROP_HEADER);
bandDropCaseBuilder.setMeterBandDrop(bandDropBuilder.build());
bandsBuilder.setMeterBand(bandDropCaseBuilder.build());
break;
case 2:
final MeterBandDscpRemarkCaseBuilder bandDscpRemarkCaseBuilder = new MeterBandDscpRemarkCaseBuilder();
MeterBandDscpRemarkBuilder bandDscpRemarkBuilder = new MeterBandDscpRemarkBuilder();
bandDscpRemarkBuilder.setType(MeterBandType.forValue(bandType));
rawMessage.readUnsignedShort();
bandDscpRemarkBuilder.setRate(rawMessage.readUnsignedInt());
bandDscpRemarkBuilder.setBurstSize(rawMessage.readUnsignedInt());
bandDscpRemarkBuilder.setPrecLevel(rawMessage.readUnsignedByte());
rawMessage.skipBytes(PADDING_IN_METER_BAND_DSCP_HEADER);
bandDscpRemarkCaseBuilder.setMeterBandDscpRemark(bandDscpRemarkBuilder.build());
bandsBuilder.setMeterBand(bandDscpRemarkCaseBuilder.build());
break;
case 0xFFFF:
long expId = rawMessage.getUnsignedInt(rawMessage.readerIndex() + 2 * EncodeConstants.SIZE_OF_INT_IN_BYTES);
rawMessage.readerIndex(bandStartIndex);
OFDeserializer<MeterBandExperimenterCase> deserializer = registry.getDeserializer(ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(EncodeConstants.OF13_VERSION_ID, expId));
bandsBuilder.setMeterBand(deserializer.deserialize(rawMessage));
break;
default:
break;
}
bandsList.add(bandsBuilder.build());
}
builder.setBands(bandsList);
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.dscp.remark._case.MeterBandDscpRemarkBuilder in project openflowplugin by opendaylight.
the class MeterModInputMessageFactoryTest method createBandsList.
private static List<Bands> createBandsList() {
final List<Bands> bandsList = new ArrayList<>();
final BandsBuilder bandsBuilder = new BandsBuilder();
final MeterBandDropCaseBuilder dropCaseBuilder = new MeterBandDropCaseBuilder();
MeterBandDropBuilder dropBand = new MeterBandDropBuilder();
dropBand.setType(MeterBandType.OFPMBTDROP);
dropBand.setRate(1L);
dropBand.setBurstSize(2L);
dropCaseBuilder.setMeterBandDrop(dropBand.build());
bandsList.add(bandsBuilder.setMeterBand(dropCaseBuilder.build()).build());
final MeterBandDscpRemarkCaseBuilder dscpCaseBuilder = new MeterBandDscpRemarkCaseBuilder();
MeterBandDscpRemarkBuilder dscpRemarkBand = new MeterBandDscpRemarkBuilder();
dscpRemarkBand.setType(MeterBandType.OFPMBTDSCPREMARK);
dscpRemarkBand.setRate(1L);
dscpRemarkBand.setBurstSize(2L);
dscpRemarkBand.setPrecLevel((short) 3);
dscpCaseBuilder.setMeterBandDscpRemark(dscpRemarkBand.build());
bandsList.add(bandsBuilder.setMeterBand(dscpCaseBuilder.build()).build());
return bandsList;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.dscp.remark._case.MeterBandDscpRemarkBuilder in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method decodeBandsList.
private static List<Bands> decodeBandsList(ByteBuf input) {
final List<Bands> bandsList = new ArrayList<>();
final BandsBuilder bandsBuilder = new BandsBuilder();
final MeterBandDropCaseBuilder dropCaseBuilder = new MeterBandDropCaseBuilder();
MeterBandDropBuilder dropBand = new MeterBandDropBuilder();
dropBand.setType(MeterBandType.forValue(input.readUnsignedShort()));
input.skipBytes(Short.SIZE / Byte.SIZE);
dropBand.setRate(input.readUnsignedInt());
dropBand.setBurstSize(input.readUnsignedInt());
dropCaseBuilder.setMeterBandDrop(dropBand.build());
bandsList.add(bandsBuilder.setMeterBand(dropCaseBuilder.build()).build());
final MeterBandDscpRemarkCaseBuilder dscpCaseBuilder = new MeterBandDscpRemarkCaseBuilder();
MeterBandDscpRemarkBuilder dscpRemarkBand = new MeterBandDscpRemarkBuilder();
dscpRemarkBand.setType(MeterBandType.forValue(input.readUnsignedShort()));
input.skipBytes(Short.SIZE / Byte.SIZE);
dscpRemarkBand.setRate(input.readUnsignedInt());
dscpRemarkBand.setBurstSize(input.readUnsignedInt());
dscpRemarkBand.setPrecLevel((short) 3);
dscpCaseBuilder.setMeterBandDscpRemark(dscpRemarkBand.build());
bandsList.add(bandsBuilder.setMeterBand(dscpCaseBuilder.build()).build());
return bandsList;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.dscp.remark._case.MeterBandDscpRemarkBuilder in project openflowplugin by opendaylight.
the class MeterModInputMessageFactoryTest method createBandsList.
private static List<Bands> createBandsList() {
final List<Bands> bandsList = new ArrayList<>();
final BandsBuilder bandsBuilder = new BandsBuilder();
final MeterBandDropCaseBuilder dropCaseBuilder = new MeterBandDropCaseBuilder();
MeterBandDropBuilder dropBand = new MeterBandDropBuilder();
dropBand.setType(MeterBandType.OFPMBTDROP);
dropBand.setRate(1L);
dropBand.setBurstSize(2L);
dropCaseBuilder.setMeterBandDrop(dropBand.build());
bandsList.add(bandsBuilder.setMeterBand(dropCaseBuilder.build()).build());
final MeterBandDscpRemarkCaseBuilder dscpCaseBuilder = new MeterBandDscpRemarkCaseBuilder();
MeterBandDscpRemarkBuilder dscpRemarkBand = new MeterBandDscpRemarkBuilder();
dscpRemarkBand.setType(MeterBandType.OFPMBTDSCPREMARK);
dscpRemarkBand.setRate(1L);
dscpRemarkBand.setBurstSize(2L);
dscpRemarkBand.setPrecLevel((short) 3);
dscpCaseBuilder.setMeterBandDscpRemark(dscpRemarkBand.build());
bandsList.add(bandsBuilder.setMeterBand(dscpCaseBuilder.build()).build());
return bandsList;
}
Aggregations