summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py106
-rw-r--r--yardstick/network_services/vnf_generic/vnf/sample_vnf.py41
2 files changed, 0 insertions, 147 deletions
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
index 6c102ed59..39f25eacc 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
@@ -29,7 +29,6 @@ from yardstick.benchmark.contexts.base import Context
from yardstick.network_services.nfvi.resource import ResourceProfile
from yardstick.network_services.traffic_profile.base import TrafficProfile
from yardstick.network_services.vnf_generic.vnf.base import VnfdHelper
-from yardstick.ssh import SSHError
class MockError(BaseException):
@@ -609,111 +608,6 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase):
dpdk_setup_helper._build_pipeline_kwargs()
self.assertDictEqual(dpdk_setup_helper.pipeline_kwargs, expected)
- def test__get_app_cpu(self):
- vnfd_helper = VnfdHelper(self.VNFD_0)
- ssh_helper = mock.Mock()
- ssh_helper.provision_tool.return_value = 'tool_path'
- scenario_helper = mock.Mock()
- dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
-
- dpdk_setup_helper.CORES = expected = [5, 4, 3]
- result = dpdk_setup_helper._get_app_cpu()
- self.assertEqual(result, expected)
-
- @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.CpuSysCores')
- def test__get_app_cpu_no_cores_sw(self, mock_cpu_sys_cores_class):
- mock_cpu_sys_cores = mock_cpu_sys_cores_class()
- mock_cpu_sys_cores.get_core_socket.return_value = {
- 'socket': [2, 4, 8, 10, 12],
- }
- vnfd_helper = VnfdHelper(self.VNFD_0)
- ssh_helper = mock.Mock()
- ssh_helper.provision_tool.return_value = 'tool_path'
- scenario_helper = mock.Mock()
- scenario_helper.vnf_cfg = {
- 'worker_threads': '2',
- }
- dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
- dpdk_setup_helper.CORES = []
- dpdk_setup_helper.SW_DEFAULT_CORE = 1
- dpdk_setup_helper.HW_DEFAULT_CORE = 2
- dpdk_setup_helper.socket = 'socket'
-
- expected = [2, 4, 8]
- result = dpdk_setup_helper._get_app_cpu()
- self.assertEqual(result, expected)
-
- @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.CpuSysCores')
- def test__get_app_cpu_no_cores_hw(self, mock_cpu_sys_cores_class):
- mock_cpu_sys_cores = mock_cpu_sys_cores_class()
- mock_cpu_sys_cores.get_core_socket.return_value = {
- 'socket': [2, 4, 8, 10, 12],
- }
- vnfd_helper = VnfdHelper(self.VNFD_0)
- ssh_helper = mock.Mock()
- scenario_helper = mock.Mock()
- scenario_helper.vnf_cfg = {
- 'worker_threads': '2',
- 'lb_config': 'HW',
- }
- dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
- dpdk_setup_helper.CORES = []
- dpdk_setup_helper.SW_DEFAULT_CORE = 1
- dpdk_setup_helper.HW_DEFAULT_CORE = 2
- dpdk_setup_helper.socket = 'socket'
-
- expected = [2, 4, 8, 10]
- result = dpdk_setup_helper._get_app_cpu()
- self.assertEqual(result, expected)
-
- def test__get_cpu_sibling_list(self):
- vnfd_helper = VnfdHelper(self.VNFD_0)
- ssh_helper = mock.Mock()
- ssh_helper.execute.side_effect = iter([(0, '5', ''), (0, '3,4', ''), (0, '10', '')])
- scenario_helper = mock.Mock()
- dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
- dpdk_setup_helper._get_app_cpu = mock.Mock(return_value=[])
-
- expected = ['5', '3', '4', '10']
- result = dpdk_setup_helper._get_cpu_sibling_list([1, 3, 7])
- self.assertEqual(result, expected)
-
- def test__get_cpu_sibling_list_no_core_arg(self):
- vnfd_helper = VnfdHelper(self.VNFD_0)
- ssh_helper = mock.Mock()
- ssh_helper.execute.side_effect = iter([(0, '5', ''), (0, '3,4', ''), (0, '10', '')])
- scenario_helper = mock.Mock()
- dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
- dpdk_setup_helper._get_app_cpu = mock.Mock(return_value=[1, 7])
-
- expected = ['5', '3', '4']
- result = dpdk_setup_helper._get_cpu_sibling_list()
- self.assertEqual(result, expected)
-
- def test__get_cpu_sibling_list_ssh_failure(self):
- vnfd_helper = VnfdHelper(self.VNFD_0)
- ssh_helper = mock.Mock()
- ssh_helper.execute.side_effect = iter([(0, '5', ''), SSHError, (0, '10', '')])
- scenario_helper = mock.Mock()
- dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
- dpdk_setup_helper._get_app_cpu = mock.Mock(return_value=[])
-
- expected = []
- result = dpdk_setup_helper._get_cpu_sibling_list([1, 3, 7])
- self.assertEqual(result, expected)
-
- def test__validate_cpu_cfg(self):
- vnfd_helper = VnfdHelper(self.VNFD_0)
- ssh_helper = mock.Mock()
- ssh_helper.execute.side_effect = iter([(0, '5', ''), (0, '3,4', ''), (0, '10', '')])
- scenario_helper = mock.Mock()
- dpdk_setup_helper = DpdkVnfSetupEnvHelper(vnfd_helper, ssh_helper, scenario_helper)
- dpdk_setup_helper._get_app_cpu = mock.Mock(return_value=[1, 3, 7])
-
- expected = ['5', '3', '4', '10']
- result = dpdk_setup_helper._validate_cpu_cfg()
- self.assertEqual(result, expected)
-
@mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.time')
@mock.patch('yardstick.ssh.SSH')
def test_setup_vnf_environment(self, _, mock_time):
diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
index f0c276ab3..75ed6227d 100644
--- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
+++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
@@ -22,7 +22,6 @@ import os
import re
import subprocess
from collections import Mapping
-
from multiprocessing import Queue, Value, Process
from six.moves import cStringIO
@@ -30,7 +29,6 @@ from six.moves import cStringIO
from yardstick.benchmark.contexts.base import Context
from yardstick.benchmark.scenarios.networking.vnf_generic import find_relative_file
from yardstick.common.process import check_if_process_failed
-from yardstick.network_services.helpers.cpu import CpuSysCores
from yardstick.network_services.helpers.samplevnf_helper import PortPairs
from yardstick.network_services.helpers.samplevnf_helper import MultiPortConfig
from yardstick.network_services.helpers.dpdkbindnic_helper import DpdkBindHelper
@@ -97,7 +95,6 @@ class SetupEnvHelper(object):
CFG_CONFIG = os.path.join(REMOTE_TMP, "sample_config")
CFG_SCRIPT = os.path.join(REMOTE_TMP, "sample_script")
- CORES = []
DEFAULT_CONFIG_TPL_CFG = "sample.cfg"
PIPELINE_COMMAND = ''
VNF_TYPE = "SAMPLE"
@@ -126,9 +123,6 @@ class DpdkVnfSetupEnvHelper(SetupEnvHelper):
APP_NAME = 'DpdkVnf'
FIND_NET_CMD = "find /sys/class/net -lname '*{}*' -printf '%f'"
- HW_DEFAULT_CORE = 3
- SW_DEFAULT_CORE = 2
-
@staticmethod
def _update_packet_type(ip_pipeline_cfg, traffic_options):
match_str = 'pkt_type = ipv4'
@@ -241,41 +235,6 @@ class DpdkVnfSetupEnvHelper(SetupEnvHelper):
'tool_path': tool_path,
}
- def _get_app_cpu(self):
- if self.CORES:
- return self.CORES
-
- vnf_cfg = self.scenario_helper.vnf_cfg
- sys_obj = CpuSysCores(self.ssh_helper)
- self.sys_cpu = sys_obj.get_core_socket()
- num_core = int(vnf_cfg["worker_threads"])
- if vnf_cfg.get("lb_config", "SW") == 'HW':
- num_core += self.HW_DEFAULT_CORE
- else:
- num_core += self.SW_DEFAULT_CORE
- app_cpu = self.sys_cpu[str(self.socket)][:num_core]
- return app_cpu
-
- def _get_cpu_sibling_list(self, cores=None):
- if cores is None:
- cores = self._get_app_cpu()
- sys_cmd_template = "%s/cpu%s/topology/thread_siblings_list"
- awk_template = "awk -F: '{ print $1 }' < %s"
- sys_path = "/sys/devices/system/cpu/"
- cpu_topology = []
- try:
- for core in cores:
- sys_cmd = sys_cmd_template % (sys_path, core)
- cpu_id = self.ssh_helper.execute(awk_template % sys_cmd)[1]
- cpu_topology.extend(cpu.strip() for cpu in cpu_id.split(','))
-
- return cpu_topology
- except Exception:
- return []
-
- def _validate_cpu_cfg(self):
- return self._get_cpu_sibling_list()
-
def setup_vnf_environment(self):
self._setup_dpdk()
self.bound_pci = [v['virtual-interface']["vpci"] for v in self.vnfd_helper.interfaces]