Search in sources :

Example 6 with GetSwitchResponse

use of org.openkilda.messaging.nbtopology.response.GetSwitchResponse in project open-kilda by telstra.

the class SwitchServiceImpl method getSwitches.

/**
 * {@inheritDoc}
 */
@Override
public CompletableFuture<List<SwitchDto>> getSwitches() {
    final String correlationId = RequestCorrelationId.getId();
    logger.debug("Get switch request received");
    CommandMessage request = new CommandMessage(new GetSwitchesRequest(), System.currentTimeMillis(), correlationId);
    return messagingChannel.sendAndGetChunked(nbworkerTopic, request).thenApply(messages -> messages.stream().map(GetSwitchResponse.class::cast).map(GetSwitchResponse::getPayload).map(switchMapper::toSwitchDto).collect(Collectors.toList()));
}
Also used : GetSwitchResponse(org.openkilda.messaging.nbtopology.response.GetSwitchResponse) GetSwitchesRequest(org.openkilda.messaging.nbtopology.request.GetSwitchesRequest) CommandMessage(org.openkilda.messaging.command.CommandMessage)

Aggregations

GetSwitchResponse (org.openkilda.messaging.nbtopology.response.GetSwitchResponse)6 CommandMessage (org.openkilda.messaging.command.CommandMessage)4 Switch (org.openkilda.model.Switch)2 SwitchNotFoundException (org.openkilda.wfm.error.SwitchNotFoundException)2 HashSet (java.util.HashSet)1 Values (org.apache.storm.tuple.Values)1 FlowRerouteRequest (org.openkilda.messaging.command.flow.FlowRerouteRequest)1 MessageException (org.openkilda.messaging.error.MessageException)1 GetSwitchRequest (org.openkilda.messaging.nbtopology.request.GetSwitchRequest)1 GetSwitchesRequest (org.openkilda.messaging.nbtopology.request.GetSwitchesRequest)1 SwitchPatchRequest (org.openkilda.messaging.nbtopology.request.SwitchPatchRequest)1 UpdateSwitchUnderMaintenanceRequest (org.openkilda.messaging.nbtopology.request.UpdateSwitchUnderMaintenanceRequest)1 FlowPath (org.openkilda.model.FlowPath)1 IslEndpoint (org.openkilda.model.IslEndpoint)1 SwitchId (org.openkilda.model.SwitchId)1 CommandContext (org.openkilda.wfm.CommandContext)1