diff options
6 files changed, 23 insertions, 181 deletions
diff --git a/samples/vnf_samples/nsut/prox/configs/tuples.lua b/samples/vnf_samples/nsut/prox/configs/tuples.lua index 431125082..60a1b3ecd 100644 --- a/samples/vnf_samples/nsut/prox/configs/tuples.lua +++ b/samples/vnf_samples/nsut/prox/configs/tuples.lua @@ -1,34 +1,17 @@ +-- Copyright (c) 2016-2017 Intel Corporation -- --- Dataplane Automated Testing System +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at -- --- Copyright (c) 2015-2017, Intel Corporation. --- All rights reserved. +-- http://www.apache.org/licenses/LICENSE-2.0 -- --- Redistribution and use in source and binary forms, with or without --- modification, are permitted provided that the following conditions --- are met: +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. -- --- * Redistributions of source code must retain the above copyright --- notice, this list of conditions and the following disclaimer. --- * Redistributions in binary form must reproduce the above copyright --- notice, this list of conditions and the following disclaimer in --- the documentation and/or other materials provided with the --- distribution. --- * Neither the name of Intel Corporation nor the names of its --- contributors may be used to endorse or promote products derived --- from this software without specific prior written permission. --- --- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- tuples = {}; diff --git a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml index 6ba1553ad..7b66d663b 100644 --- a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml +++ b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml @@ -42,6 +42,8 @@ uplink_0: 373b: "{{get(imix, 'imix.uplink.373B', '0') }}" 512B: "{{get(imix, 'imix.uplink.512B', '0') }}" 570B: "{{get(imix, 'imix.uplink.570B', '0') }}" + 1024B: "{{get(imix, 'imix.uplink.1024B', '0') }}" + 1280B: "{{get(imix, 'imix.uplink.1280B', '0') }}" 1400B: "{{get(imix, 'imix.uplink.1400B', '0') }}" 1500B: "{{get(imix, 'imix.uplink.1500B', '0') }}" 1518B: "{{get(imix, 'imix.uplink.1518B', '0') }}" @@ -68,6 +70,8 @@ downlink_0: 373b: "{{get(imix, 'imix.downlink.373B', '0') }}" 512B: "{{get(imix, 'imix.downlink.512B', '0') }}" 570B: "{{get(imix, 'imix.downlink.570B', '0') }}" + 1024B: "{{get(imix, 'imix.downlink.1024B', '0') }}" + 1280B: "{{get(imix, 'imix.downlink.1280B', '0') }}" 1400B: "{{get(imix, 'imix.downlink.1400B', '0') }}" 1500B: "{{get(imix, 'imix.downlink.1500B', '0') }}" 1518B: "{{get(imix, 'imix.downlink.1518B', '0') }}" @@ -97,6 +101,8 @@ uplink_1: 373b: "{{get(imix, 'imix.uplink.373B', '0') }}" 512B: "{{get(imix, 'imix.uplink.512B', '0') }}" 570B: "{{get(imix, 'imix.uplink.570B', '0') }}" + 1024B: "{{get(imix, 'imix.uplink.1024B', '0') }}" + 1280B: "{{get(imix, 'imix.uplink.1280B', '0') }}" 1400B: "{{get(imix, 'imix.uplink.1400B', '0') }}" 1500B: "{{get(imix, 'imix.uplink.1500B', '0') }}" 1518B: "{{get(imix, 'imix.uplink.1518B', '0') }}" @@ -123,6 +129,8 @@ downlink_1: 373b: "{{get(imix, 'imix.downlink.373B', '0') }}" 512B: "{{get(imix, 'imix.downlink.512B', '0') }}" 570B: "{{get(imix, 'imix.downlink.570B', '0') }}" + 1024B: "{{get(imix, 'imix.downlink.1024B', '0') }}" + 1280B: "{{get(imix, 'imix.downlink.1280B', '0') }}" 1400B: "{{get(imix, 'imix.downlink.1400B', '0') }}" 1500B: "{{get(imix, 'imix.downlink.1500B', '0') }}" 1518B: "{{get(imix, 'imix.downlink.1518B', '0') }}" diff --git a/tests/unit/network_services/nfvi/test_resource.py b/tests/unit/network_services/nfvi/test_resource.py index f3244fdbd..2eef784fc 100644 --- a/tests/unit/network_services/nfvi/test_resource.py +++ b/tests/unit/network_services/nfvi/test_resource.py @@ -99,7 +99,7 @@ class TestResourceProfile(unittest.TestCase): port_names = \ self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]['vdu'][0]['external-interface'] self.resource_profile = \ - ResourceProfile(mgmt, port_names, [1, 2, 3]) + ResourceProfile(mgmt, port_names) self.resource_profile.connection = self.ssh_mock def test___init__(self): 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..57f9fac61 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): @@ -1497,8 +1391,9 @@ class TestRfc2544ResourceHelper(unittest.TestCase): class TestSampleVNFDeployHelper(unittest.TestCase): + @mock.patch('yardstick.network_services.vnf_generic.vnf.sample_vnf.time') @mock.patch('subprocess.check_output') - def test_deploy_vnfs_disabled(self, mock_check_output): + def test_deploy_vnfs_disabled(self, mock_check_output, mock_time): vnfd_helper = mock.Mock() ssh_helper = mock.Mock() ssh_helper.join_bin_path.return_value = 'joined_path' diff --git a/yardstick/network_services/nfvi/resource.py b/yardstick/network_services/nfvi/resource.py index 5b96aaf29..190e1f7bd 100644 --- a/yardstick/network_services/nfvi/resource.py +++ b/yardstick/network_services/nfvi/resource.py @@ -55,8 +55,7 @@ class ResourceProfile(object): DEFAULT_TIMEOUT = 3600 OVS_SOCKET_PATH = "/usr/local/var/run/openvswitch/db.sock" - def __init__(self, mgmt, port_names=None, cores=None, plugins=None, - interval=None, timeout=None): + def __init__(self, mgmt, port_names=None, plugins=None, interval=None, timeout=None): if plugins is None: self.plugins = {} @@ -91,7 +90,6 @@ class ResourceProfile(object): plugins = collectd_options.get("plugins", {}) interval = collectd_options.get("interval") - # use default cores = None to MatchAllCores return cls(node, plugins=plugins, interval=interval, timeout=timeout) def check_if_sa_running(self, process): diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py index 08ec44f65..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] @@ -323,7 +282,6 @@ class DpdkVnfSetupEnvHelper(SetupEnvHelper): else: self.socket = 1 - cores = self._validate_cpu_cfg() # implicit ordering, presumably by DPDK port num, so pre-sort by port_num # this won't work because we don't have DPDK port numbers yet ports = sorted(self.vnfd_helper.interfaces, key=self.vnfd_helper.port_num) @@ -331,7 +289,7 @@ class DpdkVnfSetupEnvHelper(SetupEnvHelper): collectd_options = self.get_collectd_options() plugins = collectd_options.get("plugins", {}) # we must set timeout to be the same as the VNF otherwise KPIs will die before VNF - return ResourceProfile(self.vnfd_helper.mgmt_interface, port_names=port_names, cores=cores, + return ResourceProfile(self.vnfd_helper.mgmt_interface, port_names=port_names, plugins=plugins, interval=collectd_options.get("interval"), timeout=self.scenario_helper.timeout) |