Search in sources :

Example 41 with UnknownKeyException

use of org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException in project open-kilda by telstra.

the class FlowCreateService 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);
    FlowCreateFsm fsm = fsmRegister.getFsmByKey(key).orElseThrow(() -> new UnknownKeyException(key));
    FlowCreateContext context = FlowCreateContext.builder().speakerFlowResponse(flowResponse).build();
    fsmExecutor.fire(fsm, Event.RESPONSE_RECEIVED, context);
    removeIfFinished(fsm, key);
}
Also used : FlowCreateContext(org.openkilda.wfm.topology.flowhs.fsm.create.FlowCreateContext) FlowCreateFsm(org.openkilda.wfm.topology.flowhs.fsm.create.FlowCreateFsm) UnknownKeyException(org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException)

Example 42 with UnknownKeyException

use of org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException in project open-kilda by telstra.

the class FlowValidationHubService 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);
}
Also used : UnknownKeyException(org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException)

Example 43 with UnknownKeyException

use of org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException in project open-kilda by telstra.

the class FlowUpdateHubBolt method onWorkerResponse.

@Override
protected void onWorkerResponse(Tuple input) {
    String operationKey = input.getStringByField(MessageKafkaTranslator.FIELD_ID_KEY);
    currentKey = KeyProvider.getParentKey(operationKey);
    SpeakerFlowSegmentResponse flowResponse = (SpeakerFlowSegmentResponse) input.getValueByField(FIELD_ID_PAYLOAD);
    try {
        service.handleAsyncResponse(currentKey, flowResponse);
    } catch (UnknownKeyException e) {
        log.warn("Received a response with unknown key {}.", currentKey);
    }
}
Also used : SpeakerFlowSegmentResponse(org.openkilda.floodlight.api.response.SpeakerFlowSegmentResponse) UnknownKeyException(org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException)

Example 44 with UnknownKeyException

use of org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException in project open-kilda by telstra.

the class FlowValidationHubBolt method onWorkerResponse.

@Override
protected void onWorkerResponse(Tuple input) throws PipelineException {
    String operationKey = pullKey(input);
    currentKey = KeyProvider.getParentKey(operationKey);
    MessageData messageData = pullValue(input, FIELD_ID_PAYLOAD, MessageData.class);
    try {
        service.handleAsyncResponse(currentKey, messageData);
    } catch (UnknownKeyException e) {
        log.warn("Received a response with unknown key {}.", currentKey);
    }
}
Also used : MessageData(org.openkilda.messaging.MessageData) UnknownKeyException(org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException)

Example 45 with UnknownKeyException

use of org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException in project open-kilda by telstra.

the class YFlowUpdateHubBolt method onWorkerResponse.

@Override
protected void onWorkerResponse(Tuple input) throws PipelineException {
    String operationKey = pullKey(input);
    currentKey = KeyProvider.getParentKey(operationKey);
    SpeakerResponse speakerResponse = pullValue(input, FIELD_ID_PAYLOAD, SpeakerResponse.class);
    try {
        yflowUpdateService.handleAsyncResponse(currentKey, speakerResponse);
    } catch (UnknownKeyException e) {
        log.error("Received a response with unknown key {}.", currentKey);
    }
}
Also used : SpeakerResponse(org.openkilda.floodlight.api.response.SpeakerResponse) UnknownKeyException(org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException)

Aggregations

UnknownKeyException (org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException)49 FlowSegmentRequest (org.openkilda.floodlight.api.request.FlowSegmentRequest)9 SpeakerFlowSegmentResponse (org.openkilda.floodlight.api.response.SpeakerFlowSegmentResponse)9 Flow (org.openkilda.model.Flow)7 SpeakerResponse (org.openkilda.floodlight.api.response.SpeakerResponse)6 Test (org.junit.Test)5 FlowErrorResponse (org.openkilda.floodlight.flow.response.FlowErrorResponse)5 SpeakerCommandResponse (org.openkilda.floodlight.api.response.rulemanager.SpeakerCommandResponse)4 FlowRequest (org.openkilda.messaging.command.flow.FlowRequest)4 FlowEndpoint (org.openkilda.model.FlowEndpoint)4 CommandContext (org.openkilda.wfm.CommandContext)4 ErrorData (org.openkilda.messaging.error.ErrorData)3 HashMap (java.util.HashMap)2 Set (java.util.Set)2 UUID (java.util.UUID)2 Matchers.equalTo (org.hamcrest.Matchers.equalTo)2 Matchers.hasProperty (org.hamcrest.Matchers.hasProperty)2 Assert (org.junit.Assert)2 Assert.assertEquals (org.junit.Assert.assertEquals)2 Assert.assertFalse (org.junit.Assert.assertFalse)2