Search in sources :

Example 1 with ResourcePoolState

use of com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState in project photon-model by vmware.

the class AWSResetServiceTest method initResourcePoolAndComputeHost.

/**
 * Creates the state associated with the resource pool, compute host and the VM to be created.
 *
 * @throws Throwable
 */
private void initResourcePoolAndComputeHost() throws Throwable {
    // Create a resource pool where the VM will be housed
    ResourcePoolState resourcePool = createAWSResourcePool(this.host);
    AuthCredentialsServiceState auth = createAWSAuthentication(this.host, this.accessKey, this.secretKey);
    this.endpointState = TestAWSSetupUtils.createAWSEndpointState(this.host, auth.documentSelfLink, resourcePool.documentSelfLink);
    // create a compute host for the AWS EC2 VM
    this.computeHost = createAWSComputeHost(this.host, this.endpointState, zoneId, regionId, this.isAwsClientMock, this.awsMockEndpointReference, null);
}
Also used : ResourcePoolState(com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState) AuthCredentialsServiceState(com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState)

Example 2 with ResourcePoolState

use of com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState in project photon-model by vmware.

the class LongRunEndToEndStatsCollectionTest method initResourcePoolAndComputeHost.

/**
 * Creates the state associated with the resource pool, compute host and the VM to be created.
 *
 * @throws Throwable
 */
private void initResourcePoolAndComputeHost() throws Throwable {
    // Create a resource pool where the VM will be housed
    ResourcePoolState resourcePool = createAWSResourcePool(this.host);
    AuthCredentialsServiceState auth = createAWSAuthentication(this.host, this.accessKey, this.secretKey);
    this.endpointState = TestAWSSetupUtils.createAWSEndpointState(this.host, auth.documentSelfLink, resourcePool.documentSelfLink);
    // create a compute host for the AWS EC2 VM
    this.computeHost = createAWSComputeHost(this.host, this.endpointState, null, /*zoneId*/
    this.useAllRegions ? null : regionId, this.isAwsClientMock, this.awsMockEndpointReference, null);
}
Also used : ResourcePoolState(com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState) AuthCredentialsServiceState(com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState)

Example 3 with ResourcePoolState

use of com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState in project photon-model by vmware.

the class TestAWSProvisionTask method initResourcePoolAndComputeHost.

/**
 * Creates the state associated with the resource pool, compute host and the VM to be created.
 *
 * @throws Throwable
 */
private void initResourcePoolAndComputeHost() throws Throwable {
    // Create a resource pool where the VM will be housed
    ResourcePoolState resourcePool = createAWSResourcePool(this.host);
    AuthCredentialsServiceState auth = createAWSAuthentication(this.host, this.accessKey, this.secretKey);
    this.endpointState = TestAWSSetupUtils.createAWSEndpointState(this.host, auth.documentSelfLink, resourcePool.documentSelfLink);
    // create a compute host for the AWS EC2 VM
    this.computeHost = createAWSComputeHost(this.host, this.endpointState, zoneId, regionId, this.isAwsClientMock, this.awsMockEndpointReference, null);
}
Also used : ResourcePoolState(com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState) AuthCredentialsServiceState(com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState)

Example 4 with ResourcePoolState

use of com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState in project photon-model by vmware.

the class ModelUtils method createResourcePool.

public static ResourcePoolState createResourcePool(BaseModelTest test, String endpointLink) throws Throwable {
    ResourcePoolState poolState = new ResourcePoolState();
    poolState.name = UUID.randomUUID().toString();
    poolState.id = poolState.name;
    poolState.documentSelfLink = poolState.id;
    poolState.maxCpuCount = 1600L;
    poolState.minCpuCount = 16L;
    poolState.minMemoryBytes = 1024L * 1024L * 1024L * 46L;
    poolState.maxMemoryBytes = poolState.minMemoryBytes * 2;
    poolState.minDiskCapacityBytes = poolState.maxDiskCapacityBytes = 1024L * 1024L * 1024L * 1024L;
    if (endpointLink != null) {
        poolState.customProperties = new HashMap<>();
        poolState.customProperties.put(ComputeProperties.ENDPOINT_LINK_PROP_NAME, endpointLink);
    }
    return test.postServiceSynchronously(ResourcePoolService.FACTORY_LINK, poolState, ResourcePoolState.class);
}
Also used : ResourcePoolState(com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState)

Example 5 with ResourcePoolState

use of com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState in project photon-model by vmware.

the class EndpointAllocationTaskService method createResourcePoolOp.

private Operation createResourcePoolOp(EndpointState state) {
    ResourcePoolState poolState = new ResourcePoolState();
    poolState.customProperties = new HashMap<>();
    poolState.customProperties.put(ENDPOINT_LINK_PROP_NAME, state.documentSelfLink);
    String name = String.format("%s-%s", state.endpointType, state.name);
    poolState.name = name;
    poolState.id = poolState.name;
    poolState.tenantLinks = state.tenantLinks;
    return Operation.createPost(this, ResourcePoolService.FACTORY_LINK).setBody(poolState);
}
Also used : ResourcePoolState(com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState)

Aggregations

ResourcePoolState (com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState)38 AuthCredentialsServiceState (com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState)22 Test (org.junit.Test)12 BaseModelTest (com.vmware.photon.controller.model.helpers.BaseModelTest)10 ComputeDescription (com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription)10 ComputeState (com.vmware.photon.controller.model.resources.ComputeService.ComputeState)10 Operation (com.vmware.xenon.common.Operation)10 ArrayList (java.util.ArrayList)9 StatsCollectionTaskState (com.vmware.photon.controller.model.tasks.monitoring.StatsCollectionTaskService.StatsCollectionTaskState)7 ServiceDocumentQueryResult (com.vmware.xenon.common.ServiceDocumentQueryResult)7 Before (org.junit.Before)7 ServiceStats (com.vmware.xenon.common.ServiceStats)6 ApplicationTokenCredentials (com.microsoft.azure.credentials.ApplicationTokenCredentials)5 SingleResourceStatsCollectionTaskState (com.vmware.photon.controller.model.tasks.monitoring.SingleResourceStatsCollectionTaskService.SingleResourceStatsCollectionTaskState)5 ComputeManagementClientImpl (com.microsoft.azure.management.compute.implementation.ComputeManagementClientImpl)4 SecurityGroupState (com.vmware.photon.controller.model.resources.SecurityGroupService.SecurityGroupState)4 ProvisionSecurityGroupTaskState (com.vmware.photon.controller.model.tasks.ProvisionSecurityGroupTaskService.ProvisionSecurityGroupTaskState)4 ScheduledTaskState (com.vmware.photon.controller.model.tasks.ScheduledTaskService.ScheduledTaskState)4 Query (com.vmware.xenon.services.common.QueryTask.Query)4 NetworkManagementClientImpl (com.microsoft.azure.management.network.implementation.NetworkManagementClientImpl)3