Search in sources :

Example 16 with SpeakerResponse

use of org.openkilda.floodlight.api.response.SpeakerResponse in project open-kilda by telstra.

the class YFlowDeleteHubBolt 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 {
        yFlowDeleteService.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)

Example 17 with SpeakerResponse

use of org.openkilda.floodlight.api.response.SpeakerResponse in project open-kilda by telstra.

the class SpeakerWorkerBolt method onAsyncResponse.

@Override
protected void onAsyncResponse(Tuple request, Tuple response) throws PipelineException {
    Object payload = response.getValueByField(FIELD_ID_PAYLOAD);
    if (payload instanceof SpeakerResponse) {
        SpeakerResponse message = (SpeakerResponse) payload;
        service.handleResponse(pullKey(response), message);
    } else {
        log.debug("Unknown response received: {}", payload);
    }
}
Also used : SpeakerResponse(org.openkilda.floodlight.api.response.SpeakerResponse)

Example 18 with SpeakerResponse

use of org.openkilda.floodlight.api.response.SpeakerResponse 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)

Example 19 with SpeakerResponse

use of org.openkilda.floodlight.api.response.SpeakerResponse in project open-kilda by telstra.

the class FlowPathSwapHubBolt method onWorkerResponse.

@Override
protected void onWorkerResponse(Tuple input) {
    String operationKey = input.getStringByField(MessageKafkaTranslator.FIELD_ID_KEY);
    currentKey = KeyProvider.getParentKey(operationKey);
    SpeakerResponse flowResponse = (SpeakerResponse) input.getValueByField(FIELD_ID_PAYLOAD);
    service.handleAsyncResponse(currentKey, flowResponse);
}
Also used : SpeakerResponse(org.openkilda.floodlight.api.response.SpeakerResponse)

Example 20 with SpeakerResponse

use of org.openkilda.floodlight.api.response.SpeakerResponse in project open-kilda by telstra.

the class YFlowRerouteServiceTest method handleSpeakerCommandsAndTimeoutInstall.

private void handleSpeakerCommandsAndTimeoutInstall(YFlowRerouteService service, String yFlowFsmKey) {
    handleSpeakerRequests(request -> {
        SpeakerResponse commandResponse;
        if (request instanceof FlowSegmentRequest) {
            FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) request;
            commandResponse = buildSuccessfulSpeakerResponse(flowSegmentRequest);
            handleAsyncResponse(service, yFlowFsmKey, commandResponse);
        } else {
            BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) request;
            if (speakerCommandsRequest instanceof InstallSpeakerCommandsRequest) {
                try {
                    service.handleTimeout(yFlowFsmKey);
                } catch (UnknownKeyException ex) {
                // skip
                }
            } else {
                commandResponse = buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
                handleAsyncResponse(service, yFlowFsmKey, commandResponse);
            }
        }
    });
}
Also used : FlowSegmentRequest(org.openkilda.floodlight.api.request.FlowSegmentRequest) InstallSpeakerCommandsRequest(org.openkilda.floodlight.api.request.rulemanager.InstallSpeakerCommandsRequest) SpeakerResponse(org.openkilda.floodlight.api.response.SpeakerResponse) BaseSpeakerCommandsRequest(org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest) UnknownKeyException(org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException)

Aggregations

SpeakerResponse (org.openkilda.floodlight.api.response.SpeakerResponse)33 FlowSegmentRequest (org.openkilda.floodlight.api.request.FlowSegmentRequest)21 BaseSpeakerCommandsRequest (org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest)21 CommandContext (org.openkilda.wfm.CommandContext)9 InstallSpeakerCommandsRequest (org.openkilda.floodlight.api.request.rulemanager.InstallSpeakerCommandsRequest)6 UnknownKeyException (org.openkilda.wfm.topology.flowhs.exception.UnknownKeyException)6 UUID (java.util.UUID)4 FlowSegmentRequestFactory (org.openkilda.floodlight.api.request.factory.FlowSegmentRequestFactory)4 FlowErrorResponse (org.openkilda.floodlight.flow.response.FlowErrorResponse)3 String.format (java.lang.String.format)2 Set (java.util.Set)2 Slf4j (lombok.extern.slf4j.Slf4j)2 DeleteSpeakerCommandsRequest (org.openkilda.floodlight.api.request.rulemanager.DeleteSpeakerCommandsRequest)2 SpeakerFlowSegmentResponse (org.openkilda.floodlight.api.response.SpeakerFlowSegmentResponse)2 SpeakerCommandResponse (org.openkilda.floodlight.api.response.rulemanager.SpeakerCommandResponse)2 SpeakerRequestError (org.openkilda.messaging.info.reroute.error.SpeakerRequestError)2 SwitchId (org.openkilda.model.SwitchId)2 FlowPathSwapContext (org.openkilda.wfm.topology.flowhs.fsm.pathswap.FlowPathSwapContext)2 FlowPathSwapFsm (org.openkilda.wfm.topology.flowhs.fsm.pathswap.FlowPathSwapFsm)2 Event (org.openkilda.wfm.topology.flowhs.fsm.pathswap.FlowPathSwapFsm.Event)2