Implementation of bp per-net-dhcp-enable
Change-Id: I81c2e6adb02921e8b80f8181a730b1cba9ffa649
This commit is contained in:
@@ -58,6 +58,7 @@ class FakeV4Subnet:
|
||||
ip_version = 4
|
||||
cidr = '192.168.0.0/24'
|
||||
gateway_ip = '192.168.0.1'
|
||||
enable_dhcp = True
|
||||
|
||||
|
||||
class FakeV6Subnet:
|
||||
@@ -65,6 +66,15 @@ class FakeV6Subnet:
|
||||
ip_version = 6
|
||||
cidr = 'fdca:3ba5:a17a:4ba3::/64'
|
||||
gateway_ip = 'fdca:3ba5:a17a:4ba3::1'
|
||||
enable_dhcp = True
|
||||
|
||||
|
||||
class FakeV4SubnetNoDHCP:
|
||||
id = 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee'
|
||||
ip_version = 4
|
||||
cidr = '192.168.1.0/24'
|
||||
gateway_ip = '192.168.1.1'
|
||||
enable_dhcp = False
|
||||
|
||||
|
||||
class FakeV4Network:
|
||||
@@ -85,6 +95,12 @@ class FakeDualNetwork:
|
||||
ports = [FakePort1(), FakePort2(), FakePort3()]
|
||||
|
||||
|
||||
class FakeDualNetworkSingleDHCP:
|
||||
id = 'cccccccc-cccc-cccc-cccc-cccccccccccc'
|
||||
subnets = [FakeV4Subnet(), FakeV4SubnetNoDHCP()]
|
||||
ports = [FakePort1(), FakePort2(), FakePort3()]
|
||||
|
||||
|
||||
class TestDhcpBase(unittest.TestCase):
|
||||
def test_base_abc_error(self):
|
||||
self.assertRaises(TypeError, dhcp.DhcpBase, None)
|
||||
@@ -353,6 +369,15 @@ class TestDnsmasq(TestBase):
|
||||
|
||||
self.safe.assert_called_once_with('/foo/opts', expected)
|
||||
|
||||
def test_output_opts_file_single_dhcp(self):
|
||||
expected = 'tag:tag0,option:router,192.168.0.1'
|
||||
with mock.patch.object(dhcp.Dnsmasq, 'get_conf_file_name') as conf_fn:
|
||||
conf_fn.return_value = '/foo/opts'
|
||||
dm = dhcp.Dnsmasq(self.conf, FakeDualNetworkSingleDHCP())
|
||||
dm._output_opts_file()
|
||||
|
||||
self.safe.assert_called_once_with('/foo/opts', expected)
|
||||
|
||||
def test_reload_allocations(self):
|
||||
exp_host_name = '/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/host'
|
||||
exp_host_data = """
|
||||
|
||||
Reference in New Issue
Block a user