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;
}
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);
}
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);
}
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);
}
Aggregations