use of org.openkilda.messaging.error.CacheException in project open-kilda by telstra.
the class NetworkCache method deleteSwitch.
/**
* Deletes {@link SwitchInfoData} instance.
*
* @param switchId {@link SwitchInfoData} instance id
* @return removed {@link SwitchInfoData} instance
* @throws CacheException if {@link SwitchInfoData} instance with specified id does not exist
*/
public SwitchInfoData deleteSwitch(String switchId) throws CacheException {
logger.debug("Delete {} switch", switchId);
SwitchInfoData node = switchPool.remove(switchId);
if (node == null) {
throw new CacheException(ErrorType.NOT_FOUND, "Can not delete switch", String.format("Switch %s not found", switchId));
}
network.removeNode(node);
return node;
}
Aggregations