Package netaddr :: Module strategy :: Class EUI48Strategy
[frames] | no frames]

Class EUI48Strategy

source code

  object --+    
           |    
AddrStrategy --+
               |
              EUI48Strategy

Implements the operations that can be performed on an IEEE 48-bit EUI (Extended Unique Identifer). For all intents and purposes here, a MAC address.

Supports most common MAC address formats including Cisco's string format.

Instance Methods
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
valid_str(self, addr)
Returns True if MAC address string is valid, False otherwise.
source code
 
str_to_words(self, addr)
Returns an integer word sequence that is equivalent in value to MAC address in string form.
source code
 
int_to_str(self, int_val, delimiter=None, word_fmt=None, to_upper=True)
Returns a MAC address in string form that is equivalent to value represented by a network byte order integer.
source code

Inherited from AddrStrategy: bits_to_int, bits_to_str, bits_to_words, description, int_to_bits, int_to_words, str_to_bits, str_to_int, valid_bits, valid_int, valid_words, word_to_bits, words_to_bits, words_to_int, words_to_str

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

valid_str(self, addr)

source code 

Returns True if MAC address string is valid, False otherwise.

Overrides: AddrStrategy.valid_str

str_to_words(self, addr)

source code 

Returns an integer word sequence that is equivalent in value to MAC address in string form.

Overrides: AddrStrategy.str_to_words

int_to_str(self, int_val, delimiter=None, word_fmt=None, to_upper=True)

source code 

Returns a MAC address in string form that is equivalent to value represented by a network byte order integer. The output is configurable :-

delimiter - (optional) the delimiter used between words in address

word_fmt - (optional) the string format used for each word in address

Overrides: AddrStrategy.int_to_str