Package netaddr :: Module address :: Class EUI
[hide private]
[frames] | no frames]

Class EUI

source code

object --+    
         |    
      Addr --+
             |
            EUI

Represents an IEEE EUI (Extended Unique Identifier) indentifier.

Input parser is flexible, supporting EUI-48 (including the many Media Access Control variants) and EUI-64.

Instance Methods [hide private]
 
__init__(self, addr, addr_type=0)
Constructor.
source code
 
oui(self, fmt=<class 'netaddr.eui.OUI'>)
Returns: The OUI (Organisationally Unique Identifier) for this EUI.
source code
 
ei(self)
Returns: The EI (Extension Identifier) for this EUI
source code
 
isiab(self)
Returns: True if this EUI is an IAB address, False otherwise
source code
 
iab(self, fmt=<class 'netaddr.eui.IAB'>)
Returns: If isiab() is True, the IAB (Individual Address Block) is returned, None otherwise.
source code
 
eui64(self)
Returns: The value of this EUI object as a new 64-bit EUI object.
source code
 
ipv6_link_local(self)
Returns: new link local IPv6 IP object based on this EUI using technique described in RFC 4291.
source code
 
info(self)
Returns: A record dict containing IEEE registration details for this EUI (MAC-48) if available, None otherwise.
source code

Inherited from object: __delattr__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__

    Inherited from Addr
 
__add__(self, other)
Returns: A new (potentially larger) Addr class/subclass instance.
source code
 
__and__(self, other)
Returns: bitwise AND (x & y) between the integer value of this address and another.
source code
 
__eq__(self, other)
Returns: True if this address is numerically the same as other, False otherwise.
source code
 
__ge__(self, other)
Returns: True if this address is numerically greater or equal in value to other, False otherwise.
source code
 
__getitem__(self, index)
Returns: The integer value of the word referenced by index (both positive and negative).
source code
 
__gt__(self, other)
Returns: True if this address is numerically greater in value than other, False otherwise.
source code
 
__hash__(self)
Returns: hash of this address suitable for dict keys, sets etc
source code
 
__hex__(self)
Returns: hexadecimal string representation of this address (in network byte order).
source code
 
__iadd__(self, num)
Increment value of network address by specified amount.
source code
 
__int__(self)
Returns: value of this address as an unsigned integer
source code
 
__isub__(self, num)
Decrement value of network address by specified amount.
source code
 
__iter__(self)
Returns: An iterator over individual words in this address
source code
 
__le__(self, other)
Returns: True if this address is numerically lower or equal in value to other, False otherwise.
source code
 
__len__(self)
Returns: The size (width) of this address in bits
source code
 
__long__(self)
Returns: value of this address as an unsigned integer
source code
 
__lshift__(self, numbits)
Returns: an address based on this one with its integer value left shifted by x bits.
source code
 
__lt__(self, other)
Returns: True if this address is numerically lower in value than other, False otherwise.
source code
 
__ne__(self, other)
Returns: False if this address is numerically the same as the other, True otherwise.
source code
 
__nonzero__(self)
Returns: True if the numerical value of this address is not zero, False otherwise.
source code
 
__or__(self, other)
Returns: bitwise OR (x | y) between the integer value of this IP address and another.
source code
 
__repr__(self)
Returns: executable Python string to recreate equivalent object
source code
 
__rshift__(self, numbits)
Returns: an address based on this one with its integer value right shifted by x bits.
source code
 
__setitem__(self, index, value)
Sets the value of the word referenced by index in this address
source code
 
__str__(self)
Returns: common string representation of this address
source code
 
__sub__(self, other)
Returns: A new (potentially smaller) Addr class/subclass instance.
source code
 
__xor__(self, other)
Returns: bitwise exclusive OR (x ^ y) between the integer value of this address and another.
source code
 
bin(self)
Returns: standard Python binary representation of this address.
source code
 
bits(self, word_sep=None)
Returns: human-readable binary digit string of this address
source code
 
packed(self)
Returns: binary packed string of this address
source code
Class Variables [hide private]
  STRATEGIES = (EUI48Strategy(48, 8, '-', 48, 16), AddrStrategy(...
  ADDR_TYPES = (0, 48, 64)
  strategy = StrategyDescriptor(STRATEGIES)
  addr_type = AddrTypeDescriptor(ADDR_TYPES)
    Inherited from Addr
  value = AddrValueDescriptor('value')
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, addr, addr_type=0)
(Constructor)

source code 

Constructor.

Parameters:
  • addr - an EUI-48 (MAC) or EUI-64 address in string format or as an unsigned integer.
  • addr_type - (optional) the specific EUI address type (AT_LINK or AT_EUI64). This argument is used mainly to differentiate EUI48 and EUI48 identifiers that may be numerically equivalent.
Overrides: object.__init__

oui(self, fmt=<class 'netaddr.eui.OUI'>)

source code 
Parameters:
  • fmt - callable used on return values. Default: OUI object. Also Supports str(), unicode(), int() and long().
Returns:
The OUI (Organisationally Unique Identifier) for this EUI.

ei(self)

source code 
Returns:
The EI (Extension Identifier) for this EUI

isiab(self)

source code 
Returns:
True if this EUI is an IAB address, False otherwise

iab(self, fmt=<class 'netaddr.eui.IAB'>)

source code 
Parameters:
  • fmt - callable used on return values. Default: IAB object. Also Supports str(), unicode(), int() and long().
Returns:
If isiab() is True, the IAB (Individual Address Block) is returned, None otherwise.

eui64(self)

source code 
Returns:
The value of this EUI object as a new 64-bit EUI object.
  • If this object represents an EUI-48 it is converted to EUI-64 as per the standard.
  • If this object is already and EUI-64, it just returns a new, numerically equivalent object is returned instead.

ipv6_link_local(self)

source code 
Returns:
new link local IPv6 IP object based on this EUI using technique described in RFC 4291. Please Note: this technique poses security risks in certain scenarios. Please read RFC 4941 for details. Reference: RFCs 4291 and 4941.

info(self)

source code 
Returns:
A record dict containing IEEE registration details for this EUI (MAC-48) if available, None otherwise.

Class Variable Details [hide private]

STRATEGIES

Value:
(EUI48Strategy(48, 8, '-', 48, 16), AddrStrategy(64, 8, '-', 64, 16))