stdnum.mac¶
MAC address (Media Access Control address).
A media access control address (MAC address, sometimes Ethernet address) of a device is meant as a unique identifier within a network at the data link layer.
More information:
- https://en.wikipedia.org/wiki/MAC_address
- https://en.wikipedia.org/wiki/Organizationally_unique_identifier
- https://standards.ieee.org/faqs/regauth.html#2
>>> validate('D0-50-99-84-A2-A0')
'd0:50:99:84:a2:a0'
>>> to_eui48('d0:50:99:84:a2:a0')
'D0-50-99-84-A2-A0'
>>> is_multicast('d0:50:99:84:a2:a0')
False
>>> str(get_manufacturer('d0:50:99:84:a2:a0'))
'ASRock Incorporation'
>>> get_oui('d0:50:99:84:a2:a0')
'D05099'
>>> get_iab('d0:50:99:84:a2:a0')
'84A2A0'
-
stdnum.mac.
compact
(number)¶ Convert the MAC address to the minimal, consistent representation.
-
stdnum.mac.
get_iab
(number)¶ Return the IAB (individual address block) part of the address.
-
stdnum.mac.
get_manufacturer
(number)¶ Look up the manufacturer in the IEEE OUI registry.
-
stdnum.mac.
get_oui
(number)¶ Return the OUI (organization unique ID) part of the address.
-
stdnum.mac.
is_broadcast
(number)¶ Check whether the number is the broadcast address.
Broadcast addresses are meant to be received by all nodes in a network.
-
stdnum.mac.
is_locally_administered
(number)¶ Check if the address is meant to be configured by an administrator.
-
stdnum.mac.
is_multicast
(number)¶ Check whether the number is a multicast address.
Multicast addresses are meant to be received by (potentially) multiple nodes in a network (LAN).
-
stdnum.mac.
is_unicast
(number)¶ Check whether the number is a unicast address.
Unicast addresses are received by one node in a network (LAN).
-
stdnum.mac.
is_universally_administered
(number)¶ Check if the address is supposed to be assigned by the manufacturer.
-
stdnum.mac.
is_valid
(number, validate_manufacturer=None)¶ Check if the number provided is a valid IBAN.
-
stdnum.mac.
to_eui48
(number)¶ Convert the MAC address to EUI-48 format.
-
stdnum.mac.
validate
(number, validate_manufacturer=None)¶ Check if the number provided is a valid MAC address.
The existence of the manufacturer is by default only checked for universally administered addresses but can be explicitly set with the validate_manufacturer argument.