Search in sources :

Example 1 with DeleteLagPortRequest

use of org.openkilda.messaging.swmanager.request.DeleteLagPortRequest in project open-kilda by telstra.

the class SwitchServiceImpl method deleteLagPort.

@Override
public CompletableFuture<LagPortDto> deleteLagPort(SwitchId switchId, Integer logicalPortNumber) {
    logger.info("Removing Link aggregation group {} on switch {}", logicalPortNumber, switchId);
    DeleteLagPortRequest data = new DeleteLagPortRequest(switchId, logicalPortNumber);
    CommandMessage request = new CommandMessage(data, System.currentTimeMillis(), RequestCorrelationId.getId());
    return messagingChannel.sendAndGet(switchManagerTopic, request).thenApply(LagPortResponse.class::cast).thenApply(lagPortMapper::map);
}
Also used : DeleteLagPortRequest(org.openkilda.messaging.swmanager.request.DeleteLagPortRequest) CommandMessage(org.openkilda.messaging.command.CommandMessage)

Example 2 with DeleteLagPortRequest

use of org.openkilda.messaging.swmanager.request.DeleteLagPortRequest in project open-kilda by telstra.

the class SwitchManagerHub method onRequest.

@Override
protected void onRequest(Tuple input) throws PipelineException {
    if (!active) {
        log.info("Switch Manager Topology is inactive");
        return;
    }
    String key = input.getStringByField(MessageKafkaTranslator.FIELD_ID_KEY);
    CommandMessage message = pullValue(input, MessageKafkaTranslator.FIELD_ID_PAYLOAD, CommandMessage.class);
    CommandData data = message.getData();
    if (data instanceof SwitchValidateRequest) {
        validateService.handleSwitchValidateRequest(key, (SwitchValidateRequest) data);
    } else if (data instanceof SwitchRulesDeleteRequest) {
        switchRuleService.deleteRules(key, (SwitchRulesDeleteRequest) data);
    } else if (data instanceof SwitchRulesInstallRequest) {
        switchRuleService.installRules(key, (SwitchRulesInstallRequest) data);
    } else if (data instanceof CreateLagPortRequest) {
        createLagPortService.handleCreateLagRequest(key, (CreateLagPortRequest) data);
    } else if (data instanceof DeleteLagPortRequest) {
        deleteLagPortService.handleDeleteLagRequest(key, (DeleteLagPortRequest) data);
    } else {
        log.warn("Receive unexpected CommandMessage for key {}: {}", key, data);
    }
}
Also used : SwitchRulesInstallRequest(org.openkilda.messaging.command.switches.SwitchRulesInstallRequest) CreateLagPortRequest(org.openkilda.messaging.swmanager.request.CreateLagPortRequest) DeleteLagPortRequest(org.openkilda.messaging.swmanager.request.DeleteLagPortRequest) SwitchRulesDeleteRequest(org.openkilda.messaging.command.switches.SwitchRulesDeleteRequest) SwitchValidateRequest(org.openkilda.messaging.command.switches.SwitchValidateRequest) CommandData(org.openkilda.messaging.command.CommandData) CommandMessage(org.openkilda.messaging.command.CommandMessage)

Aggregations

CommandMessage (org.openkilda.messaging.command.CommandMessage)2 DeleteLagPortRequest (org.openkilda.messaging.swmanager.request.DeleteLagPortRequest)2 CommandData (org.openkilda.messaging.command.CommandData)1 SwitchRulesDeleteRequest (org.openkilda.messaging.command.switches.SwitchRulesDeleteRequest)1 SwitchRulesInstallRequest (org.openkilda.messaging.command.switches.SwitchRulesInstallRequest)1 SwitchValidateRequest (org.openkilda.messaging.command.switches.SwitchValidateRequest)1 CreateLagPortRequest (org.openkilda.messaging.swmanager.request.CreateLagPortRequest)1