Search in sources :

Example 11 with SpeakerResponse

use of org.openkilda.floodlight.api.response.SpeakerResponse in project open-kilda by telstra.

the class YFlowCreateServiceTest method handleSpeakerCommandsAndFailVerify.

private void handleSpeakerCommandsAndFailVerify(YFlowCreateService yFlowCreateService, String yFlowFsmKey, String commandFlowIdToFail) {
    handleSpeakerRequests(request -> {
        SpeakerResponse commandResponse;
        if (request instanceof FlowSegmentRequest) {
            FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) request;
            commandResponse = flowSegmentRequest.isVerifyRequest() && flowSegmentRequest.getMetadata().getFlowId().equals(commandFlowIdToFail) ? buildErrorSpeakerResponse(flowSegmentRequest) : buildSuccessfulSpeakerResponse(flowSegmentRequest);
        } else {
            BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) request;
            commandResponse = buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
        }
        handleAsyncResponse(yFlowCreateService, yFlowFsmKey, commandResponse);
    });
}
Also used : FlowSegmentRequest(org.openkilda.floodlight.api.request.FlowSegmentRequest) SpeakerResponse(org.openkilda.floodlight.api.response.SpeakerResponse) BaseSpeakerCommandsRequest(org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest)

Example 12 with SpeakerResponse

use of org.openkilda.floodlight.api.response.SpeakerResponse in project open-kilda by telstra.

the class YFlowCreateServiceTest method handleSpeakerCommandsAndTimeoutVerify.

private void handleSpeakerCommandsAndTimeoutVerify(YFlowCreateService yFlowCreateService, String yFlowFsmKey, String commandFlowIdToFail) {
    handleSpeakerRequests(request -> {
        SpeakerResponse commandResponse;
        if (request instanceof FlowSegmentRequest) {
            FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) request;
            if (flowSegmentRequest.isVerifyRequest() && flowSegmentRequest.getMetadata().getFlowId().equals(commandFlowIdToFail)) {
                handleTimeout(yFlowCreateService, yFlowFsmKey);
            }
            commandResponse = buildSuccessfulSpeakerResponse(flowSegmentRequest);
        } else {
            BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) request;
            commandResponse = buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
        }
        yFlowCreateService.handleAsyncResponse(yFlowFsmKey, commandResponse);
    });
}
Also used : FlowSegmentRequest(org.openkilda.floodlight.api.request.FlowSegmentRequest) SpeakerResponse(org.openkilda.floodlight.api.response.SpeakerResponse) BaseSpeakerCommandsRequest(org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest)

Example 13 with SpeakerResponse

use of org.openkilda.floodlight.api.response.SpeakerResponse in project open-kilda by telstra.

the class YFlowCreateServiceTest method processRequestAndSpeakerCommands.

private void processRequestAndSpeakerCommands(YFlowRequest yFlowRequest) throws DuplicateKeyException {
    YFlowCreateService service = makeYFlowCreateService(0);
    service.handleRequest(yFlowRequest.getYFlowId(), new CommandContext(), yFlowRequest);
    verifyYFlowAndSubFlowStatus(yFlowRequest.getYFlowId(), FlowStatus.IN_PROGRESS);
    handleSpeakerRequests(speakerRequest -> {
        SpeakerResponse commandResponse;
        if (speakerRequest instanceof FlowSegmentRequest) {
            FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) speakerRequest;
            commandResponse = buildSuccessfulSpeakerResponse(flowSegmentRequest);
        } else {
            BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) speakerRequest;
            commandResponse = buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
        }
        handleAsyncResponse(service, yFlowRequest.getYFlowId(), commandResponse);
    });
}
Also used : CommandContext(org.openkilda.wfm.CommandContext) FlowSegmentRequest(org.openkilda.floodlight.api.request.FlowSegmentRequest) SpeakerResponse(org.openkilda.floodlight.api.response.SpeakerResponse) BaseSpeakerCommandsRequest(org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest)

Example 14 with SpeakerResponse

use of org.openkilda.floodlight.api.response.SpeakerResponse in project open-kilda by telstra.

the class YFlowCreateServiceTest method handleSpeakerCommandsAndFailInstall.

