mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
15 lines
447 B
Python
Executable File
15 lines
447 B
Python
Executable File
#!/usr/bin/python
|
|
# $Id: macgen.py 9132 2010-06-04 20:17:43Z manuel $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/util/macgen.py $
|
|
# macgen.py script to generate a MAC address for Red Hat Virtualization guests
|
|
#
|
|
import random
|
|
#
|
|
def randomMAC():
|
|
mac = [ 0x00, 0x16, 0x3e,
|
|
random.randint(0x00, 0x7f),
|
|
random.randint(0x00, 0xff),
|
|
random.randint(0x00, 0xff) ]
|
|
return ':'.join(map(lambda x: "%02x" % x, mac))
|
|
#
|
|
print randomMAC()
|