use of org.openkilda.messaging.command.grpc.DeleteLogicalPortRequest in project open-kilda by telstra.
the class BfdWorker method processPortDeleteRequest.
/**
* Send logical port (BFD) delete request.
*/
public void processPortDeleteRequest(String requestId, Endpoint logical) {
Optional<String> address = lookupSwitchAddress(logical.getDatapath());
if (!address.isPresent()) {
processPortCrudErrorResponse(requestId, logical, makeSwitchAddressNotFoundError(logical.getDatapath()));
return;
}
DeleteLogicalPortRequest request = new DeleteLogicalPortRequest(address.get(), logical.getPortNumber());
emit(STREAM_GRPC_ID, getCurrentTuple(), makeGrpcTuple(requestId, request));
}
use of org.openkilda.messaging.command.grpc.DeleteLogicalPortRequest in project open-kilda by telstra.
the class DeleteLagPortFsm method createGrpcRequest.
void createGrpcRequest(DeleteLagState from, DeleteLagState to, DeleteLagEvent event, DeleteLagContext context) {
log.info("Removing LAG {} on switch {}. Key={}", request, switchId, key);
try {
lagPortOperationService.ensureDeleteIsPossible(switchId, request.getLogicalPortNumber());
String ipAddress = lagPortOperationService.getSwitchIpAddress(switchId);
grpcRequest = new DeleteLogicalPortRequest(ipAddress, request.getLogicalPortNumber());
} catch (LagPortNotFoundException | InvalidDataException | SwitchNotFoundException | InconsistentDataException e) {
log.error(format("Unable to delete LAG logical port %d on switch %s. Error: %s", request.getLogicalPortNumber(), switchId, e.getMessage()), e);
fire(ERROR, DeleteLagContext.builder().error(e).build());
}
}
use of org.openkilda.messaging.command.grpc.DeleteLogicalPortRequest in project open-kilda by telstra.
the class SwitchSyncFsm method sendLogicalPortsCommandsCommands.
protected void sendLogicalPortsCommandsCommands(SwitchSyncState from, SwitchSyncState to, SwitchSyncEvent event, Object context) {
if (missingLogicalPorts.isEmpty() && excessLogicalPorts.isEmpty()) {
log.info("Nothing to do with logical ports (switch={}, key={})", switchId, key);
fire(NEXT);
return;
}
if (!missingLogicalPorts.isEmpty()) {
log.info("Request to install logical ports has been sent (switch={}, key={})", switchId, key);
missingLogicalPortsPendingResponsesCount = missingLogicalPorts.size();
for (CreateLogicalPortRequest createRequest : missingLogicalPorts) {
carrier.sendCommandToSpeaker(key, createRequest);
}
}
if (!excessLogicalPorts.isEmpty()) {
log.info("Request to remove logical ports has been sent (switch={}, key={})", switchId, key);
excessLogicalPortsPendingResponsesCount = excessLogicalPorts.size();
for (DeleteLogicalPortRequest deleteRequest : excessLogicalPorts) {
carrier.sendCommandToSpeaker(key, deleteRequest);
}
}
continueIfLogicalPortsSynchronized();
}
use of org.openkilda.messaging.command.grpc.DeleteLogicalPortRequest in project open-kilda by telstra.
the class MessageProcessor method handleCommandMessage.
private void handleCommandMessage(CommandMessage command, String key) {
CommandData data = command.getData();
String correlationId = command.getCorrelationId();
CompletableFuture<Response> result;
if (data instanceof CreateLogicalPortRequest) {
result = handleCreateLogicalPortRequest((CreateLogicalPortRequest) data);
} else if (data instanceof DumpLogicalPortsRequest) {
result = handleDumpLogicalPortsRequest((DumpLogicalPortsRequest) data);
} else if (data instanceof GetSwitchInfoRequest) {
result = handleGetSwitchInfoRequest((GetSwitchInfoRequest) data);
} else if (data instanceof GetPacketInOutStatsRequest) {
result = handleGetPacketInOutStatsRequest((GetPacketInOutStatsRequest) data);
} else if (data instanceof DeleteLogicalPortRequest) {
result = handleDeleteLogicalPortRequest((DeleteLogicalPortRequest) data);
} else {
result = unhandledMessage(command);
}
result.thenAccept(response -> sendResponse(response, correlationId, key));
}
Aggregations