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

# Class EUI

    object --+
             |
            EUI

An IEEE EUI (Extended Unique Identifier).

Both EUI-48 (used for layer 2 MAC addresses) and EUI-64 are supported.

Input parsing for EUI-48 addresses is flexible, supporting many MAC variants.

Instance Methods | [hide private]
__init__(self, addr, version=None, dialect=None) Constructor. |
_get_value(self) |
_set_value(self, value) |
_get_dialect(self) |
_set_dialect(self, value) |
is_iab(self) Returns: True if this EUI is an IAB address, False otherwise |
__getitem__(self, idx) Returns: The integer value of the word referenced by index (both positive and negative). |
__setitem__(self, idx, value) Sets the value of the word referenced by index in this address |
__hash__(self) Returns: hash of this EUI object suitable for dict keys, sets etc |
__int__(self) Returns: value of this EUI object as an unsigned integer |
__long__(self) Returns: value of this EUI object as an unsigned integer |
__hex__(self) Returns: hexadecimal string representation of this EUI identifier. |
__eq__(self, other) Returns: `True` if this EUI object is numerically the same as other, `False` otherwise. |
__ne__(self, other) Returns: `False` if this EUI object is numerically the same as the other, `True` otherwise. |
__lt__(self, other) Returns: `True` if this EUI object is numerically lower in value than other, `False` otherwise. |
__le__(self, other) Returns: `True` if this EUI object is numerically lower or equal in value to other, `False` otherwise. |
__gt__(self, other) Returns: `True` if this EUI object is numerically greater in value than other, `False` otherwise. |
__ge__(self, other) Returns: `True` if this EUI object is numerically greater or equal in value to other, `False` otherwise. |
bits(self, word_sep=None) Returns: human-readable binary digit string of this address |
packed(self) Returns: binary packed string of this address |
bin(self) Returns: standard Python binary representation of this address. |
eui64(self) Returns: The value of this EUI object as a new 64-bit EUI object. |
ipv6_link_local(self) Returns: new link local IPv6 IPAddress object based on this EUI using the technique described in RFC 4291. |
__str__(self) Returns: EUI in representational format |
__repr__(self) Returns: Python statement to create equivalent object |
Inherited from `object`: `__delattr__`, `__getattribute__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`

Properties | [hide private]
| value a positive integer representing the value of this EUI indentifier.
| dialect a Python class providing support for the interpretation of various MAC address formats.
| oui The OUI (Organisationally Unique Identifier) for this EUI.
| ei The EI (Extension Identifier) for this EUI
| iab If is_iab() is True, the IAB (Individual Address Block) is returned, `None` otherwise.
| version The EUI version represented by this EUI object.
| info A record dict containing IEEE registration details for this EUI (MAC-48) if available, None otherwise.
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, addr, version=None, dialect=None) (Constructor) |
Constructor. Parameters: `addr` - an EUI-48 (MAC) or EUI-64 address in string format or an unsigned integer. May also be another EUI object (copy construction). `version` - (optional) the explict EUI address version. Mainly used to distinguish between EUI-48 and EUI-64 identifiers specified as integers which may be numerically equivalent. `dialect` - (optional) the mac_* dialect to be used to configure the formatting of EUI-48 (MAC) addresses. Overrides: object.__init__

### is_iab(self) |
Returns: True if this EUI is an IAB address, False otherwise

### __getitem__(self, idx) (Indexing operator) |
Returns: The integer value of the word referenced by index (both positive and negative). Raises `IndexError` if index is out of bounds. Also supports Python list slices for accessing word groups.

### __hash__(self) (Hashing function) |
hash(x) Returns: hash of this EUI object suitable for dict keys, sets etc Overrides: object.__hash__

### __int__(self) |
Returns: value of this EUI object as an unsigned integer

### __long__(self) |
Returns: value of this EUI object as an unsigned integer

### __hex__(self) |
Returns: hexadecimal string representation of this EUI identifier.

### __eq__(self, other) (Equality operator) |
Returns: `True` if this EUI object is numerically the same as other, `False` otherwise.

### __ne__(self, other) |
Returns: `False` if this EUI object is numerically the same as the other, `True` otherwise.

### __lt__(self, other) (Less-than operator) |
Returns: `True` if this EUI object is numerically lower in value than other, `False` otherwise.

### __le__(self, other) (Less-than-or-equals operator) |
Returns: `True` if this EUI object is numerically lower or equal in value to other, `False` otherwise.

### __gt__(self, other) (Greater-than operator) |
Returns: `True` if this EUI object is numerically greater in value than other, `False` otherwise.

### __ge__(self, other) (Greater-than-or-equals operator) |
Returns: `True` if this EUI object is numerically greater or equal in value to other, `False` otherwise.

### bits(self, word_sep=None) |
Parameters: `word_sep` - (optional) the separator to insert between words. Default: None - use default separator for address type. Returns: human-readable binary digit string of this address

### packed(self) |
Returns: binary packed string of this address

### bin(self) |
Returns: standard Python binary representation of this address. A back port of the format provided by the builtin bin() type available in Python 2.6.x and higher.

### eui64(self) |
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) |
Returns: new link local IPv6 IPAddress object based on this EUI using the technique described in RFC 4291. Please Note: this poses security risks in certain scenarios. Please read RFC 4941 for details. Reference: RFCs 4291 and 4941.

### __str__(self) (Informal representation operator) |
str(x) Returns: EUI in representational format Overrides: object.__str__

### __repr__(self) (Representation operator) |
repr(x) Returns: Python statement to create equivalent object Overrides: object.__repr__

Property Details | [hide private]

### value a positive integer representing the value of this EUI indentifier. Get Method: _get_value(self) Set Method: _set_value(self, value)

### dialect a Python class providing support for the interpretation of various MAC address formats. Get Method: _get_dialect(self) Set Method: _set_dialect(self, value)

### oui The OUI (Organisationally Unique Identifier) for this EUI. Get Method: unreachable.oui(self) - The OUI (Organisationally Unique Identifier) for this EUI.

### ei The EI (Extension Identifier) for this EUI Get Method: unreachable.ei(self) - The EI (Extension Identifier) for this EUI

### iab If is_iab() is True, the IAB (Individual Address Block) is returned, `None` otherwise. Get Method: unreachable.iab(self) - If is_iab() is True, the IAB (Individual Address Block) is returned, `None` otherwise.

### version The EUI version represented by this EUI object. Get Method: unreachable.version(self) - The EUI version represented by this EUI object.

### info A record dict containing IEEE registration details for this EUI (MAC-48) if available, None otherwise. Get Method: unreachable.info(self) - A record dict containing IEEE registration details for this EUI (MAC-48) if available, None otherwise.