use of org.ovirt.engine.core.common.businessentities.network.NameServer in project ovirt-engine by oVirt.
the class NetworkInSyncWithVdsNetworkInterfaceTest method reverseNameServersOrder.
private DnsResolverConfiguration reverseNameServersOrder(DnsResolverConfiguration sampleDnsResolverConfiguration) {
List<NameServer> reversedNameServers = sampleDnsResolverConfiguration.getNameServers();
Collections.reverse(reversedNameServers);
DnsResolverConfiguration result = new DnsResolverConfiguration();
result.setNameServers(reversedNameServers);
return result;
}
use of org.ovirt.engine.core.common.businessentities.network.NameServer in project ovirt-engine by oVirt.
the class VdsBrokerObjectsBuilder method setDnsResolverConfigurationData.
private static void setDnsResolverConfigurationData(VDS vds, Map<String, Object> struct) {
String[] nameServersAddresses = assignStringArrayValue(struct, VdsProperties.name_servers);
if (nameServersAddresses != null) {
List<NameServer> nameServers = Stream.of(nameServersAddresses).map(NameServer::new).collect(Collectors.toList());
DnsResolverConfiguration reportedDnsResolverConfiguration = new DnsResolverConfiguration();
reportedDnsResolverConfiguration.setNameServers(nameServers);
DnsResolverConfiguration oldDnsResolverConfiguration = vds.getReportedDnsResolverConfiguration();
if (oldDnsResolverConfiguration != null) {
reportedDnsResolverConfiguration.setId(oldDnsResolverConfiguration.getId());
}
vds.getDynamicData().setReportedDnsResolverConfiguration(reportedDnsResolverConfiguration);
}
}
use of org.ovirt.engine.core.common.businessentities.network.NameServer in project ovirt-engine by oVirt.
the class DnsConfigurationModel method init.
public void init() {
boolean shouldSetDnsConfiguration = shouldSetDnsConfiguration();
this.shouldSetDnsConfiguration.setEntity(shouldSetDnsConfiguration);
List<NameServerModel> nameServerModels = new ArrayList<>();
if (shouldSetDnsConfiguration) {
for (NameServer nameServer : getEntity().getNameServers()) {
nameServerModels.add(new NameServerModel(nameServer.getAddress()));
}
}
nameServerModelListModel.setItems(nameServerModels);
}
use of org.ovirt.engine.core.common.businessentities.network.NameServer in project ovirt-engine by oVirt.
the class DnsConfigurationModel method flush.
public DnsResolverConfiguration flush() {
Boolean shouldSetDnsConfiguration = this.shouldSetDnsConfiguration.getEntity();
if (!shouldSetDnsConfiguration) {
return null;
}
List<NameServer> nameServers = new ArrayList<>();
for (NameServerModel nameServerModel : this.nameServerModelListModel.getItems()) {
nameServers.add(new NameServer(nameServerModel.flush()));
}
DnsResolverConfiguration result = new DnsResolverConfiguration();
result.setNameServers(nameServers);
if (getEntity() != null) {
result.setId(getEntity().getId());
}
return result;
}
use of org.ovirt.engine.core.common.businessentities.network.NameServer in project ovirt-engine by oVirt.
the class NetworkAttachmentDaoImplTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
dao = dbFacade.getNetworkAttachmentDao();
dnsResolverConfigurationDao = dbFacade.getDnsResolverConfigurationDao();
networkAttachment = new NetworkAttachment();
networkAttachment.setNicId(FixturesTool.VDS_NETWORK_INTERFACE);
networkAttachment.setProperties(new HashMap<>());
networkAttachment.setId(Guid.newGuid());
networkAttachment.setNetworkId(FixturesTool.NETWORK_ENGINE);
networkAttachment.setIpConfiguration(createIpConfiguration(Ipv4BootProtocol.DHCP, Ipv6BootProtocol.AUTOCONF));
networkAttachment.setDnsResolverConfiguration(new DnsResolverConfiguration());
networkAttachment.getDnsResolverConfiguration().setNameServers(new ArrayList<>(Arrays.asList(new NameServer("1.1.1.1"))));
}
Aggregations