Classes | |
class | _BaseIP |
class | _BaseNet |
class | _BaseV4 |
class | _BaseV6 |
class | _IPAddrBase |
class | AddressValueError |
class | IPv4Address |
class | IPv4Network |
class | IPv6Address |
class | IPv6Network |
class | NetmaskValueError |
Functions | |
def | _collapse_address_list_recursive |
def | _count_righthand_zero_bits |
def | _find_address_range |
def | _get_prefix_length |
def | collapse_address_list |
def | get_mixed_type_key |
def | IPAddress |
def | IPNetwork |
def | summarize_address_range |
Variables | |
string | __version__ = '2.1.1' |
_compat_has_real_bytes = bytesisnotstr | |
CollapseAddrList = collapse_address_list |
def multi_interface_roam.ipaddr._collapse_address_list_recursive | ( | addresses | ) | [private] |
Loops through the addresses, collapsing concurrent netblocks. Example: ip1 = IPv4Network'1.1.0.0/24') ip2 = IPv4Network'1.1.1.0/24') ip3 = IPv4Network'1.1.2.0/24') ip4 = IPv4Network'1.1.3.0/24') ip5 = IPv4Network'1.1.4.0/24') ip6 = IPv4Network'1.1.0.1/22') _collapse_address_list_recursive([ip1, ip2, ip3, ip4, ip5, ip6]) -> [IPv4Network('1.1.0.0/22'), IPv4Network('1.1.4.0/24')] This shouldn't be called directly; it is called via collapse_address_list([]). Args: addresses: A list of IPv4Network's or IPv6Network's Returns: A list of IPv4Network's or IPv6Network's depending on what we were passed.
def multi_interface_roam.ipaddr._count_righthand_zero_bits | ( | number, | |
bits | |||
) | [private] |
def multi_interface_roam.ipaddr._find_address_range | ( | addresses | ) | [private] |
def multi_interface_roam.ipaddr._get_prefix_length | ( | number1, | |
number2, | |||
bits | |||
) | [private] |
def multi_interface_roam.ipaddr.collapse_address_list | ( | addresses | ) |
Collapse a list of IP objects. Example: collapse_address_list([IPv4('1.1.0.0/24'), IPv4('1.1.1.0/24')]) -> [IPv4('1.1.0.0/23')] Args: addresses: A list of IPv4Network or IPv6Network objects. Returns: A list of IPv4Network or IPv6Network objects depending on what we were passed. Raises: TypeError: If passed a list of mixed version objects.
Return a key suitable for sorting between networks and addresses. Address and Network objects are not sortable by default; they're fundamentally different so the expression IPv4Address('1.1.1.1') <= IPv4Network('1.1.1.1/24') doesn't make any sense. There are some times however, where you may wish to have ipaddr sort these for you anyway. If you need to do this, you can use this function as the key= argument to sorted(). Args: obj: either a Network or Address object. Returns: appropriate key.
def multi_interface_roam.ipaddr.IPAddress | ( | address, | |
version = None |
|||
) |
Take an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. version: An Integer, 4 or 6. If set, don't try to automatically determine what the IP address type is. important for things like IPAddress(1), which could be IPv4, '0.0.0.0.1', or IPv6, '::1'. Returns: An IPv4Address or IPv6Address object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address.
def multi_interface_roam.ipaddr.IPNetwork | ( | address, | |
version = None , |
|||
strict = False |
|||
) |
Take an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. version: An Integer, if set, don't try to automatically determine what the IP address type is. important for things like IPNetwork(1), which could be IPv4, '0.0.0.1/32', or IPv6, '::1/128'. Returns: An IPv4Network or IPv6Network object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. Or if a strict network was requested and a strict network wasn't given.
def multi_interface_roam.ipaddr.summarize_address_range | ( | first, | |
last | |||
) |
Summarize a network range given the first and last IP addresses. Example: >>> summarize_address_range(IPv4Address('1.1.1.0'), IPv4Address('1.1.1.130')) [IPv4Network('1.1.1.0/25'), IPv4Network('1.1.1.128/31'), IPv4Network('1.1.1.130/32')] Args: first: the first IPv4Address or IPv6Address in the range. last: the last IPv4Address or IPv6Address in the range. Returns: The address range collapsed to a list of IPv4Network's or IPv6Network's. Raise: TypeError: If the first and last objects are not IP addresses. If the first and last objects are not the same version. ValueError: If the last object is not greater than the first. If the version is not 4 or 6.
string multi_interface_roam::ipaddr::__version__ = '2.1.1' |
multi_interface_roam::ipaddr::_compat_has_real_bytes = bytesisnotstr |