aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/VppConfigGenerator.py
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2018-07-03 05:01:46 +0000
committerPeter Mikus <pmikus@cisco.com>2018-07-03 05:56:57 +0000
commiteff8394cc41612be330b19ba4e6c87a8068ad032 (patch)
tree5c875dd0fe72de72fc13893f0758b498087cd12d /resources/libraries/python/VppConfigGenerator.py
parent21af99fef1c4dd45651704678b2ee545f55dfb88 (diff)
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 <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries/python/VppConfigGenerator.py')
-rw-r--r--resources/libraries/python/VppConfigGenerator.py36
1 files changed, 20 insertions, 16 deletions
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)