Search in sources :

Example 1 with ConnectModeResponse

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);
}
Also used : ConnectModeRequest(org.openkilda.messaging.command.switches.ConnectModeRequest) ISwitchManager(org.openkilda.floodlight.switchmanager.ISwitchManager) InfoMessage(org.openkilda.messaging.info.InfoMessage) ConnectModeResponse(org.openkilda.messaging.info.switches.ConnectModeResponse)

Example 2 with ConnectModeResponse

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();
}
Also used : ConnectModeRequest(org.openkilda.messaging.command.switches.ConnectModeRequest) Message(org.openkilda.messaging.Message) CommandMessage(org.openkilda.messaging.command.CommandMessage) CommandWithReplyToMessage(org.openkilda.messaging.command.CommandWithReplyToMessage) CommandWithReplyToMessage(org.openkilda.messaging.command.CommandWithReplyToMessage) CommandMessage(org.openkilda.messaging.command.CommandMessage) ConnectModeResponse(org.openkilda.messaging.info.switches.ConnectModeResponse)

Aggregations

ConnectModeRequest (org.openkilda.messaging.command.switches.ConnectModeRequest)2 ConnectModeResponse (org.openkilda.messaging.info.switches.ConnectModeResponse)2 ISwitchManager (org.openkilda.floodlight.switchmanager.ISwitchManager)1 Message (org.openkilda.messaging.Message)1 CommandMessage (org.openkilda.messaging.command.CommandMessage)1 CommandWithReplyToMessage (org.openkilda.messaging.command.CommandWithReplyToMessage)1 InfoMessage (org.openkilda.messaging.info.InfoMessage)1