You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
:param oui: an OUI string ``XX-XX-XX`` or an unsigned integer. \
Also accepts and parses full MAC/EUI-48 address strings (but not \
MAC/EUI-48 integers)!
"""
super(OUI, self).__init__()
It handles a hyphen-separated OUI okay:
>>> OUI('f4-6d-04')
OUI('F4-6D-04')
But doesn't work as advertised in the doc string with any of the formats (supported by EUI parser):
Bare MAC:
>>> oui = OUI('f46d04112233')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/netaddr/eui/__init__.py", line 101, in __init__
raise NotRegisteredError('OUI %r not registered!' % oui)
netaddr.core.NotRegisteredError: OUI 'f46d04112233' not registered!
Hyphen-separated MAC:
>>> oui = OUI('f4-6d-04-11-22-33')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/netaddr/eui/__init__.py", line 101, in __init__
raise NotRegisteredError('OUI %r not registered!' % oui)
netaddr.core.NotRegisteredError: OUI 'f4-6d-04-11-22-33' not registered!
Colon-separated MAC:
>>> OUI('f4:6d:04:11:22:33')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/netaddr/eui/__init__.py", line 83, in __init__
self._value = int(oui.replace('-', ''), 16)
ValueError: invalid literal for int() with base 16: 'f4:6d:04:11:22:33'
FWIW I'm testing on version 0.7.19 (Debian bullseye) but the code I've linked to is in master.
The OUI constructor
OUI.__init__
claims to support accepting a regular old MAC address as an input:netaddr/netaddr/eui/__init__.py
Lines 64 to 72 in e84688f
It handles a hyphen-separated OUI okay:
>>> OUI('f4-6d-04') OUI('F4-6D-04')
But doesn't work as advertised in the doc string with any of the formats (supported by EUI parser):
Bare MAC:
Hyphen-separated MAC:
Colon-separated MAC:
>>> OUI('f4:6d:04:11:22:33') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3/dist-packages/netaddr/eui/__init__.py", line 83, in __init__ self._value = int(oui.replace('-', ''), 16) ValueError: invalid literal for int() with base 16: 'f4:6d:04:11:22:33'
FWIW I'm testing on version
0.7.19
(Debian bullseye) but the code I've linked to is inmaster
.There are a number of TODOs here:
netaddr/netaddr/eui/__init__.py
Lines 79 to 83 in e84688f
The text was updated successfully, but these errors were encountered: