org.ovirt.engine.core.common.businessentities.network.Network.getId()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中org.ovirt.engine.core.common.businessentities.network.Network.getId()方法的一些代码示例,展示了Network.getId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Network.getId()方法的具体详情如下:
包路径:org.ovirt.engine.core.common.businessentities.network.Network
类名称:Network
方法名:getId

Network.getId介绍

暂无

代码示例

代码示例来源:origin: oVirt/ovirt-engine

@Override
  protected ActionParametersBase getRemoveParameters(
      org.ovirt.engine.core.common.businessentities.network.Network entity) {
    return new RemoveNetworkParameters(entity.getId());
  }
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
  protected ActionParametersBase getRemoveParameters(org.ovirt.engine.core.common.businessentities.network.Network entity) {
    return new RemoveNetworkParameters(entity.getId());
  }
}

代码示例来源:origin: oVirt/ovirt-engine

private org.ovirt.engine.core.common.businessentities.network.Network getNetworkById(String networkId,
    List<org.ovirt.engine.core.common.businessentities.network.Network> networks) {
  for (org.ovirt.engine.core.common.businessentities.network.Network network : networks) {
    if (network.getId().toString().equals(networkId)) {
      return network;
    }
  }
  return null;
}

代码示例来源:origin: oVirt/ovirt-engine

public Network findNetworkById(Guid networkId) {
  for (Network network : clusterNetworks) {
    if (network.getId().equals(networkId)) {
      return network;
    }
  }
  return null;
}

代码示例来源:origin: oVirt/ovirt-engine

private org.ovirt.engine.core.common.businessentities.network.Network getNetwork() {
  List<org.ovirt.engine.core.common.businessentities.network.Network> networks = parent.getNetworks();
  for (org.ovirt.engine.core.common.businessentities.network.Network entity : networks) {
    if (entity.getId().toString().equals(id)) {
      return entity;
    }
  }
  return null;
}

代码示例来源:origin: oVirt/ovirt-engine

public static void setNetworkVdsmName(Network network) {
  String networkName = network.getName();
  if (VALID_VDS_NAME_PATTERN.matcher(networkName).matches()) {
    network.setVdsmName(networkName);
  } else {
    network.setVdsmName("on" + network.getId().toString()
        .replaceAll("[^a-zA-Z0-9]+", "")
        .substring(0, BusinessEntitiesDefinitions.HOST_NIC_NAME_LENGTH - 2));
  }
}

代码示例来源:origin: oVirt/ovirt-engine

private void initNetworks(List<Network> allClusterNetworks) {
  List<VfsConfigNetwork> vfsConfigNetworks = new ArrayList<>();
  Set<Guid> attachedNetworks = getEntity().getNetworks();
  for (Network network : allClusterNetworks) {
    boolean isAttached = attachedNetworks.contains(network.getId());
    VfsConfigNetwork vfsConfigNetwork =
        new VfsConfigNetwork(isAttached, labelsModel, network);
    vfsConfigNetworks.add(vfsConfigNetwork);
  }
  networks.setItems(vfsConfigNetworks);
}

代码示例来源:origin: oVirt/ovirt-engine

private void initializeNetworkList() {
  AsyncDataProvider.getInstance().getAllDataCenterNetworks(new AsyncQuery<>(networks -> {
    Set<Guid> iscsiBonded = isBondExist() ?
        new HashSet<>(getIscsiBond().getNetworkIds()) : Collections.emptySet();
    List<Network> selected =
        networks.stream().filter(n -> iscsiBonded.contains(n.getId())).collect(Collectors.toList());
    filterNonRequiredNetworks(networks, selected);
  }), getStoragePool().getId());
}

代码示例来源:origin: oVirt/ovirt-engine

public org.ovirt.engine.core.common.businessentities.network.Network lookupNetwork(Guid id, String name) {
  for (org.ovirt.engine.core.common.businessentities.network.Network entity : getBackendCollection(queryType, getQueryParameters())) {
    if ((id != null && id.equals(entity.getId())) ||
      (name != null && name.equals(entity.getName()))) {
      return entity;
    }
  }
  return null;
}

代码示例来源:origin: oVirt/ovirt-engine

