use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.meter.band.experimenter._case.MeterBandExperimenterBuilder 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.experimenter._case.MeterBandExperimenterBuilder in project openflowplugin by opendaylight.
the class MeterConvertor method getBandsFromSAL.
private static void getBandsFromSAL(MeterBandHeaders meterBandHeaders, List<Bands> bands) {
for (MeterBandHeader meterBandHeader : meterBandHeaders.getMeterBandHeader()) {
// The band types :drop,DSCP_Remark or experimenter.
if (null != meterBandHeader.getMeterBandTypes() && null != meterBandHeader.getMeterBandTypes().getFlags()) {
if (meterBandHeader.getMeterBandTypes().getFlags().isOfpmbtDrop()) {
if (meterBandHeader.getBandType() != null) {
MeterBandDropBuilder meterBandDropBuilder = new MeterBandDropBuilder();
meterBandDropBuilder.setType(MeterBandType.OFPMBTDROP);
Drop drop = (Drop) meterBandHeader.getBandType();
meterBandDropBuilder.setBurstSize(drop.getDropBurstSize());
meterBandDropBuilder.setRate(drop.getDropRate());
MeterBandDropCaseBuilder dropCaseBuilder = new MeterBandDropCaseBuilder();
dropCaseBuilder.setMeterBandDrop(meterBandDropBuilder.build());
MeterBand meterBandItem = dropCaseBuilder.build();
BandsBuilder bandsB = new BandsBuilder();
bandsB.setMeterBand(meterBandItem);
// Bands list
bands.add(bandsB.build());
} else {
logBandTypeMissing(MeterBandType.OFPMBTDROP);
}
} else if (meterBandHeader.getMeterBandTypes().getFlags().isOfpmbtDscpRemark()) {
if (meterBandHeader.getBandType() != null) {
MeterBandDscpRemarkBuilder meterBandDscpRemarkBuilder = new MeterBandDscpRemarkBuilder();
meterBandDscpRemarkBuilder.setType(MeterBandType.OFPMBTDSCPREMARK);
DscpRemark dscpRemark = (DscpRemark) meterBandHeader.getBandType();
meterBandDscpRemarkBuilder.setBurstSize(dscpRemark.getDscpRemarkBurstSize());
meterBandDscpRemarkBuilder.setRate(dscpRemark.getDscpRemarkRate());
meterBandDscpRemarkBuilder.setPrecLevel(dscpRemark.getPrecLevel());
MeterBandDscpRemarkCaseBuilder dscpCaseBuilder = new MeterBandDscpRemarkCaseBuilder();
dscpCaseBuilder.setMeterBandDscpRemark(meterBandDscpRemarkBuilder.build());
MeterBand meterBandItem = dscpCaseBuilder.build();
BandsBuilder bandsB = new BandsBuilder();
bandsB.setMeterBand(meterBandItem);
// Bands list
bands.add(bandsB.build());
} else {
logBandTypeMissing(MeterBandType.OFPMBTDSCPREMARK);
}
} else if (meterBandHeader.getMeterBandTypes().getFlags().isOfpmbtExperimenter()) {
if (meterBandHeader.getBandType() != null) {
MeterBandExperimenterBuilder meterBandExperimenterBuilder = new MeterBandExperimenterBuilder();
meterBandExperimenterBuilder.setType(MeterBandType.OFPMBTEXPERIMENTER);
Experimenter experimenter = (Experimenter) meterBandHeader.getBandType();
meterBandExperimenterBuilder.setBurstSize(experimenter.getExperimenterBurstSize());
meterBandExperimenterBuilder.setRate(experimenter.getExperimenterRate());
ExperimenterIdMeterBandBuilder expBuilder = new ExperimenterIdMeterBandBuilder();
expBuilder.setExperimenter(new ExperimenterId(experimenter.getExperimenter()));
meterBandExperimenterBuilder.addAugmentation(ExperimenterIdMeterBand.class, expBuilder.build());
// TODO - implement / finish experimenter meter band translation
MeterBandExperimenterCaseBuilder experimenterCaseBuilder = new MeterBandExperimenterCaseBuilder();
experimenterCaseBuilder.setMeterBandExperimenter(meterBandExperimenterBuilder.build());
MeterBand meterBandItem = experimenterCaseBuilder.build();
BandsBuilder bandsB = new BandsBuilder();
bandsB.setMeterBand(meterBandItem);
// Bands list
bands.add(bandsB.build());
} else {
logBandTypeMissing(MeterBandType.OFPMBTEXPERIMENTER);
}
}
} else {
LOG.error("Invalid meter band data found.");
}
}
}
Aggregations