use of com.woorea.openstack.quantum.Quantum in project AJSC by att.
the class OpenStackNetworkService method createPort.
/**
* @see com.att.cdp.zones.NetworkService#createPort(com.att.cdp.zones.model.Subnet)
*/
@Override
public Port createPort(Subnet subnet) throws ZoneException {
this.checkArg(subnet, "subnet");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.PORT, subnet.getName());
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
com.woorea.openstack.quantum.model.Port port = new com.woorea.openstack.quantum.model.Port();
try {
Quantum client = quantumConnector.getClient();
port.setNetworkId(subnet.getNetwork());
// List<com.woorea.openstack.quantum.model.Port.Ip> ips = new ArrayList<>();
// com.woorea.openstack.quantum.model.Port.Ip ip = new com.woorea.openstack.quantum.model.Port.Ip();
// ip.setSubnetId(subnet.getId());
// ips.add(ip);
// port.setList(ips);
port = client.ports().create(port).execute();
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return new OpenStackPort(context, port);
}
use of com.woorea.openstack.quantum.Quantum 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.woorea.openstack.quantum.Quantum 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.woorea.openstack.quantum.Quantum in project AJSC by att.
the class OpenStackNetworkService method getLoadBalancerPools.
/**
* @see com.att.cdp.zones.NetworkService#getLoadBalancerPools()
*/
@Override
public List<LoadBalancerPool> getLoadBalancerPools() throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
ArrayList<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()) {
list.add(new OpenStackLoadBalancerPool(context, loadBalancerPool));
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
use of com.woorea.openstack.quantum.Quantum in project AJSC by att.
the class OpenStackNetworkService method createLoadBalancerPool.
/**
* @see com.att.cdp.zones.NetworkService#createLoadBalancerPool(com.att.cdp.zones.model.LoadBalancerPool)
*/
@Override
public LoadBalancerPool createLoadBalancerPool(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().create(loadBalancerPoolToCreate).execute();
return new OpenStackLoadBalancerPool(context, openstackLbPool);
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return null;
}
Aggregations