use of org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException in project open-kilda by telstra.
the class FlowDeleteService method handleAsyncResponseByFlowId.
/**
* Handles async response from worker.
* Used if the command identifier is unknown, so FSM is identified by the flow Id.
*/
public void handleAsyncResponseByFlowId(@NonNull String flowId, @NonNull SpeakerFlowSegmentResponse flowResponse) throws UnknownKeyException {
String commandKey = fsmRegister.getKeyByFlowId(flowId).orElseThrow(() -> new UnknownKeyException(flowId));
handleAsyncResponse(commandKey, flowResponse);
}
use of org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException in project open-kilda by telstra.
the class FlowDeleteService method handleTimeoutByFlowId.
/**
* Handles timeout case.
* Used if the command identifier is unknown, so FSM is identified by the flow Id.
*/
public void handleTimeoutByFlowId(@NonNull String flowId) throws UnknownKeyException {
String commandKey = fsmRegister.getKeyByFlowId(flowId).orElseThrow(() -> new UnknownKeyException(flowId));
handleTimeout(commandKey);
}
use of org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException in project open-kilda by telstra.
the class FlowValidationHubService method handleAsyncResponseByFlowId.
/**
* Handles async response from worker.
* Used if the command identifier is unknown, so FSM is identified by the flow Id.
*/
public void handleAsyncResponseByFlowId(@NonNull String flowId, @NonNull MessageData data) throws UnknownKeyException {
String commandKey = fsmRegister.getKeyByFlowId(flowId).orElseThrow(() -> new UnknownKeyException(flowId));
handleAsyncResponse(commandKey, data);
}
use of org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException in project open-kilda by telstra.
the class FlowValidationHubService method handleTimeout.
/**
* Handles timeout case.
*
* @param key command identifier.
*/
public void handleTimeout(@NonNull String key) throws UnknownKeyException {
log.debug("Handling timeout for {}", key);
FlowValidationFsm fsm = fsmRegister.getFsmByKey(key).orElseThrow(() -> new UnknownKeyException(key));
ErrorData errorData = new ErrorData(ErrorType.OPERATION_TIMED_OUT, "Flow validation failed by timeout", "Error in FlowValidationHubService");
fsmExecutor.fire(fsm, Event.ERROR, errorData);
removeIfFinished(fsm, key);
}
use of org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException in project open-kilda by telstra.
the class FlowValidationHubService method handleAsyncResponse.
/**
* Handles async response from worker.
*
* @param key command identifier.
*/
public void handleAsyncResponse(@NonNull String key, @NonNull MessageData data) throws UnknownKeyException {
log.debug("Received command response {}", data);
FlowValidationFsm fsm = fsmRegister.getFsmByKey(key).orElseThrow(() -> new UnknownKeyException(key));
if (data instanceof SwitchFlowEntries) {
fsmExecutor.fire(fsm, Event.RULES_RECEIVED, data);
} else if (data instanceof SwitchMeterEntries) {
fsmExecutor.fire(fsm, Event.METERS_RECEIVED, data);
} else if (data instanceof SwitchMeterUnsupported) {
SwitchMeterUnsupported meterUnsupported = (SwitchMeterUnsupported) data;
log.info("Key: {}; Meters unsupported for switch '{};", key, meterUnsupported.getSwitchId());
fsmExecutor.fire(fsm, Event.METERS_RECEIVED, SwitchMeterEntries.builder().switchId(meterUnsupported.getSwitchId()).meterEntries(Collections.emptyList()).build());
} else if (data instanceof SwitchGroupEntries) {
fsmExecutor.fire(fsm, Event.GROUPS_RECEIVED, data);
} else if (data instanceof ErrorData) {
fsmExecutor.fire(fsm, Event.ERROR, data);
} else {
log.warn("Key: {}; Unhandled message {}", key, data);
}
removeIfFinished(fsm, key);
}
Aggregations