Search in sources :

Example 1 with DeleterMeterForSwitchManagerRequest

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

the class SwitchSyncFsm method sendMetersCommands.

protected void sendMetersCommands(SwitchSyncState from, SwitchSyncState to, SwitchSyncEvent event, Object context) {
    if (excessMeters.isEmpty() && misconfiguredMeters.isEmpty()) {
        log.info("Nothing to do with meters (switch={}, key={})", switchId, key);
        fire(NEXT);
        return;
    }
    if (!excessMeters.isEmpty()) {
        log.info("Request to remove switch meters has been sent (switch={}, key={})", switchId, key);
        excessMetersPendingResponsesCount = excessMeters.size();
        for (Long meterId : excessMeters) {
            carrier.sendCommandToSpeaker(key, new DeleterMeterForSwitchManagerRequest(switchId, meterId));
        }
    }
    if (!misconfiguredMeters.isEmpty()) {
        log.info("Request to modify switch meters has been sent (switch={}, key={})", switchId, key);
        misconfiguredMetersPendingResponsesCount = misconfiguredMeters.size();
        for (ModifyDefaultMeterForSwitchManagerRequest request : misconfiguredMeters) {
            carrier.sendCommandToSpeaker(key, request);
        }
    }
}
Also used : ModifyDefaultMeterForSwitchManagerRequest(org.openkilda.messaging.command.flow.ModifyDefaultMeterForSwitchManagerRequest) DeleterMeterForSwitchManagerRequest(org.openkilda.messaging.command.switches.DeleterMeterForSwitchManagerRequest)

Example 2 with DeleterMeterForSwitchManagerRequest

use of org.openkilda.messaging.command.switches.DeleterMeterForSwitchManagerRequest 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)

Aggregations

ModifyDefaultMeterForSwitchManagerRequest (org.openkilda.messaging.command.flow.ModifyDefaultMeterForSwitchManagerRequest)2 DeleterMeterForSwitchManagerRequest (org.openkilda.messaging.command.switches.DeleterMeterForSwitchManagerRequest)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 AliveRequest (org.openkilda.messaging.AliveRequest)1 BroadcastWrapper (org.openkilda.messaging.command.BroadcastWrapper)1 CommandData (org.openkilda.messaging.command.CommandData)1 DiscoverIslCommandData (org.openkilda.messaging.command.discovery.DiscoverIslCommandData)1 DiscoverPathCommandData (org.openkilda.messaging.command.discovery.DiscoverPathCommandData)1 NetworkCommandData (org.openkilda.messaging.command.discovery.NetworkCommandData)1 PortsCommandData (org.openkilda.messaging.command.discovery.PortsCommandData)1 DeleteMeterRequest (org.openkilda.messaging.command.flow.DeleteMeterRequest)1 InstallFlowForSwitchManagerRequest (org.openkilda.messaging.command.flow.InstallFlowForSwitchManagerRequest)1 MeterModifyCommandRequest (org.openkilda.messaging.command.flow.MeterModifyCommandRequest)1 ModifyFlowMeterForSwitchManagerRequest (org.openkilda.messaging.command.flow.ModifyFlowMeterForSwitchManagerRequest)1 ReinstallDefaultFlowForSwitchManagerRequest (org.openkilda.messaging.command.flow.ReinstallDefaultFlowForSwitchManagerRequest)1 RemoveFlowForSwitchManagerRequest (org.openkilda.messaging.command.flow.RemoveFlowForSwitchManagerRequest)1 DeleteGroupRequest (org.openkilda.messaging.command.switches.DeleteGroupRequest)1 DumpGroupsForFlowHsRequest (org.openkilda.messaging.command.switches.DumpGroupsForFlowHsRequest)1 DumpGroupsForSwitchManagerRequest (org.openkilda.messaging.command.switches.DumpGroupsForSwitchManagerRequest)1 DumpMetersForFlowHsRequest (org.openkilda.messaging.command.switches.DumpMetersForFlowHsRequest)1