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

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

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

Network.setDnsResolverConfiguration介绍

暂无

代码示例

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

@Test
public void testDefaultRouteWhenOutOfSync() {
  network.setDnsResolverConfiguration(sampleDnsResolverConfiguration);
  assertThat(createTestedInstance(true, sampleDnsResolverConfiguration).isNetworkInSync(), is(false));
}

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

@Override
public T mapRow(ResultSet rs, int rowNum) throws SQLException {
  T entity = createNetworkEntity();
  entity.setId(getGuidDefaultEmpty(rs, "id"));
  entity.setName(rs.getString("name"));
  entity.setVdsmName(rs.getString("vdsm_name"));
  entity.setDescription(rs.getString("description"));
  entity.setComment(rs.getString("free_text_comment"));
  entity.setType((Integer) rs.getObject("type"));
  entity.setAddr(rs.getString("addr"));
  entity.setSubnet(rs.getString("subnet"));
  entity.setGateway(rs.getString("gateway"));
  entity.setVlanId((Integer) rs.getObject("vlan_id"));
  entity.setStp(rs.getBoolean("stp"));
  entity.setDataCenterId(getGuidDefaultEmpty(rs, "storage_pool_id"));
  entity.setMtu(rs.getInt("mtu"));
  entity.setVmNetwork(rs.getBoolean("vm_network"));
  Guid providerId = getGuid(rs, "provider_network_provider_id");
  if (providerId != null) {
    entity.setProvidedBy(new ProviderNetwork(
        providerId,
        rs.getString("provider_network_external_id"),
        getGuid(rs, "provider_physical_network_id")));
  }
  entity.setQosId(getGuid(rs, "qos_id"));
  entity.setLabel(rs.getString("label"));
  Guid dnsResolverConfigurationId = getGuid(rs, "dns_resolver_configuration_id");
  entity.setDnsResolverConfiguration(dnsResolverConfigurationDao.get(dnsResolverConfigurationId));
  return entity;
}

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

@Test
public void testDefaultRouteNonDefaultRouteNetwork() {
  iface.setIpv4DefaultRoute(true);
  network.setDnsResolverConfiguration(sampleDnsResolverConfiguration);
  assertThat(createTestedInstance(false, sampleDnsResolverConfiguration).isNetworkInSync(), is(false));
}

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

@Test
public void testDefaultRouteWhenOutOfSyncOnOlderCluster() {
  cluster.setCompatibilityVersion(Version.v4_1);
  network.setDnsResolverConfiguration(sampleDnsResolverConfiguration);
  assertThat(createTestedInstance(true, sampleDnsResolverConfiguration).isNetworkInSync(), is(true));
}

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

@Test
public void testDefaultRouteWhenInSync() {
  iface.setIpv4DefaultRoute(true);
  network.setDnsResolverConfiguration(sampleDnsResolverConfiguration);
  assertThat(createTestedInstance(true, sampleDnsResolverConfiguration).isNetworkInSync(), is(true));
}

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

@Test
public void testDnsResolverConfigurationNonDefaultRouteNetwork() {
  iface.setIpv4DefaultRoute(true);
  network.setDnsResolverConfiguration(sampleDnsResolverConfiguration);
  testedNetworkAttachment.setDnsResolverConfiguration(sampleDnsResolverConfiguration2);
  assertThat(createTestedInstance(false, sampleDnsResolverConfiguration).isNetworkInSync(), is(false));
}

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

@Test
public void testDnsResolverConfigurationInSyncWithHostWhenDhcpIsUsed() {
  iface.setIpv4DefaultRoute(false);
  network.setDnsResolverConfiguration(sampleDnsResolverConfiguration2);
  testedNetworkAttachment.setDnsResolverConfiguration(null);
  iface.setIpv4BootProtocol(Ipv4BootProtocol.DHCP);
  IPv4Address address = new IPv4Address();
  address.setBootProtocol(Ipv4BootProtocol.DHCP);
  testedNetworkAttachment.getIpConfiguration().setIPv4Addresses(Collections.singletonList(address));
  assertThat(createTestedInstance(true, sampleDnsResolverConfiguration).isNetworkInSync(), is(false));
}

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

private void testDnsResolverConfiguration(DnsResolverConfiguration vdsDnsResolver,
    DnsResolverConfiguration networkDnsResolver,
    DnsResolverConfiguration attachmentDnsResolver,
    boolean expectedInSync) {
  iface.setIpv4DefaultRoute(true);
  //cannot use initIpv4ConfigurationBootProtocol because of 'randomized tests' technique.
  iface.setIpv4BootProtocol(Ipv4BootProtocol.DHCP);
  IPv4Address address = new IPv4Address();
  address.setBootProtocol(Ipv4BootProtocol.DHCP);
  testedNetworkAttachment.getIpConfiguration().setIPv4Addresses(Collections.singletonList(address));
  network.setDnsResolverConfiguration(networkDnsResolver);
  testedNetworkAttachment.setDnsResolverConfiguration(attachmentDnsResolver);
  assertThat(createTestedInstance(true, vdsDnsResolver).isNetworkInSync(), is(expectedInSync));
}

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

