Search in sources :

Example 6 with SwitchRulesDeleteRequest

use of org.openkilda.messaging.command.switches.SwitchRulesDeleteRequest in project open-kilda by telstra.

the class RecordHandler method doDeleteSwitchRules.

private void doDeleteSwitchRules(final CommandMessage message) {
    SwitchRulesDeleteRequest request = (SwitchRulesDeleteRequest) message.getData();
    logger.info("Deleting rules from '{}' switch: action={}, criteria={}", request.getSwitchId(), request.getDeleteRulesAction(), request.getCriteria());
    final IKafkaProducerService producerService = getKafkaProducer();
    final String replyToTopic = context.getKafkaSwitchManagerTopic();
    DatapathId dpid = DatapathId.of(request.getSwitchId().toLong());
    DeleteRulesAction deleteAction = request.getDeleteRulesAction();
    DeleteRulesCriteria criteria = request.getCriteria();
    ISwitchManager switchManager = context.getSwitchManager();
    try {
        List<Long> removedRules = new ArrayList<>();
        if (deleteAction != null) {
            switch(deleteAction) {
                case REMOVE_DROP:
                    criteria = DeleteRulesCriteria.builder().cookie(DROP_RULE_COOKIE).build();
                    break;
                case REMOVE_BROADCAST:
                    criteria = DeleteRulesCriteria.builder().cookie(VERIFICATION_BROADCAST_RULE_COOKIE).build();
                    break;
                case REMOVE_UNICAST:
                    criteria = DeleteRulesCriteria.builder().cookie(VERIFICATION_UNICAST_RULE_COOKIE).build();
                    break;
                case REMOVE_VERIFICATION_LOOP:
                    criteria = DeleteRulesCriteria.builder().cookie(DROP_VERIFICATION_LOOP_RULE_COOKIE).build();
                    break;
                case REMOVE_BFD_CATCH:
                    criteria = DeleteRulesCriteria.builder().cookie(CATCH_BFD_RULE_COOKIE).build();
                    break;
                case REMOVE_ROUND_TRIP_LATENCY:
                    criteria = DeleteRulesCriteria.builder().cookie(ROUND_TRIP_LATENCY_RULE_COOKIE).build();
                    break;
                case REMOVE_UNICAST_VXLAN:
                    criteria = DeleteRulesCriteria.builder().cookie(VERIFICATION_UNICAST_VXLAN_RULE_COOKIE).build();
                    break;
                case REMOVE_MULTITABLE_PRE_INGRESS_PASS_THROUGH:
                    criteria = DeleteRulesCriteria.builder().cookie(MULTITABLE_PRE_INGRESS_PASS_THROUGH_COOKIE).build();
                    break;
                case REMOVE_MULTITABLE_INGRESS_DROP:
                    criteria = DeleteRulesCriteria.builder().cookie(MULTITABLE_INGRESS_DROP_COOKIE).build();
                    break;
                case REMOVE_MULTITABLE_POST_INGRESS_DROP:
                    criteria = DeleteRulesCriteria.builder().cookie(MULTITABLE_POST_INGRESS_DROP_COOKIE).build();
                    break;
                case REMOVE_MULTITABLE_EGRESS_PASS_THROUGH:
                    criteria = DeleteRulesCriteria.builder().cookie(MULTITABLE_EGRESS_PASS_THROUGH_COOKIE).build();
                    break;
                case REMOVE_MULTITABLE_TRANSIT_DROP:
                    criteria = DeleteRulesCriteria.builder().cookie(MULTITABLE_TRANSIT_DROP_COOKIE).build();
                    break;
                case REMOVE_LLDP_INPUT_PRE_DROP:
                    criteria = DeleteRulesCriteria.builder().cookie(LLDP_INPUT_PRE_DROP_COOKIE).build();
                    break;
                case REMOVE_LLDP_INGRESS:
                    criteria = DeleteRulesCriteria.builder().cookie(LLDP_INGRESS_COOKIE).build();
                    break;
                case REMOVE_LLDP_POST_INGRESS:
                    criteria = DeleteRulesCriteria.builder().cookie(LLDP_POST_INGRESS_COOKIE).build();
                    break;
                case REMOVE_LLDP_POST_INGRESS_VXLAN:
                    criteria = DeleteRulesCriteria.builder().cookie(LLDP_POST_INGRESS_VXLAN_COOKIE).build();
                    break;
                case REMOVE_LLDP_POST_INGRESS_ONE_SWITCH:
                    criteria = DeleteRulesCriteria.builder().cookie(LLDP_POST_INGRESS_ONE_SWITCH_COOKIE).build();
                    break;
                case REMOVE_LLDP_TRANSIT:
                    criteria = DeleteRulesCriteria.builder().cookie(LLDP_TRANSIT_COOKIE).build();
                    break;
                case REMOVE_ARP_INPUT_PRE_DROP:
                    criteria = DeleteRulesCriteria.builder().cookie(ARP_INPUT_PRE_DROP_COOKIE).build();
                    break;
                case REMOVE_ARP_INGRESS:
                    criteria = DeleteRulesCriteria.builder().cookie(ARP_INGRESS_COOKIE).build();
                    break;
                case REMOVE_ARP_POST_INGRESS:
                    criteria = DeleteRulesCriteria.builder().cookie(ARP_POST_INGRESS_COOKIE).build();
                    break;
                case REMOVE_ARP_POST_INGRESS_VXLAN:
                    criteria = DeleteRulesCriteria.builder().cookie(ARP_POST_INGRESS_VXLAN_COOKIE).build();
                    break;
                case REMOVE_ARP_POST_INGRESS_ONE_SWITCH:
                    criteria = DeleteRulesCriteria.builder().cookie(ARP_POST_INGRESS_ONE_SWITCH_COOKIE).build();
                    break;
                case REMOVE_ARP_TRANSIT:
                    criteria = DeleteRulesCriteria.builder().cookie(ARP_TRANSIT_COOKIE).build();
                    break;
                case REMOVE_SERVER_42_FLOW_RTT_TURNING:
                case REMOVE_SERVER_42_TURNING:
                    criteria = DeleteRulesCriteria.builder().cookie(SERVER_42_FLOW_RTT_TURNING_COOKIE).build();
                    break;
                case REMOVE_SERVER_42_FLOW_RTT_VXLAN_TURNING:
                    criteria = DeleteRulesCriteria.builder().cookie(SERVER_42_FLOW_RTT_VXLAN_TURNING_COOKIE).build();
                    break;
                case REMOVE_SERVER_42_FLOW_RTT_OUTPUT_VLAN:
                case REMOVE_SERVER_42_OUTPUT_VLAN:
                    criteria = DeleteRulesCriteria.builder().cookie(SERVER_42_FLOW_RTT_OUTPUT_VLAN_COOKIE).build();
                    break;
                case REMOVE_SERVER_42_FLOW_RTT_OUTPUT_VXLAN:
                case REMOVE_SERVER_42_OUTPUT_VXLAN:
                    criteria = DeleteRulesCriteria.builder().cookie(SERVER_42_FLOW_RTT_OUTPUT_VXLAN_COOKIE).build();
                    break;
                case REMOVE_SERVER_42_ISL_RTT_TURNING:
                    criteria = DeleteRulesCriteria.builder().cookie(SERVER_42_ISL_RTT_TURNING_COOKIE).build();
                    break;
                case REMOVE_SERVER_42_ISL_RTT_OUTPUT:
                    criteria = DeleteRulesCriteria.builder().cookie(SERVER_42_ISL_RTT_OUTPUT_COOKIE).build();
                    break;
                default:
                    logger.warn("Received unexpected delete switch rule action: {}", deleteAction);
            }
            // The cases when we delete all non-default rules.
            if (deleteAction.nonDefaultRulesToBeRemoved()) {
                removedRules.addAll(switchManager.deleteAllNonDefaultRules(dpid));
            }
            // The cases when we delete the default rules.
            if (deleteAction.defaultRulesToBeRemoved()) {
                removedRules.addAll(switchManager.deleteDefaultRules(dpid, request.getIslPorts(), request.getFlowPorts(), request.getFlowLldpPorts(), request.getFlowArpPorts(), request.getServer42FlowRttPorts(), request.isMultiTable(), request.isSwitchLldp(), request.isSwitchArp(), request.isServer42FlowRttFeatureToggle() && request.isServer42FlowRttSwitchProperty(), request.isServer42IslRttEnabled()));
            }
        }
        // The case when we either delete by criteria or a specific default rule.
        if (criteria != null) {
            removedRules.addAll(switchManager.deleteRulesByCriteria(dpid, false, null, criteria));
        }
        // The cases when we (re)install the default rules.
        if (deleteAction != null && deleteAction.defaultRulesToBeInstalled()) {
            switchManager.installDefaultRules(dpid);
            if (request.isMultiTable()) {
                processInstallDefaultFlowByCookie(request.getSwitchId(), MULTITABLE_PRE_INGRESS_PASS_THROUGH_COOKIE);
                processInstallDefaultFlowByCookie(request.getSwitchId(), MULTITABLE_INGRESS_DROP_COOKIE);
                processInstallDefaultFlowByCookie(request.getSwitchId(), MULTITABLE_POST_INGRESS_DROP_COOKIE);
                processInstallDefaultFlowByCookie(request.getSwitchId(), MULTITABLE_EGRESS_PASS_THROUGH_COOKIE);
                processInstallDefaultFlowByCookie(request.getSwitchId(), MULTITABLE_TRANSIT_DROP_COOKIE);
                processInstallDefaultFlowByCookie(request.getSwitchId(), LLDP_POST_INGRESS_COOKIE);
                processInstallDefaultFlowByCookie(request.getSwitchId(), LLDP_POST_INGRESS_VXLAN_COOKIE);
                processInstallDefaultFlowByCookie(request.getSwitchId(), LLDP_POST_INGRESS_ONE_SWITCH_COOKIE);
                processInstallDefaultFlowByCookie(request.getSwitchId(), ARP_POST_INGRESS_COOKIE);
                processInstallDefaultFlowByCookie(request.getSwitchId(), ARP_POST_INGRESS_VXLAN_COOKIE);
                processInstallDefaultFlowByCookie(request.getSwitchId(), ARP_POST_INGRESS_ONE_SWITCH_COOKIE);
                for (int port : request.getIslPorts()) {
                    switchManager.installMultitableEndpointIslRules(dpid, port);
                }
                for (int port : request.getFlowPorts()) {
                    switchManager.installIntermediateIngressRule(dpid, port);
                }
                for (Integer port : request.getFlowLldpPorts()) {
                    switchManager.installLldpInputCustomerFlow(dpid, port);
                }
                for (Integer port : request.getFlowArpPorts()) {
                    switchManager.installArpInputCustomerFlow(dpid, port);
                }
                if (request.isSwitchLldp()) {
                    processInstallDefaultFlowByCookie(request.getSwitchId(), LLDP_INPUT_PRE_DROP_COOKIE);
                    processInstallDefaultFlowByCookie(request.getSwitchId(), LLDP_TRANSIT_COOKIE);
                    processInstallDefaultFlowByCookie(request.getSwitchId(), LLDP_INGRESS_COOKIE);
                }
                if (request.isSwitchArp()) {
                    processInstallDefaultFlowByCookie(request.getSwitchId(), ARP_INPUT_PRE_DROP_COOKIE);
                    processInstallDefaultFlowByCookie(request.getSwitchId(), ARP_TRANSIT_COOKIE);
                    processInstallDefaultFlowByCookie(request.getSwitchId(), ARP_INGRESS_COOKIE);
                }
            }
            Integer server42Port = request.getServer42Port();
            Integer server42Vlan = request.getServer42Vlan();
            MacAddress server42MacAddress = request.getServer42MacAddress();
            if (request.isServer42FlowRttFeatureToggle()) {
                switchManager.installServer42FlowRttTurningFlow(dpid);
                switchManager.installServer42FlowRttVxlanTurningFlow(dpid);
                if (request.isServer42FlowRttSwitchProperty() && server42Port != null && server42Vlan != null && server42MacAddress != null) {
                    switchManager.installServer42FlowRttOutputVlanFlow(dpid, server42Port, server42Vlan, server42MacAddress);
                    switchManager.installServer42FlowRttOutputVxlanFlow(dpid, server42Port, server42Vlan, server42MacAddress);
                    for (Integer port : request.getServer42FlowRttPorts()) {
                        switchManager.installServer42FlowRttInputFlow(dpid, server42Port, port, server42MacAddress);
                    }
                }
            }
            if (request.isServer42IslRttEnabled()) {
                switchManager.installServer42IslRttTurningFlow(dpid);
                switchManager.installServer42IslRttOutputFlow(dpid, server42Port, server42Vlan, server42MacAddress);
                for (Integer port : request.getIslPorts()) {
                    switchManager.installServer42IslRttInputFlow(dpid, server42Port, port);
                }
            }
        }
        SwitchRulesResponse response = new SwitchRulesResponse(removedRules);
        InfoMessage infoMessage = new InfoMessage(response, System.currentTimeMillis(), message.getCorrelationId());
        producerService.sendMessageAndTrack(replyToTopic, record.key(), infoMessage);
    } catch (SwitchNotFoundException e) {
        logger.error("Deleting switch rules was unsuccessful. Switch '{}' not found", request.getSwitchId());
        anError(ErrorType.NOT_FOUND).withMessage(e.getMessage()).withDescription(request.getSwitchId().toString()).withCorrelationId(message.getCorrelationId()).withTopic(replyToTopic).withKey(record.key()).sendVia(producerService);
    } catch (SwitchOperationException e) {
        logger.error("Failed to delete switch '{}' rules.", request.getSwitchId(), e);
        anError(ErrorType.DELETION_FAILURE).withMessage(e.getMessage()).withDescription(request.getSwitchId().toString()).withCorrelationId(message.getCorrelationId()).withTopic(replyToTopic).withKey(record.key()).sendVia(producerService);
    }
}
Also used : SwitchOperationException(org.openkilda.floodlight.error.SwitchOperationException) UnsupportedSwitchOperationException(org.openkilda.floodlight.error.UnsupportedSwitchOperationException) ISwitchManager(org.openkilda.floodlight.switchmanager.ISwitchManager) ArrayList(java.util.ArrayList) DeleteRulesCriteria(org.openkilda.messaging.command.switches.DeleteRulesCriteria) DatapathId(org.projectfloodlight.openflow.types.DatapathId) MacAddress(org.openkilda.model.MacAddress) SwitchNotFoundException(org.openkilda.floodlight.error.SwitchNotFoundException) FlowEndpoint(org.openkilda.model.FlowEndpoint) IKafkaProducerService(org.openkilda.floodlight.service.kafka.IKafkaProducerService) InfoMessage(org.openkilda.messaging.info.InfoMessage) SwitchRulesResponse(org.openkilda.messaging.info.switches.SwitchRulesResponse) DeleteRulesAction(org.openkilda.messaging.command.switches.DeleteRulesAction) SwitchRulesDeleteRequest(org.openkilda.messaging.command.switches.SwitchRulesDeleteRequest)

