Search in sources :

Example 1 with FlowErrorResponseBuilder

use of org.openkilda.floodlight.flow.response.FlowErrorResponse.FlowErrorResponseBuilder in project open-kilda by telstra.

the class FlowSegmentReport method assembleResponse.

private SpeakerResponse assembleResponse() {
    FlowErrorResponseBuilder errorResponse = makeErrorTemplate();
    try {
        raiseError();
        return makeSuccessReply();
    } catch (SwitchNotFoundException e) {
        errorResponse.errorCode(ErrorCode.SWITCH_UNAVAILABLE);
    } catch (SessionErrorResponseException e) {
        decodeError(errorResponse, e.getErrorResponse());
    } catch (SwitchMissingFlowsException e) {
        errorResponse.errorCode(ErrorCode.MISSING_OF_FLOWS);
        errorResponse.description(e.getMessage());
    } catch (SwitchOperationException e) {
        errorResponse.errorCode(ErrorCode.UNKNOWN);
        errorResponse.description(e.getMessage());
    } catch (Exception e) {
        log.error(String.format("Unhandled exception while processing command %s", command), e);
        errorResponse.errorCode(ErrorCode.UNKNOWN);
    }
    FlowErrorResponse response = errorResponse.build();
    log.error("Command {} have failed - {} {}", command, response.getErrorCode(), response.getDescription());
    return response;
}
Also used : SwitchMissingFlowsException(org.openkilda.floodlight.error.SwitchMissingFlowsException) SwitchOperationException(org.openkilda.floodlight.error.SwitchOperationException) FlowErrorResponse(org.openkilda.floodlight.flow.response.FlowErrorResponse) FlowErrorResponseBuilder(org.openkilda.floodlight.flow.response.FlowErrorResponse.FlowErrorResponseBuilder) SwitchNotFoundException(org.openkilda.floodlight.error.SwitchNotFoundException) SessionErrorResponseException(org.openkilda.floodlight.error.SessionErrorResponseException) SessionErrorResponseException(org.openkilda.floodlight.error.SessionErrorResponseException) SwitchMissingFlowsException(org.openkilda.floodlight.error.SwitchMissingFlowsException) SwitchOperationException(org.openkilda.floodlight.error.SwitchOperationException) SwitchNotFoundException(org.openkilda.floodlight.error.SwitchNotFoundException)

Aggregations

SessionErrorResponseException (org.openkilda.floodlight.error.SessionErrorResponseException)1 SwitchMissingFlowsException (org.openkilda.floodlight.error.SwitchMissingFlowsException)1 SwitchNotFoundException (org.openkilda.floodlight.error.SwitchNotFoundException)1 SwitchOperationException (org.openkilda.floodlight.error.SwitchOperationException)1 FlowErrorResponse (org.openkilda.floodlight.flow.response.FlowErrorResponse)1 FlowErrorResponseBuilder (org.openkilda.floodlight.flow.response.FlowErrorResponse.FlowErrorResponseBuilder)1