use of org.openkilda.messaging.info.switches.ConnectModeResponse in project open-kilda by telstra.
the class RecordHandler method doConnectMode.
private void doConnectMode(final CommandMessage message, String replyToTopic, Destination replyDestination) {
ConnectModeRequest request = (ConnectModeRequest) message.getData();
if (request.getMode() != null)
logger.debug("Setting CONNECT MODE to '{}'", request.getMode());
else
logger.debug("Getting CONNECT MODE");
ISwitchManager switchManager = context.getSwitchManager();
ConnectModeRequest.Mode result = switchManager.connectMode(request.getMode());
logger.debug("CONNECT MODE is now '{}'", result);
ConnectModeResponse response = new ConnectModeResponse(result);
InfoMessage infoMessage = new InfoMessage(response, System.currentTimeMillis(), message.getCorrelationId(), replyDestination);
context.getKafkaProducer().postMessage(replyToTopic, infoMessage);
}
use of org.openkilda.messaging.info.switches.ConnectModeResponse in project open-kilda by telstra.
the class SwitchServiceImpl method connectMode.
@Override
public ConnectModeRequest.Mode connectMode(ConnectModeRequest.Mode mode, String correlationId) {
LOGGER.debug("Set/Get switch connect mode request received: mode = {}", mode);
ConnectModeRequest data = new ConnectModeRequest(mode);
CommandMessage request = new CommandWithReplyToMessage(data, System.currentTimeMillis(), correlationId, Destination.CONTROLLER, northboundTopic);
messageProducer.send(floodlightTopic, request);
Message message = messageConsumer.poll(correlationId);
ConnectModeResponse response = (ConnectModeResponse) validateInfoMessage(request, message, correlationId);
return response.getMode();
}
Aggregations