@Test
public void testReportConfigurationsOnHostWhenDnsConfigurationResolverOutOfSync() {
  iface.setIpv4DefaultRoute(true);
  //cannot use initIpv4ConfigurationBootProtocol because of 'randomized tests' technique.
  iface.setIpv4BootProtocol(Ipv4BootProtocol.DHCP);
  IPv4Address address = new IPv4Address();
  address.setBootProtocol(Ipv4BootProtocol.DHCP);
  testedNetworkAttachment.getIpConfiguration().setIPv4Addresses(Collections.singletonList(address));
  network.setDnsResolverConfiguration(sampleDnsResolverConfiguration2);
  ReportedConfigurations reportedConfigurations = createTestedInstanceWithSameNonQosValues(true).reportConfigurationsOnHost();
  assertThat(reportedConfigurations.isNetworkInSync(), is(false));
  List<ReportedConfiguration> reportedConfigurationList = reportedConfigurations.getReportedConfigurationList();
  List<ReportedConfiguration> expectedReportedConfigurations = addReportedConfigurations(
      combineReportedConfigurations(createBasicReportedConfigurations(), reportQos(true)),
      new ReportedConfiguration(ReportedConfigurationType.IPV4_BOOT_PROTOCOL,
          iface.getIpv4BootProtocol().name(),
          /*ipv4Address*/address.getBootProtocol().name(),
          true),
      new ReportedConfiguration(ReportedConfigurationType.DNS_CONFIGURATION,
          addressesAsString(sampleDnsResolverConfiguration.getNameServers()),
          addressesAsString(network.getDnsResolverConfiguration().getNameServers()),
          false),
      new ReportedConfiguration(ReportedConfigurationType.DEFAULT_ROUTE, true, true, true)
  );
  assertThat(reportedConfigurationList.containsAll(expectedReportedConfigurations), is(true));
  assertThat(reportedConfigurationList.size(), is(expectedReportedConfigurations.size()));
}

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

public void flush() {
  network.setDataCenterId(getSelectedDc().getId());
  network.setName(getName().getEntity());
  network.setStp(getIsStpEnabled().getEntity());
  network.setDescription(getDescription().getEntity());
  network.setComment(getComment().getEntity());
  network.setVmNetwork(getIsVmNetwork().getEntity());
  String label = getNetworkLabel().getSelectedItem();
  network.setLabel(StringHelper.isNotNullOrEmpty(label) ? label : null);
  network.setDefaultMtu();
  if (getMtu().getIsChangable()) {
    network.setMtu(Integer.parseInt(getMtu().getEntity().toString()));
  }
  network.setDnsResolverConfiguration(getDnsConfigurationModel().flush());
  network.setVlanId(null);
  if (getHasVLanTag().getEntity() && !getExternal().getEntity()) {
    network.setVlanId(Integer.parseInt(getVLanTag().getEntity().toString()));
  }
  for (VnicProfileModel profileModel : getProfiles().getItems()) {
    profileModel.flush();
  }
  if (getQos().getIsChangable()) {
    HostNetworkQos qos = getQos().getSelectedItem();
    network.setQosId(qos == EMPTY_HOST_NETWORK_QOS ? null : qos.getId());
  }
}

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

/**
 * Ensures that saving a network works as expected.
 */
@Test
public void testSave() {
  List<NetworkCluster> clustersFromDB = networkClusterDao.getAllForCluster(FixturesTool.CLUSTER);
  DnsResolverConfiguration dnsResolverConfiguration =
      dnsResolverConfigurationDao.get(FixturesTool.EXISTING_DNS_RESOLVER_CONFIGURATION);
  dnsResolverConfiguration.setId(null);
  NetworkCluster clusterFromDB = clustersFromDB.get(0);
  assertNotNull(clusterFromDB);
  newNet.setCluster(clusterFromDB);
  newNet.setId(Guid.newGuid());
  newNet.setDnsResolverConfiguration(dnsResolverConfiguration);
  dao.save(newNet);
  Network result = dao.getByNameAndDataCenter(newNet.getName(), FixturesTool.DATA_CENTER);
  assertNotNull(result);
  assertEquals(newNet, result);
}

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

entity.setDnsResolverConfiguration(
    DnsResolverConfigurationMapper.map(entity.getDnsResolverConfiguration(),
        model.getDnsResolverConfiguration()));

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

@BeforeEach
public void setUp() {
  sampleDnsResolverConfiguration = new DnsResolverConfiguration();
  sampleDnsResolverConfiguration.setNameServers(Arrays.asList(
          new NameServer("192.168.1.1"),
          new NameServer("2001:0db8:85a3:0000:0000:8a2e:0370:7334")));
  sampleDnsResolverConfiguration2 = new DnsResolverConfiguration();
  sampleDnsResolverConfiguration2.setNameServers(Arrays.asList(
      new NameServer("192.168.1.2"),
      new NameServer("2002:0db8:85a3:0000:0000:8a2e:0370:7334")));
  sampleDnsResolverConfigurationWithReversedNameServers = reverseNameServersOrder(sampleDnsResolverConfiguration);
  ifaceQos = new HostNetworkQos();
  networkQos = new HostNetworkQos();
  iface = new VdsNetworkInterface();
  //needed because network is vm network by default
  iface.setBridged(true);
  iface.setQos(ifaceQos);
  iface.setReportedSwitchType(SwitchType.LEGACY);
  iface.setIpv4DefaultRoute(false);
  iface.setMtu(getDefaultHostMtu());
  network = new Network();
  network.setDnsResolverConfiguration(sampleDnsResolverConfiguration);
  testedNetworkAttachment = new NetworkAttachment();
  testedNetworkAttachment.setIpConfiguration(new IpConfiguration());
  cluster = new Cluster();
  cluster.setCompatibilityVersion(Version.v4_2);
  cluster.setRequiredSwitchTypeForCluster(SwitchType.LEGACY);
}

相关文章