From d04f640acaf5d0f1bd5fa2c4a645900c8bd34f5b Mon Sep 17 00:00:00 2001 From: Pierrick Louin Date: Tue, 13 Oct 2020 18:24:12 +0200 Subject: NFVBENCH-183: Correct a very old bug - revealed with python3 - when traffic is unidirectional (while checking pps rate) Change-Id: I55fd64915c647a3a6b2b85bf30ecc69af620f420 Signed-off-by: Pierrick Louin --- nfvbench/traffic_gen/trex_gen.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/nfvbench/traffic_gen/trex_gen.py b/nfvbench/traffic_gen/trex_gen.py index f5c2afb..85331b2 100644 --- a/nfvbench/traffic_gen/trex_gen.py +++ b/nfvbench/traffic_gen/trex_gen.py @@ -869,8 +869,10 @@ class TRex(AbstractTrafficGenerator): chain_count) break - # if the capture from the TRex console was started before the arp request step, - # it keeps 'service_mode' enabled, otherwise, it disables the 'service_mode' + # A traffic capture may have been started (from a T-Rex console) at this time. + # If asked so, we keep the service mode enabled here, and disable it otherwise. + # | Disabling the service mode while a capture is in progress + # | would cause the application to stop/crash with an error. if not self.config.service_mode: self.client.set_service_mode(ports=self.port_handle, enabled=False) if len(arp_dest_macs) == len(self.port_handle): @@ -889,7 +891,8 @@ class TRex(AbstractTrafficGenerator): total_rate += int(r['rate_pps']) else: mult = 1 - total_rate = utils.convert_rates(l2frame_size, rates[0], intf_speed) + r = utils.convert_rates(l2frame_size, rates[0], intf_speed) + total_rate = int(r['rate_pps']) # rate must be enough for latency stream and at least 1 pps for base stream per chain required_rate = (self.LATENCY_PPS + 1) * self.config.service_chain_count * mult result = utils.convert_rates(l2frame_size, @@ -1020,8 +1023,10 @@ class TRex(AbstractTrafficGenerator): if self.capture_id: self.client.stop_capture(capture_id=self.capture_id['id']) self.capture_id = None - # if the capture from TRex console was started before the connectivity step, - # it keeps 'service_mode' enabled, otherwise, it disables the 'service_mode' + # A traffic capture may have been started (from a T-Rex console) at this time. + # If asked so, we keep the service mode enabled here, and disable it otherwise. + # | Disabling the service mode while a capture is in progress + # | would cause the application to stop/crash with an error. if not self.config.service_mode: self.client.set_service_mode(ports=self.port_handle, enabled=False) @@ -1036,5 +1041,5 @@ class TRex(AbstractTrafficGenerator): pass def set_service_mode(self, enabled=True): - """Enable/disable the 'service_mode'.""" + """Enable/disable the 'service' mode.""" self.client.set_service_mode(ports=self.port_handle, enabled=enabled) -- cgit 1.2.3-korg