use of com.woorea.openstack.quantum.api.NetworksResource in project AJSC by att.
the class OpenStackNetworkService method getNetworks.
/**
* @see com.att.cdp.zones.NetworkService#getNetworks()
*/
@SuppressWarnings("nls")
@Override
public List<Network> getNetworks() throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
ArrayList<Network> list = new ArrayList<>();
try {
Quantum client = quantumConnector.getClient();
NetworksResource resource = client.networks();
for (com.woorea.openstack.quantum.model.Network net : resource.list().execute()) {
list.add(new OpenStackNetwork(context, net));
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
use of com.woorea.openstack.quantum.api.NetworksResource in project AJSC by att.
the class OpenStackNetworkService method getNetworksByName.
/**
* @see com.att.cdp.zones.NetworkService#getNetworksByName(java.lang.String)
*/
@SuppressWarnings("nls")
@Override
public List<Network> getNetworksByName(String name) throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.NETWORK, name);
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
List<Network> list = new ArrayList<>();
try {
Quantum client = quantumConnector.getClient();
NetworksResource resource = client.networks();
for (com.woorea.openstack.quantum.model.Network net : resource.list().execute()) {
if (net.getName().equals(name)) {
list.add(new OpenStackNetwork(context, net));
}
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
Aggregations