def add_cryptodev_config(self, node, count):
        """Add cryptodev configuration for node.

        :param node: DUT node.
        :param count: Number of crypto devices to add.
        :type node: dict
        :type count: int
        :returns: nothing
        :raises ValueError: If node type is not a DUT
        """
        if node['type'] != NodeType.DUT:
            raise ValueError('Node type is not a DUT')
        hostname = Topology.get_node_hostname(node)
        if hostname not in self._nodeconfig:
            self._nodeconfig[hostname] = {}

        cryptodev = Topology.get_cryptodev(node)
        cryptodev_config = ''

        for i in range(count):
            cryptodev_config += 'dev {}\n'.format(
                re.sub(r'\d.\d$', '1.'+str(i), cryptodev))

        self._nodeconfig[hostname]['cryptodev_config'] = cryptodev_config
        logger.debug('Setting hostname {} Cryptodev config to {}'.
                     format(hostname, cryptodev_config))

        uio_driver_config = 'uio-driver {}'.\
            format(Topology.get_uio_driver(node))

        self._nodeconfig[hostname]['uio_driver_config'] = uio_driver_config
        logger.debug('Setting hostname {} uio_driver config to {}'.
                     format(hostname, uio_driver_config))
Example #2
0
    def verify_uio_driver_on_all_duts(nodes):
        """Verify if uio driver kernel module is loaded on all DUTs. If module
        is not present it will try to load it.

        :param nodes: DUT nodes.
        :type nodes: dict
        """
        for node in nodes.values():
            if node[u"type"] == NodeType.DUT:
                uio_driver = Topology.get_uio_driver(node)
                DUTSetup.verify_kernel_module(node, uio_driver, force_load=True)
Example #3
0
    def add_dpdk_uio_driver(self, value=None):
        """Add DPDK uio-driver configuration.

        :param value: DPDK uio-driver configuration. By default, driver will be
            loaded automatically from Topology file, still leaving option
            to manually override by parameter.
        :type value: str
        """
        if value is None:
            value = Topology.get_uio_driver(self._node)
        path = [u"dpdk", u"uio-driver"]
        self.add_config_item(self._nodeconfig, value, path)