use of org.openkilda.model.MeterConfig in project open-kilda by telstra.
the class MeterVerifyCommandTest method invalidBands0.
@Test
public void invalidBands0() {
switchFeaturesSetup(sw, true);
SettableFuture<List<OFMeterConfigStatsReply>> statsReplyProxy = setupMeterConfigStatsReply();
// for command2
setupMeterConfigStatsReply();
replayAll();
CompletableFuture<MeterVerifyReport> result = command.execute(commandProcessor);
// make one more command with altered config, to produce meter config flags/bands
MeterConfig invalidConfig = new MeterConfig(meterConfig.getId(), meterConfig.getBandwidth() + 1);
MeterVerifyCommand command2 = new MeterVerifyCommand(command.getMessageContext(), command.getSwitchId(), invalidConfig);
// must be executed, for let .setup() method to initialize all dependencies
command2.execute(commandProcessor);
OFMeterConfig reply = sw.getOFFactory().buildMeterConfig().setMeterId(meterConfig.getId().getValue()).setFlags(command2.makeMeterFlags()).setEntries(command2.makeMeterBands()).build();
statsReplyProxy.set(wrapMeterStatsReply(reply));
verifyErrorCompletion(result, SwitchIncorrectMeterException.class);
}
use of org.openkilda.model.MeterConfig in project open-kilda by telstra.
the class MeterVerifyCommandTest method shouldVerifyInaccurateMeterBandwidth.
@Test
public void shouldVerifyInaccurateMeterBandwidth() throws Exception {
MeterConfig validConfig = new MeterConfig(new MeterId(1), 100);
MeterVerifyCommand command1 = new MeterVerifyCommand(new MessageContext(), mapSwitchId(dpId), validConfig);
switchFeaturesSetup(sw, SwitchFeature.METERS, SwitchFeature.INACCURATE_METER);
SettableFuture<List<OFMeterConfigStatsReply>> statsReplyProxy = setupMeterConfigStatsReply();
// for command2
setupMeterConfigStatsReply();
replayAll();
CompletableFuture<MeterVerifyReport> result = command1.execute(commandProcessor);
// make one more command with altered config, to produce meter config flags/bands
MeterConfig invalidConfig = new MeterConfig(validConfig.getId(), validConfig.getBandwidth() + 1);
MeterVerifyCommand command2 = new MeterVerifyCommand(command1.getMessageContext(), command1.getSwitchId(), invalidConfig);
// must be executed, for let .setup() method to initialize all dependencies
command2.execute(commandProcessor);
OFMeterConfig reply = sw.getOFFactory().buildMeterConfig().setMeterId(validConfig.getId().getValue()).setFlags(command2.makeMeterFlags()).setEntries(command2.makeMeterBands()).build();
statsReplyProxy.set(wrapMeterStatsReply(reply));
verifySuccessCompletion(result);
}
Aggregations