use of org.openkilda.messaging.command.CommandData in project open-kilda by telstra.
the class SpeakerWorkerService method handleTimeout.
/**
* Handles operation timeout.
* @param key operation identifier.
*/
public void handleTimeout(String key) throws PipelineException {
log.debug("Send timeout error to hub {}", key);
CommandData commandData = keyToRequest.remove(key);
ErrorData errorData = new ErrorData(ErrorType.OPERATION_TIMED_OUT, String.format("Timeout for waiting response %s", commandData.toString()), "Error in SpeakerWorkerService");
ErrorMessage errorMessage = new ErrorMessage(errorData, System.currentTimeMillis(), key);
carrier.sendResponse(key, errorMessage);
}
use of org.openkilda.messaging.command.CommandData in project open-kilda by telstra.
the class SpeakerWorkerService method handleResponse.
/**
* Processes received response and forwards it to the hub component.
* @param key operation's key.
* @param response response payload.
*/
public void handleResponse(String key, Message response) throws PipelineException {
log.debug("Got a response from speaker {}", response);
CommandData pendingRequest = keyToRequest.remove(key);
if (pendingRequest != null) {
carrier.sendResponse(key, response);
}
}
use of org.openkilda.messaging.command.CommandData in project open-kilda by telstra.
the class RecordHandler method handleCommand.
@VisibleForTesting
void handleCommand(CommandMessage message) {
logger.debug("Handling message: '{}'.", message);
CommandData data = message.getData();
if (data instanceof DiscoverIslCommandData) {
doDiscoverIslCommand((DiscoverIslCommandData) data, message.getCorrelationId());
} else if (data instanceof DiscoverPathCommandData) {
doDiscoverPathCommand(data);
} else if (data instanceof RemoveFlowForSwitchManagerRequest) {
doDeleteFlowForSwitchManager(message);
} else if (data instanceof ModifyFlowMeterForSwitchManagerRequest) {
doModifyFlowMeterForSwitchManager(message);
} else if (data instanceof ModifyDefaultMeterForSwitchManagerRequest) {
doModifyDefaultMeterForSwitchManager(message);
} else if (data instanceof ReinstallDefaultFlowForSwitchManagerRequest) {
doReinstallDefaultFlowForSwitchManager(message);
} else if (data instanceof NetworkCommandData) {
doNetworkDump((NetworkCommandData) data);
} else if (data instanceof SwitchRulesDeleteRequest) {
doDeleteSwitchRules(message);
} else if (data instanceof SwitchRulesInstallRequest) {
doInstallSwitchRules(message);
} else if (data instanceof DumpRulesForFlowHsRequest) {
doDumpRulesForFlowHsRequest(message);
} else if (data instanceof DumpRulesRequest) {
doDumpRulesRequest(message);
} else if (data instanceof DumpRulesForSwitchManagerRequest) {
doDumpRulesForSwitchManagerRequest(message);
} else if (data instanceof InstallFlowForSwitchManagerRequest) {
doInstallFlowForSwitchManager(message);
} else if (data instanceof DeleterMeterForSwitchManagerRequest) {
doDeleteMeter(message, context.getKafkaSwitchManagerTopic());
} else if (data instanceof DeleteMeterRequest) {
doDeleteMeter(message, context.getKafkaNorthboundTopic());
} else if (data instanceof PortConfigurationRequest) {
doConfigurePort(message);
} else if (data instanceof DumpSwitchPortsDescriptionRequest) {
doDumpSwitchPortsDescriptionRequest(message);
} else if (data instanceof DumpPortDescriptionRequest) {
doDumpPortDescriptionRequest(message);
} else if (data instanceof DumpMetersRequest) {
doDumpMetersRequest(message);
} else if (data instanceof DumpMetersForSwitchManagerRequest) {
doDumpMetersForSwitchManagerRequest(message);
} else if (data instanceof DumpMetersForFlowHsRequest) {
doDumpMetersForFlowHsRequest(message);
} else if (data instanceof MeterModifyCommandRequest) {
doModifyMeterRequest(message);
} else if (data instanceof AliveRequest) {
doAliveRequest(message);
} else if (data instanceof InstallIslDefaultRulesCommand) {
doInstallIslDefaultRule(message);
} else if (data instanceof RemoveIslDefaultRulesCommand) {
doRemoveIslDefaultRule(message);
} else if (data instanceof DumpGroupsForSwitchManagerRequest) {
doDumpGroupsForSwitchManagerRequest(message);
} else if (data instanceof DumpGroupsForFlowHsRequest) {
doDumpGroupsForFlowHsRequest(message);
} else if (data instanceof InstallGroupRequest) {
doInstallGroupRequest(message);
} else if (data instanceof ModifyGroupRequest) {
doModifyGroupRequest(message);
} else if (data instanceof DeleteGroupRequest) {
doDeleteGroupRequest(message);
} else if (data instanceof BroadcastWrapper) {
handleBroadcastCommand(message, (BroadcastWrapper) data);
} else {
handlerNotFound(data);
}
}
use of org.openkilda.messaging.command.CommandData in project open-kilda by telstra.
the class MessageProcessor method handleCommandMessage.
private void handleCommandMessage(CommandMessage command, String key) {
CommandData data = command.getData();
String correlationId = command.getCorrelationId();
CompletableFuture<Response> result;
if (data instanceof CreateLogicalPortRequest) {
result = handleCreateLogicalPortRequest((CreateLogicalPortRequest) data);
} else if (data instanceof DumpLogicalPortsRequest) {
result = handleDumpLogicalPortsRequest((DumpLogicalPortsRequest) data);
} else if (data instanceof GetSwitchInfoRequest) {
result = handleGetSwitchInfoRequest((GetSwitchInfoRequest) data);
} else if (data instanceof GetPacketInOutStatsRequest) {
result = handleGetPacketInOutStatsRequest((GetPacketInOutStatsRequest) data);
} else if (data instanceof DeleteLogicalPortRequest) {
result = handleDeleteLogicalPortRequest((DeleteLogicalPortRequest) data);
} else {
result = unhandledMessage(command);
}
result.thenAccept(response -> sendResponse(response, correlationId, key));
}
use of org.openkilda.messaging.command.CommandData in project open-kilda by telstra.
the class SpeakerWorkerBolt method onHubRequest.
@Override
protected void onHubRequest(Tuple input) throws PipelineException {
String key = input.getStringByField(MessageKafkaTranslator.FIELD_ID_KEY);
CommandData command = pullValue(input, MessageKafkaTranslator.FIELD_ID_PAYLOAD, CommandData.class);
if (command instanceof GrpcBaseRequest) {
service.sendGrpcCommand(key, command);
} else {
service.sendFloodlightCommand(key, command);
}
}
Aggregations