use of com.att.cdp.zones.Context in project AJSC by att.
the class OpenStackNetworkService method deleteSubnet.
/**
* Delete the specified network using it's id.
*
* @param subnet
* The subnet to be deleted.
* @throws ZoneException
* If the network does not exist or cannot be deleted for some reason.
*/
@SuppressWarnings("nls")
@Override
public void deleteSubnet(Subnet subnet) throws ZoneException {
checkArg(subnet, "subnet");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SUBNET, subnet.getId());
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
try {
Quantum client = quantumConnector.getClient();
client.subnets().delete(subnet.getId()).execute();
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
}
use of com.att.cdp.zones.Context in project AJSC by att.
the class OpenStackNetworkService method getLoadBalancerHealthMonitors.
/**
* @see com.att.cdp.zones.NetworkService#getLoadBalancerHealthMonitors()
*/
@Override
public List<LoadBalancerHealthMonitor> getLoadBalancerHealthMonitors() throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
ArrayList<LoadBalancerHealthMonitor> list = new ArrayList<>();
try {
Quantum client = quantumConnector.getClient();
LoadBalancerResource.HealthMonitor resource = client.lbaas().HealthMonitor();
for (com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor loadBalancerHealthMonitor : resource.list().execute()) {
list.add(new OpenStackLoadBalancerHealthMonitor(context, loadBalancerHealthMonitor));
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
use of com.att.cdp.zones.Context in project AJSC by att.
the class OpenStackNetworkService method getRouters.
/**
* @return List<Router>
* @throws ZoneException
* If the context cannot be used to get the list or routers
* @see com.att.cdp.zones.NetworkService#getRouters()
*/
@SuppressWarnings("nls")
@Override
public List<Router> getRouters() throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
ArrayList<Router> list = new ArrayList<>();
try {
Quantum client = quantumConnector.getClient();
RoutersResource resource = client.routers();
for (com.woorea.openstack.quantum.model.Router openstackRouter : resource.list().execute().getList()) {
Router r = new OpenStackRouter(context, openstackRouter);
list.add(r);
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
use of com.att.cdp.zones.Context in project AJSC by att.
the class OpenStackNetworkService method getLoadBalancerHealthMonitorById.
/**
* @see com.att.cdp.zones.NetworkService#getLoadBalancerHealthMonitorById(java.lang.String)
*/
@SuppressWarnings("nls")
@Override
public LoadBalancerHealthMonitor getLoadBalancerHealthMonitorById(String id) throws ZoneException {
checkArg(id, "id");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.LOADBALANCERHEALTHMONITOR, id);
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
try {
com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor n = quantumConnector.getClient().lbaas().HealthMonitor().show(id).execute();
return new OpenStackLoadBalancerHealthMonitor(context, n);
} catch (OpenStackBaseException ex) {
ExceptionMapper.mapException(ex);
}
return null;
}
use of com.att.cdp.zones.Context 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;
}
Aggregations