diff options
author | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-08-20 12:39:27 +0100 |
---|---|---|
committer | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-08-20 15:23:53 +0100 |
commit | 087964a27c111205adb57d74321bee7f703cd844 (patch) | |
tree | e6e26d0bc3a9d4f7c56af4616aa3f4a8d34bcff3 /yardstick | |
parent | 4343c22ed72556aca12aea1167b7b92e02e8a20d (diff) |
Make TRex latency statistics optional
Because of performance issues in TRex due to the extra power needed to
retrieve the latency statistics, this parameter will be optional and disabled
by default.
JIRA: YARDSTICK-1388
Change-Id: I07c0ec7bef86fd438d078cbd6748b98bc8cc0b37
Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'yardstick')
3 files changed, 17 insertions, 12 deletions
diff --git a/yardstick/network_services/traffic_profile/base.py b/yardstick/network_services/traffic_profile/base.py index a8f950b7b..4fbceea9b 100644 --- a/yardstick/network_services/traffic_profile/base.py +++ b/yardstick/network_services/traffic_profile/base.py @@ -44,6 +44,7 @@ class TrafficProfileConfig(object): self.lower_bound = tprofile.get('lower_bound') self.upper_bound = tprofile.get('upper_bound') self.step_interval = tprofile.get('step_interval') + self.enable_latency = tprofile.get('enable_latency', False) def _parse_rate(self, rate): """Parse traffic profile rate diff --git a/yardstick/network_services/traffic_profile/rfc2544.py b/yardstick/network_services/traffic_profile/rfc2544.py index b54fc575f..772e96716 100644 --- a/yardstick/network_services/traffic_profile/rfc2544.py +++ b/yardstick/network_services/traffic_profile/rfc2544.py @@ -118,7 +118,8 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): ports.append(port_num) port_pg_id.add_port(port_num) profile = self._create_profile(profile_data, - self.rate, port_pg_id) + self.rate, port_pg_id, + self.config.enable_latency) self.generator.client.add_streams(profile, ports=[port_num]) self.generator.client.start(ports=ports, @@ -126,7 +127,7 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): force=True) return ports, port_pg_id - def _create_profile(self, profile_data, rate, port_pg_id): + def _create_profile(self, profile_data, rate, port_pg_id, enable_latency): """Create a STL profile (list of streams) for a port""" streams = [] for packet_name in profile_data: @@ -134,7 +135,8 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): get('outer_l2', {}).get('framesize')) imix_data = self._create_imix_data(imix) self._create_vm(profile_data[packet_name]) - _streams = self._create_streams(imix_data, rate, port_pg_id) + _streams = self._create_streams(imix_data, rate, port_pg_id, + enable_latency) streams.extend(_streams) return trex_stl_streams.STLProfile(streams) @@ -213,7 +215,7 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): return trex_stl_packet_builder_scapy.STLPktBuilder( pkt=base_pkt / pad, vm=self.trex_vm) - def _create_streams(self, imix_data, rate, port_pg_id): + def _create_streams(self, imix_data, rate, port_pg_id, enable_latency): """Create a list of streams per packet size The STL TX mode speed of the generated streams will depend on the frame @@ -237,7 +239,8 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): in imix_data.items() if float(weight) > 0): packet = self._create_single_packet(size) pg_id = port_pg_id.increase_pg_id() - stl_flow = trex_stl_streams.STLFlowLatencyStats(pg_id=pg_id) + stl_flow = (trex_stl_streams.STLFlowLatencyStats(pg_id=pg_id) if + enable_latency else None) mode = trex_stl_streams.STLTXCont(percentage=weight * rate / 100) streams.append(trex_stl_client.STLStream( packet=packet, flow_stats=stl_flow, mode=mode)) 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 2e0331e8e..20f67d71a 100644 --- a/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py +++ b/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py @@ -102,10 +102,10 @@ class TestRFC2544Profile(base.BaseUnitTestCase): mock_create_profile: rfc2544_profile.execute_traffic(traffic_generator=mock_generator) mock_create_profile.assert_has_calls([ - mock.call('profile1', rfc2544_profile.rate, mock.ANY), - mock.call('profile1', rfc2544_profile.rate, mock.ANY), - mock.call('profile2', rfc2544_profile.rate, mock.ANY), - mock.call('profile2', rfc2544_profile.rate, mock.ANY)]) + mock.call('profile1', rfc2544_profile.rate, mock.ANY, False), + mock.call('profile1', rfc2544_profile.rate, mock.ANY, False), + mock.call('profile2', rfc2544_profile.rate, mock.ANY, False), + mock.call('profile2', rfc2544_profile.rate, mock.ANY, False)]) mock_generator.client.add_streams.assert_has_calls([ mock.call(mock.ANY, ports=[10]), mock.call(mock.ANY, ports=[20]), @@ -129,13 +129,14 @@ class TestRFC2544Profile(base.BaseUnitTestCase): mock_create_streams: mock_create_imix.return_value = 'imix_data' mock_create_streams.return_value = ['stream1'] - rfc2544_profile._create_profile(profile_data, rate, port_pg_id) + rfc2544_profile._create_profile(profile_data, rate, port_pg_id, + True) mock_create_imix.assert_called_once_with('imix_info') mock_create_vm.assert_called_once_with( {'outer_l2': {'framesize': 'imix_info'}}) mock_create_streams.assert_called_once_with('imix_data', 100, - port_pg_id) + port_pg_id, True) mock_stl_profile.assert_called_once_with(['stream1']) def test__create_imix_data(self): @@ -208,7 +209,7 @@ class TestRFC2544Profile(base.BaseUnitTestCase): rfc2544_profile = rfc2544.RFC2544Profile(self.TRAFFIC_PROFILE) with mock.patch.object(rfc2544_profile, '_create_single_packet'): output = rfc2544_profile._create_streams(imix_data, rate, - port_pg_id) + port_pg_id, True) self.assertEqual(['stream1', 'stream2'], output) mock_latency.assert_has_calls([ mock.call(pg_id=1), mock.call(pg_id=2)]) |