use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeter in project openflowplugin by opendaylight.
the class SalMeterServiceImplTest method updateMeter.
private void updateMeter() throws Exception {
final UpdatedMeter dummyUpdatedMeter = new UpdatedMeterBuilder().setMeterId(new MeterId(DUMMY_METTER_ID)).build();
final OriginalMeter dummyOriginalMeter = new OriginalMeterBuilder().setMeterId(new MeterId(DUMMY_METTER_ID)).build();
final UpdateMeterInput updateMeterInput = new UpdateMeterInputBuilder().setUpdatedMeter(dummyUpdatedMeter).setOriginalMeter(dummyOriginalMeter).build();
this.<AddMeterOutput>mockSuccessfulFuture();
salMeterService.updateMeter(updateMeterInput);
verify(mockedRequestContextStack).createRequestContext();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeter in project openflowplugin by opendaylight.
the class MeterConvertor method convert.
@Override
public MeterModInputBuilder convert(Meter source, VersionConvertorData data) {
MeterModInputBuilder meterModInputBuilder = new MeterModInputBuilder();
List<Bands> bands = new ArrayList<>();
if (source instanceof AddMeterInput) {
meterModInputBuilder.setCommand(MeterModCommand.OFPMCADD);
} else if (source instanceof RemoveMeterInput) {
meterModInputBuilder.setCommand(MeterModCommand.OFPMCDELETE);
} else if (source instanceof UpdatedMeter) {
meterModInputBuilder.setCommand(MeterModCommand.OFPMCMODIFY);
}
meterModInputBuilder.setMeterId(new MeterId(source.getMeterId().getValue()));
if (null != source.getFlags()) {
meterModInputBuilder.setFlags(new MeterFlags(source.getFlags().isMeterBurst(), source.getFlags().isMeterKbps(), source.getFlags().isMeterPktps(), source.getFlags().isMeterStats()));
} else {
/*
* As per 0F1.3.1,The rate field indicates the rate value above
* which the corresponding band may apply to packets (see 5.7.1).
* The rate value is in kilobit per seconds, unless the flags eld
* includes OFPMF_PKTPS, in which case the rate is in packets per
* seconds.
*/
meterModInputBuilder.setFlags(new MeterFlags(false, false, true, false));
}
if (source.getMeterBandHeaders() != null) {
getBandsFromSAL(source.getMeterBandHeaders(), bands);
meterModInputBuilder.setBands(bands);
} else {
LOG.error("For this meter Id" + source.getMeterId().getValue() + ",no associated band data found!");
}
meterModInputBuilder.setVersion(data.getVersion());
return meterModInputBuilder;
}
Aggregations