Search in sources :

Example 56 with FlowSegmentRequest

use of org.openkilda.floodlight.api.request.FlowSegmentRequest in project open-kilda by telstra.

the class YFlowDeleteServiceTest method processRequestAndSpeakerCommands.

private void processRequestAndSpeakerCommands(String yFlowId) throws DuplicateKeyException {
    YFlowDeleteRequest yFlowRequest = new YFlowDeleteRequest(yFlowId);
    YFlowDeleteService service = makeYFlowDeleteService(0);
    service.handleRequest(yFlowRequest.getYFlowId(), new CommandContext(), yFlowRequest);
    verifyYFlowStatus(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 : YFlowDeleteRequest(org.openkilda.messaging.command.yflow.YFlowDeleteRequest) 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 57 with FlowSegmentRequest

use of org.openkilda.floodlight.api.request.FlowSegmentRequest in project open-kilda by telstra.

the class YFlowCreateServiceTest method handleSpeakerCommandsAndTimeoutInstall.

private void handleSpeakerCommandsAndTimeoutInstall(YFlowCreateService yFlowCreateService, String yFlowFsmKey) {
    handleSpeakerRequests(request -> {
        SpeakerResponse commandResponse;
        if (request instanceof FlowSegmentRequest) {
            FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) request;
            commandResponse = buildSuccessfulSpeakerResponse(flowSegmentRequest);
        } else {
            BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) request;
            if (speakerCommandsRequest instanceof InstallSpeakerCommandsRequest) {
                handleTimeout(yFlowCreateService, yFlowFsmKey);
            }
            commandResponse = buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
        }
        yFlowCreateService.handleAsyncResponse(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 58 with FlowSegmentRequest

use of org.openkilda.floodlight.api.request.FlowSegmentRequest in project open-kilda by telstra.

the class YFlowUpdateServiceTest method processUpdateRequestAndSpeakerCommands.

private void processUpdateRequestAndSpeakerCommands(YFlowRequest yFlowRequest) throws DuplicateKeyException {
    YFlowUpdateService service = makeYFlowUpdateService(0);
    service.handleRequest(yFlowRequest.getYFlowId(), new CommandContext(), yFlowRequest);
    verifyYFlowStatus(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 59 with FlowSegmentRequest

use of org.openkilda.floodlight.api.request.FlowSegmentRequest in project open-kilda by telstra.

the class YFlowUpdateServiceTest method processUpdateRequestAndSpeakerCommands.

private void processUpdateRequestAndSpeakerCommands(YFlowRequest request, FlowStatus expectedStatus, FlowStatus expectedFirstSubFlowStatus, FlowStatus expectedSecondSubFlowStatus) throws DuplicateKeyException {
    FlowUpdateService flowUpdateService = makeFlowUpdateService(0);
    YFlowUpdateService service = makeYFlowUpdateService(flowUpdateService, 0);
    service.handleRequest(request.getYFlowId(), new CommandContext(), request);
    verifyYFlowStatus(request.getYFlowId(), expectedStatus, expectedFirstSubFlowStatus, expectedSecondSubFlowStatus);
    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) FlowUpdateService(org.openkilda.wfm.topology.flowhs.service.FlowUpdateService)

Example 60 with FlowSegmentRequest

use of org.openkilda.floodlight.api.request.FlowSegmentRequest in project open-kilda by telstra.

the class FlowRerouteServiceTest method shouldIgnoreEffectivelyDownStateIfSamePaths.

@Test
public void shouldIgnoreEffectivelyDownStateIfSamePaths() throws RecoverableException, UnroutableFlowException, UnknownKeyException {
    Flow origin = makeFlow();
    preparePathComputation(origin.getFlowId(), make2SwitchesPathPair());
    FlowRerouteService service = makeService();
    FlowRerouteRequest request = new FlowRerouteRequest(origin.getFlowId(), false, true, false, Collections.emptySet(), null, false);
    service.handleRequest(currentRequestKey, request, commandContext);
    FlowSegmentRequest speakerRequest;
    while ((speakerRequest = requests.poll()) != null) {
        produceAsyncResponse(service, speakerRequest);
    }
    Flow result = verifyFlowStatus(origin.getFlowId(), FlowStatus.UP);
    verifyNoPathReplace(origin, result);
}
Also used : FlowSegmentRequest(org.openkilda.floodlight.api.request.FlowSegmentRequest) FlowRerouteRequest(org.openkilda.messaging.command.flow.FlowRerouteRequest) Flow(org.openkilda.model.Flow) Test(org.junit.Test)

Aggregations

FlowSegmentRequest (org.openkilda.floodlight.api.request.FlowSegmentRequest)65 Flow (org.openkilda.model.Flow)38 Test (org.junit.Test)31 BaseSpeakerCommandsRequest (org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest)23 SpeakerResponse (org.openkilda.floodlight.api.response.SpeakerResponse)21 CommandContext (org.openkilda.wfm.CommandContext)15 FlowRerouteRequest (org.openkilda.messaging.command.flow.FlowRerouteRequest)14 FlowRequest (org.openkilda.messaging.command.flow.FlowRequest)12 UUID (java.util.UUID)10 FlowSegmentRequestFactory (org.openkilda.floodlight.api.request.factory.FlowSegmentRequestFactory)9 UnknownKeyException (org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException)9 InstallSpeakerCommandsRequest (org.openkilda.floodlight.api.request.rulemanager.InstallSpeakerCommandsRequest)6 FlowPath (org.openkilda.model.FlowPath)6 GetPathsResult (org.openkilda.pce.GetPathsResult)6 FlowPathRepository (org.openkilda.persistence.repositories.FlowPathRepository)6 ArrayList (java.util.ArrayList)5 Ignore (org.junit.Ignore)4 SpeakerRequest (org.openkilda.floodlight.api.request.SpeakerRequest)4 FlowEndpoint (org.openkilda.model.FlowEndpoint)4 FlowPathSwapRequest (org.openkilda.messaging.command.flow.FlowPathSwapRequest)3