Search in sources :

Example 11 with NetworkInterfaceState

use of com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState in project photon-model by vmware.

the class ResourceGroomerTaskService method populateEndpointLinksByDocumentLinks.

/**
 * Helper for creating corresponding object and parsing the response for given documentKind
 * to store selfLink and endpointLink.
 */
private static void populateEndpointLinksByDocumentLinks(Map<String, Object> documents, Map<String, Set<String>> endpointLinksByDocumentLinks, Map<String, String> endpointLinkByDocumentLinks) {
    for (Object document : documents.values()) {
        ServiceDocument doc = Utils.fromJson(document, ServiceDocument.class);
        Set<String> endpointLinks = new HashSet<>();
        if (doc.documentKind.equals(COMPUTE_STATE_DOCUMENT_KIND)) {
            ComputeState state = Utils.fromJson(document, ComputeState.class);
            if (state.endpointLinks != null) {
                state.endpointLinks.remove(null);
                endpointLinks.addAll(state.endpointLinks);
            }
            endpointLinksByDocumentLinks.put(state.documentSelfLink, endpointLinks);
            endpointLinkByDocumentLinks.put(state.documentSelfLink, state.endpointLink != null ? state.endpointLink : EMPTY_STRING);
        } else if (doc.documentKind.equals(DISK_STATE_DOCUMENT_KIND)) {
            DiskState state = Utils.fromJson(document, DiskState.class);
            if (state.customProperties != null && state.customProperties.containsKey(ResourceUtils.CUSTOM_PROP_NO_ENDPOINT)) {
                // skip resources that have never been attached to a particular endpoint
                continue;
            }
            if (state.endpointLinks != null) {
                state.endpointLinks.remove(null);
                endpointLinks.addAll(state.endpointLinks);
            }
            endpointLinksByDocumentLinks.put(state.documentSelfLink, endpointLinks);
            endpointLinkByDocumentLinks.put(state.documentSelfLink, state.endpointLink != null ? state.endpointLink : EMPTY_STRING);
        } else if (doc.documentKind.equals(COMPUTE_DESCRIPTION_DOCUMENT_KIND)) {
            ComputeDescription state = Utils.fromJson(document, ComputeDescription.class);
            // only deleting discovered resources
            if (!(state.customProperties != null && (ResourceEnumerationTaskService.FACTORY_LINK.equals(state.customProperties.get(SOURCE_TASK_LINK)) || EndpointAllocationTaskService.FACTORY_LINK.equals(state.customProperties.get(SOURCE_TASK_LINK))))) {
                continue;
            }
            if (state.endpointLinks != null) {
                state.endpointLinks.remove(null);
                endpointLinks.addAll(state.endpointLinks);
            }
            endpointLinksByDocumentLinks.put(state.documentSelfLink, endpointLinks);
            endpointLinkByDocumentLinks.put(state.documentSelfLink, state.endpointLink != null ? state.endpointLink : EMPTY_STRING);
        } else if (doc.documentKind.equals(NETWORK_STATE_DOCUMENT_KIND)) {
            NetworkState state = Utils.fromJson(document, NetworkState.class);
            if (state.endpointLinks != null) {
                state.endpointLinks.remove(null);
                endpointLinks.addAll(state.endpointLinks);
            }
            endpointLinksByDocumentLinks.put(state.documentSelfLink, endpointLinks);
            endpointLinkByDocumentLinks.put(state.documentSelfLink, state.endpointLink != null ? state.endpointLink : EMPTY_STRING);
        } else if (doc.documentKind.equals(NETWORK_INTERFACE_STATE_DOCUMENT_KIND)) {
            NetworkInterfaceState state = Utils.fromJson(document, NetworkInterfaceState.class);
            if (state.endpointLinks != null) {
                state.endpointLinks.remove(null);
                endpointLinks.addAll(state.endpointLinks);
            }
            endpointLinksByDocumentLinks.put(state.documentSelfLink, endpointLinks);
            endpointLinkByDocumentLinks.put(state.documentSelfLink, state.endpointLink != null ? state.endpointLink : EMPTY_STRING);
        } else if (doc.documentKind.equals(SECURITY_GROUP_STATE_DOCUMENT_KIND)) {
            SecurityGroupState state = Utils.fromJson(document, SecurityGroupState.class);
            if (state.endpointLinks != null) {
                state.endpointLinks.remove(null);
                endpointLinks.addAll(state.endpointLinks);
            }
            endpointLinksByDocumentLinks.put(state.documentSelfLink, endpointLinks);
            endpointLinkByDocumentLinks.put(state.documentSelfLink, state.endpointLink != null ? state.endpointLink : EMPTY_STRING);
        } else if (doc.documentKind.equals(SUBNET_STATE_DOCUMENT_KIND)) {
            SubnetState state = Utils.fromJson(document, SubnetState.class);
            if (state.endpointLinks != null) {
                state.endpointLinks.remove(null);
                endpointLinks.addAll(state.endpointLinks);
            }
            endpointLinksByDocumentLinks.put(state.documentSelfLink, endpointLinks);
            endpointLinkByDocumentLinks.put(state.documentSelfLink, state.endpointLink != null ? state.endpointLink : EMPTY_STRING);
        } else if (doc.documentKind.equals(LOAD_BALANCER_DOCUMENT_KIND)) {
            LoadBalancerState state = Utils.fromJson(document, LoadBalancerState.class);
            if (state.endpointLinks != null) {
                state.endpointLinks.remove(null);
                endpointLinks.addAll(state.endpointLinks);
            }
            endpointLinksByDocumentLinks.put(state.documentSelfLink, endpointLinks);
            endpointLinkByDocumentLinks.put(state.documentSelfLink, state.endpointLink != null ? state.endpointLink : EMPTY_STRING);
        } else if (doc.documentKind.equals(STORAGE_DESCRIPTION_DOCUMENT_KIND)) {
            StorageDescription state = Utils.fromJson(document, StorageDescription.class);
            if (state.endpointLinks != null) {
                state.endpointLinks.remove(null);
                endpointLinks.addAll(state.endpointLinks);
            }
            endpointLinksByDocumentLinks.put(state.documentSelfLink, endpointLinks);
            endpointLinkByDocumentLinks.put(state.documentSelfLink, state.endpointLink != null ? state.endpointLink : EMPTY_STRING);
        } else if (doc.documentKind.equals(RESOURCE_GROUP_DOCUMENT_KIND)) {
            ResourceGroupState state = Utils.fromJson(document, ResourceGroupState.class);
            if (state.customProperties != null && state.customProperties.containsKey(ResourceGroupService.PROPERTY_NAME_IS_USER_CREATED)) {
                continue;
            }
            if (state.customProperties != null && state.customProperties.containsKey(ResourceUtils.CUSTOM_PROP_NO_ENDPOINT)) {
                // skip resources that have never been attached to a particular endpoint
                continue;
            }
            if (state.endpointLinks != null) {
                state.endpointLinks.remove(null);
                endpointLinks.addAll(state.endpointLinks);
            }
            endpointLinksByDocumentLinks.put(state.documentSelfLink, endpointLinks);
            endpointLinkByDocumentLinks.put(state.documentSelfLink, state.endpointLink != null ? state.endpointLink : EMPTY_STRING);
        } else if (doc.documentKind.equals(IMAGE_STATE_KIND)) {
            ImageState state = Utils.fromJson(document, ImageState.class);
            if (state.endpointLinks != null) {
                state.endpointLinks.remove(null);
                endpointLinks.addAll(state.endpointLinks);
            }
            endpointLinksByDocumentLinks.put(state.documentSelfLink, endpointLinks);
            endpointLinkByDocumentLinks.put(state.documentSelfLink, state.endpointLink != null ? state.endpointLink : EMPTY_STRING);
        } else if (doc.documentKind.equals(ROUTER_STATE_KIND)) {
            RouterState state = Utils.fromJson(document, RouterState.class);
            if (state.endpointLinks != null) {
                state.endpointLinks.remove(null);
                endpointLinks.addAll(state.endpointLinks);
            }
            endpointLinksByDocumentLinks.put(state.documentSelfLink, endpointLinks);
            endpointLinkByDocumentLinks.put(state.documentSelfLink, state.endpointLink != null ? state.endpointLink : EMPTY_STRING);
        } else if (doc.documentKind.equals(AUTH_CREDENTIALS_SERVICE_STATE_KIND)) {
            AuthCredentialsServiceState state = Utils.fromJson(document, AuthCredentialsServiceState.class);
            if (state.customProperties != null && state.customProperties.get(CUSTOM_PROP_ENDPOINT_LINK) != null) {
                endpointLinkByDocumentLinks.put(state.documentSelfLink, state.customProperties.get(CUSTOM_PROP_ENDPOINT_LINK));
            } else {
                endpointLinkByDocumentLinks.put(state.documentSelfLink, EMPTY_STRING);
            }
        }
    }
}
Also used : ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) ComputeDescription(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) SecurityGroupState(com.vmware.photon.controller.model.resources.SecurityGroupService.SecurityGroupState) ResourceGroupState(com.vmware.photon.controller.model.resources.ResourceGroupService.ResourceGroupState) RouterState(com.vmware.photon.controller.model.resources.RouterService.RouterState) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) SubnetState(com.vmware.photon.controller.model.resources.SubnetService.SubnetState) LoadBalancerState(com.vmware.photon.controller.model.resources.LoadBalancerService.LoadBalancerState) StorageDescription(com.vmware.photon.controller.model.resources.StorageDescriptionService.StorageDescription) AuthCredentialsServiceState(com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState) ServiceDocument(com.vmware.xenon.common.ServiceDocument) NetworkState(com.vmware.photon.controller.model.resources.NetworkService.NetworkState) HashSet(java.util.HashSet) ImageState(com.vmware.photon.controller.model.resources.ImageService.ImageState)

