From aa96484fb613061a649ce47948e7b81241b36d58 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Wed, 15 Jan 2020 17:02:27 -0800 Subject: [PATCH] updated utils.validate_mac format to use unix expanded to avoid singular values --- daemon/core/utils.py | 2 +- daemon/tests/test_utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon/core/utils.py b/daemon/core/utils.py index 73e11cb8..72bff755 100644 --- a/daemon/core/utils.py +++ b/daemon/core/utils.py @@ -469,7 +469,7 @@ def validate_mac(value: str) -> str: """ try: mac = netaddr.EUI(value) - mac.dialect = netaddr.mac_unix + mac.dialect = netaddr.mac_unix_expanded return str(mac) except netaddr.AddrFormatError as e: raise CoreError(f"invalid mac address {value}: {e}") diff --git a/daemon/tests/test_utils.py b/daemon/tests/test_utils.py index 37fe2f8a..0c6b84c4 100644 --- a/daemon/tests/test_utils.py +++ b/daemon/tests/test_utils.py @@ -47,7 +47,7 @@ class TestUtils: "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"), + ("00:00:00:FF:FF:FF", "00:00:00:ff:ff:ff"), ], ) def test_validate_mac(self, data, expected):