daemon: removed utils.validate_mac and shifted tests to test_nodes

This commit is contained in:
Blake Harnden 2020-06-19 15:41:41 -07:00
parent 0d4a360e89
commit adfce52632
3 changed files with 14 additions and 40 deletions

View file

@ -33,7 +33,7 @@ from typing import (
import netaddr
from core.errors import CoreCommandError, CoreError
from core.errors import CoreCommandError
if TYPE_CHECKING:
from core.emulator.session import Session
@ -430,17 +430,3 @@ def random_mac() -> str:
value |= 0x00163E << 24
mac = netaddr.EUI(value, dialect=netaddr.mac_unix_expanded)
return str(mac)
def validate_mac(value: str) -> str:
"""
Validate mac and return unix formatted version.
:param value: address to validate
:return: unix formatted mac
"""
try:
mac = netaddr.EUI(value, dialect=netaddr.mac_unix_expanded)
return str(mac)
except netaddr.AddrFormatError as e:
raise CoreError(f"invalid mac address {value}: {e}")