- def vhost_user_dump(node):
- """Get vhost-user data for the given node.
-
- TODO: Move to VhostUser.py
-
- :param node: VPP node to get interface data from.
- :type node: dict
- :returns: List of dictionaries with all vhost-user interfaces.
- :rtype: list
- """
- def process_vhost_dump(vhost_dump):
- """Process vhost dump.
-
- :param vhost_dump: Vhost interface dump.
- :type vhost_dump: dict
- :returns: Processed vhost interface dump.
- :rtype: dict
- """
- vhost_dump['interface_name'] = \
- vhost_dump['interface_name'].rstrip('\x00')
- vhost_dump['sock_filename'] = \
- vhost_dump['sock_filename'].rstrip('\x00')
- return vhost_dump
-
- cmd = 'sw_interface_vhost_user_dump'
- err_msg = 'Failed to get vhost-user dump on host {host}'.format(
- host=node['host'])
- with PapiSocketExecutor(node) as papi_exec:
- details = papi_exec.add(cmd).get_details(err_msg)
-
- for dump in details:
- # In-place edits.
- process_vhost_dump(dump)
-
- logger.debug('Vhost-user details:\n{vhost_details}'.format(
- vhost_details=details))
- return details
-
- @staticmethod
- def create_subinterface(node, interface, sub_id, outer_vlan_id=None,
- inner_vlan_id=None, type_subif=None):
+ def create_subinterface(
+ node, interface, sub_id, outer_vlan_id=None, inner_vlan_id=None,
+ type_subif=None):