Search in sources :

Example 31 with OpenStackBaseException

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

the class OpenStackNetworkService method getLoadBalancerHealthMonitors.

/**
 * @see com.att.cdp.zones.NetworkService#getLoadBalancerHealthMonitors()
 */
@Override
public List<LoadBalancerHealthMonitor> getLoadBalancerHealthMonitors() throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    ArrayList<LoadBalancerHealthMonitor> list = new ArrayList<>();
    try {
        Quantum client = quantumConnector.getClient();
        LoadBalancerResource.HealthMonitor resource = client.lbaas().HealthMonitor();
        for (com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor loadBalancerHealthMonitor : resource.list().execute()) {
            list.add(new OpenStackLoadBalancerHealthMonitor(context, loadBalancerHealthMonitor));
        }
    } catch (OpenStackBaseException e) {
        ExceptionMapper.mapException(e);
    }
    return list;
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) ArrayList(java.util.ArrayList) OpenStackLoadBalancerHealthMonitor(com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor) LoadBalancerHealthMonitor(com.att.cdp.zones.model.LoadBalancerHealthMonitor) LoadBalancerResource(com.woorea.openstack.quantum.api.LoadBalancerResource) Quantum(com.woorea.openstack.quantum.Quantum) OpenStackLoadBalancerHealthMonitor(com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor)

Example 32 with OpenStackBaseException

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

the class OpenStackNetworkService method getRouters.

/**
 * @return List<Router>
 * @throws ZoneException
 *             If the context cannot be used to get the list or routers
 * @see com.att.cdp.zones.NetworkService#getRouters()
 */
@SuppressWarnings("nls")
@Override
public List<Router> getRouters() throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    ArrayList<Router> list = new ArrayList<>();
    try {
        Quantum client = quantumConnector.getClient();
        RoutersResource resource = client.routers();
        for (com.woorea.openstack.quantum.model.Router openstackRouter : resource.list().execute().getList()) {
            Router r = new OpenStackRouter(context, openstackRouter);
            list.add(r);
        }
    } 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) ArrayList(java.util.ArrayList) OpenStackRouter(com.att.cdp.openstack.model.OpenStackRouter) Router(com.att.cdp.zones.model.Router) OpenStackRouter(com.att.cdp.openstack.model.OpenStackRouter) RoutersResource(com.woorea.openstack.quantum.api.RoutersResource)

Example 33 with OpenStackBaseException

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

the class OpenStackNetworkService method getLoadBalancerHealthMonitorById.

/**
 * @see com.att.cdp.zones.NetworkService#getLoadBalancerHealthMonitorById(java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public LoadBalancerHealthMonitor getLoadBalancerHealthMonitorById(String id) throws ZoneException {
    checkArg(id, "id");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.LOADBALANCERHEALTHMONITOR, id);
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    try {
        com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor n = quantumConnector.getClient().lbaas().HealthMonitor().show(id).execute();
        return new OpenStackLoadBalancerHealthMonitor(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) OpenStackLoadBalancerHealthMonitor(com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor)

Example 34 with OpenStackBaseException

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

the class OpenStackNetworkService method getLoadBalancerPoolByName.

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

Example 35 with OpenStackBaseException

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

the class OpenStackComputeService method associateACL.

/**
 * @see com.att.cdp.zones.ComputeService#associateACL(java.lang.String,
 *      java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public void associateACL(String serverId, String aclName) throws ZoneException {
    checkArg(serverId, "serverId");
    checkArg(aclName, "aclName");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVER, serverId);
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    try {
        nova.getClient().servers().associateSecurityGroup(serverId, aclName).execute();
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException)

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