possible_leases += cidr.size
if cfg.CONF.advertise_mtu:
- mtu = self.network.mtu
+ mtu = getattr(self.network, 'mtu', 0)
# Do not advertise unknown mtu
if mtu > 0:
cmd.append('--dhcp-option-force=option:mtu,%d' % mtu)
possible_leases += netaddr.IPNetwork(s.cidr).size
if cfg.CONF.advertise_mtu:
- expected.append('--dhcp-option-force=option:mtu,%s' % network.mtu)
+ if hasattr(network, 'mtu'):
+ expected.append(
+ '--dhcp-option-force=option:mtu,%s' % network.mtu)
expected.append('--dhcp-lease-max=%d' % min(
possible_leases, max_leases))
self._test_spawn(['--conf-file=', '--domain=openstacklocal'],
network)
+ def test_spawn_cfg_advertise_mtu_plugin_doesnt_pass_mtu_value(self):
+ cfg.CONF.set_override('advertise_mtu', True)
+ network = FakeV4Network()
+ self._test_spawn(['--conf-file=', '--domain=openstacklocal'],
+ network)
+
def _test_output_init_lease_file(self, timestamp):
expected = [
'00:00:80:aa:bb:cc 192.168.0.2 * *',