- def vpp_add_l2fib_entry(node, mac, interface, bd_id):
- """ Create a static L2FIB entry on a vpp node.
+ def mac_to_bin(mac_str):
+ """Convert MAC address from string format (e.g. 01:02:03:04:05:06) to
+ binary representation (\x01\x02\x03\x04\x05\x06).
+
+ :param mac_str: MAC address in string representation.
+ :type mac_str: str
+ :returns: Binary representation of MAC address.
+ :rtype: binary
+ """
+ return binascii.unhexlify(mac_str.replace(':', ''))
+
+ @staticmethod
+ def bin_to_mac(mac_bin):
+ """Convert MAC address from binary representation
+ (\x01\x02\x03\x04\x05\x06) to string format (e.g. 01:02:03:04:05:06).
+
+ :param mac_bin: MAC address in binary representation.
+ :type mac_bin: binary
+ :returns: String representation of MAC address.
+ :rtype: str
+ """
+ mac_str = ':'.join(binascii.hexlify(mac_bin)[i:i + 2]
+ for i in range(0, 12, 2))
+ return str(mac_str.decode('ascii'))
+
+ @staticmethod
+ def vpp_add_l2fib_entry(node, mac, interface, bd_id, static_mac=1,
+ filter_mac=0, bvi_mac=0):
+ """ Create a static L2FIB entry on a VPP node.