Search in sources :

Example 1 with OpenStackLoadBalancerVIP

use of com.att.cdp.openstack.model.OpenStackLoadBalancerVIP 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 2 with OpenStackLoadBalancerVIP

use of com.att.cdp.openstack.model.OpenStackLoadBalancerVIP 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 3 with OpenStackLoadBalancerVIP

use of com.att.cdp.openstack.model.OpenStackLoadBalancerVIP in project AJSC by att.

the class OpenStackNetworkService method updateLoadBalancerListener.

/**
 * @see com.att.cdp.zones.NetworkService#updateLoadBalancerListener(com.att.cdp.zones.model.LoadBalancerListener)
 */
@Override
public LoadBalancerListener updateLoadBalancerListener(LoadBalancerListener loadBalancerVIP) throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.LOADBALANCERLISTENER, loadBalancerVIP.getName());
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    try {
        Quantum client = quantumConnector.getClient();
        com.woorea.openstack.quantum.model.LoadBalancerVIP loadBalancerVIPToCreate = new com.woorea.openstack.quantum.model.LoadBalancerVIP();
        loadBalancerVIPToCreate.setName(loadBalancerVIP.getName());
        // TODO Description
        loadBalancerVIPToCreate.setSubnetId(loadBalancerVIP.getSubnetId());
        loadBalancerVIPToCreate.setAddress(loadBalancerVIP.getIpAddress());
        if (loadBalancerVIP.getProtocol() != null) {
            loadBalancerVIPToCreate.setProtocol(loadBalancerVIP.getProtocol().name());
        }
        loadBalancerVIPToCreate.setPort(loadBalancerVIP.getProtocolPort());
        loadBalancerVIPToCreate.setPoolId(loadBalancerVIP.getPoolId());
        // TODO session persistence
        loadBalancerVIPToCreate.setConnectionLimit(loadBalancerVIP.getConnectionLimit());
        loadBalancerVIPToCreate.setState(loadBalancerVIP.isAdminStateUp());
        com.woorea.openstack.quantum.model.LoadBalancerVIP openstackLbVip = client.lbaas().VIP().update(loadBalancerVIPToCreate).execute();
        return new OpenStackLoadBalancerVIP(context, openstackLbVip);
    } 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) OpenStackLoadBalancerVIP(com.att.cdp.openstack.model.OpenStackLoadBalancerVIP) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) OpenStackLoadBalancerVIP(com.att.cdp.openstack.model.OpenStackLoadBalancerVIP)

Example 4 with OpenStackLoadBalancerVIP

use of com.att.cdp.openstack.model.OpenStackLoadBalancerVIP in project AJSC by att.

the class OpenStackNetworkService method getLoadBalancerListenerById.

/**
 * @see com.att.cdp.zones.NetworkService#getLoadBalancerListenerById(java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public LoadBalancerListener getLoadBalancerListenerById(String id) throws ZoneException {
    checkArg(id, "id");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.LOADBALANCERLISTENER, id);
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    try {
        com.woorea.openstack.quantum.model.LoadBalancerVIP n = quantumConnector.getClient().lbaas().VIP().show(id).execute();
        return new OpenStackLoadBalancerVIP(context, n);
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
    return null;
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) OpenStackLoadBalancerVIP(com.att.cdp.openstack.model.OpenStackLoadBalancerVIP)

Example 5 with OpenStackLoadBalancerVIP

use of com.att.cdp.openstack.model.OpenStackLoadBalancerVIP in project AJSC by att.

the class OpenStackNetworkService method createLoadBalancerListener.

/**
 * @see com.att.cdp.zones.NetworkService#createLoadBalancerListener(com.att.cdp.zones.model.LoadBalancerListener)
 */
@Override
public LoadBalancerListener createLoadBalancerListener(LoadBalancerListener listener) throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.LOADBALANCERLISTENER, listener.getName());
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    try {
        Quantum client = quantumConnector.getClient();
        com.woorea.openstack.quantum.model.LoadBalancerVIP loadBalancerVIPToCreate = new com.woorea.openstack.quantum.model.LoadBalancerVIP();
        loadBalancerVIPToCreate.setName(listener.getName());
        // TODO Description
        loadBalancerVIPToCreate.setSubnetId(listener.getSubnetId());
        loadBalancerVIPToCreate.setAddress(listener.getIpAddress());
        if (listener.getProtocol() != null) {
            loadBalancerVIPToCreate.setProtocol(listener.getProtocol().name());
        }
        loadBalancerVIPToCreate.setPort(listener.getProtocolPort());
        loadBalancerVIPToCreate.setPoolId(listener.getPoolId());
        // TODO session persistence
        loadBalancerVIPToCreate.setConnectionLimit(listener.getConnectionLimit());
        loadBalancerVIPToCreate.setState(listener.isAdminStateUp());
        com.woorea.openstack.quantum.model.LoadBalancerVIP openstackLbVip = client.lbaas().VIP().create(loadBalancerVIPToCreate).execute();
        return new OpenStackLoadBalancerVIP(context, openstackLbVip);
    } 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) OpenStackLoadBalancerVIP(com.att.cdp.openstack.model.OpenStackLoadBalancerVIP) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) OpenStackLoadBalancerVIP(com.att.cdp.openstack.model.OpenStackLoadBalancerVIP)

Aggregations

OpenStackContext (com.att.cdp.openstack.OpenStackContext)5 OpenStackLoadBalancerVIP (com.att.cdp.openstack.model.OpenStackLoadBalancerVIP)5 Context (com.att.cdp.zones.Context)5 OpenStackBaseException (com.woorea.openstack.base.client.OpenStackBaseException)5 Quantum (com.woorea.openstack.quantum.Quantum)4 LoadBalancerListener (com.att.cdp.zones.model.LoadBalancerListener)2 LoadBalancerResource (com.woorea.openstack.quantum.api.LoadBalancerResource)2 ArrayList (java.util.ArrayList)2