Example 12 with NetworkInterfaceState

use of com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState in project photon-model by vmware.

the class TestAzureProvisionTask method assertVmNetworksConfiguration.

private void assertVmNetworksConfiguration(AzureNicSpecs azureNicSpec, String vmName) throws Throwable {
    // This assert is only suitable for real (non-mocking env).
    if (this.isMock) {
        return;
    }
    getHost().log(Level.INFO, "%s: Assert network configuration for [%s] VM", this.currentTestName.getMethodName(), this.vmState.name);
    ComputeState vm = getHost().getServiceState(null, ComputeState.class, UriUtils.buildUri(getHost(), this.vmState.documentSelfLink));
    NetworkInterfaceStateWithDescription primaryNicState = getHost().getServiceState(null, NetworkInterfaceStateWithDescription.class, NetworkInterfaceStateWithDescription.buildUri(UriUtils.buildUri(getHost(), vm.networkInterfaceLinks.get(0))));
    // In case that private ip is set explicitly.
    assertStaticPrivateIPAddress(azureNicSpec, primaryNicState.address);
    assertNotNull("Primary NIC private IP should be set.", primaryNicState.address);
    if (primaryNicState.description.assignPublicIpAddress == null || primaryNicState.description.assignPublicIpAddress == Boolean.TRUE) {
        assertNotNull("VM address should be set.", vm.address);
        assertNotEquals("VM address should not be the same as primary NIC private IP.", vm.address, primaryNicState.address);
    } else {
        assertNull("VM address should be empty.", vm.address);
    }
    assertNotNull("Primary NIC security group should be set.", primaryNicState.securityGroupLinks != null);
    for (int i = 1; i < vm.networkInterfaceLinks.size(); i++) {
        NetworkInterfaceState nonPrimaryNicState = getHost().getServiceState(null, NetworkInterfaceState.class, UriUtils.buildUri(getHost(), vm.networkInterfaceLinks.get(i)));
        assertNotNull("Non-primary NIC" + i + " IP should not be set to the privatese ip.", nonPrimaryNicState.address);
        assertNull("Non-primary NIC" + i + " security group should not be set.", nonPrimaryNicState.securityGroupLinks);
    }
    // Ensure that from the list of provided network resource groups,
    // and security group resource groups, the one with the correct type has been chosen.
    // Verifying the resources can be obtained from this RG, ensures they have been placed
    // correctly.
    NetworkManagementClientImpl networkClient = getAzureSdkClients().getNetworkManagementClientImpl();
    final String vmRGName = vm.customProperties.get(ComputeProperties.RESOURCE_GROUP_NAME);
    VirtualNetworkInner provisionedNetwork = AzureTestUtil.getAzureVirtualNetwork(networkClient, vmRGName, AzureTestUtil.AZURE_NETWORK_NAME);
    assertNotNull("Azure virtual network object '" + vmRGName + "/" + AzureTestUtil.AZURE_NETWORK_NAME + "' is not found.", provisionedNetwork);
    final String sgName = AzureTestUtil.AZURE_SECURITY_GROUP_NAME + "-" + vmName;
    NetworkSecurityGroupInner provisionedSG = AzureTestUtil.getAzureSecurityGroup(networkClient, vmRGName, sgName);
    assertNotNull("Azure security group object '" + vmRGName + "/" + sgName + "' is not found.", provisionedSG);
}
Also used : ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) NetworkManagementClientImpl(com.microsoft.azure.management.network.implementation.NetworkManagementClientImpl) VirtualNetworkInner(com.microsoft.azure.management.network.implementation.VirtualNetworkInner) NetworkSecurityGroupInner(com.microsoft.azure.management.network.implementation.NetworkSecurityGroupInner) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) NetworkInterfaceStateWithDescription(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceStateWithDescription)

