+ cmd = u"create_vhost_user_if"
+ err_msg = f"Failed to create Vhost-user interface " \
+ f"on host {node[u'host']}"
+ args = dict(
+ is_server=bool(is_server),
+ sock_filename=str(socket),
+ enable_gso=bool(enable_gso)
+ )
+
+ with PapiSocketExecutor(node) as papi_exec:
+ sw_if_index = papi_exec.add(cmd, **args).get_sw_if_index(err_msg)
+
+ # Update the Topology:
+ if_key = Topology.add_new_port(node, u"vhost")
+ Topology.update_interface_sw_if_index(node, if_key, sw_if_index)
+
+ ifc_name = InterfaceUtil.vpp_get_interface_name(node, sw_if_index)
+ Topology.update_interface_name(node, if_key, ifc_name)
+
+ ifc_mac = InterfaceUtil.vpp_get_interface_mac(node, sw_if_index)
+ Topology.update_interface_mac_address(node, if_key, ifc_mac)
+
+ Topology.update_interface_vhost_socket(node, if_key, socket)
+
+ return sw_if_index
+
+ @staticmethod
+ def get_vhost_user_if_name_by_sock(node, socket):
+ """Get Vhost-user interface name by socket.
+
+ :param node: Node to get Vhost-user interface name on.
+ :param socket: Vhost-user interface socket path.
+ :type node: dict
+ :type socket: str
+ :returns: Interface name or None if not found.
+ :rtype: str
+ """
+ for interface in node[u"interfaces"].values():
+ if interface.get(u"socket") == socket:
+ return interface.get(u"name")
+ return None
+
+ @staticmethod
+ def get_vhost_user_mac_by_sw_index(node, sw_if_index):
+ """Get Vhost-user l2_address for the given interface from actual
+ interface dump.
+
+ :param node: VPP node to get interface data from.
+ :param sw_if_index: SW index of the specific interface.
+ :type node: dict
+ :type sw_if_index: str
+ :returns: l2_address of the given interface.
+ :rtype: str
+ """
+ return InterfaceUtil.vpp_get_interface_mac(node, sw_if_index)
+
+ @staticmethod
+ def show_vpp_vhost_on_all_duts(nodes):
+ """Show Vhost-user on all DUTs.
+
+ :param nodes: VPP nodes.
+ :type nodes: dict
+ """
+ for node in nodes.values():
+ if node[u"type"] == NodeType.DUT:
+ VhostUser.vhost_user_dump(node)
+
+ @staticmethod
+ def vhost_user_dump(node):
+ """Get vhost-user data for the given node.
+
+ :param node: VPP node to get interface data from.
+ :type node: dict
+ :returns: List of dictionaries with all vhost-user interfaces.
+ :rtype: list
+ """
+ cmd = u"sw_interface_vhost_user_dump"
+ err_msg = f"Failed to get vhost-user dump on host {node['host']}"
+
+ with PapiSocketExecutor(node) as papi_exec:
+ details = papi_exec.add(cmd).get_details(err_msg)
+
+ logger.debug(f"Vhost-user details:\n{details}")
+ return details