summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-09-21 15:00:30 -0700
committerRoss Brattain <ross.b.brattain@intel.com>2017-09-25 08:30:21 -0700
commita8225b336df8fbb626a22bb38d8f8ca96af977f9 (patch)
treea1b7c8c7ad72bf0d77e704591c023542599d0603
parent86c0326342b33f6e0b090b973fb58831ed1d38d2 (diff)
tg_rfc2544_ixia: log exceptions and fix list iter
Change-Id: Ia9722604b7c8ae23e784e780f113d012de544d4b Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py18
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py16
2 files changed, 20 insertions, 14 deletions
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
index 0c3520c44..f62a0fb3b 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
@@ -252,7 +252,8 @@ class TestIXIATrafficGen(unittest.TestCase):
mock_traffic_profile = mock.Mock(autospec=TrafficProfile)
mock_traffic_profile.get_traffic_definition.return_value = "64"
mock_traffic_profile.params = self.TRAFFIC_PROFILE
- mock_traffic_profile.ports = ["xe0", "xe1"]
+ # traffic_profile.ports is standardized on port_num
+ mock_traffic_profile.ports = [0, 1]
mock_ssh_instance = mock.Mock(autospec=mock_ssh.SSH)
mock_ssh_instance.execute.return_value = 0, "", ""
@@ -346,9 +347,12 @@ class TestIXIATrafficGen(unittest.TestCase):
'task_path': '/path/to/task'
}
- with mock.patch('yardstick.benchmark.scenarios.networking.vnf_generic.open',
- create=True) as mock_open:
- with mock.patch('yardstick.network_services.vnf_generic.vnf.tg_rfc2544_ixia.open',
- create=True) as mock_ixia_open:
- result = sut._traffic_runner(mock_traffic_profile)
- self.assertIsNone(result)
+ @mock.patch('yardstick.benchmark.scenarios.networking.vnf_generic.open', create=True)
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.tg_rfc2544_ixia.open',
+ mock.mock_open(), create=True)
+ @mock.patch('yardstick.network_services.vnf_generic.vnf.tg_rfc2544_ixia.LOG.exception')
+ def _traffic_runner(*args):
+ result = sut._traffic_runner(mock_traffic_profile)
+ self.assertIsNone(result)
+
+ _traffic_runner()
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
index cd9553d12..12266d6ad 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
@@ -81,11 +81,13 @@ class IxiaResourceHelper(ClientResourceHelper):
latency = stats[0]
samples = {}
- for port_name in ports:
+ # this is not DPDK port num, but this is whatever number we gave
+ # when we selected ports and programmed the profile
+ for port_num in ports:
try:
- # this is not DPDK port num, but this is whatever number we gave
- # when we selected ports and programmed the profile
- port_num = self.vnfd_helper.port_num(port_name)
+ # reverse lookup port name from port_num so the stats dict is descriptive
+ intf = self.vnfd_helper.find_interface_by_port(port_num)
+ port_name = intf["name"]
samples[port_name] = {
"rx_throughput_kps": float(last_result["Rx_Rate_Kbps"][port_num]),
"tx_throughput_kps": float(last_result["Tx_Rate_Kbps"][port_num]),
@@ -140,9 +142,9 @@ class IxiaResourceHelper(ClientResourceHelper):
mac = {}
for vld_id, traffic in static_traffic.items():
intfs = self.vnfd_helper.port_pairs.networks.get(vld_id, [])
- interface = next(intfs, None)
+ interface = next(iter(intfs), None)
if interface:
- virt_intf = interface["virtual-interface"]
+ virt_intf = self.vnfd_helper.find_interface(name=interface)["virtual-interface"]
# we only know static traffic id by reading the json
# this is used by _get_ixia_traffic_profile
mac["src_mac_{}".format(traffic["id"])] = virt_intf.get("local_mac", default)
@@ -169,7 +171,7 @@ class IxiaResourceHelper(ClientResourceHelper):
self.client.ix_stop_traffic()
self._queue.put(samples)
except Exception:
- LOG.info("Run Traffic terminated")
+ LOG.exception("Run Traffic terminated")
if not self.rfc_helper.is_done():
self._terminated.value = 1