Package netaddr
[frames] | no frames]

Package netaddr

source code

network address manipulation, done Pythonically


Version: 0.6

Submodules
  • 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.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.

Classes
  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
 
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
  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.
  ST_IPV4 = IPv4StrategyOpt(32, 8, '.', 4, 10, False)
  ST_IPV6 = IPv6Strategy(128, 16, ':', 6, 16, False)
  ST_EUI48 = EUI48Strategy(48, 8, '-', 48, 16, True)
  ST_EUI64 = AddrStrategy(64, 8, '-', 64, 16, True)
Function Details

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 strings
    • int, long - IP address integer (network byte order)
    • hex - IP address as a hexadecimal number
    • IP class/subclass or callable that accepts addr_value and addr_type arguments.