Search in sources :

Example 1 with UpdateLinkUnderMaintenanceRequest

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()));
}
Also used : UpdateLinkUnderMaintenanceRequest(org.openkilda.messaging.nbtopology.request.UpdateLinkUnderMaintenanceRequest) NetworkEndpoint(org.openkilda.messaging.model.NetworkEndpoint) MessageException(org.openkilda.messaging.error.MessageException) SwitchId(org.openkilda.model.SwitchId) CommandMessage(org.openkilda.messaging.command.CommandMessage)

Aggregations

CommandMessage (org.openkilda.messaging.command.CommandMessage)1 MessageException (org.openkilda.messaging.error.MessageException)1 NetworkEndpoint (org.openkilda.messaging.model.NetworkEndpoint)1 UpdateLinkUnderMaintenanceRequest (org.openkilda.messaging.nbtopology.request.UpdateLinkUnderMaintenanceRequest)1 SwitchId (org.openkilda.model.SwitchId)1