Search in sources :

Example 1 with Interface

use of com.citrix.netscaler.nitro.resource.config.network.Interface in project cloudstack by apache.

the class NetscalerResource method validateInterfaces.

private void validateInterfaces(final String publicInterface, final String privateInterface) throws ExecutionException {
    try {
        if (!_isSdx && !_cloudManaged) {
            final Interface publicIf = Interface.get(_netscalerService, publicInterface);
            final Interface privateIf = Interface.get(_netscalerService, privateInterface);
            if (publicIf != null || privateIf != null) {
                return;
            } else {
                throw new ExecutionException("Invalid interface name specified for public/private interfaces.");
            }
        }
    } catch (final nitro_exception e) {
        if (e.getErrorCode() == NitroError.NS_RESOURCE_NOT_EXISTS) {
            throw new ExecutionException("Invalid interface name specified for public and private interfaces.");
        } else {
            throw new ExecutionException("Failed to verify public interface and private intefaces are valid due to " + e.getMessage());
        }
    } catch (final Exception e) {
        throw new ExecutionException("Failed to verify public interface and private intefaces are valid due to " + e.getMessage());
    }
}
Also used : com.citrix.netscaler.nitro.exception.nitro_exception(com.citrix.netscaler.nitro.exception.nitro_exception) ExecutionException(com.cloud.utils.exception.ExecutionException) Interface(com.citrix.netscaler.nitro.resource.config.network.Interface) ExecutionException(com.cloud.utils.exception.ExecutionException) IOException(java.io.IOException) ConfigurationException(javax.naming.ConfigurationException)

Aggregations

com.citrix.netscaler.nitro.exception.nitro_exception (com.citrix.netscaler.nitro.exception.nitro_exception)1 Interface (com.citrix.netscaler.nitro.resource.config.network.Interface)1 ExecutionException (com.cloud.utils.exception.ExecutionException)1 IOException (java.io.IOException)1 ConfigurationException (javax.naming.ConfigurationException)1