X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FVhostUser.py;h=cc9685d74d5fa0b4afab83a23e2cdd304b8924ed;hp=48cce002bd08c64c6cce370e81b36d8ae3c6d409;hb=e08706e85b412b1307df3789fdbe747b43c2bd95;hpb=d68951ac245150eeefa6e0f4156e4c1b5c9e9325 diff --git a/resources/libraries/python/VhostUser.py b/resources/libraries/python/VhostUser.py index 48cce002bd..cc9685d74d 100644 --- a/resources/libraries/python/VhostUser.py +++ b/resources/libraries/python/VhostUser.py @@ -24,36 +24,18 @@ class VhostUser: """Vhost-user interfaces L1 library.""" @staticmethod - def _sw_interface_vhost_user_dump(node): - """Get the Vhost-user dump on the given node. - - :param node: Given node to get Vhost dump from. - :type node: dict - :returns: List of Vhost-user interfaces data extracted from Papi - response. - :rtype: list - """ - cmd = u"sw_interface_vhost_user_dump" - - with PapiSocketExecutor(node) as papi_exec: - details = papi_exec.add(cmd).get_details() - - for vhost in details: - vhost[u"interface_name"] = vhost[u"interface_name"] - vhost[u"sock_filename"] = vhost[u"sock_filename"] - - logger.debug(f"VhostUser details:\n{details}") - - return details - - @staticmethod - def vpp_create_vhost_user_interface(node, socket): + def vpp_create_vhost_user_interface( + node, socket, is_server=False, enable_gso=False): """Create Vhost-user interface on VPP node. :param node: Node to create Vhost-user interface on. :param socket: Vhost-user interface socket path. + :param is_server: Server side of connection. Default: False + :param enable_gso: Generic segmentation offloading. Default: False :type node: dict :type socket: str + :type is_server: bool + :type enable_gso: bool :returns: SW interface index. :rtype: int """ @@ -61,7 +43,9 @@ class VhostUser: err_msg = f"Failed to create Vhost-user interface " \ f"on host {node[u'host']}" args = dict( - sock_filename=str(socket).encode(encoding=u"utf-8") + is_server=bool(is_server), + sock_filename=str(socket), + enable_gso=bool(enable_gso) ) with PapiSocketExecutor(node) as papi_exec: @@ -111,15 +95,6 @@ class VhostUser: """ return InterfaceUtil.vpp_get_interface_mac(node, sw_if_index) - @staticmethod - def vpp_show_vhost(node): - """Get Vhost-user data for the given node. - - :param node: VPP node to get interface data from. - :type node: dict - """ - VhostUser._sw_interface_vhost_user_dump(node) - @staticmethod def show_vpp_vhost_on_all_duts(nodes): """Show Vhost-user on all DUTs. @@ -129,7 +104,7 @@ class VhostUser: """ for node in nodes.values(): if node[u"type"] == NodeType.DUT: - VhostUser.vpp_show_vhost(node) + VhostUser.vhost_user_dump(node) @staticmethod def vhost_user_dump(node):