Search in sources :

Example 11 with ComputeService

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

the class TestSecurityGroups method testAssociations.

@Test
@Ignore
public void testAssociations() throws ZoneException {
    Context context = connect();
    ComputeService service = context.getComputeService();
    String name = "sm974v";
    String server_id = "7d5b3322-6a00-45cd-ae8f-95d985c4148b";
    Server server = service.getServer(server_id);
    service.associateACL(server_id, name);
    server.refresh();
    service.disassociateACL(server_id, name);
    server.refresh();
}
Also used : Context(com.att.cdp.zones.Context) Server(com.att.cdp.zones.model.Server) ComputeService(com.att.cdp.zones.ComputeService) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 12 with ComputeService

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

the class TestTemplates method listTemplates.

/**
 * Verifies that we can list the existing templates on a provider. This test requires that the provider actually has
 * templates installed.
 *
 * @throws ZoneException
 */
@Test
@Ignore
public void listTemplates() throws ZoneException {
    Context context = connect();
    ComputeService service = context.getComputeService();
    List<Template> templates = service.getTemplates();
    assertNotNull(templates);
    assertFalse(templates.isEmpty());
    for (Template template : templates) {
        System.out.println(template.toString());
    }
}
Also used : Context(com.att.cdp.zones.Context) ComputeService(com.att.cdp.zones.ComputeService) Template(com.att.cdp.zones.model.Template) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 13 with ComputeService

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

the class OpenStackServer method loadVolumeAttachments.

/**
 * This method is called to load the volume attachments, if they have not already been loaded. If they have been
 * loaded, then the call is ignored.
 *
 * @param context
 *            The context that represents the connection we are servicing
 * @throws ZoneException
 *             If the attachments cannot be obtained, or if a volume cannot be listed, or a volume does not exist
 */
private void loadVolumeAttachments(Context context) throws ZoneException {
    if (volumeAttachmentsProcessed.compareAndSet(false, true)) {
        VolumeService volumeService = context.getVolumeService();
        ComputeService computeService = context.getComputeService();
        Map<String, String> attachments = computeService.getAttachments(getId());
        for (Entry<String, String> entry : attachments.entrySet()) {
            Volume volume = volumeService.getVolume(entry.getValue());
            getVolumes().put(entry.getKey(), volume);
        }
    }
}
Also used : Volume(com.att.cdp.zones.model.Volume) VolumeService(com.att.cdp.zones.VolumeService) ComputeService(com.att.cdp.zones.ComputeService)

Example 14 with ComputeService

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

the class OpenStackNetworkService method releaseIpAddress.

/**
 * @see com.att.cdp.zones.NetworkService#releaseIpAddress(java.lang.String, java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public void releaseIpAddress(String serverId, String assignedAddress) throws ZoneException {
    checkArg(serverId, "serverId");
    checkArg(assignedAddress, "assignedAddress");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVER, serverId);
    RequestState.put(RequestState.IPADDRESS, assignedAddress);
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, novaConnector.getEndpoint());
    ComputeService compute = context.getComputeService();
    compute.releaseIpAddress(serverId, assignedAddress);
    ((OpenStackContext) context).deallocateFloatingIP(assignedAddress);
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackContext(com.att.cdp.openstack.OpenStackContext) ComputeService(com.att.cdp.zones.ComputeService)

Example 15 with ComputeService

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

the class TestComputeService method testDeletePort.

@Ignore
@Test
public void testDeletePort() throws ZoneException {
    String[] ids = { "0e1ae02a-f34e-4208-a031-ba251c9d6538", "7235a241-a5d1-473c-97e2-f3115e91d878", "791b9689-7f19-469a-9759-154018315d4b", "958bbf73-7559-439d-bbad-94e67fc07263", "b43449bc-a427-4838-a0ab-4fd544533677", "b94deec4-fdcc-41d9-ae93-8d0f746011d2" };
    Context context = connect();
    ComputeService compute = context.getComputeService();
    NetworkService network = context.getNetworkService();
    for (String id : ids) {
        Port port = network.getPort(id);
        if (port != null) {
            port.delete();
        }
    }
}
Also used : Context(com.att.cdp.zones.Context) Port(com.att.cdp.zones.model.Port) NetworkService(com.att.cdp.zones.NetworkService) ComputeService(com.att.cdp.zones.ComputeService) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

ComputeService (com.att.cdp.zones.ComputeService)25 Context (com.att.cdp.zones.Context)21 Ignore (org.junit.Ignore)18 Test (org.junit.Test)16 Server (com.att.cdp.zones.model.Server)12 OpenStackContext (com.att.cdp.openstack.OpenStackContext)10 OpenStackServer (com.att.cdp.openstack.model.OpenStackServer)6 Port (com.att.cdp.zones.model.Port)4 NetworkService (com.att.cdp.zones.NetworkService)3 Hypervisor (com.att.cdp.zones.model.Hypervisor)3 Volume (com.att.cdp.zones.model.Volume)3 ZoneException (com.att.cdp.exceptions.ZoneException)2 VolumeService (com.att.cdp.zones.VolumeService)2 ACL (com.att.cdp.zones.model.ACL)2 Template (com.att.cdp.zones.model.Template)2 GlanceConnector (com.att.cdp.openstack.connectors.GlanceConnector)1 NovaConnector (com.att.cdp.openstack.connectors.NovaConnector)1 QuantumConnector (com.att.cdp.openstack.connectors.QuantumConnector)1 OpenStackComputeService (com.att.cdp.openstack.v2.OpenStackComputeService)1 IdentityService (com.att.cdp.zones.IdentityService)1