Search in sources :

Example 1 with GetAllSwitchPropertiesRequest

use of org.openkilda.messaging.nbtopology.request.GetAllSwitchPropertiesRequest in project open-kilda by telstra.

the class SwitchServiceImpl method dumpSwitchProperties.

@Override
public CompletableFuture<SwitchPropertiesDump> dumpSwitchProperties() {
    final String correlationId = RequestCorrelationId.getId();
    logger.debug("Dump switch properties for the switch: {}");
    CommandMessage request = new CommandMessage(new GetAllSwitchPropertiesRequest(), System.currentTimeMillis(), correlationId);
    return messagingChannel.sendAndGetChunked(nbworkerTopic, request).thenApply(messages -> messages.stream().map(SwitchPropertiesResponse.class::cast).map(r -> switchMapper.map(r.getSwitchProperties())).collect(Collectors.toList())).thenApply(dump -> new SwitchPropertiesDump(dump));
}
Also used : SwitchConnectionsResponse(org.openkilda.northbound.dto.v2.switches.SwitchConnectionsResponse) UnderMaintenanceDto(org.openkilda.northbound.dto.v1.switches.UnderMaintenanceDto) GetPortPropertiesRequest(org.openkilda.messaging.nbtopology.request.GetPortPropertiesRequest) Autowired(org.springframework.beans.factory.annotation.Autowired) SwitchPatchDto(org.openkilda.northbound.dto.v2.switches.SwitchPatchDto) SwitchMeterUnsupported(org.openkilda.messaging.info.meter.SwitchMeterUnsupported) SwitchLagPortResponse(org.openkilda.messaging.nbtopology.response.SwitchLagPortResponse) SwitchMapper(org.openkilda.northbound.converter.SwitchMapper) FlowPayload(org.openkilda.messaging.payload.flow.FlowPayload) DeleteMeterRequest(org.openkilda.messaging.command.flow.DeleteMeterRequest) CreateLagPortDto(org.openkilda.northbound.dto.v2.switches.CreateLagPortDto) MessageException(org.openkilda.messaging.error.MessageException) CommandMessage(org.openkilda.messaging.command.CommandMessage) SwitchPropertiesDump(org.openkilda.northbound.dto.v2.switches.SwitchPropertiesDump) LagPortResponse(org.openkilda.messaging.swmanager.response.LagPortResponse) DeleteMeterResponse(org.openkilda.messaging.info.switches.DeleteMeterResponse) PortConfigurationPayload(org.openkilda.messaging.payload.switches.PortConfigurationPayload) DeleteRulesAction(org.openkilda.messaging.command.switches.DeleteRulesAction) DumpPortDescriptionRequest(org.openkilda.messaging.command.switches.DumpPortDescriptionRequest) DeleteSwitchResponse(org.openkilda.messaging.nbtopology.response.DeleteSwitchResponse) GetSwitchRequest(org.openkilda.messaging.nbtopology.request.GetSwitchRequest) SwitchFlowEntries(org.openkilda.messaging.info.rule.SwitchFlowEntries) PortStatus(org.openkilda.model.PortStatus) PortHistoryRequest(org.openkilda.messaging.nbtopology.request.PortHistoryRequest) RulesValidationResult(org.openkilda.northbound.dto.v1.switches.RulesValidationResult) GetSwitchResponse(org.openkilda.messaging.nbtopology.response.GetSwitchResponse) SwitchMeterEntries(org.openkilda.messaging.info.meter.SwitchMeterEntries) SwitchSyncResponse(org.openkilda.messaging.info.switches.SwitchSyncResponse) UpdateSwitchPropertiesRequest(org.openkilda.messaging.nbtopology.request.UpdateSwitchPropertiesRequest) Message(org.openkilda.messaging.Message) PortPropertiesDto(org.openkilda.northbound.dto.v2.switches.PortPropertiesDto) DeleteSwitchResult(org.openkilda.northbound.dto.v1.switches.DeleteSwitchResult) GetSwitchLagPortsRequest(org.openkilda.messaging.nbtopology.request.GetSwitchLagPortsRequest) PortHistoryResponse(org.openkilda.northbound.dto.v2.switches.PortHistoryResponse) PortDescription(org.openkilda.messaging.info.switches.PortDescription) Value(org.springframework.beans.factory.annotation.Value) SwitchSyncResult(org.openkilda.northbound.dto.v1.switches.SwitchSyncResult) Service(org.springframework.stereotype.Service) SwitchPortsDescription(org.openkilda.messaging.info.switches.SwitchPortsDescription) MessagingChannel(org.openkilda.northbound.messaging.MessagingChannel) SwitchService(org.openkilda.northbound.service.SwitchService) CreateLagPortRequest(org.openkilda.messaging.swmanager.request.CreateLagPortRequest) FlowMapper(org.openkilda.northbound.converter.FlowMapper) DeleteMeterResult(org.openkilda.northbound.dto.v1.switches.DeleteMeterResult) UpdateSwitchUnderMaintenanceRequest(org.openkilda.messaging.nbtopology.request.UpdateSwitchUnderMaintenanceRequest) SwitchPropertiesDto(org.openkilda.northbound.dto.v1.switches.SwitchPropertiesDto) ErrorType(org.openkilda.messaging.error.ErrorType) SwitchValidationResult(org.openkilda.northbound.dto.v1.switches.SwitchValidationResult) FlowEntry(org.openkilda.messaging.info.rule.FlowEntry) RequestCorrelationId(org.openkilda.northbound.utils.RequestCorrelationId) DeleteLagPortRequest(org.openkilda.messaging.swmanager.request.DeleteLagPortRequest) InstallRulesAction(org.openkilda.messaging.command.switches.InstallRulesAction) SwitchConnectionsRequest(org.openkilda.messaging.nbtopology.request.SwitchConnectionsRequest) PortConfigurationResponse(org.openkilda.messaging.info.switches.PortConfigurationResponse) SwitchValidationResponse(org.openkilda.messaging.info.switches.SwitchValidationResponse) SwitchDto(org.openkilda.northbound.dto.v1.switches.SwitchDto) InfoMessage(org.openkilda.messaging.info.InfoMessage) DumpMetersRequest(org.openkilda.messaging.command.switches.DumpMetersRequest) DeleteRulesCriteria(org.openkilda.messaging.command.switches.DeleteRulesCriteria) LoggerFactory(org.slf4j.LoggerFactory) SwitchRulesDeleteRequest(org.openkilda.messaging.command.switches.SwitchRulesDeleteRequest) SwitchRulesInstallRequest(org.openkilda.messaging.command.switches.SwitchRulesInstallRequest) GetSwitchesRequest(org.openkilda.messaging.nbtopology.request.GetSwitchesRequest) PortPropertiesMapper(org.openkilda.northbound.converter.PortPropertiesMapper) PortConfigurationRequest(org.openkilda.messaging.command.switches.PortConfigurationRequest) UpdatePortPropertiesRequest(org.openkilda.messaging.nbtopology.request.UpdatePortPropertiesRequest) SwitchPatchRequest(org.openkilda.messaging.nbtopology.request.SwitchPatchRequest) ConnectModeRequest(org.openkilda.messaging.command.switches.ConnectModeRequest) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) FlowResponse(org.openkilda.messaging.info.flow.FlowResponse) MacAddress(org.openkilda.model.MacAddress) DumpRulesRequest(org.openkilda.messaging.command.switches.DumpRulesRequest) List(java.util.List) PortPropertiesPayload(org.openkilda.messaging.payload.switches.PortPropertiesPayload) RulesSyncResult(org.openkilda.northbound.dto.v1.switches.RulesSyncResult) PortPropertiesResponse(org.openkilda.northbound.dto.v2.switches.PortPropertiesResponse) LagPortMapper(org.openkilda.northbound.converter.LagPortMapper) SwitchConnectedDevicesResponse(org.openkilda.northbound.dto.v2.switches.SwitchConnectedDevicesResponse) GetSwitchConnectedDevicesRequest(org.openkilda.messaging.nbtopology.request.GetSwitchConnectedDevicesRequest) GetSwitchPropertiesRequest(org.openkilda.messaging.nbtopology.request.GetSwitchPropertiesRequest) CompletableFuture(java.util.concurrent.CompletableFuture) DumpSwitchPortsDescriptionRequest(org.openkilda.messaging.command.switches.DumpSwitchPortsDescriptionRequest) SwitchDtoV2(org.openkilda.northbound.dto.v2.switches.SwitchDtoV2) SwitchValidateRequest(org.openkilda.messaging.command.switches.SwitchValidateRequest) LagPortDto(org.openkilda.northbound.dto.v2.switches.LagPortDto) PortHistoryPayload(org.openkilda.messaging.payload.history.PortHistoryPayload) ConnectModeResponse(org.openkilda.messaging.info.switches.ConnectModeResponse) Logger(org.slf4j.Logger) DeleteSwitchRequest(org.openkilda.messaging.nbtopology.request.DeleteSwitchRequest) GetFlowsForSwitchRequest(org.openkilda.messaging.nbtopology.request.GetFlowsForSwitchRequest) SwitchPropertiesResponse(org.openkilda.messaging.nbtopology.response.SwitchPropertiesResponse) PortDto(org.openkilda.northbound.dto.v1.switches.PortDto) GetAllSwitchPropertiesRequest(org.openkilda.messaging.nbtopology.request.GetAllSwitchPropertiesRequest) SwitchId(org.openkilda.model.SwitchId) SwitchRulesResponse(org.openkilda.messaging.info.switches.SwitchRulesResponse) ConnectedDeviceMapper(org.openkilda.northbound.converter.ConnectedDeviceMapper) Destination(org.openkilda.messaging.Destination) NumberUtils(org.apache.commons.lang3.math.NumberUtils) SwitchPropertiesDump(org.openkilda.northbound.dto.v2.switches.SwitchPropertiesDump) GetAllSwitchPropertiesRequest(org.openkilda.messaging.nbtopology.request.GetAllSwitchPropertiesRequest) SwitchPropertiesResponse(org.openkilda.messaging.nbtopology.response.SwitchPropertiesResponse) CommandMessage(org.openkilda.messaging.command.CommandMessage)

