@Test public void testIsNetworkInSyncWhenMtuDifferent() { iface.setMtu(1); network.setMtu(2); assertThat(createTestedInstance().isNetworkInSync(), is(false)); }
@Test public void testIsNetworkInSyncWhenMtuSameViaDefault() { NetworkInSyncWithVdsNetworkInterface testedInstanceWithSameNonQosValues = createTestedInstanceWithSameNonQosValues(); iface.setMtu(DEFAULT_MTU_VALUE); network.setMtu(VALUE_DENOTING_THAT_MTU_SHOULD_BE_SET_TO_DEFAULT_VALUE); assertThat(testedInstanceWithSameNonQosValues.isNetworkInSync(), is(true)); }
entity.setIpv6BootProtocol(Ipv6BootProtocol.forValue(rs.getInt("ipv6_boot_protocol"))); entity.setReportedSwitchType(SwitchType.parse(rs.getString("reported_switch_type"))); entity.setMtu(rs.getInt("mtu")); entity.setBridged(rs.getBoolean("bridged")); entity.setQos(hostNetworkQosDao.get(entity.getId()));
@Test public void testIsNetworkInSyncWhenVlanIdDifferent() { iface.setMtu(1); network.setMtu(1); iface.setVlanId(1); network.setVlanId(2); assertThat(createTestedInstance().isNetworkInSync(), is(false)); }
@Test public void testIsNetworkInSyncWhenBridgedFlagDifferent() { iface.setMtu(1); network.setMtu(1); iface.setVlanId(1); network.setVlanId(1); iface.setBridged(true); network.setVmNetwork(false); assertThat(createTestedInstance().isNetworkInSync(), is(false)); }
private NetworkInSyncWithVdsNetworkInterface createTestedInstanceWithSameNonQosValues(boolean isDefaultRouteNetwork) { iface.setMtu(1); network.setMtu(1); iface.setVlanId(1); network.setVlanId(1); iface.setBridged(true); network.setVmNetwork(true); return createTestedInstance(isDefaultRouteNetwork, sampleDnsResolverConfiguration); }
@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); }
@BeforeEach @Override public void setUp() throws Exception { super.setUp(); existingVdsInterface = dao.get(FixturesTool.VDS_NETWORK_INTERFACE); newQos = new HostNetworkQos(); newQos.setOutAverageLinkshare(30); newQos.setOutAverageUpperlimit(30); newQos.setOutAverageRealtime(30); newVdsInterface = new VdsNetworkInterface(); newVdsInterface.setStatistics(new VdsNetworkStatistics()); newVdsInterface.setId(Guid.newGuid()); newVdsInterface.setName("eth77"); newVdsInterface.setNetworkName("enginet"); newVdsInterface.setSpeed(1000); newVdsInterface.setType(3); newVdsInterface.setMacAddress("01:C0:81:21:71:17"); newVdsInterface.setIpv4BootProtocol(Ipv4BootProtocol.STATIC_IP); newVdsInterface.setIpv4Address("192.168.122.177"); newVdsInterface.setIpv4Subnet("255.255.255.0"); newVdsInterface.setIpv4Gateway("192.168.122.1"); newVdsInterface.setIpv6BootProtocol(Ipv6BootProtocol.AUTOCONF); newVdsInterface.setIpv6Address("ipv6 address"); newVdsInterface.setIpv6Prefix(666); newVdsInterface.setIpv6Gateway("ipv6 gateway"); newVdsInterface.setMtu(1500); newVdsInterface.setQos(newQos); newVdsStatistics = newVdsInterface.getStatistics(); }