Example 13 with NetworkInterfaceState

use of com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState in project photon-model by vmware.

the class TestAzureEnumerationTask method testEnumeration.

@Test
public void testEnumeration() throws Throwable {
    this.storageDescription = createDefaultStorageAccountDescription(this.host, this.mockedStorageAccountName, computeHost, endpointState);
    this.resourceGroupState = createDefaultResourceGroupState(this.host, this.mockedStorageAccountName, computeHost, endpointState, ResourceGroupStateType.AzureResourceGroup);
    this.diskState = createDefaultDiskState(this.host, this.mockedStorageAccountName, this.mockedStorageAccountName, computeHost, endpointState);
    // create an Azure VM compute resource (this also creates a disk and a storage account)
    this.vmState = createDefaultVMResource(this.host, azureVMName, computeHost, endpointState, NIC_SPEC);
    // kick off a provision task to do the actual VM creation
    ProvisionComputeTaskState provisionTask = new ProvisionComputeTaskState();
    provisionTask.computeLink = this.vmState.documentSelfLink;
    provisionTask.isMockRequest = this.isMock;
    provisionTask.taskSubStage = SubStage.CREATING_HOST;
    ProvisionComputeTaskState outTask = TestUtils.doPost(this.host, provisionTask, ProvisionComputeTaskState.class, UriUtils.buildUri(this.host, ProvisionComputeTaskService.FACTORY_LINK));
    this.host.waitForFinishedTask(ProvisionComputeTaskState.class, outTask.documentSelfLink);
    // Check resources have been created
    // expected VM count = 2 (1 compute host instance + 1 vm compute state)
    ProvisioningUtils.queryDocumentsAndAssertExpectedCount(this.host, 2, ComputeService.FACTORY_LINK, false);
    ProvisioningUtils.queryDocumentsAndAssertExpectedCount(this.host, 1, StorageDescriptionService.FACTORY_LINK, false);
    ProvisioningUtils.queryDocumentsAndAssertExpectedCount(this.host, 1, ResourceGroupService.FACTORY_LINK, false);
    ProvisioningUtils.queryDocumentsAndAssertExpectedCount(this.host, 1, DiskService.FACTORY_LINK, false);
    this.numberOfVMsToDelete++;
    if (this.isMock) {
        runEnumeration();
        deleteVMs(this.host, this.vmState.documentSelfLink, this.isMock, 1);
        this.vmState = null;
        ProvisioningUtils.queryDocumentsAndAssertExpectedCount(this.host, 1, ComputeService.FACTORY_LINK, false);
        deleteServiceDocument(this.host, this.storageDescription.documentSelfLink);
        this.storageDescription = null;
        ProvisioningUtils.queryDocumentsAndAssertExpectedCount(this.host, 0, StorageDescriptionService.FACTORY_LINK, true);
        deleteServiceDocument(this.host, this.resourceGroupState.documentSelfLink);
        this.resourceGroupState = null;
        ProvisioningUtils.queryDocumentsAndAssertExpectedCount(this.host, 0, ResourceGroupService.FACTORY_LINK, false);
        deleteServiceDocument(this.host, this.diskState.documentSelfLink);
        this.diskState = null;
        ProvisioningUtils.queryDocumentsAndAssertExpectedCount(this.host, 0, DiskService.FACTORY_LINK, false);
        return;
    }
    createStaleResource();
    tagAzureResources();
    // stale resources + 1 compute host instance + 1 vm compute state
    ProvisioningUtils.queryDocumentsAndAssertExpectedCount(this.host, STALE_VM_RESOURCES_COUNT + 2, ComputeService.FACTORY_LINK, false);
    ProvisioningUtils.queryDocumentsAndAssertExpectedCount(this.host, STALE_STORAGE_ACCOUNTS_COUNT + 1, StorageDescriptionService.FACTORY_LINK, false);
    ProvisioningUtils.queryDocumentsAndAssertExpectedCount(this.host, STALE_CONTAINERS_COUNT + STALE_RG_COUNT + 1, ResourceGroupService.FACTORY_LINK, false);
    ProvisioningUtils.queryDocumentsAndAssertExpectedCount(this.host, STALE_DISKS_COUNT + 1, DiskService.FACTORY_LINK, false);
    // 1 network per each stale vm resource + 1 network for original vm compute state.
    ProvisioningUtils.queryDocumentsAndAssertExpectedCount(this.host, STALE_VM_RESOURCES_COUNT + 1, NetworkService.FACTORY_LINK, false);
    // 1 subnet per network, 1 network per each stale vm resource + 1 subnet for the original
    // compute state.
    ProvisioningUtils.queryDocumentsAndAssertExpectedCount(this.host, STALE_VM_RESOURCES_COUNT + 1, SubnetService.FACTORY_LINK, false);
    // 1 network per each stale vm resource + 1 network for original vm compute state.
    ProvisioningUtils.queryDocumentsAndAssertExpectedCount(this.host, STALE_VM_RESOURCES_COUNT + 1, NetworkInterfaceService.FACTORY_LINK, false);
    ProvisioningUtils.queryDocumentsAndAssertExpectedCount(this.host, STALE_SECURITY_GROUPS_COUNT, SecurityGroupService.FACTORY_LINK, false);
    this.vmCount = getAzureVMCount(this.computeManagementClient);
    this.host.log(Level.INFO, "Initial VM Count: %d", this.vmCount);
    runEnumeration();
    assertRemoteResources();
    assertInternalTagResources();
    assertStaleResources();
    // VM count + 1 compute host instance
    this.vmCount = this.vmCount + 1;
    ServiceDocumentQueryResult result = ProvisioningUtils.queryDocumentsAndAssertExpectedCount(this.host, this.vmCount, ComputeService.FACTORY_LINK, false);
    // validate type field for enumerated VMs
    result.documents.entrySet().stream().map(e -> Utils.fromJson(e.getValue(), ComputeState.class)).filter(c -> !c.documentSelfLink.equals(computeHost.documentSelfLink));
    // validate internal tags for enumerated VMs
    TagService.TagState expectedInternalTypeTag = newTagState(TAG_KEY_TYPE, AzureConstants.AzureResourceType.azure_vm.toString(), EnumSet.of(SYSTEM), endpointState.tenantLinks);
    result.documents.entrySet().stream().map(e -> Utils.fromJson(e.getValue(), ComputeState.class)).filter(c -> c.type.equals(ComputeType.VM_GUEST)).forEach(c -> {
        assertNotNull("ComputeState tagLinks is NULL", c.tagLinks);
        assertTrue(String.format("ComputeState doesn't contain tagLink: %s", expectedInternalTypeTag.documentSelfLink), c.tagLinks.contains(expectedInternalTypeTag.documentSelfLink));
    });
    // 1 network per each stale vm resource + 1 network for original vm compute state.
    ServiceDocumentQueryResult networkResults = ProvisioningUtils.queryAllFactoryResources(this.host, NetworkService.FACTORY_LINK);
    // validate internal tags for enumerated networks
    TagService.TagState expectedNetworkInternalTypeTag = newTagState(TAG_KEY_TYPE, NETWORK_TAG_TYPE_VALUE, false, endpointState.tenantLinks);
    networkResults.documents.entrySet().stream().map(e -> Utils.fromJson(e.getValue(), NetworkState.class)).forEach(c -> {
        assertNotNull("NetworkState tagLinks is NULL", c.tagLinks);
        assertTrue(String.format("NetworkState doesn't contain tagLink: %s", expectedNetworkInternalTypeTag.documentSelfLink), c.tagLinks.contains(expectedNetworkInternalTypeTag.documentSelfLink));
    });
    // 1 subnet per network, 1 network per each stale vm resource + 1 subnet for the original
    // compute state.
    ServiceDocumentQueryResult subnetResults = ProvisioningUtils.queryAllFactoryResources(this.host, SubnetService.FACTORY_LINK);
    // validate internal tags for enumerated subnets
    TagService.TagState expectedSubnetInternalTypeTag = newTagState(TAG_KEY_TYPE, SUBNET_TAG_TYPE_VALUE, false, endpointState.tenantLinks);
    subnetResults.documents.entrySet().stream().map(e -> Utils.fromJson(e.getValue(), SubnetState.class)).forEach(c -> {
        assertNotNull("SubnetState tagLinks is NULL", c.tagLinks);
        assertTrue(String.format("SubnetState doesn't contain tagLink: %s", expectedSubnetInternalTypeTag.documentSelfLink), c.tagLinks.contains(expectedSubnetInternalTypeTag.documentSelfLink));
    });
    ServiceDocumentQueryResult nicResults = ProvisioningUtils.queryAllFactoryResources(this.host, NetworkInterfaceService.FACTORY_LINK);
    // validate internal tags for enumerated network interfaces
    TagService.TagState expectedNicInternalTypeTag = newTagState(TAG_KEY_TYPE, NETWORK_INTERFACE_TAG_TYPE_VALUE, false, endpointState.tenantLinks);
    nicResults.documents.entrySet().stream().map(e -> Utils.fromJson(e.getValue(), NetworkInterfaceState.class)).filter(c -> c.regionId != null).forEach(c -> {
        assertNotNull("NetworkInterfaceState tagLinks is NULL", c.tagLinks);
        assertTrue(String.format("NetworkInterfaceState doesn't contain tagLink: %s", expectedNicInternalTypeTag.documentSelfLink), c.tagLinks.contains(expectedNicInternalTypeTag.documentSelfLink));
    });
    // validate internal tags for disks
    ServiceDocumentQueryResult diskResults = ProvisioningUtils.queryAllFactoryResources(this.host, DiskService.FACTORY_LINK);
    TagService.TagState expectedManagedDiskInternalTypeTag = newTagState(TAG_KEY_TYPE, azure_managed_disk.toString(), false, endpointState.tenantLinks);
    diskResults.documents.entrySet().stream().map(e -> Utils.fromJson(e.getValue(), DiskState.class)).filter(d -> d.customProperties != null && d.customProperties.containsKey(AzureConstants.AZURE_MANAGED_DISK_TYPE)).forEach(c -> {
        assertNotNull("tagLinks is null for disk", c.tagLinks);
        assertTrue("disk doesn't contain correct internal tagLink", c.tagLinks.contains(expectedManagedDiskInternalTypeTag.documentSelfLink));
    });
    // validate environment name field for enumerated VMs
    result.documents.entrySet().stream().map(e -> Utils.fromJson(e.getValue(), ComputeState.class)).forEach(c -> assertEquals(ComputeDescription.ENVIRONMENT_NAME_AZURE, c.environmentName));
    // validate Security Group tagLinks
    ServiceDocumentQueryResult securityGroupResults = ProvisioningUtils.queryAllFactoryResources(this.host, SecurityGroupService.FACTORY_LINK);
    securityGroupResults.documents.entrySet().stream().map(e -> Utils.fromJson(e.getValue(), SecurityGroupService.SecurityGroupState.class)).forEach(c -> {
        if (c.tagLinks != null) {
            for (String tag : c.tagLinks) {
                assertTrue(tag.startsWith(TagService.FACTORY_LINK));
            }
        }
    });
    for (Entry<String, Object> key : result.documents.entrySet()) {
        ComputeState document = Utils.fromJson(key.getValue(), ComputeState.class);
        if (!document.documentSelfLink.equals(computeHost.documentSelfLink) && !document.documentSelfLink.equals(this.vmState.documentSelfLink) && document.id.toLowerCase().contains(CUSTOM_DIAGNOSTIC_ENABLED_VM.toLowerCase())) {
            this.enumeratedComputeLink = document.documentSelfLink;
            break;
        }
    }
    try {
        // Test stats for the VM that was just enumerated from Azure.
        this.host.log(Level.INFO, "Collecting stats for VM [%s]-[%s]", CUSTOM_DIAGNOSTIC_ENABLED_VM, this.enumeratedComputeLink);
        this.host.setTimeoutSeconds(300);
        if (this.enumeratedComputeLink != null) {
            this.host.waitFor("Error waiting for VM stats", () -> {
                try {
                    issueStatsRequest(this.enumeratedComputeLink, false);
                } catch (Throwable t) {
                    return false;
                }
                return true;
            });
        }
        // Test stats for the compute host.
        this.host.log(Level.INFO, "Collecting stats for host [%s]", computeHost.documentSelfLink);
        this.host.waitFor("Error waiting for host stats", () -> {
            try {
                issueStatsRequest(computeHost.documentSelfLink, true);
            } catch (Throwable t) {
                return false;
            }
            return true;
        });
    } catch (Throwable te) {
        this.host.log(Level.SEVERE, te.getMessage());
    }
    // delete vm directly on azure
    this.computeManagementClient.virtualMachines().beginDelete(azureVMName, azureVMName);
    runEnumeration();
    assertResourceDisassociated(this.host, ComputeService.FACTORY_LINK, azureVMName, true);
    // clean up
    this.vmState = null;
    this.resourceManagementClient.resourceGroups().beginDelete(azureVMName);
}
Also used : NetworkManagementClientImpl(com.microsoft.azure.management.network.implementation.NetworkManagementClientImpl) ProvisionComputeTaskService(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService) AzureTestUtil.deleteVMs(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.deleteVMs) VerificationHost(com.vmware.xenon.common.test.VerificationHost) VirtualNetworkInner(com.microsoft.azure.management.network.implementation.VirtualNetworkInner) ResourceGroupState(com.vmware.photon.controller.model.resources.ResourceGroupService.ResourceGroupState) Utils(com.vmware.xenon.common.Utils) SubnetState(com.vmware.photon.controller.model.resources.SubnetService.SubnetState) AzureTestUtil.createDefaultComputeHost(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createDefaultComputeHost) Map(java.util.Map) StorageDescription(com.vmware.photon.controller.model.resources.StorageDescriptionService.StorageDescription) AzureEnvironment(com.microsoft.azure.AzureEnvironment) ServiceDocumentQueryResult(com.vmware.xenon.common.ServiceDocumentQueryResult) AzureTestUtil.deleteServiceDocument(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.deleteServiceDocument) ProvisioningUtils(com.vmware.photon.controller.model.tasks.ProvisioningUtils) EnumSet(java.util.EnumSet) ResourceEnumerationTaskService(com.vmware.photon.controller.model.tasks.ResourceEnumerationTaskService) ComputeStatsResponse(com.vmware.photon.controller.model.adapterapi.ComputeStatsResponse) SubnetService(com.vmware.photon.controller.model.resources.SubnetService) ComputeStatsRequest(com.vmware.photon.controller.model.adapterapi.ComputeStatsRequest) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) StatelessService(com.vmware.xenon.common.StatelessService) Set(java.util.Set) AzureTestUtil.createDefaultStorageAccountDescription(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createDefaultStorageAccountDescription) AzureTestUtil.updateAzureSecurityGroup(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.updateAzureSecurityGroup) NetworkInterfaceService(com.vmware.photon.controller.model.resources.NetworkInterfaceService) TagService(com.vmware.photon.controller.model.resources.TagService) AzureTestUtil.assertResourceDisassociated(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.assertResourceDisassociated) AzureAdaptersTestUtils(com.vmware.photon.controller.model.adapters.azure.base.AzureAdaptersTestUtils) Assert.assertFalse(org.junit.Assert.assertFalse) StorageDescriptionService(com.vmware.photon.controller.model.resources.StorageDescriptionService) DeferredResult(com.vmware.xenon.common.DeferredResult) UriUtils(com.vmware.xenon.common.UriUtils) ComputeService(com.vmware.photon.controller.model.resources.ComputeService) AzureTestUtil.initializeNicSpecs(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.initializeNicSpecs) AzureTestUtil.createDefaultResourceGroupState(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createDefaultResourceGroupState) ComputeProperties(com.vmware.photon.controller.model.ComputeProperties) ResourceGroupStateType(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.ResourceGroupStateType) AzureTestUtil.getAzureVMCount(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.getAzureVMCount) PhotonModelMetricServices(com.vmware.photon.controller.model.PhotonModelMetricServices) ResourcePoolState(com.vmware.photon.controller.model.resources.ResourcePoolService.ResourcePoolState) AzureTestUtil.validateDiskInternalTag(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.validateDiskInternalTag) AzureResourceType.azure_net_interface(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AzureResourceType.azure_net_interface) SYSTEM(com.vmware.photon.controller.model.resources.TagService.TagState.TagOrigin.SYSTEM) ArrayList(java.util.ArrayList) TagState(com.vmware.photon.controller.model.resources.TagService.TagState) USER_DEFINED(com.vmware.photon.controller.model.resources.TagService.TagState.TagOrigin.USER_DEFINED) Query(com.vmware.xenon.services.common.QueryTask.Query) UriPaths(com.vmware.photon.controller.model.UriPaths) AzureTestUtil.assertDiskExist(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.assertDiskExist) VirtualMachineInner(com.microsoft.azure.management.compute.implementation.VirtualMachineInner) StatsUtil(com.vmware.photon.controller.model.tasks.monitoring.StatsUtil) AzureTestUtil(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil) Before(org.junit.Before) AzureTestUtil.assertResourceExists(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.assertResourceExists) QueryUtils(com.vmware.photon.controller.model.query.QueryUtils) SecurityGroupService(com.vmware.photon.controller.model.resources.SecurityGroupService) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) AzureTestUtil.updateAzureVirtualMachine(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.updateAzureVirtualMachine) QueryTop(com.vmware.photon.controller.model.query.QueryUtils.QueryTop) NetworkService(com.vmware.photon.controller.model.resources.NetworkService) PhotonModelConstants(com.vmware.photon.controller.model.constants.PhotonModelConstants) RegionEnumerationResponse(com.vmware.photon.controller.model.adapterapi.RegionEnumerationResponse) AzureTestUtil.createDefaultEndpointState(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createDefaultEndpointState) ApplicationTokenCredentials(com.microsoft.azure.credentials.ApplicationTokenCredentials) NetworkState(com.vmware.photon.controller.model.resources.NetworkService.NetworkState) Assert(org.junit.Assert) Assert.assertEquals(org.junit.Assert.assertEquals) DISCOVERED(com.vmware.photon.controller.model.resources.TagService.TagState.TagOrigin.DISCOVERED) ModelUtils.createSecurityGroup(com.vmware.photon.controller.model.ModelUtils.createSecurityGroup) STORAGE_USED_BYTES(com.vmware.photon.controller.model.constants.PhotonModelConstants.STORAGE_USED_BYTES) PhotonModelUtils.createOriginTagQuery(com.vmware.photon.controller.model.resources.util.PhotonModelUtils.createOriginTagQuery) NicSpec(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.AzureNicSpecs.NicSpec) AuthCredentialsServiceState(com.vmware.xenon.services.common.AuthCredentialsService.AuthCredentialsServiceState) BaseModelTest(com.vmware.photon.controller.model.helpers.BaseModelTest) PhotonModelServices(com.vmware.photon.controller.model.PhotonModelServices) SHARED_NETWORK_NIC_SPEC(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.SHARED_NETWORK_NIC_SPEC) AzureUriPaths(com.vmware.photon.controller.model.adapters.azure.AzureUriPaths) AzureTestUtil.getAzureVirtualMachine(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.getAzureVirtualMachine) AzureTestUtil.createDefaultResourcePool(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createDefaultResourcePool) ComputeType(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription.ComputeType) AzureResourceType.azure_subnet(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AzureResourceType.azure_subnet) ResourceManagementClientImpl(com.microsoft.azure.management.resources.implementation.ResourceManagementClientImpl) AzureTestUtil.updateAzureVirtualNetwork(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.updateAzureVirtualNetwork) After(org.junit.After) URI(java.net.URI) TagsUtil.newTagState(com.vmware.photon.controller.model.adapters.util.TagsUtil.newTagState) EndpointState(com.vmware.photon.controller.model.resources.EndpointService.EndpointState) AzureTestUtil.randomString(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.randomString) AzureConstants(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants) ComputeDescription(com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription) AZURE_SECURITY_GROUP_NAME(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.AZURE_SECURITY_GROUP_NAME) TestUtils(com.vmware.photon.controller.model.tasks.TestUtils) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) ServiceHost(com.vmware.xenon.common.ServiceHost) QueryStrategy(com.vmware.photon.controller.model.query.QueryStrategy) ResourceGroupService(com.vmware.photon.controller.model.resources.ResourceGroupService) List(java.util.List) AzureUtils(com.vmware.photon.controller.model.adapters.azure.utils.AzureUtils) AzureTestUtil.createResourceGroupWithSharedNetwork(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createResourceGroupWithSharedNetwork) TAG_KEY_TYPE(com.vmware.photon.controller.model.constants.PhotonModelConstants.TAG_KEY_TYPE) Entry(java.util.Map.Entry) PhotonModelUtils.waitToComplete(com.vmware.photon.controller.model.resources.util.PhotonModelUtils.waitToComplete) NetworkSecurityGroupInner(com.microsoft.azure.management.network.implementation.NetworkSecurityGroupInner) TaskOption(com.vmware.photon.controller.model.tasks.TaskOption) DiskService(com.vmware.photon.controller.model.resources.DiskService) SingleResourceTaskCollectionStage(com.vmware.photon.controller.model.tasks.monitoring.SingleResourceStatsCollectionTaskService.SingleResourceTaskCollectionStage) QueryByPages(com.vmware.photon.controller.model.query.QueryUtils.QueryByPages) BeforeClass(org.junit.BeforeClass) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) ResourceMetricsService(com.vmware.photon.controller.model.monitoring.ResourceMetricsService) ProvisionComputeTaskState(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService.ProvisionComputeTaskState) AzureTestUtil.createDefaultVMResource(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createDefaultVMResource) Level(java.util.logging.Level) AzureTestUtil.createDefaultAuthCredentials(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createDefaultAuthCredentials) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) AzureTestUtil.getAzureVirtualNetwork(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.getAzureVirtualNetwork) EnumerationAction(com.vmware.photon.controller.model.adapterapi.EnumerationAction) Assume(org.junit.Assume) SubStage(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService.ProvisionComputeTaskState.SubStage) AzureNicSpecs(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.AzureNicSpecs) PhotonModelTaskServices(com.vmware.photon.controller.model.tasks.PhotonModelTaskServices) ComputeManagementClientImpl(com.microsoft.azure.management.compute.implementation.ComputeManagementClientImpl) ResourceEnumerationTaskState(com.vmware.photon.controller.model.tasks.ResourceEnumerationTaskService.ResourceEnumerationTaskState) Assert.assertNotNull(org.junit.Assert.assertNotNull) AzureResourceType.azure_vnet(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AzureResourceType.azure_vnet) Operation(com.vmware.xenon.common.Operation) AzureTestUtil.createDefaultDiskState(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createDefaultDiskState) AzureTestUtil.getAzureSecurityGroup(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.getAzureSecurityGroup) ServiceStat(com.vmware.xenon.common.ServiceStats.ServiceStat) PhotonModelAdaptersRegistryAdapters(com.vmware.photon.controller.model.adapters.registry.PhotonModelAdaptersRegistryAdapters) AzureTestUtil.generateName(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.generateName) AzureResourceType.azure_managed_disk(com.vmware.photon.controller.model.adapters.azure.constants.AzureConstants.AzureResourceType.azure_managed_disk) Collections(java.util.Collections) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) TagState(com.vmware.photon.controller.model.resources.TagService.TagState) ProvisionComputeTaskState(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService.ProvisionComputeTaskState) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) TagService(com.vmware.photon.controller.model.resources.TagService) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) AzureTestUtil.createDefaultDiskState(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.createDefaultDiskState) AzureTestUtil.randomString(com.vmware.photon.controller.model.adapters.azure.instance.AzureTestUtil.randomString) SecurityGroupService(com.vmware.photon.controller.model.resources.SecurityGroupService) ServiceDocumentQueryResult(com.vmware.xenon.common.ServiceDocumentQueryResult) Test(org.junit.Test) BaseModelTest(com.vmware.photon.controller.model.helpers.BaseModelTest)