Example 7 with SwitchRulesDeleteRequest

use of org.openkilda.messaging.command.switches.SwitchRulesDeleteRequest in project open-kilda by telstra.

the class RecordHandler method handleCommand.

@VisibleForTesting
void handleCommand(CommandMessage message) {
    logger.debug("Handling message: '{}'.", message);
    CommandData data = message.getData();
    if (data instanceof DiscoverIslCommandData) {
        doDiscoverIslCommand((DiscoverIslCommandData) data, message.getCorrelationId());
    } else if (data instanceof DiscoverPathCommandData) {
        doDiscoverPathCommand(data);
    } else if (data instanceof RemoveFlowForSwitchManagerRequest) {
        doDeleteFlowForSwitchManager(message);
    } else if (data instanceof ModifyFlowMeterForSwitchManagerRequest) {
        doModifyFlowMeterForSwitchManager(message);
    } else if (data instanceof ModifyDefaultMeterForSwitchManagerRequest) {
        doModifyDefaultMeterForSwitchManager(message);
    } else if (data instanceof ReinstallDefaultFlowForSwitchManagerRequest) {
        doReinstallDefaultFlowForSwitchManager(message);
    } else if (data instanceof NetworkCommandData) {
        doNetworkDump((NetworkCommandData) data);
    } else if (data instanceof SwitchRulesDeleteRequest) {
        doDeleteSwitchRules(message);
    } else if (data instanceof SwitchRulesInstallRequest) {
        doInstallSwitchRules(message);
    } else if (data instanceof DumpRulesForFlowHsRequest) {
        doDumpRulesForFlowHsRequest(message);
    } else if (data instanceof DumpRulesRequest) {
        doDumpRulesRequest(message);
    } else if (data instanceof DumpRulesForSwitchManagerRequest) {
        doDumpRulesForSwitchManagerRequest(message);
    } else if (data instanceof InstallFlowForSwitchManagerRequest) {
        doInstallFlowForSwitchManager(message);
    } else if (data instanceof DeleterMeterForSwitchManagerRequest) {
        doDeleteMeter(message, context.getKafkaSwitchManagerTopic());
    } else if (data instanceof DeleteMeterRequest) {
        doDeleteMeter(message, context.getKafkaNorthboundTopic());
    } else if (data instanceof PortConfigurationRequest) {
        doConfigurePort(message);
    } else if (data instanceof DumpSwitchPortsDescriptionRequest) {
        doDumpSwitchPortsDescriptionRequest(message);
    } else if (data instanceof DumpPortDescriptionRequest) {
        doDumpPortDescriptionRequest(message);
    } else if (data instanceof DumpMetersRequest) {
        doDumpMetersRequest(message);
    } else if (data instanceof DumpMetersForSwitchManagerRequest) {
        doDumpMetersForSwitchManagerRequest(message);
    } else if (data instanceof DumpMetersForFlowHsRequest) {
        doDumpMetersForFlowHsRequest(message);
    } else if (data instanceof MeterModifyCommandRequest) {
        doModifyMeterRequest(message);
    } else if (data instanceof AliveRequest) {
        doAliveRequest(message);
    } else if (data instanceof InstallIslDefaultRulesCommand) {
        doInstallIslDefaultRule(message);
    } else if (data instanceof RemoveIslDefaultRulesCommand) {
        doRemoveIslDefaultRule(message);
    } else if (data instanceof DumpGroupsForSwitchManagerRequest) {
        doDumpGroupsForSwitchManagerRequest(message);
    } else if (data instanceof DumpGroupsForFlowHsRequest) {
        doDumpGroupsForFlowHsRequest(message);
    } else if (data instanceof InstallGroupRequest) {
        doInstallGroupRequest(message);
    } else if (data instanceof ModifyGroupRequest) {
        doModifyGroupRequest(message);
    } else if (data instanceof DeleteGroupRequest) {
        doDeleteGroupRequest(message);
    } else if (data instanceof BroadcastWrapper) {
        handleBroadcastCommand(message, (BroadcastWrapper) data);
    } else {
        handlerNotFound(data);
    }
}
Also used : DumpGroupsForFlowHsRequest(org.openkilda.messaging.command.switches.DumpGroupsForFlowHsRequest) RemoveFlowForSwitchManagerRequest(org.openkilda.messaging.command.flow.RemoveFlowForSwitchManagerRequest) InstallGroupRequest(org.openkilda.messaging.command.switches.InstallGroupRequest) DumpGroupsForSwitchManagerRequest(org.openkilda.messaging.command.switches.DumpGroupsForSwitchManagerRequest) InstallFlowForSwitchManagerRequest(org.openkilda.messaging.command.flow.InstallFlowForSwitchManagerRequest) InstallIslDefaultRulesCommand(org.openkilda.messaging.payload.switches.InstallIslDefaultRulesCommand) DumpMetersRequest(org.openkilda.messaging.command.switches.DumpMetersRequest) BroadcastWrapper(org.openkilda.messaging.command.BroadcastWrapper) DumpMetersForSwitchManagerRequest(org.openkilda.messaging.command.switches.DumpMetersForSwitchManagerRequest) DumpMetersForFlowHsRequest(org.openkilda.messaging.command.switches.DumpMetersForFlowHsRequest) DumpRulesRequest(org.openkilda.messaging.command.switches.DumpRulesRequest) ModifyDefaultMeterForSwitchManagerRequest(org.openkilda.messaging.command.flow.ModifyDefaultMeterForSwitchManagerRequest) DumpRulesForSwitchManagerRequest(org.openkilda.messaging.command.switches.DumpRulesForSwitchManagerRequest) ModifyGroupRequest(org.openkilda.messaging.command.switches.ModifyGroupRequest) DiscoverIslCommandData(org.openkilda.messaging.command.discovery.DiscoverIslCommandData) ReinstallDefaultFlowForSwitchManagerRequest(org.openkilda.messaging.command.flow.ReinstallDefaultFlowForSwitchManagerRequest) SwitchRulesInstallRequest(org.openkilda.messaging.command.switches.SwitchRulesInstallRequest) DumpPortDescriptionRequest(org.openkilda.messaging.command.switches.DumpPortDescriptionRequest) RemoveIslDefaultRulesCommand(org.openkilda.messaging.payload.switches.RemoveIslDefaultRulesCommand) ModifyFlowMeterForSwitchManagerRequest(org.openkilda.messaging.command.flow.ModifyFlowMeterForSwitchManagerRequest) DeleteGroupRequest(org.openkilda.messaging.command.switches.DeleteGroupRequest) PortConfigurationRequest(org.openkilda.messaging.command.switches.PortConfigurationRequest) DeleterMeterForSwitchManagerRequest(org.openkilda.messaging.command.switches.DeleterMeterForSwitchManagerRequest) DumpSwitchPortsDescriptionRequest(org.openkilda.messaging.command.switches.DumpSwitchPortsDescriptionRequest) DumpRulesForFlowHsRequest(org.openkilda.messaging.command.switches.DumpRulesForFlowHsRequest) MeterModifyCommandRequest(org.openkilda.messaging.command.flow.MeterModifyCommandRequest) SwitchRulesDeleteRequest(org.openkilda.messaging.command.switches.SwitchRulesDeleteRequest) NetworkCommandData(org.openkilda.messaging.command.discovery.NetworkCommandData) DiscoverIslCommandData(org.openkilda.messaging.command.discovery.DiscoverIslCommandData) PortsCommandData(org.openkilda.messaging.command.discovery.PortsCommandData) DiscoverPathCommandData(org.openkilda.messaging.command.discovery.DiscoverPathCommandData) CommandData(org.openkilda.messaging.command.CommandData) NetworkCommandData(org.openkilda.messaging.command.discovery.NetworkCommandData) DeleteMeterRequest(org.openkilda.messaging.command.flow.DeleteMeterRequest) AliveRequest(org.openkilda.messaging.AliveRequest) DiscoverPathCommandData(org.openkilda.messaging.command.discovery.DiscoverPathCommandData) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 8 with SwitchRulesDeleteRequest

