Search in sources :

Example 1 with Quantum

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

the class OpenStackNetworkService method createLoadBalancerHealthMonitor.

/**
 * @see com.att.cdp.zones.NetworkService#createLoadBalancerHealthMonitor(com.att.cdp.zones.model.LoadBalancerHealthMonitor)
 */
@Override
public LoadBalancerHealthMonitor createLoadBalancerHealthMonitor(LoadBalancerHealthMonitor loadBalancerHealthMonitor) throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    try {
        Quantum client = quantumConnector.getClient();
        com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor loadBalancerHealthMonitorToCreate = new com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor();
        if (loadBalancerHealthMonitor.getType() != null) {
            loadBalancerHealthMonitorToCreate.setType(loadBalancerHealthMonitor.getType().name());
        }
        loadBalancerHealthMonitorToCreate.setDelay(loadBalancerHealthMonitor.getDelay());
        loadBalancerHealthMonitorToCreate.setTimeout(loadBalancerHealthMonitor.getTimeout());
        loadBalancerHealthMonitorToCreate.setMaxRetries(loadBalancerHealthMonitor.getMaxRetries());
        loadBalancerHealthMonitorToCreate.setUrlPath(loadBalancerHealthMonitor.getUrlPath());
        loadBalancerHealthMonitorToCreate.setExpectedCodes(loadBalancerHealthMonitor.getExpectedCodes());
        com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor openstackLbMonitor = client.lbaas().HealthMonitor().create(loadBalancerHealthMonitorToCreate).execute();
        return new OpenStackLoadBalancerHealthMonitor(context, openstackLbMonitor);
    } 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) OpenStackLoadBalancerHealthMonitor(com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor) LoadBalancerHealthMonitor(com.att.cdp.zones.model.LoadBalancerHealthMonitor) OpenStackLoadBalancerHealthMonitor(com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor)

Example 2 with Quantum

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

the class OpenStackNetworkService method getLoadBalancerListenerByName.

/**
 * @see com.att.cdp.zones.NetworkService#getLoadBalancerListenerByName(java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public List<LoadBalancerListener> getLoadBalancerListenerByName(String name) throws ZoneException {
    checkArg(name, "name");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.LOADBALANCERLISTENER, name);
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    List<LoadBalancerListener> list = new ArrayList<>();
    try {
        Quantum client = quantumConnector.getClient();
        LoadBalancerResource.VIP resource = client.lbaas().VIP();
        for (com.woorea.openstack.quantum.model.LoadBalancerVIP loadBalancerVIP : resource.list().execute()) {
            if (loadBalancerVIP.getName().equals(name)) {
                list.add(new OpenStackLoadBalancerVIP(context, loadBalancerVIP));
            }
        }
    } catch (OpenStackBaseException e) {
        ExceptionMapper.mapException(e);
    }
    return list;
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) LoadBalancerListener(com.att.cdp.zones.model.LoadBalancerListener) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) ArrayList(java.util.ArrayList) LoadBalancerResource(com.woorea.openstack.quantum.api.LoadBalancerResource) Quantum(com.woorea.openstack.quantum.Quantum) OpenStackLoadBalancerVIP(com.att.cdp.openstack.model.OpenStackLoadBalancerVIP)

Example 3 with Quantum

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

the class OpenStackNetworkService method getLoadBalancerListeners.

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

Example 4 with Quantum

use of com.woorea.openstack.quantum.Quantum 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;
}
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) Network(com.att.cdp.zones.model.Network) AbstractNetwork(com.att.cdp.zones.spi.AbstractNetwork) OpenStackNetwork(com.att.cdp.openstack.model.OpenStackNetwork) ArrayList(java.util.ArrayList) OpenStackNetwork(com.att.cdp.openstack.model.OpenStackNetwork) NetworksResource(com.woorea.openstack.quantum.api.NetworksResource)

Example 5 with Quantum

use of com.woorea.openstack.quantum.Quantum 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);
    }
}
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)

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