Search in sources :

Example 1 with SwitchMissingMeterException

use of org.openkilda.floodlight.error.SwitchMissingMeterException in project open-kilda by telstra.

the class MeterVerifyCommand method handleMeterStats.

private MeterSchema handleMeterStats(List<OFMeterConfigStatsReply> meterStatResponses) {
    Optional<OFMeterConfig> target = Optional.empty();
    for (OFMeterConfigStatsReply meterConfigReply : meterStatResponses) {
        target = findMeter(meterConfigReply);
        if (target.isPresent()) {
            break;
        }
    }
    if (!target.isPresent()) {
        throw maskCallbackException(new SwitchMissingMeterException(getSw().getId(), meterConfig.getId()));
    }
    boolean isInaccurate = getSwitchFeatures().contains(SwitchFeature.INACCURATE_METER);
    MeterSchema schema = MeterSchemaMapper.INSTANCE.map(getSw().getId(), target.get(), isInaccurate);
    validateMeterConfig(schema, isInaccurate);
    return schema;
}
Also used : MeterSchema(org.openkilda.model.of.MeterSchema) OFMeterConfigStatsReply(org.projectfloodlight.openflow.protocol.OFMeterConfigStatsReply) SwitchMissingMeterException(org.openkilda.floodlight.error.SwitchMissingMeterException) OFMeterConfig(org.projectfloodlight.openflow.protocol.OFMeterConfig)

Example 2 with SwitchMissingMeterException

use of org.openkilda.floodlight.error.SwitchMissingMeterException in project open-kilda by telstra.

the class MeterInstallCommandTest method missingConflictError.

@Test
public void missingConflictError() throws Throwable {
    switchFeaturesSetup(sw, true);
    expectVerifyMeter(new SwitchMissingMeterException(dpIdNext, meterConfig.getId()));
    replayAll();
    CompletableFuture<MeterInstallReport> result = processConflictError();
    verifyErrorCompletion(result, SwitchMeterConflictException.class);
}
Also used : SwitchMissingMeterException(org.openkilda.floodlight.error.SwitchMissingMeterException) Test(org.junit.Test) AbstractSpeakerCommandTest(org.openkilda.floodlight.command.AbstractSpeakerCommandTest)

Aggregations

SwitchMissingMeterException (org.openkilda.floodlight.error.SwitchMissingMeterException)2 Test (org.junit.Test)1 AbstractSpeakerCommandTest (org.openkilda.floodlight.command.AbstractSpeakerCommandTest)1 MeterSchema (org.openkilda.model.of.MeterSchema)1 OFMeterConfig (org.projectfloodlight.openflow.protocol.OFMeterConfig)1 OFMeterConfigStatsReply (org.projectfloodlight.openflow.protocol.OFMeterConfigStatsReply)1