Merge pull request #349 from coreemu/enhancement/mac-format
updated utils.validate_mac format to use unix expanded to avoid singu…
This commit is contained in:
commit
a91511bac5
2 changed files with 2 additions and 2 deletions
|
@ -469,7 +469,7 @@ def validate_mac(value: str) -> str:
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
mac = netaddr.EUI(value)
|
mac = netaddr.EUI(value)
|
||||||
mac.dialect = netaddr.mac_unix
|
mac.dialect = netaddr.mac_unix_expanded
|
||||||
return str(mac)
|
return str(mac)
|
||||||
except netaddr.AddrFormatError as e:
|
except netaddr.AddrFormatError as e:
|
||||||
raise CoreError(f"invalid mac address {value}: {e}")
|
raise CoreError(f"invalid mac address {value}: {e}")
|
||||||
|
|
|
@ -47,7 +47,7 @@ class TestUtils:
|
||||||
"data,expected",
|
"data,expected",
|
||||||
[
|
[
|
||||||
("AA-AA-AA-FF-FF-FF", "aa:aa:aa:ff:ff:ff"),
|
("AA-AA-AA-FF-FF-FF", "aa:aa:aa:ff:ff:ff"),
|
||||||
("AA:AA:AA:FF:FF:FF", "aa:aa:aa:ff:ff:ff"),
|
("00:00:00:FF:FF:FF", "00:00:00:ff:ff:ff"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_validate_mac(self, data, expected):
|
def test_validate_mac(self, data, expected):
|
||||||
|
|
Loading…
Reference in a new issue