Search in sources :

Example 1 with InconsistentDataException

use of org.openkilda.wfm.topology.switchmanager.error.InconsistentDataException in project open-kilda by telstra.

the class CreateLagPortFsm method createLagInDb.

void createLagInDb(CreateLagState from, CreateLagState to, CreateLagEvent event, CreateLagContext context) {
    log.info("Creating LAG {} on switch {}. Key={}", request, switchId, key);
    try {
        HashSet<Integer> targetPorts = new HashSet<>(request.getPortNumbers());
        lagLogicalPortNumber = lagPortOperationService.createLagPort(switchId, targetPorts);
        String ipAddress = lagPortOperationService.getSwitchIpAddress(switchId);
        grpcRequest = new CreateLogicalPortRequest(ipAddress, request.getPortNumbers(), lagLogicalPortNumber, LAG);
    } catch (InvalidDataException | InconsistentDataException | SwitchNotFoundException e) {
        log.error(format("Unable to handle %s. Error: %s", request, e.getMessage()), e);
        fire(ERROR, CreateLagContext.builder().error(e).build());
    }
}
Also used : InvalidDataException(org.openkilda.wfm.topology.switchmanager.error.InvalidDataException) InconsistentDataException(org.openkilda.wfm.topology.switchmanager.error.InconsistentDataException) SwitchNotFoundException(org.openkilda.wfm.topology.switchmanager.error.SwitchNotFoundException) HashSet(java.util.HashSet) CreateLogicalPortRequest(org.openkilda.messaging.command.grpc.CreateLogicalPortRequest)

Example 2 with InconsistentDataException

use of org.openkilda.wfm.topology.switchmanager.error.InconsistentDataException 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());
    }
}
Also used : LagPortNotFoundException(org.openkilda.wfm.topology.switchmanager.error.LagPortNotFoundException) DeleteLogicalPortRequest(org.openkilda.messaging.command.grpc.DeleteLogicalPortRequest) InvalidDataException(org.openkilda.wfm.topology.switchmanager.error.InvalidDataException) SwitchNotFoundException(org.openkilda.wfm.topology.switchmanager.error.SwitchNotFoundException) InconsistentDataException(org.openkilda.wfm.topology.switchmanager.error.InconsistentDataException)

Aggregations

InconsistentDataException (org.openkilda.wfm.topology.switchmanager.error.InconsistentDataException)2 InvalidDataException (org.openkilda.wfm.topology.switchmanager.error.InvalidDataException)2 SwitchNotFoundException (org.openkilda.wfm.topology.switchmanager.error.SwitchNotFoundException)2 HashSet (java.util.HashSet)1 CreateLogicalPortRequest (org.openkilda.messaging.command.grpc.CreateLogicalPortRequest)1 DeleteLogicalPortRequest (org.openkilda.messaging.command.grpc.DeleteLogicalPortRequest)1 LagPortNotFoundException (org.openkilda.wfm.topology.switchmanager.error.LagPortNotFoundException)1