Search in sources :

Example 1 with FlowDeleteContext

use of org.openkilda.wfm.topology.flowhs.fsm.delete.FlowDeleteContext in project open-kilda by telstra.

the class FlowDeleteService method handleAsyncResponse.

/**
 * Handles async response from worker.
 *
 * @param key command identifier.
 */
public void handleAsyncResponse(@NonNull String key, @NonNull SpeakerFlowSegmentResponse flowResponse) throws UnknownKeyException {
    log.debug("Received flow command response {}", flowResponse);
    FlowDeleteFsm fsm = fsmRegister.getFsmByKey(key).orElseThrow(() -> new UnknownKeyException(key));
    FlowDeleteContext context = FlowDeleteContext.builder().speakerFlowResponse(flowResponse).build();
    if (flowResponse instanceof FlowErrorResponse) {
        fsmExecutor.fire(fsm, Event.ERROR_RECEIVED, context);
    } else {
        fsmExecutor.fire(fsm, Event.RESPONSE_RECEIVED, context);
    }
    removeIfFinished(fsm, key);
}
Also used : FlowErrorResponse(org.openkilda.floodlight.flow.response.FlowErrorResponse) FlowDeleteFsm(org.openkilda.wfm.topology.flowhs.fsm.delete.FlowDeleteFsm) UnknownKeyException(org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException) FlowDeleteContext(org.openkilda.wfm.topology.flowhs.fsm.delete.FlowDeleteContext)

Aggregations

FlowErrorResponse (org.openkilda.floodlight.flow.response.FlowErrorResponse)1 UnknownKeyException (org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException)1 FlowDeleteContext (org.openkilda.wfm.topology.flowhs.fsm.delete.FlowDeleteContext)1 FlowDeleteFsm (org.openkilda.wfm.topology.flowhs.fsm.delete.FlowDeleteFsm)1