+ def process_tap_dump(tap_dump):
+ """Process tap dump.
+
+ :param tap_dump: Tap interface dump.
+ :type tap_dump: dict
+ :returns: Processed tap interface dump.
+ :rtype: dict
+ """
+ tap_dump[u"host_mac_addr"] = str(tap_dump[u"host_mac_addr"])
+ tap_dump[u"host_ip4_prefix"] = str(tap_dump[u"host_ip4_prefix"])
+ tap_dump[u"host_ip6_prefix"] = str(tap_dump[u"host_ip6_prefix"])
+ tap_dump[u"tap_flags"] = tap_dump[u"tap_flags"].value \
+ if hasattr(tap_dump[u"tap_flags"], u"value") \
+ else int(tap_dump[u"tap_flags"])
+ tap_dump[u"host_namespace"] = None \
+ if tap_dump[u"host_namespace"] == u"(nil)" \
+ else tap_dump[u"host_namespace"]
+ tap_dump[u"host_bridge"] = None \
+ if tap_dump[u"host_bridge"] == u"(nil)" \
+ else tap_dump[u"host_bridge"]
+
+ return tap_dump
+
+ cmd = u"sw_interface_tap_v2_dump"
+ err_msg = f"Failed to get TAP dump on host {node[u'host']}"
+
+ with PapiSocketExecutor(node) as papi_exec:
+ details = papi_exec.add(cmd).get_details(err_msg)
+
+ data = list() if name is None else dict()
+ for dump in details:
+ if name is None:
+ data.append(process_tap_dump(dump))
+ elif dump.get(u"host_if_name") == name:
+ data = process_tap_dump(dump)
+ break
+
+ logger.debug(f"TAP data:\n{data}")
+ return data
+
+
+class TapFeatureMask:
+ """Tap features utilities"""