private NetworkAttachment createNetworkAttachment(Guid id, VdsNetworkInterface baseNic, Network network) { NetworkAttachment networkAttachment = new NetworkAttachment(baseNic, network, NetworkCommonUtils.createDefaultIpConfiguration()); networkAttachment.setId(id); return networkAttachment; }
private NetworkAttachment createAttachmentWhenAttachingTo(VdsNetworkInterface targetNic) { NetworkAttachment networkAttachment = new NetworkAttachment(targetNic, networkModel.getNetwork(), NetworkCommonUtils.createDefaultIpConfiguration()); NetworkParameters netParams = networkModel.getSetupModel().getNetworkToLastDetachParams().get(networkModel.getName()); if (netParams != null) { applyOnAttachmentParamsFrom(netParams, networkAttachment); } else { VdsNetworkInterface nicToTakeParamsFrom = null; if (networkModel.hasVlan()) { nicToTakeParamsFrom = getPotentialVlanDevice(targetNic); } else { nicToTakeParamsFrom = targetNic; } boolean newlyCreatedBond = nicToTakeParamsFrom != null && nicToTakeParamsFrom.getId() == null; if (nicToTakeParamsFrom != null && !newlyCreatedBond) { InterfacePropertiesAccessor.FromNic interfacePropertiesAccessor = new InterfacePropertiesAccessor.FromNic(nicToTakeParamsFrom, null); applyOnAttachmentParamsFrom(interfacePropertiesAccessor, networkAttachment); } fixBootProtocolOfMgmtNetworkIfNeeded(networkAttachment); } return networkAttachment; }
@BeforeEach @Override public void setUp() throws Exception { super.setUp(); 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")))); }
public NetworkAttachment networkAttachmentFromFixtures() { NetworkAttachment expected = new NetworkAttachment(); expected.setId(FixturesTool.NETWORK_ATTACHMENT); expected.setNetworkId(FixturesTool.NETWORK_ENGINE_2); expected.setNicId(FixturesTool.VDS_NETWORK_INTERFACE2); IpConfiguration ipConfiguration = new IpConfiguration(); ipConfiguration.getIPv4Addresses().add(createPrimaryIpv4Address()); ipConfiguration.getIpV6Addresses().add(createPrimaryIpv6Address()); expected.setIpConfiguration(ipConfiguration); Map<String, String> properties = new HashMap<>(); properties.put("prop1", "true"); properties.put("prop2", "123456"); expected.setProperties(properties); expected.setDnsResolverConfiguration(new DnsResolverConfiguration()); expected.getDnsResolverConfiguration().setId(Guid.createGuidFromString("6de58dc3-171d-426d-99fc-295c25c091d3")); expected.getDnsResolverConfiguration().setNameServers(Arrays.asList( new NameServer("192.168.1.2"), new NameServer("2002:0db8:85a3:0000:0000:8a2e:0370:7334") )); return expected; }
org.ovirt.engine.core.common.businessentities.network.NetworkAttachment template) { org.ovirt.engine.core.common.businessentities.network.NetworkAttachment entity = template == null ? new org.ovirt.engine.core.common.businessentities.network.NetworkAttachment() : template;
@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); }