Search in sources :

Example 31 with NetworkInterfaceState

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

the class ResourceAllocationTaskService method newNicStateFromDescription.

private NetworkInterfaceState newNicStateFromDescription(ResourceAllocationTaskState state, NetworkInterfaceDescription nid) {
    NetworkInterfaceState nic = new NetworkInterfaceState();
    nic.id = UUID.randomUUID().toString();
    nic.documentSelfLink = nic.id;
    nic.name = nid.name;
    nic.deviceIndex = nid.deviceIndex;
    nic.address = nid.address;
    nic.networkLink = nid.networkLink;
    nic.subnetLink = nid.subnetLink;
    nic.networkInterfaceDescriptionLink = nid.documentSelfLink;
    nic.securityGroupLinks = nid.securityGroupLinks;
    nic.groupLinks = nid.groupLinks;
    nic.tagLinks = nid.tagLinks;
    nic.tenantLinks = state.tenantLinks;
    nic.endpointLink = nid.endpointLink;
    nic.endpointLinks = new HashSet<String>();
    nic.endpointLinks.add(nid.endpointLink);
    nic.computeHostLink = nid.computeHostLink;
    nic.regionId = nid.regionId;
    nic.customProperties = nid.customProperties;
    return nic;
}
Also used : NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState)

Example 32 with NetworkInterfaceState

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

the class NicSecurityGroupsTaskServiceTest method createNetworkInterface.

private static NetworkInterfaceState createNetworkInterface(BaseModelTest test) throws Throwable {
    NetworkInterfaceState networkInterfaceState = new NetworkInterfaceState();
    networkInterfaceState.subnetLink = "subnetLink";
    networkInterfaceState.name = UUID.randomUUID().toString();
    networkInterfaceState.regionId = "regionId";
    networkInterfaceState.id = UUID.randomUUID().toString();
    return test.postServiceSynchronously(NetworkInterfaceService.FACTORY_LINK, networkInterfaceState, NetworkInterfaceState.class);
}
Also used : NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState)

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