Search in sources :

Example 1 with NameServer

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;
}
Also used : NameServer(org.ovirt.engine.core.common.businessentities.network.NameServer) DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)

Example 2 with NameServer

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);
    }
}
Also used : NameServer(org.ovirt.engine.core.common.businessentities.network.NameServer) DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)

Example 3 with NameServer

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);
}
Also used : NameServer(org.ovirt.engine.core.common.businessentities.network.NameServer) ArrayList(java.util.ArrayList)

Example 4 with NameServer

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;
}
Also used : NameServer(org.ovirt.engine.core.common.businessentities.network.NameServer) ArrayList(java.util.ArrayList) DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)

Example 5 with NameServer

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"))));
}
Also used : NameServer(org.ovirt.engine.core.common.businessentities.network.NameServer) DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)

Aggregations

NameServer (org.ovirt.engine.core.common.businessentities.network.NameServer)14 DnsResolverConfiguration (org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)9 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)4 Test (org.junit.Test)3 IpConfiguration (org.ovirt.engine.core.common.businessentities.network.IpConfiguration)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Network (org.ovirt.engine.core.common.businessentities.network.Network)2 Before (org.junit.Before)1 DnsResolverConfiguration (org.ovirt.engine.api.model.DnsResolverConfiguration)1 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 VdsDynamic (org.ovirt.engine.core.common.businessentities.VdsDynamic)1 HostNetworkQos (org.ovirt.engine.core.common.businessentities.network.HostNetworkQos)1 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)1