Search in sources :

Example 36 with Quantum

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

Example 37 with Quantum

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

the class OpenStackNetworkService method updateLoadBalancerMember.

/**
 * @see com.att.cdp.zones.NetworkService#updateLoadBalancerMember(com.att.cdp.zones.model.LoadBalancerMember)
 */
@Override
public LoadBalancerMember updateLoadBalancerMember(LoadBalancerMember loadBalancerMember) 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.LoadBalancerMember loadBalancerMemberToCreate = new com.woorea.openstack.quantum.model.LoadBalancerMember();
        loadBalancerMemberToCreate.setAddress(loadBalancerMember.getAddress());
        loadBalancerMemberToCreate.setPort(loadBalancerMember.getProtocolPort());
        loadBalancerMemberToCreate.setSubnetId(loadBalancerMember.getSubnetId());
        com.woorea.openstack.quantum.model.LoadBalancerMember openstackLbMember = client.lbaas().Member().update(loadBalancerMemberToCreate).execute();
        return new OpenStackLoadBalancerMember(context, openstackLbMember);
    } 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) OpenStackLoadBalancerMember(com.att.cdp.openstack.model.OpenStackLoadBalancerMember) LoadBalancerMember(com.att.cdp.zones.model.LoadBalancerMember) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) OpenStackLoadBalancerMember(com.att.cdp.openstack.model.OpenStackLoadBalancerMember)

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