Search in sources :

Example 6 with SwitchErrorResponseException

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

the class MeterModifyCommand method handleOfError.

@Override
public CompletableFuture<Optional<OFMessage>> handleOfError(OFErrorMsg response) {
    CompletableFuture<Optional<OFMessage>> future = new CompletableFuture<>();
    String errorMessage;
    if (isUnknownMeter(response)) {
        errorMessage = String.format("Can't modify non existent meter. sw:%s meter:%s", getSw().getId(), meterConfig.getId());
    } else {
        errorMessage = String.format("Can't modify meter %s on switch %s - %s", meterConfig.getId(), getSw().getId(), response);
    }
    future.completeExceptionally(new SwitchErrorResponseException(getSw().getId(), errorMessage));
    return future;
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) Optional(java.util.Optional) SwitchErrorResponseException(org.openkilda.floodlight.error.SwitchErrorResponseException)

Example 7 with SwitchErrorResponseException

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

the class IngressCommandRemoveTest method errorOnMeterManipulation.

@Test
public void errorOnMeterManipulation() {
    IngressFlowSegmentBase command = makeCommand(endpointIngressSingleVlan, meterConfig, makeMetadata());
    switchFeaturesSetup(sw, true);
    expectMeterDryRun();
    expectMeterRemove(new SwitchErrorResponseException(dpIdNext, "fake fail to remove meter error"));
    expectMakeOuterOnlyVlanForwardMessage(command, new EffectiveIds(meterConfig.getId(), null));
    expectNoMoreOfMessages();
    replayAll();
    CompletableFuture<FlowSegmentReport> result = command.execute(commandProcessor);
    verifyErrorCompletion(result, SwitchErrorResponseException.class);
}
Also used : EffectiveIds(org.openkilda.floodlight.model.EffectiveIds) SwitchErrorResponseException(org.openkilda.floodlight.error.SwitchErrorResponseException) FlowSegmentReport(org.openkilda.floodlight.command.flow.FlowSegmentReport) Test(org.junit.Test)

Example 8 with SwitchErrorResponseException

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

the class IngressCommandRemoveTest method errorOnFlowMod.

@Test
public void errorOnFlowMod() {
    IngressFlowSegmentBase command = makeCommand(endpointIngressSingleVlan, meterConfig, makeMetadata());
    switchFeaturesSetup(sw, true);
    expectMeterDryRun();
    expectMakeOuterOnlyVlanForwardMessage(command, new EffectiveIds(meterConfig.getId(), null));
    expectNoMoreOfMessages();
    replayAll();
    CompletableFuture<FlowSegmentReport> result = command.execute(commandProcessor);
    getWriteRecord(0).getFuture().completeExceptionally(new SwitchErrorResponseException(dpIdNext, of.errorMsgs().buildBadRequestErrorMsg().setCode(OFBadRequestCode.BAD_LEN).build()));
    verifyErrorCompletion(result, SwitchOperationException.class);
}
Also used : EffectiveIds(org.openkilda.floodlight.model.EffectiveIds) SwitchErrorResponseException(org.openkilda.floodlight.error.SwitchErrorResponseException) FlowSegmentReport(org.openkilda.floodlight.command.flow.FlowSegmentReport) Test(org.junit.Test)

Example 9 with SwitchErrorResponseException

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

the class IngressCommandInstallTest method errorOnFlowMod.

@Test
public void errorOnFlowMod() {
    IngressFlowSegmentBase command = makeCommand(endpointIngressSingleVlan, meterConfig, makeMetadata(false));
    switchFeaturesSetup(sw, true);
    expectMeterInstall();
    expectMakeOuterOnlyVlanForwardMessage(command, new EffectiveIds(meterConfig.getId(), null));
    expectNoMoreOfMessages();
    replayAll();
    CompletableFuture<FlowSegmentReport> result = command.execute(commandProcessor);
    getWriteRecord(0).getFuture().completeExceptionally(new SwitchErrorResponseException(dpIdNext, of.errorMsgs().buildBadRequestErrorMsg().setCode(OFBadRequestCode.BAD_LEN).build()));
    verifyErrorCompletion(result, SwitchOperationException.class);
}
Also used : EffectiveIds(org.openkilda.floodlight.model.EffectiveIds) SwitchErrorResponseException(org.openkilda.floodlight.error.SwitchErrorResponseException) FlowSegmentReport(org.openkilda.floodlight.command.flow.FlowSegmentReport) Test(org.junit.Test)

Aggregations

SwitchErrorResponseException (org.openkilda.floodlight.error.SwitchErrorResponseException)9 Test (org.junit.Test)6 FlowSegmentReport (org.openkilda.floodlight.command.flow.FlowSegmentReport)6 Optional (java.util.Optional)3 CompletableFuture (java.util.concurrent.CompletableFuture)3 EffectiveIds (org.openkilda.floodlight.model.EffectiveIds)3 Getter (lombok.Getter)2 AbstractSpeakerCommandTest (org.openkilda.floodlight.command.AbstractSpeakerCommandTest)2 IOfErrorResponseHandler (org.openkilda.floodlight.command.IOfErrorResponseHandler)2 SpeakerCommandProcessor (org.openkilda.floodlight.command.SpeakerCommandProcessor)2 UnsupportedSwitchOperationException (org.openkilda.floodlight.error.UnsupportedSwitchOperationException)2 Session (org.openkilda.floodlight.service.session.Session)2 MessageContext (org.openkilda.messaging.MessageContext)2 SwitchId (org.openkilda.model.SwitchId)2 OFErrorMsg (org.projectfloodlight.openflow.protocol.OFErrorMsg)2 OFMessage (org.projectfloodlight.openflow.protocol.OFMessage)2 InvalidGroupIdException (org.openkilda.floodlight.error.InvalidGroupIdException)1 InvalidMeterIdException (org.openkilda.floodlight.error.InvalidMeterIdException)1 SwitchGroupConflictException (org.openkilda.floodlight.error.SwitchGroupConflictException)1 SwitchIncorrectMeterException (org.openkilda.floodlight.error.SwitchIncorrectMeterException)1