def setUp(self): self.d, _ = Domain.objects.get_or_create(name="com") Domain.objects.get_or_create(name="arpa") Domain.objects.get_or_create(name="in-addr.arpa") Domain.objects.get_or_create(name="10.in-addr.arpa") self.s = Network(network_str="10.0.0.0/16", ip_type='4') self.s.update_network() self.s.save() self.s1 = Network(network_str="10.2.1.0/24", ip_type='4') self.s1.update_network() self.s1.save()
def setUp(self): self.d = Domain(name="com") self.s = Network(network_str="1234:1234:1234::/16", ip_type='6') self.s.update_network() self.s.save() self.s1 = Network(network_str="1234:1134:1234::/32", ip_type='6') self.s1.update_network() self.s1.save() self.s2 = Network(network_str="fff::/4", ip_type='6') self.s2.update_network() self.s2.save() self.s3 = Network(network_str="ffff::/4", ip_type='6') self.s3.update_network() self.s3.save()
def do_basic_add(self, network, prefixlen, ip_type, name=None, number=None): s = Network(network_str=network + "/" + prefixlen, ip_type=ip_type) s.clean() s.save() self.assertTrue(s) return s
def calc_networks_str(network_str, ip_type): network = Network(network_str=network_str, ip_type=ip_type) return calc_networks(network)
def calc_parent_str(network_str, ip_type): network = Network(network_str=network_str, ip_type=ip_type) return calc_parent(network)