def test1_free_ip_count(self): # Add a bunch of interfaces and make sure the calc_free_ips function is # working count = calc_free_ips_str("15.0.0.200", "15.0.0.204") self.assertEqual(count, 4) x = create_ipv4_intr_from_range("foo", "private.corp.phx1.mozilla.com.com", self.system, "11:22:33:44:55:66", "15.0.0.200", "15.0.0.204") intr, errors = x intr.save() self.assertEqual(errors, None) self.assertTrue(isinstance(intr, StaticInterface)) count = calc_free_ips_str("15.0.0.200", "15.0.0.204") self.assertEqual(count, 3) x = create_ipv4_intr_from_range("foo", "private.corp.phx1.mozilla.com.com", self.system, "11:22:33:44:55:66", "15.0.0.200", "15.0.0.204") intr, errors = x intr.save() self.assertEqual(errors, None) self.assertTrue(isinstance(intr, StaticInterface)) count = calc_free_ips_str("15.0.0.200", "15.0.0.204") self.assertEqual(count, 2) x = create_ipv4_intr_from_range("foo", "private.corp.phx1.mozilla.com.com", self.system, "11:22:33:44:55:66", "15.0.0.200", "15.0.0.204") intr, errors = x intr.save() self.assertEqual(errors, None) self.assertTrue(isinstance(intr, StaticInterface)) count = calc_free_ips_str("15.0.0.200", "15.0.0.204") self.assertEqual(count, 1) x = create_ipv4_intr_from_range("foo", "private.corp.phx1.mozilla.com.com", self.system, "11:22:33:44:55:66", "15.0.0.200", "15.0.0.204") (intr, errors) = x intr.save() self.assertEqual(errors, None) self.assertTrue(isinstance(intr, StaticInterface)) count = calc_free_ips_str("15.0.0.200", "15.0.0.204") self.assertEqual(count, 0)
def test2_free_ip_count(self): return # Time is tight, not going to do this test yet. # Add an Ipv6 address and make sure the rangecount function sees it. calc_free_ips_str("2620:101:8001::", "2620:101:8001::", ip_type='6')