Search in sources :

Example 6 with Quantum

use of com.woorea.openstack.quantum.Quantum 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;
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) Quantum(com.woorea.openstack.quantum.Quantum) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) SubnetsResource(com.woorea.openstack.quantum.api.SubnetsResource) OpenStackSubnet(com.att.cdp.openstack.model.OpenStackSubnet)

Example 7 with Quantum

use of com.woorea.openstack.quantum.Quantum 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);
    }
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) Quantum(com.woorea.openstack.quantum.Quantum) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException)

Example 8 with Quantum

use of com.woorea.openstack.quantum.Quantum 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;
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) ArrayList(java.util.ArrayList) LoadBalancerResource(com.woorea.openstack.quantum.api.LoadBalancerResource) OpenStackLoadBalancerMember(com.att.cdp.openstack.model.OpenStackLoadBalancerMember) LoadBalancerMember(com.att.cdp.zones.model.LoadBalancerMember) Quantum(com.woorea.openstack.quantum.Quantum) OpenStackLoadBalancerMember(com.att.cdp.openstack.model.OpenStackLoadBalancerMember)

Example 9 with Quantum

use of com.woorea.openstack.quantum.Quantum in project AJSC by att.

the class OpenStackNetworkService method deleteSubnet.

/**
 * Delete the specified network using it's id.
 *
 * @param subnet
 *            The subnet to be deleted.
 * @throws ZoneException
 *             If the network does not exist or cannot be deleted for some reason.
 */
@SuppressWarnings("nls")
@Override
public void deleteSubnet(Subnet subnet) throws ZoneException {
    checkArg(subnet, "subnet");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SUBNET, subnet.getId());
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    try {
        Quantum client = quantumConnector.getClient();
        client.subnets().delete(subnet.getId()).execute();
    } catch (OpenStackBaseException e) {
        ExceptionMapper.mapException(e);
    }
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) Quantum(com.woorea.openstack.quantum.Quantum) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException)

Example 10 with Quantum

use of com.woorea.openstack.quantum.Quantum in project AJSC by att.

the class OpenStackNetworkService method getLoadBalancerHealthMonitors.

/**
 * @see com.att.cdp.zones.NetworkService#getLoadBalancerHealthMonitors()
 */
@Override
public List<LoadBalancerHealthMonitor> getLoadBalancerHealthMonitors() throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    ArrayList<LoadBalancerHealthMonitor> list = new ArrayList<>();
    try {
        Quantum client = quantumConnector.getClient();
        LoadBalancerResource.HealthMonitor resource = client.lbaas().HealthMonitor();
        for (com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor loadBalancerHealthMonitor : resource.list().execute()) {
            list.add(new OpenStackLoadBalancerHealthMonitor(context, loadBalancerHealthMonitor));
        }
    } catch (OpenStackBaseException e) {
        ExceptionMapper.mapException(e);
    }
    return list;
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) ArrayList(java.util.ArrayList) OpenStackLoadBalancerHealthMonitor(com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor) LoadBalancerHealthMonitor(com.att.cdp.zones.model.LoadBalancerHealthMonitor) LoadBalancerResource(com.woorea.openstack.quantum.api.LoadBalancerResource) Quantum(com.woorea.openstack.quantum.Quantum) OpenStackLoadBalancerHealthMonitor(com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor)

Aggregations

Quantum (com.woorea.openstack.quantum.Quantum)37 OpenStackContext (com.att.cdp.openstack.OpenStackContext)36 OpenStackBaseException (com.woorea.openstack.base.client.OpenStackBaseException)36 Context (com.att.cdp.zones.Context)35 ArrayList (java.util.ArrayList)15 LoadBalancerResource (com.woorea.openstack.quantum.api.LoadBalancerResource)7 OpenStackLoadBalancerPool (com.att.cdp.openstack.model.OpenStackLoadBalancerPool)5 LoadBalancerPool (com.att.cdp.zones.model.LoadBalancerPool)5 OpenStackLoadBalancerVIP (com.att.cdp.openstack.model.OpenStackLoadBalancerVIP)4 OpenStackNetwork (com.att.cdp.openstack.model.OpenStackNetwork)4 OpenStackSubnet (com.att.cdp.openstack.model.OpenStackSubnet)4 Network (com.att.cdp.zones.model.Network)4 AbstractNetwork (com.att.cdp.zones.spi.AbstractNetwork)4 OpenStackLoadBalancerHealthMonitor (com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor)3 OpenStackLoadBalancerMember (com.att.cdp.openstack.model.OpenStackLoadBalancerMember)3 OpenStackPort (com.att.cdp.openstack.model.OpenStackPort)3 LoadBalancerHealthMonitor (com.att.cdp.zones.model.LoadBalancerHealthMonitor)3 LoadBalancerMember (com.att.cdp.zones.model.LoadBalancerMember)3 Subnet (com.att.cdp.zones.model.Subnet)3 SubnetsResource (com.woorea.openstack.quantum.api.SubnetsResource)3