Classes | Functions | Variables
multi_interface_roam::ipaddr Namespace Reference

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

Function Documentation

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.

Definition at line 235 of file ipaddr.py.

def multi_interface_roam.ipaddr._count_righthand_zero_bits (   number,
  bits 
) [private]
Count the number of zero bits on the right hand side.

Args:
    number: an integer.
    bits: maximum number of bits to count.

Returns:
    The number of zero bits on the right hand side of the number.

Definition at line 154 of file ipaddr.py.

def multi_interface_roam.ipaddr._find_address_range (   addresses) [private]
Find a sequence of addresses.

Args:
    addresses: a list of IPv4 or IPv6 addresses.

Returns:
    A tuple containing the first and last IP addresses in the sequence.

Definition at line 119 of file ipaddr.py.

def multi_interface_roam.ipaddr._get_prefix_length (   number1,
  number2,
  bits 
) [private]
Get the number of leading bits that are same for two numbers.

Args:
    number1: an integer.
    number2: another integer.
    bits: the maximum number of bits to compare.

Returns:
    The number of leading bits that are the same for two numbers.

Definition at line 137 of file ipaddr.py.

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.

Definition at line 282 of file ipaddr.py.

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.

Definition at line 348 of file ipaddr.py.

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.

Definition at line 38 of file ipaddr.py.

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.

Definition at line 78 of file ipaddr.py.

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.

Definition at line 171 of file ipaddr.py.


Variable Documentation

Definition at line 25 of file ipaddr.py.

Definition at line 344 of file ipaddr.py.

Definition at line 336 of file ipaddr.py.



multi_interface_roam
Author(s): Blaise Gassend
autogenerated on Wed Sep 16 2015 04:38:27