public NetworkAttachment(VdsNetworkInterface baseNic, Network network, IpConfiguration ipConfiguration) {
  this.networkId = network.getId();
  this.networkName = network.getName();
  this.nicId = baseNic.getId();
  this.nicName = baseNic.getName();
  this.ipConfiguration = ipConfiguration;
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
protected void selectPhysicalDatacenterNetwork() {
  final Network network = getNetwork();
  if (network.isExternal() && network.getProvidedBy().isSetPhysicalNetworkId()) {
    getDatacenterPhysicalNetwork().getItems()
        .stream()
        .filter(net -> Objects.equals(net.getId(), network.getProvidedBy().getPhysicalNetworkId()))
        .findAny()
        .ifPresent(this.getDatacenterPhysicalNetwork()::setSelectedItem);
  }
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
public Response add(Network network) {
  org.ovirt.engine.core.common.businessentities.network.Network entity = NetworkMapper.map(network, null);
  IscsiBond iscsiBond = getIscsiBond();
  iscsiBond.getNetworkIds().add(entity.getId());
  return performAction(ActionType.EditIscsiBond, new EditIscsiBondParameters(iscsiBond));
}

代码示例来源:origin: oVirt/ovirt-engine

private void setUpManagementNetworkExpectation() {
  setUpPopulateExpectation();
  final Network mockNetwork = mock(Network.class);
  when(mockNetwork.getId()).thenReturn(MANAGEMENT_NETWORK_ID);
  setUpGetEntityExpectations(QueryType.GetManagementNetwork,
      IdQueryParameters.class,
      new String[] { "Id" },
      new Object[] { GUIDS[0] },
      mockNetwork);
}

代码示例来源:origin: oVirt/ovirt-engine

static org.ovirt.engine.core.common.businessentities.network.Network setUpEntityExpectations(org.ovirt.engine.core.common.businessentities.network.Network entity, int index) {
  when(entity.getId()).thenReturn(GUIDS[index]);
  when(entity.getName()).thenReturn(NAMES[index]);
  when(entity.getDescription()).thenReturn(DESCRIPTIONS[index]);
  when(entity.getDataCenterId()).thenReturn(GUIDS[1]);
  return entity;
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
public Response add(Network networkModel) {
  validateParameters(networkModel, "id|name");
  final org.ovirt.engine.core.common.businessentities.network.Network network = findNetwork(networkModel);
  return performAction(ActionType.AddVfsConfigNetwork, new VfsConfigNetworkParameters(nicId, network.getId()));
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
protected Network getEntity(int index) {
  Network network = mock(Network.class);
  when(network.getId()).thenReturn(GUIDS[index]);
  when(network.getName()).thenReturn(NAMES[index]);
  ProviderNetwork providedBy = new ProviderNetwork();
  providedBy.setProviderId(GUIDS[0]);
  providedBy.setExternalId(string2hex(NAMES[index]));
  when(network.getProvidedBy()).thenReturn(providedBy);
  return network;
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
protected Network getEntity(int index) {
  Network network = mock(Network.class);
  when(network.getId()).thenReturn(GUIDS[index]);
  when(network.getName()).thenReturn(NAMES[index]);
  ProviderNetwork providedBy = new ProviderNetwork();
  providedBy.setProviderId(GUIDS[0]);
  providedBy.setExternalId(string2hex(NAMES[index]));
  when(network.getProvidedBy()).thenReturn(providedBy);
  return network;
}

代码示例来源:origin: oVirt/ovirt-engine

private NetworkCluster createNetworkCluster(ClusterNetworkModel manageModel) {
  final NetworkCluster networkCluster = new NetworkCluster();
  networkCluster.setClusterId(manageModel.getCluster().getId());
  networkCluster.setNetworkId(manageModel.getEntity().getId());
  copyRoles(manageModel, networkCluster);
  return networkCluster;
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
public Network update(Network incoming) {
  org.ovirt.engine.core.common.businessentities.network.Network network = map(incoming, map(get()));
  network.getCluster().setNetworkId(network.getId());
  network.getCluster().setClusterId(cluster.getCluster().getId());
  performAction(ActionType.UpdateNetworkOnCluster,
         new NetworkClusterParameters(network.getCluster()));
  return get();
}

代码示例来源:origin: oVirt/ovirt-engine

/**
 * Ensures that removing a network works as expected.
 */
@Test
public void testRemove() {
  Network result = dao.getByNameAndDataCenter(EXISTING_NETWORK_NAME2, FixturesTool.DATA_CENTER);
  assertNotNull(result);
  assertEquals(FixturesTool.EXISTING_DNS_RESOLVER_CONFIGURATION_TO_REMOVE,
      result.getDnsResolverConfiguration().getId());
  dao.remove(result.getId());
  assertNull(dao.getByNameAndDataCenter(EXISTING_NETWORK_NAME2, FixturesTool.DATA_CENTER));
  assertNull(dnsResolverConfigurationDao.get(FixturesTool.EXISTING_DNS_RESOLVER_CONFIGURATION_TO_REMOVE));
}

相关文章