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;
}
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;
}
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;
}
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;
}
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);
}
}
Aggregations