aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py')
-rw-r--r--yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py367
1 files changed, 336 insertions, 31 deletions
diff --git a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
index ab7a6a88e..c3f3e5f67 100644
--- a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
+++ b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2016-2017 Intel Corporation
+# Copyright (c) 2016-2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ import mock
import six
import unittest
import ipaddress
+import time
from collections import OrderedDict
from yardstick.common import utils
@@ -27,6 +28,7 @@ from yardstick.benchmark.contexts import base as ctx_base
from yardstick.network_services.libs.ixia_libs.ixnet import ixnet_api
from yardstick.network_services.traffic_profile import base as tp_base
from yardstick.network_services.vnf_generic.vnf import tg_rfc2544_ixia
+from yardstick.network_services.traffic_profile import ixia_rfc2544
TEST_FILE_YAML = 'nsb_test_case.yaml'
@@ -108,6 +110,31 @@ class TestIxiaResourceHelper(unittest.TestCase):
self.assertEqual('fake_samples', ixia_rhelper._queue.get())
mock_tprofile.update_traffic_profile.assert_called_once()
+ def test_run_test(self):
+ expected_result = {'test': 'fake_samples', 'Iteration': 1}
+ mock_tprofile = mock.Mock()
+ mock_tprofile.config.duration = 10
+ mock_tprofile.get_drop_percentage.return_value = \
+ True, {'test': 'fake_samples', 'Iteration': 1}
+ ixia_rhelper = tg_rfc2544_ixia.IxiaResourceHelper(mock.Mock())
+ tasks_queue = mock.Mock()
+ tasks_queue.get.return_value = 'RUN_TRAFFIC'
+ results_queue = mock.Mock()
+ ixia_rhelper.rfc_helper = mock.Mock()
+ ixia_rhelper.vnfd_helper = mock.Mock()
+ ixia_rhelper._ix_scenario = mock.Mock()
+ ixia_rhelper.vnfd_helper.port_pairs.all_ports = []
+ with mock.patch.object(ixia_rhelper, 'generate_samples'), \
+ mock.patch.object(ixia_rhelper, '_build_ports'), \
+ mock.patch.object(ixia_rhelper, '_initialize_client'), \
+ mock.patch.object(utils, 'wait_until_true'):
+ ixia_rhelper.run_test(mock_tprofile, tasks_queue, results_queue)
+
+ self.assertEqual(expected_result, ixia_rhelper._queue.get())
+ mock_tprofile.update_traffic_profile.assert_called_once()
+ tasks_queue.task_done.assert_called_once()
+ results_queue.put.assert_called_once_with('COMPLETE')
+
@mock.patch.object(tg_rfc2544_ixia, 'ixnet_api')
class TestIXIATrafficGen(unittest.TestCase):
@@ -216,7 +243,7 @@ class TestIXIATrafficGen(unittest.TestCase):
ssh.from_node.return_value = ssh_mock
vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
# NOTE(ralonsoh): check the object returned.
- tg_rfc2544_ixia.IxiaTrafficGen(NAME, vnfd, 'task_id')
+ tg_rfc2544_ixia.IxiaTrafficGen(NAME, vnfd)
def test_listen_traffic(self, *args):
with mock.patch("yardstick.ssh.SSH") as ssh:
@@ -225,8 +252,7 @@ class TestIXIATrafficGen(unittest.TestCase):
mock.Mock(return_value=(0, "", ""))
ssh.from_node.return_value = ssh_mock
vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ixnet_traffic_gen = tg_rfc2544_ixia.IxiaTrafficGen(NAME, vnfd,
- 'task_id')
+ ixnet_traffic_gen = tg_rfc2544_ixia.IxiaTrafficGen(NAME, vnfd)
self.assertIsNone(ixnet_traffic_gen.listen_traffic({}))
@mock.patch.object(ctx_base.Context, 'get_context_from_server', return_value='fake_context')
@@ -239,8 +265,7 @@ class TestIXIATrafficGen(unittest.TestCase):
mock.Mock(return_value=(0, "", ""))
ssh.from_node.return_value = ssh_mock
vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ixnet_traffic_gen = tg_rfc2544_ixia.IxiaTrafficGen(NAME, vnfd,
- 'task_id')
+ ixnet_traffic_gen = tg_rfc2544_ixia.IxiaTrafficGen(NAME, vnfd)
scenario_cfg = {'tc': "nsb_test_case",
"topology": ""}
scenario_cfg.update(
@@ -277,8 +302,7 @@ class TestIXIATrafficGen(unittest.TestCase):
ssh.from_node.return_value = ssh_mock
vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- ixnet_traffic_gen = tg_rfc2544_ixia.IxiaTrafficGen(NAME, vnfd,
- 'task_id')
+ ixnet_traffic_gen = tg_rfc2544_ixia.IxiaTrafficGen(NAME, vnfd)
ixnet_traffic_gen.scenario_helper.scenario_cfg = {
'nodes': {ixnet_traffic_gen.name: "mock"}
}
@@ -298,7 +322,7 @@ class TestIXIATrafficGen(unittest.TestCase):
mock.Mock(return_value=(0, "", ""))
ssh.from_node.return_value = ssh_mock
ixnet_traffic_gen = tg_rfc2544_ixia.IxiaTrafficGen(
- NAME, vnfd, 'task_id', resource_helper_type=mock.Mock())
+ NAME, vnfd, resource_helper_type=mock.Mock())
ixnet_traffic_gen._terminated = mock.MagicMock()
ixnet_traffic_gen._terminated.value = 0
ixnet_traffic_gen._ixia_traffic_gen = mock.MagicMock()
@@ -314,7 +338,7 @@ class TestIXIATrafficGen(unittest.TestCase):
def test__check_status(self, *args):
vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
- sut = tg_rfc2544_ixia.IxiaTrafficGen('vnf1', vnfd, 'task_id')
+ sut = tg_rfc2544_ixia.IxiaTrafficGen('vnf1', vnfd)
sut._check_status()
@mock.patch("yardstick.ssh.SSH")
@@ -380,7 +404,7 @@ class TestIXIATrafficGen(unittest.TestCase):
mock_traffic_profile.get_drop_percentage.return_value = [
'Completed', samples]
- sut = tg_rfc2544_ixia.IxiaTrafficGen(name, vnfd, 'task_id')
+ sut = tg_rfc2544_ixia.IxiaTrafficGen(name, vnfd)
sut.vnf_port_pairs = [[[0], [1]]]
sut.tc_file_name = self._get_file_abspath(TEST_FILE_YAML)
sut.topology = ""
@@ -424,14 +448,70 @@ class TestIXIATrafficGen(unittest.TestCase):
mock.mock_open(), create=True)
@mock.patch('yardstick.network_services.vnf_generic.vnf.tg_rfc2544_ixia.LOG.exception')
def _traffic_runner(*args):
- sut._setup_mq_producer = mock.Mock(return_value='mq_producer')
- result = sut._traffic_runner(mock_traffic_profile, mock.ANY)
+ result = sut._traffic_runner(mock_traffic_profile)
self.assertIsNone(result)
_traffic_runner()
+ def test_run_traffic_once(self, *args):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ sut = tg_rfc2544_ixia.IxiaTrafficGen('vnf1', vnfd)
+ sut._init_traffic_process = mock.Mock()
+ sut._tasks_queue.put = mock.Mock()
+ sut.resource_helper.client_started.value = 0
+ sut.run_traffic_once(self.TRAFFIC_PROFILE)
+ sut._tasks_queue.put.assert_called_once_with("RUN_TRAFFIC")
+ sut._init_traffic_process.assert_called_once_with(self.TRAFFIC_PROFILE)
+
+ def test__test_runner(self, *args):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ sut = tg_rfc2544_ixia.IxiaTrafficGen('vnf1', vnfd)
+ tasks = 'tasks'
+ results = 'results'
+ sut.resource_helper = mock.Mock()
+ sut._test_runner(self.TRAFFIC_PROFILE, tasks, results)
+ sut.resource_helper.run_test.assert_called_once_with(self.TRAFFIC_PROFILE,
+ tasks, results)
+
+ @mock.patch.object(time, 'sleep', return_value=0)
+ def test__init_traffic_process(self, *args):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ sut = tg_rfc2544_ixia.IxiaTrafficGen('vnf1', vnfd)
+ sut._test_runner = mock.Mock(return_value=0)
+ sut.resource_helper = mock.Mock()
+ sut.resource_helper.client_started.value = 0
+ sut._init_traffic_process(self.TRAFFIC_PROFILE)
+
+ def test_wait_on_traffic(self, *args):
+ vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
+ sut = tg_rfc2544_ixia.IxiaTrafficGen('vnf1', vnfd)
+ sut._tasks_queue.join = mock.Mock(return_value=0)
+ sut._result_queue.get = mock.Mock(return_value='COMPLETE')
+ result = sut.wait_on_traffic()
+ sut._tasks_queue.join.assert_called_once()
+ sut._result_queue.get.assert_called_once()
+ self.assertEqual(result, 'COMPLETE')
+
class TestIxiaBasicScenario(unittest.TestCase):
+
+ STATS = {'stat_name': ['Card01/Port01',
+ 'Card02/Port02'],
+ 'port_name': ['Ethernet - 001', 'Ethernet - 002'],
+ 'Frames_Tx': ['150', '150'],
+ 'Valid_Frames_Rx': ['150', '150'],
+ 'Frames_Tx_Rate': ['0.0', '0.0'],
+ 'Valid_Frames_Rx_Rate': ['0.0', '0.0'],
+ 'Bytes_Rx': ['9600', '9600'],
+ 'Bytes_Tx': ['9600', '9600'],
+ 'Tx_Rate_Kbps': ['0.0', '0.0'],
+ 'Rx_Rate_Mbps': ['0.0', '0.0'],
+ 'Tx_Rate_Mbps': ['0.0', '0.0'],
+ 'Rx_Rate_Kbps': ['0.0', '0.0'],
+ 'Store-Forward_Max_latency_ns': ['100', '200'],
+ 'Store-Forward_Min_latency_ns': ['100', '200'],
+ 'Store-Forward_Avg_latency_ns': ['100', '200']}
+
def setUp(self):
self._mock_IxNextgen = mock.patch.object(ixnet_api, 'IxNextgen')
self.mock_IxNextgen = self._mock_IxNextgen.start()
@@ -451,9 +531,13 @@ class TestIxiaBasicScenario(unittest.TestCase):
def test_create_traffic_model(self):
self.mock_IxNextgen.get_vports.return_value = [1, 2, 3, 4]
- self.scenario.create_traffic_model()
+ yaml_data = {'traffic_profile': {}
+ }
+ traffic_profile = ixia_rfc2544.IXIARFC2544Profile(yaml_data)
+ self.scenario.create_traffic_model(traffic_profile)
self.scenario.client.get_vports.assert_called_once()
- self.scenario.client.create_traffic_model.assert_called_once_with([1, 3], [2, 4])
+ self.scenario.client.create_traffic_model.assert_called_once_with(
+ [1, 3], [2, 4], traffic_profile)
def test_apply_config(self):
self.assertIsNone(self.scenario.apply_config())
@@ -464,6 +548,48 @@ class TestIxiaBasicScenario(unittest.TestCase):
def test_stop_protocols(self):
self.assertIsNone(self.scenario.stop_protocols())
+ def test__get_stats(self):
+ self.scenario._get_stats()
+ self.scenario.client.get_statistics.assert_called_once()
+
+ @mock.patch.object(tg_rfc2544_ixia.IxiaBasicScenario, '_get_stats')
+ def test_generate_samples(self, mock_get_stats):
+
+ expected_samples = {'xe0': {
+ 'InPackets': 150,
+ 'OutPackets': 150,
+ 'InBytes': 9600,
+ 'OutBytes': 9600,
+ 'RxThroughput': 5.0,
+ 'TxThroughput': 5.0,
+ 'RxThroughputBps': 320.0,
+ 'TxThroughputBps': 320.0,
+ 'LatencyMax': 100,
+ 'LatencyMin': 100,
+ 'LatencyAvg': 100},
+ 'xe1': {
+ 'InPackets': 150,
+ 'OutPackets': 150,
+ 'InBytes': 9600,
+ 'OutBytes': 9600,
+ 'RxThroughput': 5.0,
+ 'TxThroughput': 5.0,
+ 'RxThroughputBps': 320.0,
+ 'TxThroughputBps': 320.0,
+ 'LatencyMax': 200,
+ 'LatencyMin': 200,
+ 'LatencyAvg': 200}}
+
+ res_helper = mock.Mock()
+ res_helper.vnfd_helper.find_interface_by_port.side_effect = \
+ [{'name': 'xe0'}, {'name': 'xe1'}]
+ ports = [0, 1]
+ duration = 30
+ mock_get_stats.return_value = self.STATS
+ samples = self.scenario.generate_samples(res_helper, ports, duration)
+ mock_get_stats.assert_called_once()
+ self.assertEqual(samples, expected_samples)
+
class TestIxiaL3Scenario(TestIxiaBasicScenario):
IXIA_CFG = {
@@ -515,11 +641,13 @@ class TestIxiaL3Scenario(TestIxiaBasicScenario):
def test_create_traffic_model(self):
self.mock_IxNextgen.get_vports.return_value = ['1', '2']
- self.scenario.create_traffic_model()
+ traffic_profile = 'fake_profile'
+ self.scenario.create_traffic_model(traffic_profile)
self.scenario.client.get_vports.assert_called_once()
self.scenario.client.create_ipv4_traffic_model.\
assert_called_once_with(['1/protocols/static'],
- ['2/protocols/static'])
+ ['2/protocols/static'],
+ 'fake_profile')
def test_apply_config(self):
self.scenario._add_interfaces = mock.Mock()
@@ -573,6 +701,9 @@ class TestIxiaPppoeClientScenario(unittest.TestCase):
'gateway_ip': ['10.1.1.1', '10.2.2.1'],
'ip': ['10.1.1.1', '10.2.2.1'],
'prefix': ['24', '24']
+ },
+ 'priority': {
+ 'tos': {'precedence': [0, 4]}
}
}
@@ -635,7 +766,31 @@ class TestIxiaPppoeClientScenario(unittest.TestCase):
mock_id_pairs.assert_called_once_with(mock_tp.full_profile)
mock_obj_pairs.assert_called_once_with(['xe0', 'xe1', 'xe0', 'xe1'])
self.scenario.client.create_ipv4_traffic_model.assert_called_once_with(
- uplink_endpoints, downlink_endpoints)
+ uplink_endpoints, downlink_endpoints, mock_tp)
+
+ @mock.patch.object(tg_rfc2544_ixia.IxiaPppoeClientScenario,
+ '_get_endpoints_src_dst_id_pairs')
+ @mock.patch.object(tg_rfc2544_ixia.IxiaPppoeClientScenario,
+ '_get_endpoints_src_dst_obj_pairs')
+ def test_create_traffic_model_topology_based_flows(self, mock_obj_pairs,
+ mock_id_pairs):
+ uplink_topologies = ['topology1', 'topology3']
+ downlink_topologies = ['topology2', 'topology4']
+ mock_id_pairs.return_value = []
+ mock_obj_pairs.return_value = []
+ mock_tp = mock.Mock()
+ mock_tp.full_profile = {'uplink_0': 'data',
+ 'downlink_0': 'data',
+ 'uplink_1': 'data',
+ 'downlink_1': 'data'
+ }
+ self.scenario._access_topologies = ['topology1', 'topology3']
+ self.scenario._core_topologies = ['topology2', 'topology4']
+ self.scenario.create_traffic_model(mock_tp)
+ mock_id_pairs.assert_called_once_with(mock_tp.full_profile)
+ mock_obj_pairs.assert_called_once_with([])
+ self.scenario.client.create_ipv4_traffic_model.assert_called_once_with(
+ uplink_topologies, downlink_topologies, mock_tp)
def test__get_endpoints_src_dst_id_pairs(self):
full_tp = OrderedDict([
@@ -706,22 +861,10 @@ class TestIxiaPppoeClientScenario(unittest.TestCase):
}
}
- expected_result = ['tp1_dg1', 'tp3_dg1', 'tp1_dg2', 'tp3_dg1',
- 'tp1_dg3', 'tp3_dg1', 'tp1_dg4', 'tp3_dg1',
- 'tp2_dg1', 'tp4_dg1', 'tp2_dg2', 'tp4_dg1',
- 'tp2_dg3', 'tp4_dg1', 'tp2_dg4', 'tp4_dg1']
-
self.scenario._ixia_cfg = ixia_cfg
- self.scenario._access_topologies = ['topology1', 'topology2']
- self.scenario._core_topologies = ['topology3', 'topology4']
- self.mock_IxNextgen.get_topology_device_groups.side_effect = \
- [['tp1_dg1', 'tp1_dg2', 'tp1_dg3', 'tp1_dg4'],
- ['tp2_dg1', 'tp2_dg2', 'tp2_dg3', 'tp2_dg4'],
- ['tp3_dg1'],
- ['tp4_dg1']]
res = self.scenario._get_endpoints_src_dst_obj_pairs(
endpoints_id_pairs)
- self.assertEqual(res, expected_result)
+ self.assertEqual(res, [])
def test_run_protocols(self):
self.scenario.client.is_protocols_running.return_value = True
@@ -958,3 +1101,165 @@ class TestIxiaPppoeClientScenario(unittest.TestCase):
local_as=bgp_params["bgp"]["as_number"],
bgp_type=bgp_params["bgp"]["bgp_type"])
])
+
+ def test_update_tracking_options_raw_priority(self):
+ raw_priority = {'raw': 4}
+ self.scenario._ixia_cfg['priority'] = raw_priority
+ self.scenario.update_tracking_options()
+ self.scenario.client.set_flow_tracking.assert_called_once_with(
+ ['flowGroup0', 'vlanVlanId0', 'ipv4Raw0'])
+
+ def test_update_tracking_options_tos_priority(self):
+ tos_priority = {'tos': {'precedence': [4, 7]}}
+ self.scenario._ixia_cfg['priority'] = tos_priority
+ self.scenario.update_tracking_options()
+ self.scenario.client.set_flow_tracking.assert_called_once_with(
+ ['flowGroup0', 'vlanVlanId0', 'ipv4Precedence0'])
+
+ def test_update_tracking_options_dscp_priority(self):
+ dscp_priority = {'dscp': {'defaultPHB': [4, 7]}}
+ self.scenario._ixia_cfg['priority'] = dscp_priority
+ self.scenario.update_tracking_options()
+ self.scenario.client.set_flow_tracking.assert_called_once_with(
+ ['flowGroup0', 'vlanVlanId0', 'ipv4DefaultPhb0'])
+
+ def test_update_tracking_options_invalid_priority_data(self):
+ invalid_priority = {'tos': {'inet-precedence': [4, 7]}}
+ self.scenario._ixia_cfg['priority'] = invalid_priority
+ self.scenario.update_tracking_options()
+ self.scenario.client.set_flow_tracking.assert_called_once_with(
+ ['flowGroup0', 'vlanVlanId0', 'ipv4Precedence0'])
+
+ def test_get_tc_rfc2544_options(self):
+ rfc2544_tc_opts = {'allowed_drop_rate': '0.0001 - 0.0001'}
+ self.scenario._ixia_cfg['rfc2544'] = rfc2544_tc_opts
+ res = self.scenario.get_tc_rfc2544_options()
+ self.assertEqual(res, rfc2544_tc_opts)
+
+ def test__get_stats(self):
+ self.scenario._get_stats()
+ self.scenario.client.get_pppoe_scenario_statistics.assert_called_once()
+
+ def test_get_flow_id_data(self):
+ stats = [{'id': 1, 'in_packets': 10, 'out_packets': 20}]
+ key = "in_packets"
+ flow_id = 1
+ res = self.scenario.get_flow_id_data(stats, flow_id, key)
+ self.assertEqual(res, 10)
+
+ @mock.patch.object(tg_rfc2544_ixia.IxiaPppoeClientScenario, '_get_stats')
+ @mock.patch.object(tg_rfc2544_ixia.IxiaPppoeClientScenario,
+ 'get_priority_flows_stats')
+ def test_generate_samples(self, mock_prio_flow_statistics,
+ mock_get_stats):
+ ixia_stats = {
+ 'flow_statistic': [
+ {'Flow_Group': 'RFC2544-1 - Flow Group 0001',
+ 'Frames_Delta': '0',
+ 'IP_Priority': '0',
+ 'Rx_Frames': '3000',
+ 'Tx_Frames': '3000',
+ 'VLAN-ID': '100',
+ 'Tx_Port': 'Ethernet - 001',
+ 'Store-Forward_Avg_latency_ns': '2',
+ 'Store-Forward_Min_latency_ns': '2',
+ 'Store-Forward_Max_latency_ns': '2'},
+ {'Flow_Group': 'RFC2544-2 - Flow Group 0001',
+ 'Frames_Delta': '0',
+ 'IP_Priority': '0',
+ 'Rx_Frames': '3000',
+ 'Tx_Frames': '3000',
+ 'VLAN-ID': '101',
+ 'Tx_Port': 'Ethernet - 002',
+ 'Store-Forward_Avg_latency_ns': '2',
+ 'Store-Forward_Min_latency_ns': '2',
+ 'Store-Forward_Max_latency_ns': '2'
+ }],
+ 'port_statistics': [
+ {'Frames_Tx': '3000',
+ 'Valid_Frames_Rx': '3000',
+ 'Bytes_Rx': '192000',
+ 'Bytes_Tx': '192000',
+ 'Rx_Rate_Kbps': '0.0',
+ 'Tx_Rate_Kbps': '0.0',
+ 'Rx_Rate_Mbps': '0.0',
+ 'Tx_Rate_Mbps': '0.0',
+ 'port_name': 'Ethernet - 001'},
+ {'Frames_Tx': '3000',
+ 'Valid_Frames_Rx': '3000',
+ 'Bytes_Rx': '192000',
+ 'Bytes_Tx': '192000',
+ 'Rx_Rate_Kbps': '0.0',
+ 'Tx_Rate_Kbps': '0.0',
+ 'Rx_Rate_Mbps': '0.0',
+ 'Tx_Rate_Mbps': '0.0',
+ 'port_name': 'Ethernet - 002'}],
+ 'pppox_client_per_port': [
+ {'Sessions_Down': '0',
+ 'Sessions_Not_Started': '0',
+ 'Sessions_Total': '1',
+ 'Sessions_Up': '1',
+ 'subs_port': 'Ethernet - 001'}]}
+
+ prio_flows_stats = {
+ '0': {
+ 'InPackets': 6000,
+ 'OutPackets': 6000,
+ 'RxThroughput': 200.0,
+ 'TxThroughput': 200.0,
+ 'LatencyAvg': 2,
+ 'LatencyMax': 2,
+ 'LatencyMin': 2
+ }
+ }
+
+ expected_result = {'priority_stats': {
+ '0': {'RxThroughput': 200.0,
+ 'TxThroughput': 200.0,
+ 'LatencyAvg': 2,
+ 'LatencyMax': 2,
+ 'LatencyMin': 2,
+ 'InPackets': 6000,
+ 'OutPackets': 6000}},
+ 'xe0': {'RxThroughput': 100.0,
+ 'LatencyAvg': 2,
+ 'LatencyMax': 2,
+ 'LatencyMin': 2,
+ 'TxThroughput': 100.0,
+ 'InPackets': 3000,
+ 'OutPackets': 3000,
+ 'InBytes': 192000,
+ 'OutBytes': 192000,
+ 'RxThroughputBps': 6400.0,
+ 'TxThroughputBps': 6400.0,
+ 'SessionsDown': 0,
+ 'SessionsNotStarted': 0,
+ 'SessionsTotal': 1,
+ 'SessionsUp': 1},
+ 'xe1': {'RxThroughput': 100.0,
+ 'LatencyAvg': 2,
+ 'LatencyMax': 2,
+ 'LatencyMin': 2,
+ 'TxThroughput': 100.0,
+ 'InPackets': 3000,
+ 'OutPackets': 3000,
+ 'InBytes': 192000,
+ 'OutBytes': 192000,
+ 'RxThroughputBps': 6400.0,
+ 'TxThroughputBps': 6400.0}}
+
+ mock_get_stats.return_value = ixia_stats
+ mock_prio_flow_statistics.return_value = prio_flows_stats
+ ports = [0, 1]
+ port_names = [{'name': 'xe0'}, {'name': 'xe1'}]
+ duration = 30
+ res_helper = mock.Mock()
+ res_helper.vnfd_helper.find_interface_by_port.side_effect = \
+ port_names
+ samples = self.scenario.generate_samples(res_helper, ports, duration)
+ self.assertIsNotNone(samples)
+ self.assertIsNotNone(samples.get('xe0'))
+ self.assertIsNotNone(samples.get('xe1'))
+ self.assertEqual(samples, expected_result)
+ mock_get_stats.assert_called_once()
+ mock_prio_flow_statistics.assert_called_once()