use of org.openkilda.messaging.command.switches.ModifyGroupRequest in project open-kilda by telstra.
the class RecordHandler method doModifyGroupRequest.
private void doModifyGroupRequest(CommandMessage message) {
SwitchId switchId = ((ModifyGroupRequest) message.getData()).getSwitchId();
MirrorConfig mirrorConfig = ((ModifyGroupRequest) message.getData()).getMirrorConfig();
FlowTransitEncapsulation encapsulation = ((ModifyGroupRequest) message.getData()).getEncapsulation();
SwitchId egressSwitchId = ((ModifyGroupRequest) message.getData()).getEgressSwitchId();
FlowTransitData flowTransitData = null;
if (encapsulation != null) {
flowTransitData = FlowTransitData.builder().ingressSwitchId(switchId).egressSwitchId(egressSwitchId).encapsulation(encapsulation).build();
}
logger.debug("Modify group '{}' for switch '{}'", mirrorConfig.getGroupId().intValue(), switchId);
handleSpeakerCommand(new GroupModifyCommand(new MessageContext(message), switchId, mirrorConfig, flowTransitData));
ModifyGroupResponse response = new ModifyGroupResponse(switchId, mirrorConfig.getGroupId().intValue());
String correlationId = message.getCorrelationId();
InfoMessage infoMessage = new InfoMessage(response, System.currentTimeMillis(), correlationId);
getKafkaProducer().sendMessageAndTrack(context.getKafkaSwitchManagerTopic(), correlationId, infoMessage);
}
use of org.openkilda.messaging.command.switches.ModifyGroupRequest 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);
}
}
use of org.openkilda.messaging.command.switches.ModifyGroupRequest in project open-kilda by telstra.
the class SwitchSyncFsm method sendGroupsCommands.
protected void sendGroupsCommands(SwitchSyncState from, SwitchSyncState to, SwitchSyncEvent event, Object context) {
if (missingGroups.isEmpty() && misconfiguredGroups.isEmpty() && excessGroups.isEmpty()) {
log.info("Nothing to do with groups (switch={}, key={})", switchId, key);
fire(NEXT);
return;
}
if (!missingGroups.isEmpty()) {
log.info("Request to install switch groups has been sent (switch={}, key={})", switchId, key);
missingGroupsPendingResponsesCount = missingGroups.size();
for (GroupInstallContext groupContext : missingGroups) {
carrier.sendCommandToSpeaker(key, new InstallGroupRequest(switchId, groupContext.getMirrorConfig(), groupContext.getEncapsulation(), groupContext.getEgressSwitchId()));
}
}
if (!misconfiguredGroups.isEmpty()) {
log.info("Request to modify switch groups has been sent (switch={}, key={})", switchId, key);
misconfiguredGroupsPendingResponsesCount = misconfiguredGroups.size();
for (GroupInstallContext groupContext : misconfiguredGroups) {
carrier.sendCommandToSpeaker(key, new ModifyGroupRequest(switchId, groupContext.getMirrorConfig(), groupContext.getEncapsulation(), groupContext.getEgressSwitchId()));
}
}
if (!excessGroups.isEmpty()) {
log.info("Request to remove switch groups has been sent (switch={}, key={})", switchId, key);
excessGroupsPendingResponsesCount = excessGroups.size();
for (Integer groupId : excessGroups) {
carrier.sendCommandToSpeaker(key, new DeleteGroupRequest(switchId, new GroupId(groupId)));
}
}
continueIfGroupsSynchronized();
}
Aggregations