python-compute/node_agent/utils/mac.py

11 lines
276 B
Python
Raw Normal View History

2023-08-24 22:36:12 +03:00
import random
def random_mac() -> str:
"""Retrun random MAC address."""
mac = [0x00, 0x16, 0x3e,
random.randint(0x00, 0x7f),
random.randint(0x00, 0xff),
random.randint(0x00, 0xff)]
return ':'.join(map(lambda x: "%02x" % x, mac))