Example 14 with NetworkInterfaceState

use of com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState in project photon-model by vmware.

the class TestAWSEnumerationTask method validateTagAndNetworkAndComputeDescriptionInformation.

/**
 * Verifies if the tag information exists for a given resource. And that private and public IP
 * addresses are mapped to separate NICs.Also, checks that the compute description mapping is
 * not changed in an updated scenario. Currently, this method is being invoked for a VM
 * provisioned from Xenon, so the check is to make sure that during discovery it is not
 * re-mapped to a system generated compute description.
 *
 * @throws Throwable
 */
private String validateTagAndNetworkAndComputeDescriptionInformation(ComputeState computeState) throws Throwable {
    if (this.isAwsClientMock) {
        return null;
    }
    ComputeState taggedComputeState = getComputeByAWSId(this.host, computeState.id);
    assertEquals(taggedComputeState.descriptionLink, computeState.descriptionLink);
    assertTrue(taggedComputeState.networkInterfaceLinks != null);
    assertEquals(this.singleNicSpec.numberOfNics(), taggedComputeState.networkInterfaceLinks.size());
    List<URI> networkLinkURIs = new ArrayList<>();
    for (int i = 0; i < taggedComputeState.networkInterfaceLinks.size(); i++) {
        networkLinkURIs.add(UriUtils.buildUri(this.host, taggedComputeState.networkInterfaceLinks.get(i)));
    }
    // Assert that both the public and private IP addresses have been mapped to separated NICs
    Map<URI, NetworkInterfaceState> NICMap = this.host.getServiceState(null, NetworkInterfaceState.class, networkLinkURIs);
    for (URI uri : networkLinkURIs) {
        assertNotNull(NICMap.get(uri).address);
    }
    // get the VPC information for the provisioned VM
    assertTrue(taggedComputeState.customProperties.get(AWS_VPC_ID) != null);
    return taggedComputeState.customProperties.get(AWS_VPC_ID);
}
Also used : ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) ArrayList(java.util.ArrayList) URI(java.net.URI) TestAWSSetupUtils.deleteVMsOnThisEndpoint(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.deleteVMsOnThisEndpoint)

