use of com.att.cdp.openstack.model.OpenStackNetwork 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.att.cdp.openstack.model.OpenStackNetwork in project AJSC by att.
the class OpenStackComputeService method getExtendedNetworks.
/**
* This method returns a list of OS extended network attributes for the supplied tenant.
* <p>
* This lists networks that are available to the tenant. The information in the network list includes extended
* network attributes.
* </p>
*
* @return A list of networks and their extended attributes
* @throws ZoneException
* If the networks and extended attributes cannot be listed
* @see com.att.cdp.zones.ComputeService#getExtendedNetworks()
*/
@Override
public List<Network> getExtendedNetworks() throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
List<Network> list = new ArrayList<>();
try {
com.woorea.openstack.nova.model.Networks extendedNetworks = nova.getClient().networks().listExtended().execute();
for (com.woorea.openstack.nova.model.Network en : extendedNetworks.getList()) {
Network network = new OpenStackNetwork(context, en);
list.add(network);
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
use of com.att.cdp.openstack.model.OpenStackNetwork in project AJSC by att.
the class OpenStackNetworkService method getVLANTransparency.
/**
* @see com.att.cdp.zones.NetworkService#getVLANTransparency()
*/
@SuppressWarnings("nls")
@Override
public List<Network> getVLANTransparency() 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();
VLANResource resource = client.vlans();
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.att.cdp.openstack.model.OpenStackNetwork 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;
}
use of com.att.cdp.openstack.model.OpenStackNetwork in project AJSC by att.
the class OpenStackNetworkService method createNetwork.
@SuppressWarnings("nls")
@Override
public Network createNetwork(Network network) throws ZoneException {
checkArg(network, "network");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.NETWORK, network.getName());
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
try {
Quantum client = quantumConnector.getClient();
com.woorea.openstack.quantum.model.Network netcreate = new com.woorea.openstack.quantum.model.Network();
netcreate.setName(network.getName());
netcreate.setAdminStateUp(true);
com.woorea.openstack.quantum.model.Network openstackNetwork = client.networks().create(netcreate).execute();
return new OpenStackNetwork(context, openstackNetwork);
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return null;
}
Aggregations