Search in sources :

Example 1 with LoadBalancerPool

use of com.att.cdp.zones.model.LoadBalancerPool 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 2 with LoadBalancerPool

use of com.att.cdp.zones.model.LoadBalancerPool in project AJSC by att.

the class OpenStackNetworkService method updateLoadBalancerPool.

/**
 * @see com.att.cdp.zones.NetworkService#updateLoadBalancerPool(com.att.cdp.zones.model.LoadBalancerPool)
 */
@Override
public LoadBalancerPool updateLoadBalancerPool(LoadBalancerPool loadBalancerPool) throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.LOADBALANCERPOOL, loadBalancerPool.getName());
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    try {
        Quantum client = quantumConnector.getClient();
        com.woorea.openstack.quantum.model.LoadBalancerPool loadBalancerPoolToCreate = new com.woorea.openstack.quantum.model.LoadBalancerPool();
        loadBalancerPoolToCreate.setName(loadBalancerPool.getName());
        if (loadBalancerPool.getProtocol() != null) {
            loadBalancerPoolToCreate.setProtocol(loadBalancerPool.getProtocol().name());
        }
        loadBalancerPoolToCreate.setSubnetId(loadBalancerPool.getSubnetId());
        if (loadBalancerPool.getLbAlgorithm() != null) {
            loadBalancerPoolToCreate.setMethod(loadBalancerPool.getLbAlgorithm().name());
        }
        com.woorea.openstack.quantum.model.LoadBalancerPool openstackLbPool = client.lbaas().Pool().update(loadBalancerPoolToCreate).execute();
        return new OpenStackLoadBalancerPool(context, openstackLbPool);
    } catch (OpenStackBaseException e) {
        ExceptionMapper.mapException(e);
    }
    return null;
}
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) OpenStackLoadBalancerPool(com.att.cdp.openstack.model.OpenStackLoadBalancerPool) OpenStackLoadBalancerPool(com.att.cdp.openstack.model.OpenStackLoadBalancerPool) LoadBalancerPool(com.att.cdp.zones.model.LoadBalancerPool)

Example 3 with LoadBalancerPool

use of com.att.cdp.zones.model.LoadBalancerPool in project AJSC by att.

the class OpenStackNetworkService method getLoadBalancerPools.

/**
 * @see com.att.cdp.zones.NetworkService#getLoadBalancerPools()
 */
@Override
public List<LoadBalancerPool> getLoadBalancerPools() throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    ArrayList<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()) {
            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 4 with LoadBalancerPool

use of com.att.cdp.zones.model.LoadBalancerPool in project AJSC by att.

the class OpenStackNetworkService method createLoadBalancerPool.

/**
 * @see com.att.cdp.zones.NetworkService#createLoadBalancerPool(com.att.cdp.zones.model.LoadBalancerPool)
 */
@Override
public LoadBalancerPool createLoadBalancerPool(LoadBalancerPool loadBalancerPool) throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.LOADBALANCERPOOL, loadBalancerPool.getName());
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    try {
        Quantum client = quantumConnector.getClient();
        com.woorea.openstack.quantum.model.LoadBalancerPool loadBalancerPoolToCreate = new com.woorea.openstack.quantum.model.LoadBalancerPool();
        loadBalancerPoolToCreate.setName(loadBalancerPool.getName());
        if (loadBalancerPool.getProtocol() != null) {
            loadBalancerPoolToCreate.setProtocol(loadBalancerPool.getProtocol().name());
        }
        loadBalancerPoolToCreate.setSubnetId(loadBalancerPool.getSubnetId());
        if (loadBalancerPool.getLbAlgorithm() != null) {
            loadBalancerPoolToCreate.setMethod(loadBalancerPool.getLbAlgorithm().name());
        }
        com.woorea.openstack.quantum.model.LoadBalancerPool openstackLbPool = client.lbaas().Pool().create(loadBalancerPoolToCreate).execute();
        return new OpenStackLoadBalancerPool(context, openstackLbPool);
    } catch (OpenStackBaseException e) {
        ExceptionMapper.mapException(e);
    }
    return null;
}
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) OpenStackLoadBalancerPool(com.att.cdp.openstack.model.OpenStackLoadBalancerPool) OpenStackLoadBalancerPool(com.att.cdp.openstack.model.OpenStackLoadBalancerPool) LoadBalancerPool(com.att.cdp.zones.model.LoadBalancerPool)

Example 5 with LoadBalancerPool

use of com.att.cdp.zones.model.LoadBalancerPool in project AJSC by att.

the class OpenStackNetworkService method deleteLoadBalancerPool.

/**
 * @see com.att.cdp.zones.NetworkService#deleteLoadBalancerPool(com.att.cdp.zones.model.LoadBalancerPool)
 */
@SuppressWarnings("nls")
@Override
public void deleteLoadBalancerPool(LoadBalancerPool loadBalancerPool) throws ZoneException {
    checkArg(loadBalancerPool, "loadBalancerPool");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.LOADBALANCERPOOL, loadBalancerPool.getId());
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    try {
        Quantum client = quantumConnector.getClient();
        LoadBalancerResource.Pool resource = client.lbaas().Pool();
        LoadBalancerResource.Pool.Delete deleRes = resource.delete(loadBalancerPool.getId());
        deleRes.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) OpenStackLoadBalancerPool(com.att.cdp.openstack.model.OpenStackLoadBalancerPool) LoadBalancerPool(com.att.cdp.zones.model.LoadBalancerPool) LoadBalancerResource(com.woorea.openstack.quantum.api.LoadBalancerResource)

Aggregations

Context (com.att.cdp.zones.Context)6 LoadBalancerPool (com.att.cdp.zones.model.LoadBalancerPool)6 OpenStackContext (com.att.cdp.openstack.OpenStackContext)5 OpenStackLoadBalancerPool (com.att.cdp.openstack.model.OpenStackLoadBalancerPool)5 OpenStackBaseException (com.woorea.openstack.base.client.OpenStackBaseException)5 Quantum (com.woorea.openstack.quantum.Quantum)5 LoadBalancerResource (com.woorea.openstack.quantum.api.LoadBalancerResource)3 ArrayList (java.util.ArrayList)2 ZoneException (com.att.cdp.exceptions.ZoneException)1 NetworkService (com.att.cdp.zones.NetworkService)1 LoadBalancerHealthMonitor (com.att.cdp.zones.model.LoadBalancerHealthMonitor)1 LoadBalancerListener (com.att.cdp.zones.model.LoadBalancerListener)1 LoadBalancerMember (com.att.cdp.zones.model.LoadBalancerMember)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1