Package netaddr
[hide private]
[frames] | no frames]

Package netaddr

source code

network address manipulation, done Pythonically


Version: 0.6.2

Submodules [hide private]
  • netaddr.address: network address classes (IP, EUI) and associated aggregate classes (CIDR, Wildcard and IPRange).
  • netaddr.core: Classes and routines that are common to various netaddr sub modules.
  • netaddr.eui: Provides access to public network address information published by the IEEE.
  • netaddr.fallback: A module containing pure-Python implementations of certain socket module constants and functions.
  • netaddr.ip: Provides access to public network address information published by IANA.
  • netaddr.misc: Miscellanous functions and classes.
  • netaddr.strategy: network address conversion logic, constants and shared strategy objects.
  • netaddr.util: utility functions

Classes [hide private]
  AddrFormatError
An Exception indicating that a network address format is not recognised.
  AddrConversionError
An Exception indicating a failure to convert between address types or notations.
  IP
Represents individual IPv4 and IPv6 addresses.
  IPRange
Represents arbitrary contiguous blocks of IPv4 and IPv6 addresses using only a lower and upper bound IP address.
  IPRangeSet
*EXPERIMENTAL* A customised Python set class that deals with collections of IPRange class and subclass instances.
  CIDR
Represents blocks of IPv4 and IPv6 addresses using CIDR (Classless Inter-Domain Routing) notation.
  Wildcard
Represents blocks of IPv4 addresses using a wildcard or glob style syntax.
  EUI
Represents an IEEE EUI (Extended Unique Identifier) indentifier.
  OUI
Represents an individual IEEE OUI (Organisationally Unique Identifier) identifier.
  IAB
Represents an individual IEEE IAB (Individual Address Block) identifier.
  NotRegisteredError
An Exception indicating that an OUI or IAB was not found in the IEEE Registry.
Functions [hide private]
 
nrange(start, stop, step=1, fmt=None)
An xrange work alike generator that produces sequences of IP addresses based on start and stop addresses, in intervals of step size.
source code
Variables [hide private]
  BIG_ENDIAN_PLATFORM = False
True if platform is natively big endian, False otherwise.
  AT_UNSPEC = 0
unspecified address type constant.
  AT_INET = 4
IPv4 address type constant.
  AT_INET6 = 6
IPv6 address type constant.
  AT_LINK = 48
MAC/EUI-48 address type constant.
  AT_EUI64 = 64
EUI-64 address type constant.
  AT_NAMES = {0: 'unspecified', 4: 'IPv4', 6: 'IPv6', 48: 'MAC',...
Address type to address description lookup dictionary.
  ST_IPV4 = IPv4Strategy()
  ST_IPV6 = IPv6Strategy()
  ST_EUI48 = EUI48Strategy()
  ST_EUI64 = AddrStrategy(addr_type= AT_EUI64, width= 64, word_s...
Function Details [hide private]

nrange(start, stop, step=1, fmt=None)

source code 

An xrange work alike generator that produces sequences of IP addresses based on start and stop addresses, in intervals of step size.

Parameters:
  • start - first IP address string or IP object in range.
  • stop - last IP address string or IP object in range
  • step - (optional) size of step between address in range. (Default: 1)
  • fmt - (optional) callable used on addresses returned. (Default: None - IP objects). Supported options :-
    • str - IP address in string format
    • int, long - IP address as an unsigned integer
    • hex - IP address as a hexadecimal number
    • IP class/subclass or callable that accepts addr_value and addr_type arguments.

Variables Details [hide private]

AT_NAMES

Address type to address description lookup dictionary.

Value:
{0: 'unspecified', 4: 'IPv4', 6: 'IPv6', 48: 'MAC', 64: 'EUI-64'}

ST_EUI64

Value:
AddrStrategy(addr_type= AT_EUI64, width= 64, word_size= 8, word_fmt= '\
%.2X', word_sep= '-')