X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=nfvbench%2Ftraffic_gen%2Ftrex_gen.py;h=85331b274fff711f77b050dbfe34b58e8c3df104;hb=d04f640acaf5d0f1bd5fa2c4a645900c8bd34f5b;hp=f5c2afb70e97fd7a1eb7026e79a09fafd10f9165;hpb=77ad6af4cc10aece9fac24eef1a01c50979cb3d2;p=nfvbench.git 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)