use of org.openkilda.messaging.command.switches.SwitchRulesDeleteRequest in project open-kilda by telstra.

the class SwitchRuleServiceImpl method deleteRules.

@Override
public void deleteRules(String key, SwitchRulesDeleteRequest data) {
    isOperationCompleted = false;
    SwitchId switchId = data.getSwitchId();
    if (!switchRepository.exists(switchId)) {
        ErrorData errorData = new ErrorData(ErrorType.NOT_FOUND, format("Switch %s not found", switchId), "Error when deleting switch rules");
        ErrorMessage errorMessage = new ErrorMessage(errorData, System.currentTimeMillis(), key);
        carrier.response(key, errorMessage);
        return;
    }
    Optional<SwitchProperties> switchProperties = switchPropertiesRepository.findBySwitchId(switchId);
    KildaFeatureToggles featureToggles = featureTogglesRepository.getOrDefault();
    boolean server42FlowRttFeatureToggle = featureToggles.getServer42FlowRtt();
    data.setServer42FlowRttFeatureToggle(server42FlowRttFeatureToggle);
    data.setServer42IslRttEnabled(featureToggles.getServer42IslRtt() && switchProperties.map(SwitchProperties::hasServer42IslRttEnabled).orElse(false));
    if (switchProperties.isPresent()) {
        data.setMultiTable(switchProperties.get().isMultiTable());
        data.setSwitchLldp(switchProperties.get().isSwitchLldp());
        data.setSwitchArp(switchProperties.get().isSwitchArp());
        data.setServer42FlowRttSwitchProperty(switchProperties.get().isServer42FlowRtt());
        data.setServer42Port(switchProperties.get().getServer42Port());
        data.setServer42Vlan(switchProperties.get().getServer42Vlan());
        data.setServer42MacAddress(switchProperties.get().getServer42MacAddress());
        Collection<FlowPath> flowPaths = flowPathRepository.findBySrcSwitch(switchId);
        List<Integer> flowPorts = new ArrayList<>();
        Set<Integer> flowLldpPorts = new HashSet<>();
        Set<Integer> flowArpPorts = new HashSet<>();
        Set<Integer> server42FlowPorts = new HashSet<>();
        fillFlowPorts(switchProperties.get(), flowPaths, flowPorts, flowLldpPorts, flowArpPorts, server42FlowPorts, server42FlowRttFeatureToggle && switchProperties.get().isServer42FlowRtt());
        data.setFlowPorts(flowPorts);
        data.setFlowLldpPorts(flowLldpPorts);
        data.setFlowArpPorts(flowArpPorts);
        data.setServer42FlowRttPorts(server42FlowPorts);
        List<Integer> islPorts = islRepository.findBySrcSwitch(switchId).stream().map(isl -> isl.getSrcPort()).collect(Collectors.toList());
        data.setIslPorts(islPorts);
    }
    carrier.sendCommandToSpeaker(key, data);
}
Also used : InfoMessage(org.openkilda.messaging.info.InfoMessage) FlowPath(org.openkilda.model.FlowPath) KildaFeatureTogglesRepository(org.openkilda.persistence.repositories.KildaFeatureTogglesRepository) SwitchRulesDeleteRequest(org.openkilda.messaging.command.switches.SwitchRulesDeleteRequest) SwitchRulesInstallRequest(org.openkilda.messaging.command.switches.SwitchRulesInstallRequest) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) SwitchRuleService(org.openkilda.wfm.topology.switchmanager.service.SwitchRuleService) KildaFeatureToggles(org.openkilda.model.KildaFeatureToggles) SwitchManagerCarrier(org.openkilda.wfm.topology.switchmanager.service.SwitchManagerCarrier) IslRepository(org.openkilda.persistence.repositories.IslRepository) SwitchProperties(org.openkilda.model.SwitchProperties) ErrorType(org.openkilda.messaging.error.ErrorType) FlowPathRepository(org.openkilda.persistence.repositories.FlowPathRepository) Collection(java.util.Collection) Set(java.util.Set) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) RepositoryFactory(org.openkilda.persistence.repositories.RepositoryFactory) SwitchPropertiesRepository(org.openkilda.persistence.repositories.SwitchPropertiesRepository) List(java.util.List) SwitchId(org.openkilda.model.SwitchId) SwitchRulesResponse(org.openkilda.messaging.info.switches.SwitchRulesResponse) Optional(java.util.Optional) ErrorData(org.openkilda.messaging.error.ErrorData) SwitchRepository(org.openkilda.persistence.repositories.SwitchRepository) ErrorMessage(org.openkilda.messaging.error.ErrorMessage) ArrayList(java.util.ArrayList) SwitchId(org.openkilda.model.SwitchId) KildaFeatureToggles(org.openkilda.model.KildaFeatureToggles) ErrorMessage(org.openkilda.messaging.error.ErrorMessage) FlowPath(org.openkilda.model.FlowPath) ErrorData(org.openkilda.messaging.error.ErrorData) SwitchProperties(org.openkilda.model.SwitchProperties) HashSet(java.util.HashSet)

Aggregations

SwitchRulesDeleteRequest (org.openkilda.messaging.command.switches.SwitchRulesDeleteRequest)8 SwitchRulesResponse (org.openkilda.messaging.info.switches.SwitchRulesResponse)6 CommandMessage (org.openkilda.messaging.command.CommandMessage)4 SwitchRulesInstallRequest (org.openkilda.messaging.command.switches.SwitchRulesInstallRequest)3 InfoMessage (org.openkilda.messaging.info.InfoMessage)3 ArrayList (java.util.ArrayList)2 ISwitchManager (org.openkilda.floodlight.switchmanager.ISwitchManager)2 CommandData (org.openkilda.messaging.command.CommandData)2 DeleteRulesAction (org.openkilda.messaging.command.switches.DeleteRulesAction)2 ErrorData (org.openkilda.messaging.error.ErrorData)2 ErrorMessage (org.openkilda.messaging.error.ErrorMessage)2 DatapathId (org.projectfloodlight.openflow.types.DatapathId)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 String.format (java.lang.String.format)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Optional (java.util.Optional)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1