use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.
the class OpenStackNetworkService method updateLoadBalancerHealthMonitor.
/**
* @see com.att.cdp.zones.NetworkService#updateLoadBalancerHealthMonitor(com.att.cdp.zones.model.LoadBalancerHealthMonitor)
*/
@SuppressWarnings("nls")
@Override
public LoadBalancerHealthMonitor updateLoadBalancerHealthMonitor(LoadBalancerHealthMonitor loadBalancerHealthMonitor) throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
try {
Quantum client = quantumConnector.getClient();
com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor loadBalancerHealthMonitorToCreate = new com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor();
if (loadBalancerHealthMonitor.getType() != null) {
loadBalancerHealthMonitorToCreate.setType(loadBalancerHealthMonitor.getType().name());
}
loadBalancerHealthMonitorToCreate.setDelay(loadBalancerHealthMonitor.getDelay());
loadBalancerHealthMonitorToCreate.setTimeout(loadBalancerHealthMonitor.getTimeout());
loadBalancerHealthMonitorToCreate.setMaxRetries(loadBalancerHealthMonitor.getMaxRetries());
loadBalancerHealthMonitorToCreate.setUrlPath(loadBalancerHealthMonitor.getUrlPath());
loadBalancerHealthMonitorToCreate.setExpectedCodes(loadBalancerHealthMonitor.getExpectedCodes());
com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor openstackLbMonitor = client.lbaas().HealthMonitor().update(loadBalancerHealthMonitorToCreate).execute();
return new OpenStackLoadBalancerHealthMonitor(context, openstackLbMonitor);
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return null;
}
use of com.woorea.openstack.base.client.OpenStackBaseException 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.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.
the class OpenStackNetworkService method deleteNetwork.
/**
* Delete the specified network using it's id.
*
* @param network
* The network to be deleted.
* @throws ZoneException
* If the network does not exist or cannot be deleted for some reason.
*/
@SuppressWarnings("nls")
@Override
public void deleteNetwork(Network network) throws ZoneException {
checkArg(network, "network");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.NETWORK, network.getId());
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
try {
Quantum client = quantumConnector.getClient();
client.networks().delete(network.getId()).execute();
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
}
use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.
the class OpenStackNetworkService method createPort.
/**
* @see com.att.cdp.zones.NetworkService#createPort(com.att.cdp.zones.model.Subnet)
*/
@Override
public Port createPort(Subnet subnet) throws ZoneException {
this.checkArg(subnet, "subnet");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.PORT, subnet.getName());
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
com.woorea.openstack.quantum.model.Port port = new com.woorea.openstack.quantum.model.Port();
try {
Quantum client = quantumConnector.getClient();
port.setNetworkId(subnet.getNetwork());
// List<com.woorea.openstack.quantum.model.Port.Ip> ips = new ArrayList<>();
// com.woorea.openstack.quantum.model.Port.Ip ip = new com.woorea.openstack.quantum.model.Port.Ip();
// ip.setSubnetId(subnet.getId());
// ips.add(ip);
// port.setList(ips);
port = client.ports().create(port).execute();
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return new OpenStackPort(context, port);
}
use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.
the class OpenStackNetworkService method assignIpAddressFromPool.
/**
* @see com.att.cdp.zones.NetworkService#assignIpAddressFromPool(com.att.cdp.zones.model.Server)
*/
@SuppressWarnings("nls")
@Override
public String assignIpAddressFromPool(Server server) throws ZoneException {
checkArg(server, "server");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVER, server.getName());
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, novaConnector.getEndpoint());
String ip;
try {
ip = reserveFreeFloatingIPAddress(null);
if (ip != null) {
assignIpAddress(server, ip);
return ip;
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
throw new NotSupportedException(EELFResourceManager.format(OSMsg.PAL_OS_RESOURCE_UNAVAILABLE, "Floating IP Address", context.getProvider().getName()));
}
Aggregations