private void handleSpeakerCommandsAndFailInstall(YFlowCreateService yFlowCreateService, String yFlowFsmKey, String commandFlowIdToFail) {
    handleSpeakerRequests(request -> {
        SpeakerResponse commandResponse;
        if (request instanceof FlowSegmentRequest) {
            FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) request;
            commandResponse = flowSegmentRequest.isInstallRequest() && flowSegmentRequest.getMetadata().getFlowId().equals(commandFlowIdToFail) ? buildErrorSpeakerResponse(flowSegmentRequest) : buildSuccessfulSpeakerResponse(flowSegmentRequest);
        } else {
            BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) request;
            commandResponse = request instanceof InstallSpeakerCommandsRequest ? buildErrorYFlowSpeakerResponse(speakerCommandsRequest) : buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
        }
        handleAsyncResponse(yFlowCreateService, yFlowFsmKey, commandResponse);
    });
}
Also used : FlowSegmentRequest(org.openkilda.floodlight.api.request.FlowSegmentRequest) InstallSpeakerCommandsRequest(org.openkilda.floodlight.api.request.rulemanager.InstallSpeakerCommandsRequest) SpeakerResponse(org.openkilda.floodlight.api.response.SpeakerResponse) BaseSpeakerCommandsRequest(org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest)

Example 15 with SpeakerResponse

use of org.openkilda.floodlight.api.response.SpeakerResponse in project open-kilda by telstra.

the class YFlowUpdateServiceTest method processUpdateRequestAndSpeakerCommands.

private void processUpdateRequestAndSpeakerCommands(YFlowPartialUpdateRequest request) throws DuplicateKeyException {
    YFlowUpdateService service = makeYFlowUpdateService(0);
    service.handlePartialUpdateRequest(request.getYFlowId(), new CommandContext(), request);
    verifyYFlowStatus(request.getYFlowId(), FlowStatus.IN_PROGRESS);
    handleSpeakerRequests(speakerRequest -> {
        SpeakerResponse commandResponse;
        if (speakerRequest instanceof FlowSegmentRequest) {
            FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) speakerRequest;
            commandResponse = buildSuccessfulSpeakerResponse(flowSegmentRequest);
        } else {
            BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) speakerRequest;
            commandResponse = buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
        }
        handleAsyncResponse(service, request.getYFlowId(), commandResponse);
    });
}
Also used : CommandContext(org.openkilda.wfm.CommandContext) FlowSegmentRequest(org.openkilda.floodlight.api.request.FlowSegmentRequest) SpeakerResponse(org.openkilda.floodlight.api.response.SpeakerResponse) BaseSpeakerCommandsRequest(org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest)

Aggregations

SpeakerResponse (org.openkilda.floodlight.api.response.SpeakerResponse)33 FlowSegmentRequest (org.openkilda.floodlight.api.request.FlowSegmentRequest)21 BaseSpeakerCommandsRequest (org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest)21 CommandContext (org.openkilda.wfm.CommandContext)9 InstallSpeakerCommandsRequest (org.openkilda.floodlight.api.request.rulemanager.InstallSpeakerCommandsRequest)6 UnknownKeyException (org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException)6 UUID (java.util.UUID)4 FlowSegmentRequestFactory (org.openkilda.floodlight.api.request.factory.FlowSegmentRequestFactory)4 FlowErrorResponse (org.openkilda.floodlight.flow.response.FlowErrorResponse)3 String.format (java.lang.String.format)2 Set (java.util.Set)2 Slf4j (lombok.extern.slf4j.Slf4j)2 DeleteSpeakerCommandsRequest (org.openkilda.floodlight.api.request.rulemanager.DeleteSpeakerCommandsRequest)2 SpeakerFlowSegmentResponse (org.openkilda.floodlight.api.response.SpeakerFlowSegmentResponse)2 SpeakerCommandResponse (org.openkilda.floodlight.api.response.rulemanager.SpeakerCommandResponse)2 SpeakerRequestError (org.openkilda.messaging.info.reroute.error.SpeakerRequestError)2 SwitchId (org.openkilda.model.SwitchId)2 FlowPathSwapContext (org.openkilda.wfm.topology.flowhs.fsm.pathswap.FlowPathSwapContext)2 FlowPathSwapFsm (org.openkilda.wfm.topology.flowhs.fsm.pathswap.FlowPathSwapFsm)2 Event (org.openkilda.wfm.topology.flowhs.fsm.pathswap.FlowPathSwapFsm.Event)2