use of org.projectfloodlight.openflow.protocol.meterband.OFMeterBand in project open-kilda by telstra.
the class AbstractMeterInstall method makeMeterMessage.
protected OFMeterMod makeMeterMessage(OFMeterModCommand commandType) {
final OFFactory ofFactory = getSw().getOFFactory();
OFMeterMod.Builder meterModBuilder = ofFactory.buildMeterMod().setMeterId(meterConfig.getId().getValue()).setCommand(commandType).setFlags(makeMeterFlags());
// NB: some switches might replace 0 burst size value with some predefined value
List<OFMeterBand> meterBand = makeMeterBands();
if (ofFactory.getVersion().compareTo(OF_13) > 0) {
meterModBuilder.setBands(meterBand);
} else {
meterModBuilder.setMeters(meterBand);
}
return meterModBuilder.build();
}
use of org.projectfloodlight.openflow.protocol.meterband.OFMeterBand in project open-kilda by telstra.
the class OfMeterConverter method convertToMeterSpeakerData.
/**
* Convert meter config.
*/
public MeterSpeakerData convertToMeterSpeakerData(OFMeterConfig meterConfig, boolean inaccurate) {
MeterId meterId = new MeterId(meterConfig.getMeterId());
long rate = 0;
long burst = 0;
for (OFMeterBand band : meterConfig.getEntries()) {
if (band instanceof OFMeterBandDrop) {
rate = ((OFMeterBandDrop) band).getRate();
burst = ((OFMeterBandDrop) band).getBurstSize();
}
}
return MeterSpeakerData.builder().meterId(meterId).burst(burst).rate(rate).flags(fromOfMeterFlags(meterConfig.getFlags())).inaccurate(inaccurate).build();
}
use of org.projectfloodlight.openflow.protocol.meterband.OFMeterBand in project open-kilda by telstra.
the class MeterSchemaMapper method fillBands.
private void fillBands(MeterSchema.MeterSchemaBuilder schema, List<OFMeterBand> bandsSequence, boolean isInaccurate) {
for (OFMeterBand rawBand : bandsSequence) {
MeterSchemaBand.MeterSchemaBandBuilder band = MeterSchemaBand.builder().type(rawBand.getType()).inaccurate(isInaccurate);
if (rawBand instanceof OFMeterBandDrop) {
OFMeterBandDrop actualBand = (OFMeterBandDrop) rawBand;
band.rate(actualBand.getRate());
band.burstSize(actualBand.getBurstSize());
}
// do not make detailed parsing of other meter's band types
schema.band(band.build());
}
}
Aggregations