219
219
find_cluster_interface_responsible_for_ip(
220
220
interfaces, IPAddress('10.3.3.100')))
222
def test__finds_interface_using_static_range(self):
223
nodegroup = factory.make_NodeGroup()
224
factory.make_NodeGroupInterface(nodegroup, network=IPNetwork(
226
ngi = factory.make_NodeGroupInterface(
227
nodegroup, management=NODEGROUPINTERFACE_MANAGEMENT.UNMANAGED,
228
ip='192.168.0.1', subnet_mask='', ip_range_low='',
229
ip_range_high='', static_ip_range_low='192.168.1.10',
230
static_ip_range_high='192.168.1.20')
231
factory.make_NodeGroupInterface(nodegroup, network=IPNetwork(
233
self.assertEqual(ngi, find_cluster_interface_responsible_for_ip(
234
NodeGroupInterface.objects.all(), IPAddress('192.168.1.15')))
236
def test__finds_interface_using_dynamic_range(self):
237
nodegroup = factory.make_NodeGroup()
238
factory.make_NodeGroupInterface(nodegroup, network=IPNetwork(
240
ngi = factory.make_NodeGroupInterface(
241
nodegroup, management=NODEGROUPINTERFACE_MANAGEMENT.UNMANAGED,
242
ip='192.168.0.1', subnet_mask='', static_ip_range_low='',
243
static_ip_range_high='', ip_range_low='192.168.1.10',
244
ip_range_high='192.168.1.20')
245
factory.make_NodeGroupInterface(nodegroup, network=IPNetwork(
247
self.assertEqual(ngi, find_cluster_interface_responsible_for_ip(
248
NodeGroupInterface.objects.all(), IPAddress('192.168.1.15')))
223
251
def find_cluster_interface(cluster, ip_version):
224
252
"""Find cluster interface for `cluster` with the given IP version.