Example 15 with NetworkInterfaceState

use of com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState in project photon-model by vmware.

the class TestAWSSetupUtils method createAWSNicStates.

/*
     * NOTE: It is highly recommended to keep this method in sync with its Azure counterpart:
     * AzureTestUtil.createDefaultNicStates
     */
public static List<NetworkInterfaceState> createAWSNicStates(VerificationHost host, ComputeState computeHost, EndpointState endpointState, String vmName, AwsNicSpecs nicSpecs, boolean addNewSecurityGroup, Map<String, Object> awsTestContext) throws Throwable {
    // Create network state.
    NetworkState networkState;
    {
        networkState = new NetworkState();
        networkState.id = nicSpecs.network.id;
        networkState.name = nicSpecs.network.name;
        networkState.subnetCIDR = nicSpecs.network.cidr;
        networkState.authCredentialsLink = endpointState.authCredentialsLink;
        networkState.resourcePoolLink = computeHost.resourcePoolLink;
        networkState.instanceAdapterReference = UriUtils.buildUri(host, AWSUriPaths.AWS_NETWORK_ADAPTER);
        networkState.regionId = regionId;
        networkState.endpointLink = endpointState.documentSelfLink;
        networkState.endpointLinks = new HashSet<String>();
        networkState.endpointLinks.add(endpointState.documentSelfLink);
        networkState.tenantLinks = endpointState.tenantLinks;
        networkState.computeHostLink = computeHost.documentSelfLink;
        networkState = TestUtils.doPost(host, networkState, NetworkState.class, UriUtils.buildUri(host, NetworkService.FACTORY_LINK));
    }
    // Create NIC states.
    List<NetworkInterfaceState> nics = new ArrayList<>();
    for (int i = 0; i < nicSpecs.nicSpecs.size(); i++) {
        // Create subnet state per NIC.
        SubnetState subnetState;
        {
            subnetState = new SubnetState();
            subnetState.id = nicSpecs.nicSpecs.get(i).subnetSpec.id;
            subnetState.name = nicSpecs.nicSpecs.get(i).subnetSpec.name;
            subnetState.subnetCIDR = nicSpecs.nicSpecs.get(i).subnetSpec.cidr;
            subnetState.zoneId = nicSpecs.nicSpecs.get(i).subnetSpec.zoneId;
            subnetState.networkLink = networkState.documentSelfLink;
            subnetState.regionId = regionId;
            subnetState.endpointLink = endpointState.documentSelfLink;
            subnetState.endpointLinks = new HashSet<String>();
            subnetState.endpointLinks.add(endpointState.documentSelfLink);
            subnetState.tenantLinks = endpointState.tenantLinks;
            subnetState = TestUtils.doPost(host, subnetState, SubnetState.class, UriUtils.buildUri(host, SubnetService.FACTORY_LINK));
        }
        // Create NIC description.
        NetworkInterfaceDescription nicDescription;
        NicSpec nicSpec = nicSpecs.nicSpecs.get(0);
        {
            nicDescription = new NetworkInterfaceDescription();
            nicDescription.id = "nicDesc" + i;
            nicDescription.name = "nicDesc" + i;
            nicDescription.deviceIndex = i;
            nicDescription.assignment = nicSpec.getIpAssignment();
            nicDescription.regionId = regionId;
            nicDescription.endpointLink = endpointState.documentSelfLink;
            nicDescription.endpointLinks = new HashSet<String>();
            nicDescription.endpointLinks.add(endpointState.documentSelfLink);
            nicDescription.tenantLinks = endpointState.tenantLinks;
            nicDescription = TestUtils.doPost(host, nicDescription, NetworkInterfaceDescription.class, UriUtils.buildUri(host, NetworkInterfaceDescriptionService.FACTORY_LINK));
        }
        // Create security group state for an existing security group
        SecurityGroupState existingSecurityGroupState = createSecurityGroupState(host, computeHost, endpointState, true, awsTestContext);
        NetworkInterfaceState nicState = new NetworkInterfaceState();
        nicState.id = UUID.randomUUID().toString();
        nicState.name = vmName + "-nic-" + i;
        nicState.deviceIndex = nicDescription.deviceIndex;
        nicState.networkLink = networkState.documentSelfLink;
        nicState.subnetLink = subnetState.documentSelfLink;
        nicState.networkInterfaceDescriptionLink = nicDescription.documentSelfLink;
        nicState.regionId = regionId;
        nicState.endpointLink = endpointState.documentSelfLink;
        nicState.endpointLinks = new HashSet<String>();
        nicState.endpointLinks.add(endpointState.documentSelfLink);
        nicState.tenantLinks = endpointState.tenantLinks;
        nicState.securityGroupLinks = new ArrayList<>();
        nicState.securityGroupLinks.add(existingSecurityGroupState.documentSelfLink);
        if (addNewSecurityGroup) {
            // Create security group state for a new security group
            SecurityGroupState newSecurityGroupState = createSecurityGroupState(host, computeHost, endpointState, false, awsTestContext);
            nicState.securityGroupLinks.add(newSecurityGroupState.documentSelfLink);
        }
        nicState = TestUtils.doPost(host, nicState, NetworkInterfaceState.class, UriUtils.buildUri(host, NetworkInterfaceService.FACTORY_LINK));
        nics.add(nicState);
    }
    return nics;
}
Also used : NetworkInterfaceDescription(com.vmware.photon.controller.model.resources.NetworkInterfaceDescriptionService.NetworkInterfaceDescription) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) SecurityGroupState(com.vmware.photon.controller.model.resources.SecurityGroupService.SecurityGroupState) ArrayList(java.util.ArrayList) SubnetState(com.vmware.photon.controller.model.resources.SubnetService.SubnetState) NicSpec(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.AwsNicSpecs.NicSpec) NetworkState(com.vmware.photon.controller.model.resources.NetworkService.NetworkState) HashSet(java.util.HashSet)

