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