debuggers.hg

view tools/python/xen/util/mac.py @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children 6d3e8f90c2df
line source
2 from string import join, split
4 def macToString(mac):
5 return ':'.join(map(lambda x: "%02x" % x, mac))
7 def macFromString(str):
8 mac = [ int(x, 16) for x in str.split(':') ]
9 if len(mac) != 6:
10 raise ValueError("invalid mac: %s" % str)
11 return mac