use of org.openkilda.messaging.nbtopology.request.UpdateLinkUnderMaintenanceRequest in project open-kilda by telstra.
the class LinkServiceImpl method updateLinkUnderMaintenance.
@Override
public CompletableFuture<List<LinkDto>> updateLinkUnderMaintenance(LinkUnderMaintenanceDto link) {
final String correlationId = RequestCorrelationId.getId();
logger.debug("Update under maintenance link request processing");
UpdateLinkUnderMaintenanceRequest data = null;
try {
data = new UpdateLinkUnderMaintenanceRequest(new NetworkEndpoint(new SwitchId(link.getSrcSwitch()), link.getSrcPort()), new NetworkEndpoint(new SwitchId(link.getDstSwitch()), link.getDstPort()), link.isUnderMaintenance(), link.isEvacuate());
} catch (IllegalArgumentException e) {
logger.error("Can not parse arguments: {}", e.getMessage());
throw new MessageException(correlationId, System.currentTimeMillis(), ErrorType.DATA_INVALID, e.getMessage(), "Can not parse arguments when create 'update ISL Under maintenance' request");
}
CommandMessage message = new CommandMessage(data, System.currentTimeMillis(), correlationId, Destination.WFM);
return messagingChannel.sendAndGetChunked(nbworkerTopic, message).thenApply(response -> response.stream().map(IslInfoData.class::cast).map(linkMapper::mapResponse).collect(Collectors.toList()));
}
Aggregations