Aggregations

String.format (java.lang.String.format)1 Instant (java.time.Instant)1 List (java.util.List)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 Collectors (java.util.stream.Collectors)1 NumberUtils (org.apache.commons.lang3.math.NumberUtils)1 Destination (org.openkilda.messaging.Destination)1 Message (org.openkilda.messaging.Message)1 CommandMessage (org.openkilda.messaging.command.CommandMessage)1 DeleteMeterRequest (org.openkilda.messaging.command.flow.DeleteMeterRequest)1 ConnectModeRequest (org.openkilda.messaging.command.switches.ConnectModeRequest)1 DeleteRulesAction (org.openkilda.messaging.command.switches.DeleteRulesAction)1 DeleteRulesCriteria (org.openkilda.messaging.command.switches.DeleteRulesCriteria)1 DumpMetersRequest (org.openkilda.messaging.command.switches.DumpMetersRequest)1 DumpPortDescriptionRequest (org.openkilda.messaging.command.switches.DumpPortDescriptionRequest)1 DumpRulesRequest (org.openkilda.messaging.command.switches.DumpRulesRequest)1 DumpSwitchPortsDescriptionRequest (org.openkilda.messaging.command.switches.DumpSwitchPortsDescriptionRequest)1 InstallRulesAction (org.openkilda.messaging.command.switches.InstallRulesAction)1 PortConfigurationRequest (org.openkilda.messaging.command.switches.PortConfigurationRequest)1 SwitchRulesDeleteRequest (org.openkilda.messaging.command.switches.SwitchRulesDeleteRequest)1