示例#1
0
 def test_get_ip_range_with_interface(self):
     assert_regexp_matches(get_ip_range(interface=self.iface,
                                        start_offset=1, end_offset=20),
                           ip4_range_pattern)
     assert_regexp_matches(get_ip_range(interface=self.iface,
                                        start_offset=1, count=10),
                           ip4_range_pattern)
     assert_regexp_matches(get_ip_range(interface=self.iface, end_offset=20,
                                        count=10), ip4_range_pattern)
示例#2
0
 def test_get_ip_range_with_cidr(self):
     cidr = ip_network('10.10.10.0/24')
     assert_raises(IPUtilsException, get_ip_range, cidr=cidr)
     assert_regexp_matches(get_ip_range(cidr=cidr, start_offset=1,
                                        end_offset=20), ip4_pattern)
     assert_regexp_matches(get_ip_range(cidr=cidr, start_offset=1,
                                        count=10), ip4_pattern)
     assert_regexp_matches(get_ip_range(cidr=cidr, end_offset=20,
                                        count=10), ip4_pattern)