diff options
author | treyad <treyad@viosoft.com> | 2019-02-12 12:23:00 -0800 |
---|---|---|
committer | treyad <treyad@viosoft.com> | 2019-02-12 12:23:00 -0800 |
commit | ec8bf118c4b9e1b31392530a82022d7c5210cd5a (patch) | |
tree | 8d8207739396c69c21c124240a181bae7db97be4 | |
parent | 0dbd3bb46b6d2aaa71c6bf2be046c3c0f877466b (diff) |
Generate correct IMIX distribution for STL profile
JIRA: YARDSTICK-1599
Change-Id: I654644d7944d0af41d8da12cc002f31fcfecf62e
Signed-off-by: treyad <treyad@viosoft.com>
-rw-r--r-- | yardstick/network_services/traffic_profile/rfc2544.py | 10 | ||||
-rw-r--r-- | yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py | 16 |
2 files changed, 13 insertions, 13 deletions
diff --git a/yardstick/network_services/traffic_profile/rfc2544.py b/yardstick/network_services/traffic_profile/rfc2544.py index b838bf814..1fe229769 100644 --- a/yardstick/network_services/traffic_profile/rfc2544.py +++ b/yardstick/network_services/traffic_profile/rfc2544.py @@ -142,7 +142,7 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): return trex_stl_streams.STLProfile(streams) def _create_imix_data(self, imix, - weight_mode=constants.DISTRIBUTION_IN_PACKETS): + weight_mode=constants.DISTRIBUTION_IN_BYTES): """Generate the IMIX distribution for a STL profile The input information is the framesize dictionary in a test case @@ -192,13 +192,13 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): imix_dip = {size: float(weight) / weight_normalize for size, weight in imix_count.items()} - if weight_mode == constants.DISTRIBUTION_IN_BYTES: + if weight_mode == constants.DISTRIBUTION_IN_PACKETS: return imix_dip byte_total = sum([int(size) * weight - for size, weight in imix_dip.items()]) - return {size: (int(size) * weight * 100) / byte_total - for size, weight in imix_dip.items()} + for size, weight in imix_count.items()]) + return {size: float(int(size) * weight * 100) / byte_total + for size, weight in imix_count.items()} def _create_vm(self, packet_definition): """Create the STL Raw instructions""" 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..88eaaef28 100644 --- a/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py +++ b/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py @@ -141,25 +141,25 @@ class TestRFC2544Profile(base.BaseUnitTestCase): port_pg_id, True) mock_stl_profile.assert_called_once_with(['stream1']) - def test__create_imix_data_mode_DIB(self): + def test__create_imix_data_mode_DIP(self): rfc2544_profile = rfc2544.RFC2544Profile(self.TRAFFIC_PROFILE) data = {'64B': 50, '128B': 50} self.assertEqual( {'64': 50.0, '128': 50.0}, rfc2544_profile._create_imix_data( - data, weight_mode=constants.DISTRIBUTION_IN_BYTES)) + data, weight_mode=constants.DISTRIBUTION_IN_PACKETS)) data = {'64B': 1, '128b': 3} self.assertEqual( {'64': 25.0, '128': 75.0}, rfc2544_profile._create_imix_data( - data, weight_mode=constants.DISTRIBUTION_IN_BYTES)) + data, weight_mode=constants.DISTRIBUTION_IN_PACKETS)) data = {} self.assertEqual( {}, rfc2544_profile._create_imix_data( - data, weight_mode=constants.DISTRIBUTION_IN_BYTES)) + data, weight_mode=constants.DISTRIBUTION_IN_PACKETS)) - def test__create_imix_data_mode_DIP(self): + def test__create_imix_data_mode_DIB(self): rfc2544_profile = rfc2544.RFC2544Profile(self.TRAFFIC_PROFILE) data = {'64B': 25, '128B': 25, '512B': 25, '1518B': 25} byte_total = 64 * 25 + 128 * 25 + 512 * 25 + 1518 * 25 @@ -169,17 +169,17 @@ class TestRFC2544Profile(base.BaseUnitTestCase): '512': 512 * 25.0 * 100 / byte_total, '1518': 1518 * 25.0 * 100/ byte_total}, rfc2544_profile._create_imix_data( - data, weight_mode=constants.DISTRIBUTION_IN_PACKETS)) + data, weight_mode=constants.DISTRIBUTION_IN_BYTES)) data = {} self.assertEqual( {}, rfc2544_profile._create_imix_data( - data, weight_mode=constants.DISTRIBUTION_IN_PACKETS)) + data, weight_mode=constants.DISTRIBUTION_IN_BYTES)) data = {'64B': 100} self.assertEqual( {'64': 100.0}, rfc2544_profile._create_imix_data( - data, weight_mode=constants.DISTRIBUTION_IN_PACKETS)) + data, weight_mode=constants.DISTRIBUTION_IN_BYTES)) def test__create_vm(self): packet = {'outer_l2': 'l2_definition'} |