use of com.att.cdp.openstack.model.OpenStackLoadBalancerVIP in project AJSC by att.
the class OpenStackNetworkService method getLoadBalancerListenerByName.
/**
* @see com.att.cdp.zones.NetworkService#getLoadBalancerListenerByName(java.lang.String)
*/
@SuppressWarnings("nls")
@Override
public List<LoadBalancerListener> getLoadBalancerListenerByName(String name) throws ZoneException {
checkArg(name, "name");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.LOADBALANCERLISTENER, name);
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
List<LoadBalancerListener> list = new ArrayList<>();
try {
Quantum client = quantumConnector.getClient();
LoadBalancerResource.VIP resource = client.lbaas().VIP();
for (com.woorea.openstack.quantum.model.LoadBalancerVIP loadBalancerVIP : resource.list().execute()) {
if (loadBalancerVIP.getName().equals(name)) {
list.add(new OpenStackLoadBalancerVIP(context, loadBalancerVIP));
}
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
use of com.att.cdp.openstack.model.OpenStackLoadBalancerVIP in project AJSC by att.
the class OpenStackNetworkService method getLoadBalancerListeners.
/**
* @see com.att.cdp.zones.NetworkService#getLoadBalancerListeners()
*/
@Override
public List<LoadBalancerListener> getLoadBalancerListeners() throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
ArrayList<LoadBalancerListener> list = new ArrayList<>();
try {
Quantum client = quantumConnector.getClient();
LoadBalancerResource.VIP resource = client.lbaas().VIP();
for (com.woorea.openstack.quantum.model.LoadBalancerVIP loadBalancerVIP : resource.list().execute()) {
list.add(new OpenStackLoadBalancerVIP(context, loadBalancerVIP));
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
use of com.att.cdp.openstack.model.OpenStackLoadBalancerVIP in project AJSC by att.
the class OpenStackNetworkService method updateLoadBalancerListener.
/**
* @see com.att.cdp.zones.NetworkService#updateLoadBalancerListener(com.att.cdp.zones.model.LoadBalancerListener)
*/
@Override
public LoadBalancerListener updateLoadBalancerListener(LoadBalancerListener loadBalancerVIP) throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.LOADBALANCERLISTENER, loadBalancerVIP.getName());
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
try {
Quantum client = quantumConnector.getClient();
com.woorea.openstack.quantum.model.LoadBalancerVIP loadBalancerVIPToCreate = new com.woorea.openstack.quantum.model.LoadBalancerVIP();
loadBalancerVIPToCreate.setName(loadBalancerVIP.getName());
// TODO Description
loadBalancerVIPToCreate.setSubnetId(loadBalancerVIP.getSubnetId());
loadBalancerVIPToCreate.setAddress(loadBalancerVIP.getIpAddress());
if (loadBalancerVIP.getProtocol() != null) {
loadBalancerVIPToCreate.setProtocol(loadBalancerVIP.getProtocol().name());
}
loadBalancerVIPToCreate.setPort(loadBalancerVIP.getProtocolPort());
loadBalancerVIPToCreate.setPoolId(loadBalancerVIP.getPoolId());
// TODO session persistence
loadBalancerVIPToCreate.setConnectionLimit(loadBalancerVIP.getConnectionLimit());
loadBalancerVIPToCreate.setState(loadBalancerVIP.isAdminStateUp());
com.woorea.openstack.quantum.model.LoadBalancerVIP openstackLbVip = client.lbaas().VIP().update(loadBalancerVIPToCreate).execute();
return new OpenStackLoadBalancerVIP(context, openstackLbVip);
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return null;
}
use of com.att.cdp.openstack.model.OpenStackLoadBalancerVIP 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;
}
use of com.att.cdp.openstack.model.OpenStackLoadBalancerVIP in project AJSC by att.
the class OpenStackNetworkService method createLoadBalancerListener.
/**
* @see com.att.cdp.zones.NetworkService#createLoadBalancerListener(com.att.cdp.zones.model.LoadBalancerListener)
*/
@Override
public LoadBalancerListener createLoadBalancerListener(LoadBalancerListener listener) throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.LOADBALANCERLISTENER, listener.getName());
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
try {
Quantum client = quantumConnector.getClient();
com.woorea.openstack.quantum.model.LoadBalancerVIP loadBalancerVIPToCreate = new com.woorea.openstack.quantum.model.LoadBalancerVIP();
loadBalancerVIPToCreate.setName(listener.getName());
// TODO Description
loadBalancerVIPToCreate.setSubnetId(listener.getSubnetId());
loadBalancerVIPToCreate.setAddress(listener.getIpAddress());
if (listener.getProtocol() != null) {
loadBalancerVIPToCreate.setProtocol(listener.getProtocol().name());
}
loadBalancerVIPToCreate.setPort(listener.getProtocolPort());
loadBalancerVIPToCreate.setPoolId(listener.getPoolId());
// TODO session persistence
loadBalancerVIPToCreate.setConnectionLimit(listener.getConnectionLimit());
loadBalancerVIPToCreate.setState(listener.isAdminStateUp());
com.woorea.openstack.quantum.model.LoadBalancerVIP openstackLbVip = client.lbaas().VIP().create(loadBalancerVIPToCreate).execute();
return new OpenStackLoadBalancerVIP(context, openstackLbVip);
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return null;
}
Aggregations