diff options
author | Oleksandr Naumets <oleksandrx.naumets@intel.com> | 2019-02-12 18:40:26 +0000 |
---|---|---|
committer | Oleksandr Naumets <oleksandrx.naumets@intel.com> | 2019-02-12 18:40:26 +0000 |
commit | 0cce2819d798b5365d15dc174f6b4e6d06c18fbf (patch) | |
tree | bbcca77cef8b8a96bafa07d6a91def91dbe7111c /yardstick/tests | |
parent | 0dbd3bb46b6d2aaa71c6bf2be046c3c0f877466b (diff) |
Extend TRex RFC2544 test case collected stats
Added new fields into Yardstick NSB TRex RFC2544 test case results:
- Iteration
- PktSize
- Status
JIRA: YARDSTICK-1592
Change-Id: Id746b537a0ef55a891653719cc1db29ef7e994fc
Signed-off-by: Oleksandr Naumets <oleksandrx.naumets@intel.com>
Diffstat (limited to 'yardstick/tests')
4 files changed, 50 insertions, 39 deletions
diff --git a/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py b/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py index 270d342fd..a20592dc7 100644 --- a/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py +++ b/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py @@ -589,12 +589,15 @@ class TestIxNextgen(unittest.TestCase): mock__create_traffic_item): uplink_topologies = ['up1', 'up3'] downlink_topologies = ['down2', 'down4'] + traffic_profile = 'fake_profile' self.ixnet_gen.create_ipv4_traffic_model(uplink_topologies, - downlink_topologies) + downlink_topologies, + traffic_profile) mock__create_traffic_item.assert_called_once_with('ipv4') mock__create_flow_groups.assert_called_once_with(uplink_topologies, downlink_topologies) - mock__setup_config_elements.assert_called_once_with(False) + mock__setup_config_elements.assert_called_once_with( + traffic_profile='fake_profile', add_default_proto=False) def test_flows_settings(self): cfg = {'uplink_0': { diff --git a/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py b/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py index 7b5165c39..426d6b21b 100644 --- a/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py +++ b/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py @@ -517,60 +517,56 @@ class TestIXIARFC2544Profile(unittest.TestCase): def test__get_framesize(self): traffic_profile = { - 'uplink_0': {'outer_l2': {'framesize': {'64B': 100}}}, - 'downlink_0': {'outer_l2': {'framesize': {'64B': 100}}}, - 'uplink_1': {'outer_l2': {'framesize': {'64B': 100}}}, - 'downlink_1': {'outer_l2': {'framesize': {'64B': 100}}} + 'uplink_0': {'ipv4': {'outer_l2': {'framesize': {'64B': 100}}}}, + 'downlink_0': {'ipv4': {'outer_l2': {'framesize': {'64B': 100}}}}, + 'uplink_1': {'ipv4': {'outer_l2': {'framesize': {'64B': 100}}}}, + 'downlink_1': {'ipv4': {'outer_l2': {'framesize': {'64B': 100}}}} } rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE) - with mock.patch.object(rfc2544_profile, '_get_ixia_traffic_profile') \ - as mock_get_tp: - mock_get_tp.return_value = traffic_profile - result = rfc2544_profile._get_framesize() + rfc2544_profile.params = traffic_profile + result = rfc2544_profile._get_framesize() self.assertEqual(result, '64B') def test__get_framesize_IMIX_traffic(self): traffic_profile = { - 'uplink_0': {'outer_l2': {'framesize': {'64B': 50, - '128B': 50}}}, - 'downlink_0': {'outer_l2': {'framesize': {'64B': 50, - '128B': 50}}}, - 'uplink_1': {'outer_l2': {'framesize': {'64B': 50, - '128B': 50}}}, - 'downlink_1': {'outer_l2': {'framesize': {'64B': 50, - '128B': 50}}} + 'uplink_0': {'ipv4': {'outer_l2': {'framesize': {'64B': 50, + '128B': 50}}}}, + 'downlink_0': {'ipv4': {'outer_l2': {'framesize': {'64B': 50, + '128B': 50}}}}, + 'uplink_1': {'ipv4': {'outer_l2': {'framesize': {'64B': 50, + '128B': 50}}}}, + 'downlink_1': {'ipv4': {'outer_l2': {'framesize': {'64B': 50, + '128B': 50}}}} } rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE) - with mock.patch.object(rfc2544_profile, '_get_ixia_traffic_profile') \ - as mock_get_tp: - mock_get_tp.return_value = traffic_profile - result = rfc2544_profile._get_framesize() + rfc2544_profile.params = traffic_profile + result = rfc2544_profile._get_framesize() self.assertEqual(result, 'IMIX') def test__get_framesize_zero_pkt_size_weight(self): traffic_profile = { - 'uplink_0': {'outer_l2': {'framesize': {'64B': 0}}}, - 'downlink_0': {'outer_l2': {'framesize': {'64B': 0}}}, - 'uplink_1': {'outer_l2': {'framesize': {'64B': 0}}}, - 'downlink_1': {'outer_l2': {'framesize': {'64B': 0}}} + 'uplink_0': {'ipv4': {'outer_l2': {'framesize': {'64B': 0}}}}, + 'downlink_0': {'ipv4': {'outer_l2': {'framesize': {'64B': 0}}}}, + 'uplink_1': {'ipv4': {'outer_l2': {'framesize': {'64B': 0}}}}, + 'downlink_1': {'ipv4': {'outer_l2': {'framesize': {'64B': 0}}}} } rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE) - with mock.patch.object(rfc2544_profile, '_get_ixia_traffic_profile') \ - as mock_get_tp: - mock_get_tp.return_value = traffic_profile - result = rfc2544_profile._get_framesize() + rfc2544_profile.params = traffic_profile + result = rfc2544_profile._get_framesize() self.assertEqual(result, '') def test_execute_traffic_first_run(self): rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE) rfc2544_profile.first_run = True rfc2544_profile.rate = 50 + traffic_gen = mock.Mock() + traffic_gen.rfc_helper.iteration.value = 0 with mock.patch.object(rfc2544_profile, '_get_ixia_traffic_profile') \ as mock_get_tp, \ mock.patch.object(rfc2544_profile, '_ixia_traffic_generate') \ as mock_tgenerate: mock_get_tp.return_value = 'fake_tprofile' - output = rfc2544_profile.execute_traffic(mock.ANY, + output = rfc2544_profile.execute_traffic(traffic_gen, ixia_obj=mock.ANY) self.assertTrue(output) @@ -585,13 +581,15 @@ class TestIXIARFC2544Profile(unittest.TestCase): rfc2544_profile.first_run = False rfc2544_profile.max_rate = 70 rfc2544_profile.min_rate = 0 + traffic_gen = mock.Mock() + traffic_gen.rfc_helper.iteration.value = 0 with mock.patch.object(rfc2544_profile, '_get_ixia_traffic_profile') \ as mock_get_tp, \ mock.patch.object(rfc2544_profile, '_ixia_traffic_generate') \ as mock_tgenerate: mock_get_tp.return_value = 'fake_tprofile' rfc2544_profile.full_profile = mock.ANY - output = rfc2544_profile.execute_traffic(mock.ANY, + output = rfc2544_profile.execute_traffic(traffic_gen, ixia_obj=mock.ANY) self.assertFalse(output) @@ -817,6 +815,7 @@ class TestIXIARFC2544PppoeScenarioProfile(unittest.TestCase): self.TRAFFIC_PROFILE) self.ixia_tp.rate = 100.0 self.ixia_tp._get_next_rate = mock.Mock(return_value=50.0) + self.ixia_tp._get_framesize = mock.Mock(return_value='64B') def test___init__(self): self.assertIsInstance(self.ixia_tp.full_profile, diff --git a/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py b/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py index c72a72d3d..6c86bf1cb 100644 --- a/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py +++ b/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py @@ -248,8 +248,12 @@ class TestRFC2544Profile(base.BaseUnitTestCase): mock.call(percentage=float(25 * 35) / 100), mock.call(percentage=float(75 * 35) / 100)], any_order=True) - def test_get_drop_percentage(self): + @mock.patch.object(rfc2544.RFC2544Profile, '_get_framesize') + def test_get_drop_percentage(self, mock_get_framesize): rfc2544_profile = rfc2544.RFC2544Profile(self.TRAFFIC_PROFILE) + rfc2544_profile.iteration = 1 + mock_get_framesize.return_value = '64B' + samples = [ {'xe1': {'tx_throughput_fps': 110, 'rx_throughput_fps': 101, @@ -292,7 +296,10 @@ class TestRFC2544Profile(base.BaseUnitTestCase): 'TxThroughputBps': 128000000.0, 'CurrentDropPercentage': 50.0, 'Rate': 100.0, - 'Throughput': 1000000.0} + 'Throughput': 1000000.0, + 'Iteration': 1, + 'PktSize': '64B', + 'Status': 'Failure'} self.assertEqual(expected, output) self.assertFalse(completed) 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 d84fda789..51a379cee 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 @@ -115,7 +115,7 @@ class TestIxiaResourceHelper(unittest.TestCase): mock_tprofile = mock.Mock() mock_tprofile.config.duration = 10 mock_tprofile.get_drop_percentage.return_value = \ - True, {'test': 'fake_samples'} + 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' @@ -649,11 +649,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() @@ -772,7 +774,7 @@ 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') @@ -796,7 +798,7 @@ class TestIxiaPppoeClientScenario(unittest.TestCase): 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) + uplink_topologies, downlink_topologies, mock_tp) def test__get_endpoints_src_dst_id_pairs(self): full_tp = OrderedDict([ |