From 58b399dee7bdff055ca8cfb712d1e0c753d2f58c Mon Sep 17 00:00:00 2001 From: Deepak S Date: Sun, 3 Sep 2017 12:47:45 -0700 Subject: Fix Ixload KPIs collection & hang issues. Change-Id: If679333dc1cb9e041a332fb374c55f72eaab1b28 Signed-off-by: Deepak S Signed-off-by: Ross Brattain --- .../tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia.yaml | 1 + .../network_services/vnf_generic/vnf/test_tg_ixload.py | 2 +- yardstick/network_services/vnf_generic/vnf/tg_ixload.py | 15 +++++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia.yaml b/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia.yaml index e07f5f9e9..9808398f2 100644 --- a/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia.yaml +++ b/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia.yaml @@ -35,6 +35,7 @@ scenarios: vnf__1: rules: acl_1rule.yaml vnf_config: {lb_config: 'SW', lb_count: 1, worker_config: '1C/1T', worker_threads: 1} + nfvi_enable: True runner: type: Iteration iterations: 10 diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py index db128a15c..c65c0ab0a 100644 --- a/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py +++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_ixload.py @@ -123,7 +123,7 @@ class TestIxLoadTrafficGen(unittest.TestCase): ssh.from_node.return_value = ssh_mock vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] ixload_traffic_gen = IxLoadTrafficGen(NAME, vnfd) - self.assertIsNone(ixload_traffic_gen.data) + self.assertIsNone(ixload_traffic_gen.resource_helper.data) def test_collect_kpi(self): with mock.patch("yardstick.ssh.SSH") as ssh: diff --git a/yardstick/network_services/vnf_generic/vnf/tg_ixload.py b/yardstick/network_services/vnf_generic/vnf/tg_ixload.py index 6be2b58e1..612799ff5 100644 --- a/yardstick/network_services/vnf_generic/vnf/tg_ixload.py +++ b/yardstick/network_services/vnf_generic/vnf/tg_ixload.py @@ -22,8 +22,6 @@ import shutil from collections import OrderedDict from subprocess import call -import six - from yardstick.common.utils import makedirs from yardstick.network_services.vnf_generic.vnf.sample_vnf import SampleVNFTrafficGen from yardstick.network_services.vnf_generic.vnf.sample_vnf import ClientResourceHelper @@ -79,6 +77,7 @@ class IxLoadResourceHelper(ClientResourceHelper): super(IxLoadResourceHelper, self).__init__(setup_helper) self.result = OrderedDict((key, ResourceDataHelper()) for key in self.KPI_LIST) self.resource_file_name = '' + self.data = None def parse_csv_read(self, reader): for row in reader: @@ -111,6 +110,12 @@ class IxLoadResourceHelper(ClientResourceHelper): return {key_right: self.result[key_left].get_aggregates() for key_left, key_right in self.KPI_LIST.items()} + def collect_kpi(self): + if self.data: + self._result.update(self.data) + LOG.info("Collect {0} KPIs {1}".format(self.RESOURCE_WORD, self._result)) + return self._result + def log(self): for key in self.KPI_LIST: LOG.debug(self.result[key]) @@ -125,7 +130,6 @@ class IxLoadTrafficGen(SampleVNFTrafficGen): super(IxLoadTrafficGen, self).__init__(name, vnfd, setup_env_helper_type, resource_helper_type) self._result = {} - self.data = None def run_traffic(self, traffic_profile): ports = [] @@ -156,16 +160,15 @@ class IxLoadTrafficGen(SampleVNFTrafficGen): with open(self.ssh_helper.join_bin_path("ixLoad_HTTP_Client.csv")) as csv_file: lines = csv_file.readlines()[10:] - with open(self.ssh_helper.join_bin_path("http_result.csv"), 'wb+') as result_file: - result_file.writelines(six.text_type(lines[:-1])) + result_file.writelines(lines[:-1]) result_file.flush() result_file.seek(0) reader = csv.DictReader(result_file) self.resource_helper.parse_csv_read(reader) self.resource_helper.log() - self.data = self.resource_helper.make_aggregates() + self.resource_helper.data = self.resource_helper.make_aggregates() def listen_traffic(self, traffic_profile): pass -- cgit 1.2.3-korg