aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/network_services
diff options
context:
space:
mode:
authorDeepak S <deepak.s@linux.intel.com>2017-09-19 01:37:02 -0700
committerRoss Brattain <ross.b.brattain@intel.com>2017-10-02 15:16:04 -0700
commit8ae63e17a4f6934895d69f4c8b4dbc7628d48526 (patch)
tree14eb9e3df1c7d50ec1996105c41c9c8208eb8c7b /yardstick/network_services
parent134e77b91771487e9a85b92d727829d43403ce38 (diff)
Enabling multi_VM & multi port launch in standalone context
new context names: - SRIOV - StandaloneSriov - OvsDpdk - StandaloneOvsDpdk - Seperate helper, libvirt, server info class - Allow multi-port and multi-VM support. Change-Id: I3c65e4535082fa0e2f4c6ee11c3bca9ccfdc01b8 Signed-off-by: Deepak S <deepak.s@linux.intel.com> Signed-off-by: Martin Banszel <martinx.banszel@intel.com>
Diffstat (limited to 'yardstick/network_services')
-rw-r--r--yardstick/network_services/utils.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/yardstick/network_services/utils.py b/yardstick/network_services/utils.py
index d52e27c15..eac3c814f 100644
--- a/yardstick/network_services/utils.py
+++ b/yardstick/network_services/utils.py
@@ -16,6 +16,7 @@
from __future__ import absolute_import
import logging
import os
+import re
from oslo_config import cfg
from oslo_config.cfg import NoSuchOptError
@@ -38,6 +39,59 @@ OPTS = [
CONF.register_opts(OPTS, group="nsb")
+HEXADECIMAL = "[0-9a-zA-Z]"
+
+
+class PciAddress(object):
+
+ PCI_PATTERN_STR = HEXADECIMAL.join([
+ "(",
+ "{4}):(", # domain (4 bytes)
+ "{2}):(", # bus (2 bytes)
+ "{2}).(", # function (2 bytes)
+ ")", # slot (1 byte)
+ ])
+
+ PCI_PATTERN = re.compile(PCI_PATTERN_STR)
+
+ @classmethod
+ def parse_address(cls, text, multi_line=False):
+ if multi_line:
+ text = text.replace(os.linesep, '')
+ match = cls.PCI_PATTERN.search(text)
+ return cls(match.group(0))
+
+ def __init__(self, address):
+ super(PciAddress, self).__init__()
+ match = self.PCI_PATTERN.match(address)
+ if not match:
+ raise ValueError('Invalid PCI address: {}'.format(address))
+ self.address = address
+ self.match = match
+
+ def __repr__(self):
+ return self.address
+
+ @property
+ def domain(self):
+ return self.match.group(1)
+
+ @property
+ def bus(self):
+ return self.match.group(2)
+
+ @property
+ def slot(self):
+ return self.match.group(3)
+
+ @property
+ def function(self):
+ return self.match.group(4)
+
+ def values(self):
+ return [self.match.group(n) for n in range(1, 5)]
+
+
def get_nsb_option(option, default=None):
"""return requested option for yardstick.conf"""
@@ -55,6 +109,8 @@ def provision_tool(connection, tool_path, tool_file=None):
:return - Tool path
"""
+ if not tool_path:
+ tool_path = get_nsb_option('tool_path')
if tool_file:
tool_path = os.path.join(tool_path, tool_file)
bin_path = get_nsb_option("bin_path")
@@ -64,6 +120,7 @@ def provision_tool(connection, tool_path, tool_file=None):
logging.warning("%s not found on %s, will try to copy from localhost",
tool_path, connection.host)
+ bin_path = get_nsb_option("bin_path")
connection.execute('mkdir -p "%s"' % bin_path)
connection.put(tool_path, tool_path)
return tool_path