Search in sources :

Example 1 with PortDto

use of org.openkilda.northbound.dto.v1.switches.PortDto in project open-kilda by telstra.

the class SwitchServiceImpl method configurePort.

/**
 * {@inheritDoc}
 */
@Override
public CompletableFuture<PortDto> configurePort(SwitchId switchId, int port, PortConfigurationPayload config) {
    String correlationId = RequestCorrelationId.getId();
    PortConfigurationRequest request = new PortConfigurationRequest(switchId, port, toPortAdminDown(config.getStatus()));
    CommandMessage updateStatusCommand = new CommandMessage(request, System.currentTimeMillis(), correlationId, Destination.CONTROLLER);
    return messagingChannel.sendAndGet(floodlightTopic, updateStatusCommand).thenApply(PortConfigurationResponse.class::cast).thenApply(response -> new PortDto(response.getSwitchId().toString(), response.getPortNo()));
}
Also used : PortConfigurationRequest(org.openkilda.messaging.command.switches.PortConfigurationRequest) CreateLagPortDto(org.openkilda.northbound.dto.v2.switches.CreateLagPortDto) LagPortDto(org.openkilda.northbound.dto.v2.switches.LagPortDto) PortDto(org.openkilda.northbound.dto.v1.switches.PortDto) CommandMessage(org.openkilda.messaging.command.CommandMessage)

Aggregations

CommandMessage (org.openkilda.messaging.command.CommandMessage)1 PortConfigurationRequest (org.openkilda.messaging.command.switches.PortConfigurationRequest)1 PortDto (org.openkilda.northbound.dto.v1.switches.PortDto)1 CreateLagPortDto (org.openkilda.northbound.dto.v2.switches.CreateLagPortDto)1 LagPortDto (org.openkilda.northbound.dto.v2.switches.LagPortDto)1