Search in sources :

Example 6 with YFlowUpdateFsm

use of org.openkilda.wfm.topology.flowhs.fsm.yflow.update.YFlowUpdateFsm in project open-kilda by telstra.

the class YFlowUpdateService method handleTimeout.

/**
 * Handles timeout case.
 *
 * @param key command identifier.
 */
public void handleTimeout(@NonNull String key) throws UnknownKeyException {
    log.debug("Handling timeout for {}", key);
    YFlowUpdateFsm fsm = fsmRegister.getFsmByKey(key).orElseThrow(() -> new UnknownKeyException(key));
    // Propagate timeout event to all sub-flow processing FSMs.
    fsm.getUpdatingSubFlows().forEach(flowId -> {
        try {
            flowUpdateService.handleTimeoutByFlowId(flowId);
        } catch (UnknownKeyException e) {
            log.error("Failed to handle a timeout event by FlowUpdateService for {}.", flowId);
        }
    });
    fsmExecutor.fire(fsm, Event.TIMEOUT);
    removeIfFinished(fsm, key);
}
Also used : YFlowUpdateFsm(org.openkilda.wfm.topology.flowhs.fsm.yflow.update.YFlowUpdateFsm) UnknownKeyException(org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException)

Aggregations

YFlowUpdateFsm (org.openkilda.wfm.topology.flowhs.fsm.yflow.update.YFlowUpdateFsm)6 YFlowUpdateContext (org.openkilda.wfm.topology.flowhs.fsm.yflow.update.YFlowUpdateContext)5 Slf4j (lombok.extern.slf4j.Slf4j)3 SpeakerCommandResponse (org.openkilda.floodlight.api.response.rulemanager.SpeakerCommandResponse)3 HistoryRecordingAction (org.openkilda.wfm.topology.flowhs.fsm.common.actions.HistoryRecordingAction)3 Event (org.openkilda.wfm.topology.flowhs.fsm.yflow.update.YFlowUpdateFsm.Event)3 State (org.openkilda.wfm.topology.flowhs.fsm.yflow.update.YFlowUpdateFsm.State)3 String.format (java.lang.String.format)2 List (java.util.List)2 Optional (java.util.Optional)2 Set (java.util.Set)2 UUID (java.util.UUID)2 Collectors (java.util.stream.Collectors)2 FlowCommand (org.openkilda.floodlight.api.request.rulemanager.FlowCommand)2 GroupCommand (org.openkilda.floodlight.api.request.rulemanager.GroupCommand)2 MeterCommand (org.openkilda.floodlight.api.request.rulemanager.MeterCommand)2 OfCommand (org.openkilda.floodlight.api.request.rulemanager.OfCommand)2 UnknownKeyException (org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException)2 Collection (java.util.Collection)1 DeleteSpeakerCommandsRequest (org.openkilda.floodlight.api.request.rulemanager.DeleteSpeakerCommandsRequest)1