From eff8394cc41612be330b19ba4e6c87a8068ad032 Mon Sep 17 00:00:00 2001 From: Peter Mikus Date: Tue, 3 Jul 2018 05:01:46 +0000 Subject: CSIT-1046 Make uio driver configurable from topofiles Currently we are configuring uio_driver from global variable. This may not be suitable for various topologies where we need different driver per TB. This patch is suppose to put uio_driver into topology files. Change-Id: I56af0697e8b2359ccb126151217976408720c1ba Signed-off-by: Peter Mikus --- resources/libraries/python/DUTSetup.py | 13 +++++++++ resources/libraries/python/VppConfigGenerator.py | 36 +++++++++++++----------- resources/libraries/robot/shared/default.robot | 2 +- tests/vpp/perf/__init__.robot | 4 +-- 4 files changed, 35 insertions(+), 20 deletions(-) diff --git a/resources/libraries/python/DUTSetup.py b/resources/libraries/python/DUTSetup.py index 4ead76281f..7c8ca1b828 100644 --- a/resources/libraries/python/DUTSetup.py +++ b/resources/libraries/python/DUTSetup.py @@ -483,6 +483,19 @@ class DUTSetup(object): if node['type'] == NodeType.DUT: DUTSetup.kernel_module_verify(node, module, force_load) + @staticmethod + 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 node: DUT nodes. + :type node: dict + """ + for node in nodes.values(): + if node['type'] == NodeType.DUT: + uio_driver = Topology.get_uio_driver(node) + DUTSetup.kernel_module_verify(node, uio_driver, force_load=True) + @staticmethod def kernel_module_load(node, module): """Load kernel module on node. diff --git a/resources/libraries/python/VppConfigGenerator.py b/resources/libraries/python/VppConfigGenerator.py index 4e1ec74c63..93296eba36 100644 --- a/resources/libraries/python/VppConfigGenerator.py +++ b/resources/libraries/python/VppConfigGenerator.py @@ -26,20 +26,20 @@ __all__ = ['VppConfigGenerator'] def pci_dev_check(pci_dev): - """Check if provided PCI address is in correct format. - - :param pci_dev: PCI address (expected format: xxxx:xx:xx.x). - :type pci_dev: str - :returns: True if PCI address is in correct format. - :rtype: bool - :raises ValueError: If PCI address is in incorrect format. - """ - pattern = re.compile("^[0-9A-Fa-f]{4}:[0-9A-Fa-f]{2}:" - "[0-9A-Fa-f]{2}\\.[0-9A-Fa-f]$") - if not pattern.match(pci_dev): - raise ValueError('PCI address {addr} is not in valid format ' - 'xxxx:xx:xx.x'.format(addr=pci_dev)) - return True + """Check if provided PCI address is in correct format. + + :param pci_dev: PCI address (expected format: xxxx:xx:xx.x). + :type pci_dev: str + :returns: True if PCI address is in correct format. + :rtype: bool + :raises ValueError: If PCI address is in incorrect format. + """ + pattern = re.compile("^[0-9A-Fa-f]{4}:[0-9A-Fa-f]{2}:" + "[0-9A-Fa-f]{2}\\.[0-9A-Fa-f]$") + if not pattern.match(pci_dev): + raise ValueError('PCI address {addr} is not in valid format ' + 'xxxx:xx:xx.x'.format(addr=pci_dev)) + return True class VppConfigGenerator(object): @@ -352,12 +352,16 @@ class VppConfigGenerator(object): path = ['dpdk', 'socket-mem'] self.add_config_item(self._nodeconfig, value, path) - def add_dpdk_uio_driver(self, value): + def add_dpdk_uio_driver(self, value=None): """Add DPDK uio-driver configuration. - :param value: 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 = ['dpdk', 'uio-driver'] self.add_config_item(self._nodeconfig, value, path) diff --git a/resources/libraries/robot/shared/default.robot b/resources/libraries/robot/shared/default.robot index 8331b7b928..4b8c5ecb09 100644 --- a/resources/libraries/robot/shared/default.robot +++ b/resources/libraries/robot/shared/default.robot @@ -124,7 +124,7 @@ | | | Run keyword | ${dut}.Add DPDK Socketmem | 1024,1024 | | | Run keyword | ${dut}.Add DPDK No Tx Checksum Offload | | | Run keyword | ${dut}.Add DPDK Log Level | debug -| | | Run keyword | ${dut}.Add DPDK Uio Driver | ${uio_driver} +| | | Run keyword | ${dut}.Add DPDK Uio Driver | | | Run keyword | ${dut}.Add Heapsize | 4G | | | Run keyword | ${dut}.Add Plugin | disable | default | | | Run keyword | ${dut}.Add Plugin | enable | @{plugins_to_enable} diff --git a/tests/vpp/perf/__init__.robot b/tests/vpp/perf/__init__.robot index 60410160ac..7defbf1e66 100644 --- a/tests/vpp/perf/__init__.robot +++ b/tests/vpp/perf/__init__.robot @@ -19,8 +19,7 @@ | Library | resources.libraries.python.CpuUtils | Suite Setup | Run Keywords | Setup performance global Variables | ... | AND | Setup Framework | ${nodes} -| ... | AND | Kernel module verify on all DUTs | ${nodes} -| ... | ${uio_driver} | force_load=${True} +| ... | AND | Verify UIO Driver on all DUTs | ${nodes} | ... | AND | Setup All DUTs | ${nodes} | ... | AND | Show Vpp Version On All Duts | ${nodes} | ... | AND | Get CPU Layout from all nodes | ${nodes} @@ -55,6 +54,5 @@ | | Set Global Variable | ${qemu_build} | ${True} | | Set Global Variable | ${pkt_trace} | ${False} | | Set Global Variable | ${dut_stats} | ${True} -| | Set Global Variable | ${uio_driver} | igb_uio | | @{plugins_to_enable}= | Create List | dpdk_plugin.so | | Set Global Variable | @{plugins_to_enable} -- cgit 1.2.3-korg