netaddr.eui.EUI

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

# Class EUI

        object --+
                 |
    BaseIdentifier --+
                     |
                    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 |
__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 |
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: executable Python string to recreate equivalent object. |
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`
Inherited from BaseIdentifier
__hex__(self) Returns: hexadecimal string representation of this identifier. |
__index__(self) Returns: return the integer value of this identifier when passed to hex(), oct() or bin(). |
__int__(self) Returns: integer value of this identifier |
__long__(self) Returns: integer value of this identifier |
__oct__(self) Returns: octal string representation of this identifier. |

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.
| packed The value of this EUI address as a packed binary string.
| words A list of unsigned integer octets found in this EUI address.
| bin The value of this EUI adddress in standard Python binary representational form (0bxxx).
| info A record dict containing IEEE registration details for this EUI (MAC-48) if available, None otherwise.
| _dialect
| _module
Inherited from `object`: `__class__`
Inherited from BaseIdentifier
| _value

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__

### __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

### 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: executable Python string to recreate 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.

### packed The value of this EUI address as a packed binary string. Get Method: unreachable.packed(self) - The value of this EUI address as a packed binary string.

### words A list of unsigned integer octets found in this EUI address. Get Method: unreachable.words(self) - A list of unsigned integer octets found in this EUI address.

### bin The value of this EUI adddress in standard Python binary representational form (0bxxx). A back port of the format provided by the builtin bin() function found in Python 2.6.x and higher. Get Method: unreachable.bin(self) - The value of this EUI adddress in standard Python binary representational form (0bxxx).

### 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.