Aggregations

NetworkInterfaceState (com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState)32 ComputeState (com.vmware.photon.controller.model.resources.ComputeService.ComputeState)17 Operation (com.vmware.xenon.common.Operation)15 ArrayList (java.util.ArrayList)14 SubnetState (com.vmware.photon.controller.model.resources.SubnetService.SubnetState)13 URI (java.net.URI)10 HashSet (java.util.HashSet)10 ComputeService (com.vmware.photon.controller.model.resources.ComputeService)9 DeferredResult (com.vmware.xenon.common.DeferredResult)9 QueryTask (com.vmware.xenon.services.common.QueryTask)9 List (java.util.List)9 Map (java.util.Map)9 QueryUtils (com.vmware.photon.controller.model.query.QueryUtils)8 HashMap (java.util.HashMap)8 Collectors (java.util.stream.Collectors)8 ComputeDescription (com.vmware.photon.controller.model.resources.ComputeDescriptionService.ComputeDescription)7 DiskState (com.vmware.photon.controller.model.resources.DiskService.DiskState)7 NetworkState (com.vmware.photon.controller.model.resources.NetworkService.NetworkState)7 ResourceState (com.vmware.photon.controller.model.resources.ResourceState)7 OperationJoin (com.vmware.xenon.common.OperationJoin)7