Search in sources :

Example 26 with Quantum

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

the class OpenStackNetworkService method createPort.

/**
 * @see com.att.cdp.zones.NetworkService#createPort(com.att.cdp.zones.model.Subnet)
 */
@Override
public Port createPort(Subnet subnet) throws ZoneException {
    this.checkArg(subnet, "subnet");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.PORT, subnet.getName());
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    com.woorea.openstack.quantum.model.Port port = new com.woorea.openstack.quantum.model.Port();
    try {
        Quantum client = quantumConnector.getClient();
        port.setNetworkId(subnet.getNetwork());
        // List<com.woorea.openstack.quantum.model.Port.Ip> ips = new ArrayList<>();
        // com.woorea.openstack.quantum.model.Port.Ip ip = new com.woorea.openstack.quantum.model.Port.Ip();
        // ip.setSubnetId(subnet.getId());
        // ips.add(ip);
        // port.setList(ips);
        port = client.ports().create(port).execute();
    } catch (OpenStackBaseException e) {
        ExceptionMapper.mapException(e);
    }
    return new OpenStackPort(context, port);
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) Quantum(com.woorea.openstack.quantum.Quantum) OpenStackPort(com.att.cdp.openstack.model.OpenStackPort) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) Port(com.att.cdp.zones.model.Port) OpenStackPort(com.att.cdp.openstack.model.OpenStackPort)

Example 27 with Quantum

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

the class OpenStackNetworkService method getVLANTransparency.

/**
 * @see com.att.cdp.zones.NetworkService#getVLANTransparency()
 */
@SuppressWarnings("nls")
@Override
public List<Network> getVLANTransparency() 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();
        VLANResource resource = client.vlans();
        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) VLANResource(com.woorea.openstack.quantum.api.VLANResource) OpenStackNetwork(com.att.cdp.openstack.model.OpenStackNetwork)

Example 28 with Quantum

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

the class OpenStackNetworkService method getNetworksByName.

/**
 * @see com.att.cdp.zones.NetworkService#getNetworksByName(java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public List<Network> getNetworksByName(String name) throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.NETWORK, name);
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    List<Network> list = new ArrayList<>();
    try {
        Quantum client = quantumConnector.getClient();
        NetworksResource resource = client.networks();
        for (com.woorea.openstack.quantum.model.Network net : resource.list().execute()) {
            if (net.getName().equals(name)) {
                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 29 with Quantum

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

the class OpenStackNetworkService method getLoadBalancerPools.

/**
 * @see com.att.cdp.zones.NetworkService#getLoadBalancerPools()
 */
@Override
public List<LoadBalancerPool> getLoadBalancerPools() throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    ArrayList<LoadBalancerPool> list = new ArrayList<>();
    try {
        Quantum client = quantumConnector.getClient();
        LoadBalancerResource.Pool resource = client.lbaas().Pool();
        for (com.woorea.openstack.quantum.model.LoadBalancerPool loadBalancerPool : resource.list().execute()) {
            list.add(new OpenStackLoadBalancerPool(context, loadBalancerPool));
        }
    } 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) OpenStackLoadBalancerPool(com.att.cdp.openstack.model.OpenStackLoadBalancerPool) OpenStackLoadBalancerPool(com.att.cdp.openstack.model.OpenStackLoadBalancerPool) LoadBalancerPool(com.att.cdp.zones.model.LoadBalancerPool) Quantum(com.woorea.openstack.quantum.Quantum)

Example 30 with Quantum

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

the class OpenStackNetworkService method createLoadBalancerPool.

/**
 * @see com.att.cdp.zones.NetworkService#createLoadBalancerPool(com.att.cdp.zones.model.LoadBalancerPool)
 */
@Override
public LoadBalancerPool createLoadBalancerPool(LoadBalancerPool loadBalancerPool) throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.LOADBALANCERPOOL, loadBalancerPool.getName());
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    try {
        Quantum client = quantumConnector.getClient();
        com.woorea.openstack.quantum.model.LoadBalancerPool loadBalancerPoolToCreate = new com.woorea.openstack.quantum.model.LoadBalancerPool();
        loadBalancerPoolToCreate.setName(loadBalancerPool.getName());
        if (loadBalancerPool.getProtocol() != null) {
            loadBalancerPoolToCreate.setProtocol(loadBalancerPool.getProtocol().name());
        }
        loadBalancerPoolToCreate.setSubnetId(loadBalancerPool.getSubnetId());
        if (loadBalancerPool.getLbAlgorithm() != null) {
            loadBalancerPoolToCreate.setMethod(loadBalancerPool.getLbAlgorithm().name());
        }
        com.woorea.openstack.quantum.model.LoadBalancerPool openstackLbPool = client.lbaas().Pool().create(loadBalancerPoolToCreate).execute();
        return new OpenStackLoadBalancerPool(context, openstackLbPool);
    } 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) OpenStackLoadBalancerPool(com.att.cdp.openstack.model.OpenStackLoadBalancerPool) OpenStackLoadBalancerPool(com.att.cdp.openstack.model.OpenStackLoadBalancerPool) LoadBalancerPool(com.att.cdp.zones.model.LoadBalancerPool)

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