Search in sources :

Example 1 with VolumeService

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

the class OpenStackVolume method associateSnapshots.

/**
 * This method is used to locate all of the snapshots created from this volume (if any) and attach them to the model
 * object
 *
 * @throws ZoneException
 */
private void associateSnapshots(Context context) throws ZoneException {
    VolumeService service = context.getVolumeService();
    getSnapshots().addAll(service.getSnapshotsByVolume(getId()));
}
Also used : VolumeService(com.att.cdp.zones.VolumeService)

Example 2 with VolumeService

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

the class TestOpenStackContext method testLoginLogout.

/**
 * Test that we can login and out of the provider, and access the services once logged in (so we dont have to
 * repeatedly login/out)
 *
 * @throws ZoneException
 */
@Test
@Ignore
public void testLoginLogout() throws ZoneException {
    OpenStackContext context = login();
    /*
         * make sure we can retreive all of the services
         */
    ComputeService computeService = context.getComputeService();
    assertNotNull(computeService);
    IdentityService identityService = context.getIdentityService();
    assertNotNull(identityService);
    ImageService imageService = context.getImageService();
    assertNotNull(imageService);
    NetworkService networkService = context.getNetworkService();
    assertNotNull(networkService);
    VolumeService volumeService = context.getVolumeService();
    assertNotNull(volumeService);
    SnapshotService snapshotService = context.getSnapshotService();
    assertNotNull(snapshotService);
    StackService stackService = context.getStackService();
    assertNotNull(stackService);
    /*
         * Services are locally cached by the provider context. If we get them again, we should get the same exact
         * object. Check that too.
         */
    assertTrue(computeService == context.getComputeService());
    assertTrue(identityService == context.getIdentityService());
    assertTrue(imageService == context.getImageService());
    assertTrue(networkService == context.getNetworkService());
    assertTrue(volumeService == context.getVolumeService());
    assertTrue(snapshotService == context.getSnapshotService());
    assertTrue(stackService == context.getStackService());
    /*
         * Test that we can also obtain the connectors
         */
    GlanceConnector glanceConnector = context.getGlanceConnector();
    assertNotNull(glanceConnector);
    NovaConnector novaConnector = context.getNovaConnector();
    assertNotNull(novaConnector);
    QuantumConnector quantumConnector = context.getQuantumConnector();
    assertNotNull(quantumConnector);
    /*
         * Connectors are locally cached, check that
         */
    assertTrue(glanceConnector == context.getGlanceConnector());
    assertTrue(novaConnector == context.getNovaConnector());
    assertTrue(quantumConnector == context.getQuantumConnector());
    /*
         * Now, check that we can obtain the tenant as well
         */
    Tenant tenant = context.getTenant();
    assertNotNull(tenant);
    assertEquals(tenant.getName(), context.getTenantName());
    assertEquals(tenant.getId(), context.getTenantId());
    logout(context);
}
Also used : IdentityService(com.att.cdp.zones.IdentityService) SnapshotService(com.att.cdp.zones.SnapshotService) StackService(com.att.cdp.zones.StackService) Tenant(com.att.cdp.zones.model.Tenant) GlanceConnector(com.att.cdp.openstack.connectors.GlanceConnector) VolumeService(com.att.cdp.zones.VolumeService) QuantumConnector(com.att.cdp.openstack.connectors.QuantumConnector) NetworkService(com.att.cdp.zones.NetworkService) NovaConnector(com.att.cdp.openstack.connectors.NovaConnector) OpenStackComputeService(com.att.cdp.openstack.v2.OpenStackComputeService) ComputeService(com.att.cdp.zones.ComputeService) ImageService(com.att.cdp.zones.ImageService) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with VolumeService

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

the class TestVolumeService method listVolumes.

/**
 * @throws ZoneException
 */
@Test
@Ignore
public void listVolumes() throws ZoneException {
    Context context = connect();
    VolumeService service = context.getVolumeService();
    List<Volume> volumes = service.getVolumes();
    assertNotNull(volumes);
    for (Volume volume : volumes) {
        assertNotNull(service.getVolume(volume.getId()));
        assertNotNull(service.getVolumes(volume.getName()));
        if (volume.getStatus().equals(Volume.Status.ERROR)) {
            System.out.printf("%-12s: %s\n", volume.getName(), volume.getId());
        }
    }
}
Also used : Context(com.att.cdp.zones.Context) Volume(com.att.cdp.zones.model.Volume) VolumeService(com.att.cdp.zones.VolumeService) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 4 with VolumeService

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

the class TestVolumeService method CreateVolume.

@Test
@Ignore
public void CreateVolume() throws ZoneException {
    Context context = connect();
    Volume template = new Volume();
    template.setSize(Integer.valueOf(2));
    template.setName("Volume");
    VolumeService service = context.getVolumeService();
    Volume vol = service.createVolume(template);
    assertNotNull(vol);
}
Also used : Context(com.att.cdp.zones.Context) Volume(com.att.cdp.zones.model.Volume) VolumeService(com.att.cdp.zones.VolumeService) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 5 with VolumeService

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

the class TestVolumeService method DeleteVolume.

@Test
@Ignore
public void DeleteVolume() throws ZoneException {
    Context context = connect();
    String id = "";
    VolumeService service = context.getVolumeService();
    service.destroyVolume(id);
}
Also used : Context(com.att.cdp.zones.Context) VolumeService(com.att.cdp.zones.VolumeService) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

VolumeService (com.att.cdp.zones.VolumeService)8 Ignore (org.junit.Ignore)6 Test (org.junit.Test)6 Context (com.att.cdp.zones.Context)5 Volume (com.att.cdp.zones.model.Volume)5 ComputeService (com.att.cdp.zones.ComputeService)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 ImageService (com.att.cdp.zones.ImageService)1 NetworkService (com.att.cdp.zones.NetworkService)1 SnapshotService (com.att.cdp.zones.SnapshotService)1 StackService (com.att.cdp.zones.StackService)1 Tenant (com.att.cdp.zones.model.Tenant)1