diff options
author | Pierrick Louin <pierrick.louin@orange.com> | 2020-10-13 19:09:22 +0200 |
---|---|---|
committer | fmenguy <francoisregis.menguy@orange.com> | 2020-10-19 17:28:50 +0200 |
commit | 05d97da9654890303c40de256ce23915d8faf6ac (patch) | |
tree | fae0063bd7fbf335af622eb20729ca839e716a63 | |
parent | 3ff4a4a2f24d2bc6c45379c0cc326d5db1ad7beb (diff) |
NFVBENCH-186: Fix a bug: NDR mode now fully supports 'intf_speed' overriding
Change-Id: I43453b5790474324ec0db6e98311bb864ee00ec4
Signed-off-by: Pierrick Louin <pierrick.louin@orange.com>
-rwxr-xr-x | nfvbench/traffic_client.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/nfvbench/traffic_client.py b/nfvbench/traffic_client.py index c711cfb..6972509 100755 --- a/nfvbench/traffic_client.py +++ b/nfvbench/traffic_client.py @@ -58,8 +58,11 @@ class TrafficRunner(object): return None LOG.info('Running traffic generator') self.client.gen.clear_stats() - # Debug use only : new '--service-mode' option available for the NFVBench command line. - # A read-only mode TRex console would be able to capture the generated traffic. + # Debug use only: the service_mode flag may have been set in + # the configuration, in order to enable the 'service' mode + # in the trex generator, before starting the traffic (run). + # From this point, a T-rex console (launched in readonly mode) would + # then be able to capture the transmitted and/or received traffic. self.client.gen.set_service_mode(enabled=self.service_mode) LOG.info('Service mode is %sabled', 'en' if self.service_mode else 'dis') self.client.gen.start_traffic() @@ -1120,7 +1123,6 @@ class TrafficClient(object): for percentile in self.config.lat_percentiles: retDict['overall']['rx']['lat_percentile'][percentile] = \ decoded_histogram.get_value_at_percentile(percentile) - else: retDict['overall'] = retDict[ports[0]] retDict['overall']['drop_rate_percent'] = self.__get_dropped_rate(retDict['overall']) @@ -1250,6 +1252,17 @@ class TrafficClient(object): """ self._modify_load(rate) + # There used to be a inconsistency in case of interface speed override. + # The emulated 'intf_speed' value is unknown to the T-Rex generator which + # refers to the detected line rate for converting relative traffic loads. + # Therefore, we need to convert actual rates here, in terms of packets/s. + + for idx, str_rate in enumerate(self.gen.rates): + if str_rate.endswith('%'): + float_rate = float(str_rate.replace('%', '').strip()) + pps_rate = self.__convert_rates({'rate_percent': float_rate})['rate_pps'] + self.gen.rates[idx] = str(pps_rate) + 'pps' + # poll interval stats and collect them for stats in self.run_traffic(): self.interval_collector.add(stats) |