Search in sources :

Example 11 with NetworkInterfaceStateWithDetails

use of com.vmware.photon.controller.model.adapters.vsphere.ProvisionContext.NetworkInterfaceStateWithDetails in project photon-model by vmware.

the class VSphereAdapterInstanceService method findNic.

private NetworkInterfaceStateWithDetails findNic(ProvisionContext ctx, String key, String value) {
    NetworkInterfaceStateWithDetails nic = null;
    nic = ctx.nics.stream().filter(nics -> nics.subnet != null && nics.subnet.customProperties.containsKey(key) && nics.subnet.customProperties.get(key).contains(value)).findFirst().orElse(null);
    if (nic == null) {
        nic = ctx.nics.stream().filter(nics -> nics.network != null && nics.network.customProperties.containsKey(key) && nics.network.customProperties.get(key).contains(value)).findFirst().orElse(null);
    }
    return nic;
}
Also used : PowerState(com.vmware.photon.controller.model.resources.ComputeService.PowerState) IpAssignment(com.vmware.photon.controller.model.resources.NetworkInterfaceDescriptionService.IpAssignment) VirtualEthernetCardOpaqueNetworkBackingInfo(com.vmware.vim25.VirtualEthernetCardOpaqueNetworkBackingInfo) QueryTask(com.vmware.xenon.services.common.QueryTask) LifecycleState(com.vmware.photon.controller.model.resources.ComputeService.LifecycleState) DiskType(com.vmware.photon.controller.model.resources.DiskService.DiskType) SubnetState(com.vmware.photon.controller.model.resources.SubnetService.SubnetState) Map(java.util.Map) COMPUTE_HOST_LINK_PROP_NAME(com.vmware.photon.controller.model.ComputeProperties.COMPUTE_HOST_LINK_PROP_NAME) Connection(com.vmware.photon.controller.model.adapters.vsphere.util.connection.Connection) URI(java.net.URI) VirtualDevice(com.vmware.vim25.VirtualDevice) TaskInfo(com.vmware.vim25.TaskInfo) NsxProperties(com.vmware.photon.controller.model.adapters.vsphere.network.NsxProperties) CustomizationSpec(com.vmware.vim25.CustomizationSpec) DiskStateExpanded(com.vmware.photon.controller.model.resources.DiskService.DiskStateExpanded) NetworkInterfaceState(com.vmware.photon.controller.model.resources.NetworkInterfaceService.NetworkInterfaceState) StatelessService(com.vmware.xenon.common.StatelessService) Collection(java.util.Collection) TaskManager(com.vmware.photon.controller.model.adapters.util.TaskManager) Collectors(java.util.stream.Collectors) ClientUtils.handleVirtualDiskUpdate(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.handleVirtualDiskUpdate) List(java.util.List) InvalidPropertyFaultMsg(com.vmware.vim25.InvalidPropertyFaultMsg) DeferredResult(com.vmware.xenon.common.DeferredResult) ComputeService(com.vmware.photon.controller.model.resources.ComputeService) ClientUtils.handleVirtualDeviceUpdate(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.handleVirtualDeviceUpdate) VC_UUID(com.vmware.photon.controller.model.adapters.vsphere.CustomProperties.VC_UUID) VirtualFloppy(com.vmware.vim25.VirtualFloppy) VimPath(com.vmware.photon.controller.model.adapters.vsphere.util.VimPath) ComputeProperties(com.vmware.photon.controller.model.ComputeProperties) PhotonModelUriUtils(com.vmware.photon.controller.model.util.PhotonModelUriUtils) VirtualEthernetCardDistributedVirtualPortBackingInfo(com.vmware.vim25.VirtualEthernetCardDistributedVirtualPortBackingInfo) HashMap(java.util.HashMap) GetMoRef(com.vmware.photon.controller.model.adapters.vsphere.util.connection.GetMoRef) RuntimeFaultFaultMsg(com.vmware.vim25.RuntimeFaultFaultMsg) StringUtil(io.netty.util.internal.StringUtil) DvsProperties(com.vmware.photon.controller.model.adapters.vsphere.network.DvsProperties) VirtualEthernetCardNetworkBackingInfo(com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo) ArrayList(java.util.ArrayList) Level(java.util.logging.Level) ComputeInstanceRequest(com.vmware.photon.controller.model.adapterapi.ComputeInstanceRequest) VirtualCdrom(com.vmware.vim25.VirtualCdrom) ServiceStateCollectionUpdateRequest(com.vmware.xenon.common.ServiceStateCollectionUpdateRequest) ClientUtils.findMatchingDiskState(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.findMatchingDiskState) CollectionUtils(org.apache.commons.collections.CollectionUtils) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) ResourceState(com.vmware.photon.controller.model.resources.ResourceState) DATACENTER_SELF_LINK(com.vmware.photon.controller.model.adapters.vsphere.CustomProperties.DATACENTER_SELF_LINK) Operation(com.vmware.xenon.common.Operation) QueryUtils(com.vmware.photon.controller.model.query.QueryUtils) VirtualDeviceBackingInfo(com.vmware.vim25.VirtualDeviceBackingInfo) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference) TaskStage(com.vmware.xenon.common.TaskState.TaskStage) NetworkInterfaceStateWithDetails(com.vmware.photon.controller.model.adapters.vsphere.ProvisionContext.NetworkInterfaceStateWithDetails) TimeUnit(java.util.concurrent.TimeUnit) VirtualDisk(com.vmware.vim25.VirtualDisk) ClusterUtil(com.vmware.photon.controller.model.util.ClusterUtil) VirtualEthernetCard(com.vmware.vim25.VirtualEthernetCard) Collections(java.util.Collections) TaskInfoState(com.vmware.vim25.TaskInfoState) OperationJoin(com.vmware.xenon.common.OperationJoin) NetworkInterfaceStateWithDetails(com.vmware.photon.controller.model.adapters.vsphere.ProvisionContext.NetworkInterfaceStateWithDetails)

Aggregations

NetworkInterfaceStateWithDetails (com.vmware.photon.controller.model.adapters.vsphere.ProvisionContext.NetworkInterfaceStateWithDetails)11 ArrayList (java.util.ArrayList)9 ComputeState (com.vmware.photon.controller.model.resources.ComputeService.ComputeState)5 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)5 VirtualDevice (com.vmware.vim25.VirtualDevice)5 Operation (com.vmware.xenon.common.Operation)5 List (java.util.List)5 ComputeInstanceRequest (com.vmware.photon.controller.model.adapterapi.ComputeInstanceRequest)4 VimPath (com.vmware.photon.controller.model.adapters.vsphere.util.VimPath)4 Connection (com.vmware.photon.controller.model.adapters.vsphere.util.connection.Connection)4 GetMoRef (com.vmware.photon.controller.model.adapters.vsphere.util.connection.GetMoRef)4 DiskStateExpanded (com.vmware.photon.controller.model.resources.DiskService.DiskStateExpanded)4 DiskType (com.vmware.photon.controller.model.resources.DiskService.DiskType)4 PhotonModelUriUtils (com.vmware.photon.controller.model.util.PhotonModelUriUtils)4 InvalidPropertyFaultMsg (com.vmware.vim25.InvalidPropertyFaultMsg)4 RuntimeFaultFaultMsg (com.vmware.vim25.RuntimeFaultFaultMsg)4 TaskInfo (com.vmware.vim25.TaskInfo)4 TaskInfoState (com.vmware.vim25.TaskInfoState)4 VirtualCdrom (com.vmware.vim25.VirtualCdrom)4 VirtualDeviceBackingInfo (com.vmware.vim25.VirtualDeviceBackingInfo)4