Search in sources :

Example 6 with YFlowDeleteRequest

use of org.openkilda.messaging.command.yflow.YFlowDeleteRequest 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 7 with YFlowDeleteRequest

use of org.openkilda.messaging.command.yflow.YFlowDeleteRequest in project open-kilda by telstra.

the class YFlowDeleteHubBolt method onRequest.

@Override
protected void onRequest(Tuple input) throws PipelineException {
    currentKey = pullKey(input);
    YFlowDeleteRequest payload = pullValue(input, FIELD_ID_PAYLOAD, YFlowDeleteRequest.class);
    try {
        yFlowDeleteService.handleRequest(currentKey, getCommandContext(), payload);
    } catch (DuplicateKeyException e) {
        log.error("Failed to handle a request with key {}. {}", currentKey, e.getMessage());
    }
}
Also used : YFlowDeleteRequest(org.openkilda.messaging.command.yflow.YFlowDeleteRequest) DuplicateKeyException(org.openkilda.wfm.topology.flowhs.exception.DuplicateKeyException)

Aggregations

YFlowDeleteRequest (org.openkilda.messaging.command.yflow.YFlowDeleteRequest)7 CommandContext (org.openkilda.wfm.CommandContext)4 Test (org.junit.Test)3 AbstractYFlowTest (org.openkilda.wfm.topology.flowhs.service.AbstractYFlowTest)3 CommandMessage (org.openkilda.messaging.command.CommandMessage)2 Values (org.apache.storm.tuple.Values)1 FlowSegmentRequest (org.openkilda.floodlight.api.request.FlowSegmentRequest)1 BaseSpeakerCommandsRequest (org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest)1 SpeakerResponse (org.openkilda.floodlight.api.response.SpeakerResponse)1 MessageData (org.openkilda.messaging.MessageData)1 CreateFlowLoopRequest (org.openkilda.messaging.command.flow.CreateFlowLoopRequest)1 DeleteFlowLoopRequest (org.openkilda.messaging.command.flow.DeleteFlowLoopRequest)1 FlowDeleteRequest (org.openkilda.messaging.command.flow.FlowDeleteRequest)1 FlowMirrorPointCreateRequest (org.openkilda.messaging.command.flow.FlowMirrorPointCreateRequest)1 FlowMirrorPointDeleteRequest (org.openkilda.messaging.command.flow.FlowMirrorPointDeleteRequest)1 FlowPathSwapRequest (org.openkilda.messaging.command.flow.FlowPathSwapRequest)1 FlowRequest (org.openkilda.messaging.command.flow.FlowRequest)1 FlowRerouteRequest (org.openkilda.messaging.command.flow.FlowRerouteRequest)1 FlowValidationRequest (org.openkilda.messaging.command.flow.FlowValidationRequest)1 SwapFlowEndpointRequest (org.openkilda.messaging.command.flow.SwapFlowEndpointRequest)1