summaryrefslogtreecommitdiffstats
path: root/test/vpp_mac.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/vpp_mac.py')
-rw-r--r--test/vpp_mac.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/vpp_mac.py b/test/vpp_mac.py
index 787d77c58bd..b20bf54634c 100644
--- a/test/vpp_mac.py
+++ b/test/vpp_mac.py
@@ -2,8 +2,19 @@
MAC Types
"""
+import binascii
-from util import mactobinary
+
+def mactobinary(mac):
+ """ Convert the : separated format into binary packet data for the API """
+ return binascii.unhexlify(mac.replace(':', ''))
+
+
+def binarytomac(binary):
+ """ Convert binary packed data in a : separated string """
+ x = b':'.join(binascii.hexlify(binary)[i:i + 2]
+ for i in range(0, 12, 2))
+ return str(x.decode('ascii'))
class VppMacAddress():