Search in sources :

Example 11 with DeleteSpeakerCommandsRequest

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

the class YFlowDeleteServiceTest method handleSpeakerCommandsAndFailRemove.

private void handleSpeakerCommandsAndFailRemove(YFlowDeleteService yFlowDeleteService, String yFlowFsmKey, String commandFlowIdToFail) {
    handleSpeakerRequests(request -> {
        SpeakerResponse commandResponse;
        if (request instanceof FlowSegmentRequest) {
            FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) request;
            commandResponse = flowSegmentRequest.isRemoveRequest() && flowSegmentRequest.getMetadata().getFlowId().equals(commandFlowIdToFail) ? buildErrorSpeakerResponse(flowSegmentRequest) : buildSuccessfulSpeakerResponse(flowSegmentRequest);
        } else {
            BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) request;
            commandResponse = request instanceof DeleteSpeakerCommandsRequest ? buildErrorYFlowSpeakerResponse(speakerCommandsRequest) : buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
        }
        handleAsyncResponse(yFlowDeleteService, 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) DeleteSpeakerCommandsRequest(org.openkilda.floodlight.api.request.rulemanager.DeleteSpeakerCommandsRequest)

Example 12 with DeleteSpeakerCommandsRequest

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

the class UpdateYFlowRulesAction method buildYFlowDeleteRequest.

protected DeleteSpeakerCommandsRequest buildYFlowDeleteRequest(SwitchId switchId, PathId pathId, CommandContext context) {
    List<OfCommand> ofCommands = buildYFlowOfCommands(switchId, pathId);
    UUID commandId = commandIdGenerator.generate();
    MessageContext messageContext = new MessageContext(commandId.toString(), context.getCorrelationId());
    return new DeleteSpeakerCommandsRequest(messageContext, switchId, commandId, ofCommands);
}
Also used : OfCommand(org.openkilda.floodlight.api.request.rulemanager.OfCommand) MessageContext(org.openkilda.messaging.MessageContext) UUID(java.util.UUID) DeleteSpeakerCommandsRequest(org.openkilda.floodlight.api.request.rulemanager.DeleteSpeakerCommandsRequest)

Aggregations

DeleteSpeakerCommandsRequest (org.openkilda.floodlight.api.request.rulemanager.DeleteSpeakerCommandsRequest)12 UUID (java.util.UUID)5 OfCommand (org.openkilda.floodlight.api.request.rulemanager.OfCommand)5 YFlow (org.openkilda.model.YFlow)5 String.format (java.lang.String.format)4 List (java.util.List)4 Optional (java.util.Optional)4 Set (java.util.Set)4 Collectors (java.util.stream.Collectors)4 Slf4j (lombok.extern.slf4j.Slf4j)4 FlowCommand (org.openkilda.floodlight.api.request.rulemanager.FlowCommand)4 GroupCommand (org.openkilda.floodlight.api.request.rulemanager.GroupCommand)4 MeterCommand (org.openkilda.floodlight.api.request.rulemanager.MeterCommand)4 SpeakerCommandResponse (org.openkilda.floodlight.api.response.rulemanager.SpeakerCommandResponse)4 HistoryRecordingAction (org.openkilda.wfm.topology.flowhs.fsm.common.actions.HistoryRecordingAction)4 FlowSegmentRequest (org.openkilda.floodlight.api.request.FlowSegmentRequest)2 BaseSpeakerCommandsRequest (org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest)2 InstallSpeakerCommandsRequest (org.openkilda.floodlight.api.request.rulemanager.InstallSpeakerCommandsRequest)2 SpeakerResponse (org.openkilda.floodlight.api.response.SpeakerResponse)2 Flow (org.openkilda.model.Flow)2