Search in sources :

Example 16 with Context

use of com.att.cdp.zones.Context in project AJSC by att.

the class AbstractVolume method updateVolume.

/**
 * This is a default implementation that is correct for all providers other than VMware. The VMware provider
 * overrides this method. Any other providers that want to implement this method may also override it if needed.
 *
 *    updateVolume method is used to update the size of the volume (only increase)
 */
@Override
public Volume updateVolume(Volume template, Server server) throws ZoneException {
    Context context = getContext();
    Provider provider = context.getProvider();
    throw new NotSupportedException(String.format("Provider %s does not support updateVolume using a volume object as a model", provider.getName()));
}
Also used : Context(com.att.cdp.zones.Context) NotSupportedException(com.att.cdp.exceptions.NotSupportedException) Provider(com.att.cdp.zones.Provider)

Example 17 with Context

use of com.att.cdp.zones.Context in project AJSC by att.

the class ConnectedServer method attachPort.

/**
 * @see com.att.cdp.zones.model.Server#attachPort(com.att.cdp.zones.model.Port)
 */
@Override
public void attachPort(Port nic) throws ZoneException {
    Context context = getContext();
    ComputeService service = context.getComputeService();
    service.attachPort(this, nic);
}
Also used : Context(com.att.cdp.zones.Context) ComputeService(com.att.cdp.zones.ComputeService)

Example 18 with Context

use of com.att.cdp.zones.Context in project AJSC by att.

the class ConnectedServer method rebuild.

/**
 * @see com.att.cdp.zones.model.Server#rebuild(java.lang.String)
 */
@Override
public void rebuild(String snapshot) throws ZoneException {
    Context context = getContext();
    context.getComputeService().rebuildServer(this, snapshot);
}
Also used : Context(com.att.cdp.zones.Context)

Example 19 with Context

use of com.att.cdp.zones.Context in project AJSC by att.

the class ConnectedServer method delete.

/**
 * Delete the specified server using it's id.
 *
 * @throws ZoneException
 *             If the server does not exist or cannot be deleted for some reason.
 */
@Override
public void delete() throws ZoneException {
    Context context = getContext();
    context.getComputeService().deleteServer(this);
}
Also used : Context(com.att.cdp.zones.Context)

Example 20 with Context

use of com.att.cdp.zones.Context in project AJSC by att.

the class OpenStackStackService method getStacks.

/**
 * Obtains a list (unfiltered) of all stacks that exist on the provider and returns them to the caller.
 *
 * @return A list of all stacks that exist. Note that the list may be empty.
 * @throws ZoneException
 *             - If the context is closed, a login has not occurred, or an error happened trying to contact the
 *             provider.
 * @see com.att.cdp.zones.StackService#getStacks()
 */
@Override
public List<Stack> getStacks() throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Orchestration");
    RequestState.put(RequestState.SERVICE_URL, connector.getEndpoint());
    ArrayList<Stack> list = new ArrayList<>();
    Heat heat = connector.getClient();
    StackResource resource = heat.getStacks();
    try {
        /*
             * Get a list of stacks, then call byName api for each one to get the detail for the stack.
             */
        Stacks osStacks = resource.list().execute();
        if (osStacks != null) {
            for (com.woorea.openstack.heat.model.Stack osStack : osStacks) {
                list.add(getStack(osStack.getStackName(), osStack.getId()));
            }
        }
    } catch (OpenStackBaseException e) {
        ExceptionMapper.mapException(e);
    }
    return list;
}
Also used : OpenStackContext(com.att.cdp.openstack.OpenStackContext) Context(com.att.cdp.zones.Context) Heat(com.woorea.openstack.heat.Heat) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) ArrayList(java.util.ArrayList) Stacks(com.woorea.openstack.heat.model.Stacks) Stack(com.att.cdp.zones.model.Stack) AbstractStack(com.att.cdp.zones.spi.AbstractStack) OpenStackStack(com.att.cdp.openstack.model.OpenStackStack) StackResource(com.woorea.openstack.heat.StackResource)

Aggregations

Context (com.att.cdp.zones.Context)248 OpenStackContext (com.att.cdp.openstack.OpenStackContext)167 OpenStackBaseException (com.woorea.openstack.base.client.OpenStackBaseException)140 ArrayList (java.util.ArrayList)55 Ignore (org.junit.Ignore)50 Test (org.junit.Test)47 Quantum (com.woorea.openstack.quantum.Quantum)35 ZoneException (com.att.cdp.exceptions.ZoneException)30 NetworkService (com.att.cdp.zones.NetworkService)24 Server (com.att.cdp.zones.model.Server)22 ComputeService (com.att.cdp.zones.ComputeService)21 Network (com.att.cdp.zones.model.Network)19 OpenStackServer (com.att.cdp.openstack.model.OpenStackServer)18 OpenStackSnapshot (com.att.cdp.openstack.model.OpenStackSnapshot)18 Subnet (com.att.cdp.zones.model.Subnet)15 Port (com.att.cdp.zones.model.Port)14 Snapshot (com.att.cdp.zones.model.Snapshot)12 Volume (com.att.cdp.zones.model.Volume)11 OpenStackResponseException (com.woorea.openstack.base.client.OpenStackResponseException)11 ResourceNotFoundException (com.att.cdp.exceptions.ResourceNotFoundException)10