use of com.att.cdp.zones.Context 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.zones.Context in project AJSC by att.
the class OpenStackNetworkService method deletePort.
/**
* @see com.att.cdp.zones.NetworkService#deletePort(com.att.cdp.zones.model.Port)
*/
@Override
public void deletePort(Port port) throws ZoneException {
this.checkArg(port, "port");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.PORT, port.getId());
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
try {
Quantum client = quantumConnector.getClient();
client.ports().delete(port.getId()).execute();
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
}
use of com.att.cdp.zones.Context 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.att.cdp.zones.Context in project AJSC by att.
the class OpenStackNetworkService method associateLoadBalancerHealthMonitorWithPool.
/**
* @see com.att.cdp.zones.NetworkService#associateLoadBalancerHealthMonitorWithPool(java.lang.String,
* java.lang.String)
*/
@SuppressWarnings("nls")
@Override
public void associateLoadBalancerHealthMonitorWithPool(String poolId, String healthMonitorId) throws ZoneException {
checkArg(poolId, "poolId");
checkArg(healthMonitorId, "healthMonitorId");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.LOADBALANCERPOOL, poolId);
RequestState.put(RequestState.LOADBALANCERHEALTHMONITOR, healthMonitorId);
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
try {
Quantum client = quantumConnector.getClient();
client.lbaas().Pool().associateMonitor(poolId, healthMonitorId).execute();
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
}
use of com.att.cdp.zones.Context in project AJSC by att.
the class OpenStackNetworkService method getLoadBalancerMembers.
/**
* @see com.att.cdp.zones.NetworkService#getLoadBalancerMembers()
*/
@Override
public List<LoadBalancerMember> getLoadBalancerMembers() throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Network");
RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
ArrayList<LoadBalancerMember> list = new ArrayList<>();
try {
Quantum client = quantumConnector.getClient();
LoadBalancerResource.Member resource = client.lbaas().Member();
for (com.woorea.openstack.quantum.model.LoadBalancerMember loadBalancerMember : resource.list().execute()) {
list.add(new OpenStackLoadBalancerMember(context, loadBalancerMember));
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
Aggregations