9 """ Convert the : separated format into binary packet data for the API """
10 return binascii.unhexlify(mac.replace(':', ''))
13 def binarytomac(binary):
14 """ Convert binary packed data in a : separated string """
15 x = b':'.join(binascii.hexlify(binary)[i:i + 2]
16 for i in range(0, 12, 2))
17 return str(x.decode('ascii'))
20 class VppMacAddress():
21 def __init__(self, addr):
31 return mactobinary(self.address)
40 def __eq__(self, other):
41 if isinstance(other, self.__class__):
42 return self.address == other.address
43 elif hasattr(other, "bytes"):
45 return self.bytes == other.bytes
47 raise TypeError("Comparing VppMacAddress:%s"
48 "with unknown type: %s" %