Search in sources :

Example 91 with OpenStackBaseException

use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.

the class OpenStackNetworkService method getFloatingIpPools.

/**
 * @see com.att.cdp.zones.NetworkService#getFloatingIpPools()
 */
@SuppressWarnings("nls")
@Override
public List<String> getFloatingIpPools() throws ZoneException {
    HashSet<String> pools = new HashSet<>();
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, novaConnector.getEndpoint());
    FloatingIpsExtension extension = novaConnector.getClient().floatingIps();
    if (extension == null) {
        throw new NotSupportedException(EELFResourceManager.format(OSMsg.PAL_OS_UNSUPPORTED_OPERATION, "getAvailableAddresses", context.getProvider().getName()));
    }
    try {
        for (FloatingIp ip : extension.list().execute()) {
            if (!pools.contains(ip.getPool())) {
                pools.add(ip.getPool());
            }
        }
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
    return Collections.list(Collections.enumeration(pools));
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) FloatingIpsExtension(com.woorea.openstack.nova.api.extensions.FloatingIpsExtension) NotSupportedException(com.att.cdp.exceptions.NotSupportedException) FloatingIp(com.woorea.openstack.nova.model.FloatingIp) HashSet(java.util.HashSet)

Example 92 with OpenStackBaseException

use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.

the class OpenStackNetworkService method disassociateLoadBalancerHealthMonitorWithPool.

/**
 * @see com.att.cdp.zones.NetworkService#disassociateLoadBalancerHealthMonitorWithPool(java.lang.String,
 *      java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public void disassociateLoadBalancerHealthMonitorWithPool(String poolId, String healthMonitorId) throws ZoneException {
    checkArg(poolId, "poolId");
    checkArg(healthMonitorId, "healthMonitorId");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.LOADBALANCERPOOL, poolId);
    RequestState.put(RequestState.LOADBALANCERHEALTHMONITOR, healthMonitorId);
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    try {
        Quantum client = quantumConnector.getClient();
        client.lbaas().Pool().disassociateMonitor(poolId, healthMonitorId).execute();
    } catch (OpenStackBaseException e) {
        ExceptionMapper.mapException(e);
    }
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) Quantum(com.woorea.openstack.quantum.Quantum) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException)

Example 93 with OpenStackBaseException

use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.

the class OpenStackNetworkService method getLoadBalancerListenerById.

/**
 * @see com.att.cdp.zones.NetworkService#getLoadBalancerListenerById(java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public LoadBalancerListener getLoadBalancerListenerById(String id) throws ZoneException {
    checkArg(id, "id");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.LOADBALANCERLISTENER, id);
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    try {
        com.woorea.openstack.quantum.model.LoadBalancerVIP n = quantumConnector.getClient().lbaas().VIP().show(id).execute();
        return new OpenStackLoadBalancerVIP(context, n);
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
    return null;
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) OpenStackLoadBalancerVIP(com.att.cdp.openstack.model.OpenStackLoadBalancerVIP)

Example 94 with OpenStackBaseException

use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.

the class OpenStackNetworkService method getSubnetsByName.

/**
 * @see com.att.cdp.zones.NetworkService#getSubnetsByName(java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public List<Subnet> getSubnetsByName(String name) throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SUBNET, name);
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    List<Subnet> list = new ArrayList<>();
    try {
        Quantum client = quantumConnector.getClient();
        SubnetsResource resource = client.subnets();
        for (com.woorea.openstack.quantum.model.Subnet net : resource.list().execute()) {
            if (net.getName().equals(name)) {
                list.add(new OpenStackSubnet(context, net));
            }
        }
    } catch (OpenStackBaseException e) {
        ExceptionMapper.mapException(e);
    }
    return list;
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) Quantum(com.woorea.openstack.quantum.Quantum) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) SubnetsResource(com.woorea.openstack.quantum.api.SubnetsResource) ArrayList(java.util.ArrayList) OpenStackSubnet(com.att.cdp.openstack.model.OpenStackSubnet) OpenStackSubnet(com.att.cdp.openstack.model.OpenStackSubnet) Subnet(com.att.cdp.zones.model.Subnet)

Example 95 with OpenStackBaseException

use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.

the class OpenStackNetworkService method getPort.

/**
 * @see com.att.cdp.zones.NetworkService#getPort(java.lang.String)
 */
@Override
public Port getPort(String id) throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    RequestState.put(RequestState.PORT, id);
    com.woorea.openstack.quantum.model.Port p = null;
    try {
        Quantum client = quantumConnector.getClient();
        PortsResource resource = client.ports();
        p = resource.show(id).execute();
    } catch (OpenStackBaseException e) {
        ExceptionMapper.mapException(e);
    }
    return new OpenStackPort(context, p);
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) Quantum(com.woorea.openstack.quantum.Quantum) OpenStackPort(com.att.cdp.openstack.model.OpenStackPort) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) PortsResource(com.woorea.openstack.quantum.api.PortsResource)

Aggregations

OpenStackBaseException (com.woorea.openstack.base.client.OpenStackBaseException)151 OpenStackContext (com.att.cdp.openstack.OpenStackContext)140 Context (com.att.cdp.zones.Context)140 ArrayList (java.util.ArrayList)54 Quantum (com.woorea.openstack.quantum.Quantum)36 OpenStackSnapshot (com.att.cdp.openstack.model.OpenStackSnapshot)18 ZoneException (com.att.cdp.exceptions.ZoneException)15 OpenStackServer (com.att.cdp.openstack.model.OpenStackServer)14 Server (com.att.cdp.zones.model.Server)11 ConnectedServer (com.att.cdp.zones.spi.model.ConnectedServer)11 HashMap (java.util.HashMap)11 ResourceNotFoundException (com.att.cdp.exceptions.ResourceNotFoundException)10 Snapshot (com.att.cdp.zones.model.Snapshot)10 OpenStackACL (com.att.cdp.openstack.model.OpenStackACL)8 OpenStackImage (com.att.cdp.openstack.model.OpenStackImage)8 OpenStackPort (com.att.cdp.openstack.model.OpenStackPort)8 OpenStackVolume (com.att.cdp.openstack.model.OpenStackVolume)8 OpenStackNetwork (com.att.cdp.openstack.model.OpenStackNetwork)7 Network (com.att.cdp.zones.model.Network)7 Port (com.att.cdp.zones.model.Port)7