use of org.openkilda.floodlight.api.response.SpeakerDataResponse in project open-kilda by telstra.
the class ControllerToSpeakerSharedProxyBolt method handleRegionNotFoundError.
private void handleRegionNotFoundError(CommandMessage commandMessage, SwitchId switchId) {
String errorDetails = String.format("Switch %s not found", switchId.toString());
ErrorData errorData = new ErrorData(ErrorType.NOT_FOUND, errorDetails, errorDetails);
ErrorMessage errorMessage = new ErrorMessage(errorData, System.currentTimeMillis(), commandMessage.getCorrelationId(), null);
Tuple input = getCurrentTuple();
if (commandMessage.getData() instanceof DumpRulesForFlowHsRequest || commandMessage.getData() instanceof DumpMetersForFlowHsRequest) {
MessageContext messageContext = new MessageContext(commandMessage);
SpeakerDataResponse result = new SpeakerDataResponse(messageContext, errorData);
// FIXME(surabujin): there is no subscriber on this stream now
getOutput().emit(Stream.FLOWHS_WORKER, input, makeFlowHsWorkerTuple(commandMessage.getCorrelationId(), result));
} else if (commandMessage.getData() instanceof DumpRulesForSwitchManagerRequest || commandMessage.getData() instanceof DumpMetersForSwitchManagerRequest || commandMessage.getData() instanceof InstallFlowForSwitchManagerRequest || commandMessage.getData() instanceof RemoveFlowForSwitchManagerRequest || commandMessage.getData() instanceof ReinstallDefaultFlowForSwitchManagerRequest) {
getOutput().emit(Stream.KILDA_SWITCH_MANAGER, input, makeSwitchManagerTuple(commandMessage.getCorrelationId(), errorMessage));
} else if (commandMessage.getData() instanceof DumpSwitchPortsDescriptionRequest || commandMessage.getData() instanceof DumpPortDescriptionRequest || commandMessage.getData() instanceof DumpRulesRequest || commandMessage.getData() instanceof DumpMetersRequest || commandMessage.getData() instanceof DeleteMeterRequest || commandMessage.getData() instanceof PortConfigurationRequest) {
getOutput().emit(Stream.NORTHBOUND_REPLY, input, makeNorthboundTuple(commandMessage.getCorrelationId(), errorMessage));
} else {
log.error("Unable to lookup region for message: {}. switch is not tracked.", commandMessage);
}
}
use of org.openkilda.floodlight.api.response.SpeakerDataResponse in project open-kilda by telstra.
the class SpeakerWorkerForDumpsBolt method onAsyncResponse.
@Override
protected void onAsyncResponse(Tuple requestTuple, Tuple responseTuple) throws Exception {
String key = pullKey();
Object payload = responseTuple.getValueByField(FIELD_ID_PAYLOAD);
if (payload instanceof SpeakerDataResponse) {
SpeakerDataResponse dataResponse = (SpeakerDataResponse) payload;
emitResponseToHub(getCurrentTuple(), new Values(key, dataResponse.getData(), getCommandContext()));
} else {
log.debug("Unknown response received: {}", payload);
}
}
Aggregations