Search in sources :

Example 1 with CreateLagPortRequest

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

the class SwitchServiceImpl method createLag.

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

Example 2 with CreateLagPortRequest

use of org.openkilda.messaging.swmanager.request.CreateLagPortRequest 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 CreateLagPortRequest (org.openkilda.messaging.swmanager.request.CreateLagPortRequest)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 DeleteLagPortRequest (org.openkilda.messaging.swmanager.request.DeleteLagPortRequest)1