use of org.openkilda.messaging.info.switches.PortConfigurationResponse in project open-kilda by telstra.
the class RecordHandler method doConfigurePort.
private void doConfigurePort(final CommandMessage message) {
PortConfigurationRequest request = (PortConfigurationRequest) message.getData();
logger.info("Port configuration request. Switch '{}', Port '{}'", request.getSwitchId(), request.getPortNumber());
final IKafkaProducerService producerService = getKafkaProducer();
final String replyToTopic = context.getKafkaNorthboundTopic();
try {
ISwitchManager switchManager = context.getSwitchManager();
DatapathId dpId = DatapathId.of(request.getSwitchId().toLong());
switchManager.configurePort(dpId, request.getPortNumber(), request.getAdminDown());
InfoMessage infoMessage = new InfoMessage(new PortConfigurationResponse(request.getSwitchId(), request.getPortNumber()), message.getTimestamp(), message.getCorrelationId());
producerService.sendMessageAndTrack(replyToTopic, infoMessage);
} catch (SwitchOperationException e) {
logger.error("Port configuration request failed. " + e.getMessage(), e);
anError(ErrorType.DATA_INVALID).withMessage(e.getMessage()).withDescription("Port configuration request failed").withCorrelationId(message.getCorrelationId()).withTopic(replyToTopic).sendVia(producerService);
}
}
Aggregations