use of com.woorea.openstack.quantum.Quantum in project AJSC by att.
the class OpenStackNetworkService method getSubnetsByName.
/**
* @see com.att.cdp.zones.NetworkService#getSubnetsByName(java.lang.String)
*/
@SuppressWarnings("nls")
@Override
public List<Subnet> getSubnetsByName(String name) throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SUBNET, name);
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
List<Subnet> list = new ArrayList<>();
try {
Quantum client = quantumConnector.getClient();
SubnetsResource resource = client.subnets();
for (com.woorea.openstack.quantum.model.Subnet net : resource.list().execute()) {
if (net.getName().equals(name)) {
list.add(new OpenStackSubnet(context, net));
}
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
use of com.woorea.openstack.quantum.Quantum in project AJSC by att.
the class OpenStackNetworkService method getPort.
/**
* @see com.att.cdp.zones.NetworkService#getPort(java.lang.String)
*/
@Override
public Port getPort(String id) throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
RequestState.put(RequestState.PORT, id);
com.woorea.openstack.quantum.model.Port p = null;
try {
Quantum client = quantumConnector.getClient();
PortsResource resource = client.ports();
p = resource.show(id).execute();
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return new OpenStackPort(context, p);
}
use of com.woorea.openstack.quantum.Quantum 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.quantum.Quantum 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.quantum.Quantum 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);
}
}
Aggregations