aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/contexts/standalone
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/benchmark/contexts/standalone')
-rw-r--r--yardstick/benchmark/contexts/standalone/model.py16
-rw-r--r--yardstick/benchmark/contexts/standalone/ovs_dpdk.py26
-rw-r--r--yardstick/benchmark/contexts/standalone/sriov.py33
3 files changed, 50 insertions, 25 deletions
diff --git a/yardstick/benchmark/contexts/standalone/model.py b/yardstick/benchmark/contexts/standalone/model.py
index 4d43f2611..ecddcbbe0 100644
--- a/yardstick/benchmark/contexts/standalone/model.py
+++ b/yardstick/benchmark/contexts/standalone/model.py
@@ -26,7 +26,7 @@ import xml.etree.ElementTree as ET
from yardstick import ssh
from yardstick.common import constants
from yardstick.common import exceptions
-from yardstick.common.yaml_loader import yaml_load
+from yardstick.common import yaml_loader
from yardstick.network_services.utils import PciAddress
from yardstick.network_services.helpers.cpu import CpuSysCores
@@ -45,7 +45,7 @@ VM_TEMPLATE = """
<vcpu cpuset='{cpuset}'>{vcpu}</vcpu>
{cputune}
<os>
- <type arch="x86_64" machine="pc-i440fx-utopic">hvm</type>
+ <type arch="x86_64" machine="pc-i440fx-xenial">hvm</type>
<boot dev="hd" />
</os>
<features>
@@ -394,26 +394,18 @@ class StandaloneContextHelper(object):
return pf_vfs
- def read_config_file(self):
- """Read from config file"""
-
- with open(self.file_path) as stream:
- LOG.info("Parsing pod file: %s", self.file_path)
- cfg = yaml_load(stream)
- return cfg
-
def parse_pod_file(self, file_path, nfvi_role='Sriov'):
self.file_path = file_path
nodes = []
nfvi_host = []
try:
- cfg = self.read_config_file()
+ cfg = yaml_loader.read_yaml_file(self.file_path)
except IOError as io_error:
if io_error.errno != errno.ENOENT:
raise
self.file_path = os.path.join(constants.YARDSTICK_ROOT_PATH,
file_path)
- cfg = self.read_config_file()
+ cfg = yaml_loader.read_yaml_file(self.file_path)
nodes.extend([node for node in cfg["nodes"] if str(node["role"]) != nfvi_role])
nfvi_host.extend([node for node in cfg["nodes"] if str(node["role"]) == nfvi_role])
diff --git a/yardstick/benchmark/contexts/standalone/ovs_dpdk.py b/yardstick/benchmark/contexts/standalone/ovs_dpdk.py
index b9e66a481..88ad598c3 100644
--- a/yardstick/benchmark/contexts/standalone/ovs_dpdk.py
+++ b/yardstick/benchmark/contexts/standalone/ovs_dpdk.py
@@ -20,11 +20,12 @@ import re
import time
from yardstick import ssh
-from yardstick.network_services.utils import get_nsb_option
-from yardstick.benchmark.contexts.base import Context
+from yardstick.benchmark import contexts
+from yardstick.benchmark.contexts import base
from yardstick.benchmark.contexts.standalone import model
from yardstick.common import exceptions
from yardstick.network_services import utils
+from yardstick.network_services.utils import get_nsb_option
LOG = logging.getLogger(__name__)
@@ -32,12 +33,12 @@ LOG = logging.getLogger(__name__)
MAIN_BRIDGE = 'br0'
-class OvsDpdkContext(Context):
+class OvsDpdkContext(base.Context):
""" This class handles OVS standalone nodes - VM running on Non-Managed NFVi
Configuration: ovs_dpdk
"""
- __context_type__ = "StandaloneOvsDpdk"
+ __context_type__ = contexts.CONTEXT_STANDALONEOVSDPDK
SUPPORTED_OVS_TO_DPDK_MAP = {
'2.6.0': '16.07.1',
@@ -298,13 +299,28 @@ class OvsDpdkContext(Context):
for vm in self.vm_names:
model.Libvirt.check_if_vm_exists_and_delete(vm, self.connection)
+ def _get_physical_nodes(self):
+ return self.nfvi_host
+
+ def _get_physical_node_for_server(self, server_name):
+ node_name, ctx_name = self.split_host_name(server_name)
+ if ctx_name is None or self.name != ctx_name:
+ return None
+
+ matching_nodes = [s for s in self.servers if s == node_name]
+ if len(matching_nodes) == 0:
+ return None
+
+ # self.nfvi_host always contain only one host
+ return "{}.{}".format(self.nfvi_host[0]["name"], self._name)
+
def _get_server(self, attr_name):
"""lookup server info by name from context
Keyword arguments:
attr_name -- A name for a server listed in nodes config file
"""
- node_name, name = self.split_name(attr_name)
+ node_name, name = self.split_host_name(attr_name)
if name is None or self.name != name:
return None
diff --git a/yardstick/benchmark/contexts/standalone/sriov.py b/yardstick/benchmark/contexts/standalone/sriov.py
index 95472fdda..3da12a9a8 100644
--- a/yardstick/benchmark/contexts/standalone/sriov.py
+++ b/yardstick/benchmark/contexts/standalone/sriov.py
@@ -18,20 +18,21 @@ import logging
import collections
from yardstick import ssh
-from yardstick.network_services.utils import get_nsb_option
-from yardstick.benchmark.contexts.base import Context
+from yardstick.benchmark import contexts
+from yardstick.benchmark.contexts import base
from yardstick.benchmark.contexts.standalone import model
+from yardstick.network_services.utils import get_nsb_option
from yardstick.network_services.utils import PciAddress
LOG = logging.getLogger(__name__)
-class SriovContext(Context):
+class SriovContext(base.Context):
""" This class handles SRIOV standalone nodes - VM running on Non-Managed NFVi
Configuration: sr-iov
"""
- __context_type__ = "StandaloneSriov"
+ __context_type__ = contexts.CONTEXT_STANDALONESRIOV
def __init__(self):
self.file_path = None
@@ -106,13 +107,29 @@ class SriovContext(Context):
build_vfs = "echo 0 > /sys/bus/pci/devices/{0}/sriov_numvfs"
self.connection.execute(build_vfs.format(ports.get('phy_port')))
+ def _get_physical_nodes(self):
+ return self.nfvi_host
+
+ def _get_physical_node_for_server(self, server_name):
+
+ # self.nfvi_host always contain only one host.
+ node_name, ctx_name = self.split_host_name(server_name)
+ if ctx_name is None or self.name != ctx_name:
+ return None
+
+ matching_nodes = [s for s in self.servers if s == node_name]
+ if len(matching_nodes) == 0:
+ return None
+
+ return "{}.{}".format(self.nfvi_host[0]["name"], self._name)
+
def _get_server(self, attr_name):
"""lookup server info by name from context
Keyword arguments:
attr_name -- A name for a server listed in nodes config file
"""
- node_name, name = self.split_name(attr_name)
+ node_name, name = self.split_host_name(attr_name)
if name is None or self.name != name:
return None
@@ -194,10 +211,10 @@ class SriovContext(Context):
slot = index + idx + 10
vf['vpci'] = \
"{}:{}:{:02x}.{}".format(vpci.domain, vpci.bus, slot, vpci.function)
- model.Libvirt.add_sriov_interfaces(
- vf['vpci'], vf['vf_pci']['vf_pci'], vf['mac'], str(cfg))
self.connection.execute("ifconfig %s up" % vf['interface'])
self.connection.execute(vf_spoofchk.format(vf['interface']))
+ return model.Libvirt.add_sriov_interfaces(
+ vf['vpci'], vf['vf_pci']['vf_pci'], vf['mac'], str(cfg))
def setup_sriov_context(self):
nodes = []
@@ -220,7 +237,7 @@ class SriovContext(Context):
network_ports = collections.OrderedDict(
{k: v for k, v in vnf["network_ports"].items() if k != 'mgmt'})
for idx, vfs in enumerate(network_ports.values()):
- self._enable_interfaces(index, idx, vfs, cfg)
+ xml_str = self._enable_interfaces(index, idx, vfs, xml_str)
# copy xml to target...
model.Libvirt.write_file(cfg, xml_str)