Search in sources :

Example 1 with IllegalIslStateException

use of org.openkilda.wfm.error.IllegalIslStateException in project open-kilda by telstra.

the class CacheService method handleGetDataFromCache.

/**
 * Get data about specified ISL from cache.
 *
 * @param roundTripLatency round trip latency info data with source endpoint
 */
public void handleGetDataFromCache(IslRoundTripLatency roundTripLatency) {
    Endpoint source = Endpoint.of(roundTripLatency.getSrcSwitchId(), roundTripLatency.getSrcPortNo());
    Endpoint destination = cache.get(source);
    try {
        if (destination == null) {
            destination = updateCache(source);
        }
        carrier.emitCachedData(roundTripLatency, destination);
    } catch (IslNotFoundException e) {
        log.debug(String.format("Could not update ISL cache: %s", e.getMessage()), e);
    } catch (IllegalIslStateException e) {
        log.error(String.format("Could not update ISL cache: %s", e.getMessage()), e);
    }
}
Also used : Endpoint(org.openkilda.wfm.share.model.Endpoint) IslNotFoundException(org.openkilda.wfm.error.IslNotFoundException) IllegalIslStateException(org.openkilda.wfm.error.IllegalIslStateException)

Example 2 with IllegalIslStateException

use of org.openkilda.wfm.error.IllegalIslStateException in project open-kilda by telstra.

the class LinkOperationsBolt method deleteLink.

private List<IslInfoData> deleteLink(DeleteLinkRequest request) {
    try {
        Collection<Isl> operationsResult = linkOperationsService.deleteIsl(request.getSrcSwitch(), request.getSrcPort(), request.getDstSwitch(), request.getDstPort(), request.isForce());
        List<IslInfoData> responseResult = operationsResult.stream().map(IslMapper.INSTANCE::map).collect(Collectors.toList());
        for (IslInfoData isl : responseResult) {
            DeactivateIslInfoData data = new DeactivateIslInfoData(isl.getSource(), isl.getDestination());
            getOutput().emit(StreamType.DISCO.toString(), getCurrentTuple(), new Values(data, getCorrelationId()));
        }
        return responseResult;
    } catch (IslNotFoundException e) {
        throw new MessageException(ErrorType.NOT_FOUND, e.getMessage(), "ISL was not found.");
    } catch (IllegalIslStateException e) {
        throw new MessageException(ErrorType.REQUEST_INVALID, e.getMessage(), "ISL is in illegal state.");
    }
}
Also used : DeactivateIslInfoData(org.openkilda.messaging.info.event.DeactivateIslInfoData) Isl(org.openkilda.model.Isl) MessageException(org.openkilda.messaging.error.MessageException) Values(org.apache.storm.tuple.Values) IslNotFoundException(org.openkilda.wfm.error.IslNotFoundException) DeactivateIslInfoData(org.openkilda.messaging.info.event.DeactivateIslInfoData) IslInfoData(org.openkilda.messaging.info.event.IslInfoData) IslMapper(org.openkilda.wfm.share.mappers.IslMapper) IllegalIslStateException(org.openkilda.wfm.error.IllegalIslStateException)

Aggregations

IllegalIslStateException (org.openkilda.wfm.error.IllegalIslStateException)2 IslNotFoundException (org.openkilda.wfm.error.IslNotFoundException)2 Values (org.apache.storm.tuple.Values)1 MessageException (org.openkilda.messaging.error.MessageException)1 DeactivateIslInfoData (org.openkilda.messaging.info.event.DeactivateIslInfoData)1 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)1 Isl (org.openkilda.model.Isl)1 IslMapper (org.openkilda.wfm.share.mappers.IslMapper)1 Endpoint (org.openkilda.wfm.share.model.Endpoint)1