mirror of
https://git.photon.obnh.io/AXSY/whois.git
synced 2026-03-15 02:43:39 +00:00
Initial commit: mwhois with SCION AS support and decimal AS conversion
Based on mwhois by Antonios A. Chariton Modifications for SCION AS support by Olaf Baumert, Axpo Systems AG
This commit is contained in:
72
netaddr/tests/2.x/ip/ipglob.txt
Normal file
72
netaddr/tests/2.x/ip/ipglob.txt
Normal file
@@ -0,0 +1,72 @@
|
||||
=IP Glob Tests=
|
||||
|
||||
Copyright (c) 2008-2015, David P. D. Moss. All rights reserved.
|
||||
|
||||
{{{
|
||||
|
||||
>>> from netaddr import *
|
||||
|
||||
}}}
|
||||
|
||||
IP Glob tests.
|
||||
|
||||
{{{
|
||||
|
||||
>>> cidr_to_glob('10.0.0.1/32')
|
||||
'10.0.0.1'
|
||||
|
||||
>>> cidr_to_glob('192.0.2.0/24')
|
||||
'192.0.2.*'
|
||||
|
||||
>>> cidr_to_glob('172.16.0.0/12')
|
||||
'172.16-31.*.*'
|
||||
|
||||
>>> cidr_to_glob('0.0.0.0/0')
|
||||
'*.*.*.*'
|
||||
|
||||
>>> glob_to_cidrs('10.0.0.1')
|
||||
[IPNetwork('10.0.0.1/32')]
|
||||
|
||||
>>> glob_to_cidrs('192.0.2.*')
|
||||
[IPNetwork('192.0.2.0/24')]
|
||||
|
||||
>>> glob_to_cidrs('172.16-31.*.*')
|
||||
[IPNetwork('172.16.0.0/12')]
|
||||
|
||||
>>> glob_to_cidrs('*.*.*.*')
|
||||
[IPNetwork('0.0.0.0/0')]
|
||||
|
||||
>>> glob_to_iptuple('*.*.*.*')
|
||||
(IPAddress('0.0.0.0'), IPAddress('255.255.255.255'))
|
||||
|
||||
>>> iprange_to_globs('192.0.2.0', '192.0.2.255')
|
||||
['192.0.2.*']
|
||||
|
||||
>>> iprange_to_globs('192.0.2.1', '192.0.2.15')
|
||||
['192.0.2.1-15']
|
||||
|
||||
>>> iprange_to_globs('192.0.2.255', '192.0.4.1')
|
||||
['192.0.2.255', '192.0.3.*', '192.0.4.0-1']
|
||||
|
||||
>>> iprange_to_globs('10.0.1.255', '10.0.255.255')
|
||||
['10.0.1.255', '10.0.2-3.*', '10.0.4-7.*', '10.0.8-15.*', '10.0.16-31.*', '10.0.32-63.*', '10.0.64-127.*', '10.0.128-255.*']
|
||||
|
||||
}}}
|
||||
|
||||
Validity tests.
|
||||
|
||||
{{{
|
||||
|
||||
>>> valid_glob('1.1.1.a')
|
||||
False
|
||||
|
||||
>>> valid_glob('1.1.1.1/32')
|
||||
False
|
||||
|
||||
>>> valid_glob('1.1.1.a-b')
|
||||
False
|
||||
|
||||
>>> valid_glob('1.1.a-b.*')
|
||||
False
|
||||
|
||||
}}}
|
||||
Reference in New Issue
Block a user