aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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