NFVBENCH-215 Fix wrong throughput ratio in latency tests 67/72767/3
authorfmenguy <francoisregis.menguy@orange.com>
Wed, 7 Jul 2021 09:05:28 +0000 (11:05 +0200)
committerfmenguy <francoisregis.menguy@orange.com>
Thu, 8 Jul 2021 12:08:12 +0000 (14:08 +0200)
Change-Id: I5c976dd49a2c17b47559b1d6a565a6e78f7cfd0e
Signed-off-by: fmenguy <francoisregis.menguy@orange.com>
behave_tests/features/steps/steps.py
nfvbench/config_plugin.py
nfvbench/credentials.py
nfvbench/nfvbench.py
nfvbench/summarizer.py
nfvbench/traffic_server.py
test/test_nfvbench.py

index 5762fa2..8798280 100644 (file)
@@ -196,7 +196,6 @@ def step_impl(context, repeat=1):
         results)
 
     total_tx_rate = extract_value(context.result, "total_tx_rate")
-    context.rates[context.json['frame_sizes'][0] + '_' + context.json['flow_count']] = total_tx_rate
     overall = extract_value(context.result, "overall")
     avg_delay_usec = extract_value(overall, "avg_delay_usec")
     # create a synthesis with offered pps and latency values
index 0596fcf..86e5505 100644 (file)
@@ -91,7 +91,7 @@ class ConfigPlugin(ConfigPluginBase):
         """Return RunSpec for given platform."""
         return specs.RunSpec(config.no_vswitch_access, openstack_spec)
 
-    def validate_config(self, config, openstack_spec):
+    def validate_config(self, cfg, openstack_spec):
         """Nothing to validate by default."""
 
     def prepare_results_config(self, cfg):
index a707ba3..7562896 100644 (file)
@@ -138,7 +138,8 @@ class Credentials(object):
         if openrc_file:
             if isinstance(openrc_file, str):
                 if os.path.exists(openrc_file):
-                    self.__parse_openrc(open(openrc_file))
+                    with open(openrc_file) as rc_file:
+                        self.__parse_openrc(rc_file)
                 else:
                     LOG.error('Error: rc file does not exist %s', openrc_file)
                     success = False
index 0719247..740dca2 100644 (file)
@@ -736,7 +736,8 @@ def main():
         # dump the contents of the trex log file
         if opts.show_trex_log:
             try:
-                print(open('/tmp/trex.log').read(), end="")
+                with open('/tmp/trex.log') as trex_log_file:
+                    print(trex_log_file.read(), end="")
             except FileNotFoundError:
                 print("No TRex log file found!")
             sys.exit(0)
index a4b02a6..7c69f52 100644 (file)
@@ -577,9 +577,9 @@ class NFVBenchSummarizer(Summarizer):
                     lat_map['lat_' + str(percentile) + '_percentile'] = \
                         str(percentile) + ' %ile lat.'
 
-            for key in lat_map:
+            for lat_value in lat_map.values():
                 # 'append' expects a single parameter => double parentheses
-                header.append((lat_map[key], Formatter.standard))
+                header.append((lat_value, Formatter.standard))
 
         table = Table(header)
         for chain in sorted(list(chains.keys()), key=str):
@@ -633,9 +633,9 @@ class NFVBenchSummarizer(Summarizer):
                     run_specific_data['pdr'] = data['pdr']
                     run_specific_data['pdr']['drop_limit'] = self.config['measurement']['PDR']
                     del data['pdr']
-                for key in run_specific_data:
+                for data_value in run_specific_data.values():
                     data_to_send = data.copy()
-                    data_to_send.update(run_specific_data[key])
+                    data_to_send.update(data_value)
                     self.sender.record_send(data_to_send)
             self.__record_init()
 
index 53f4f39..2c85286 100644 (file)
@@ -72,8 +72,8 @@ class TRexTrafficServer(TrafficServer):
                                                                  hdrh_opt,
                                                                  mbuf_opt, cfg)]
         LOG.info(' '.join(cmd))
-        subprocess.Popen(cmd, cwd=self.trex_dir)
-        LOG.info('TRex server is running...')
+        with subprocess.Popen(cmd, cwd=self.trex_dir) as trex_process:
+            LOG.info('TRex server is running (PID: %s)...', trex_process.pid)
 
     def __load_config(self, filename):
         result = {}
index 360e3bd..e48fbda 100644 (file)
@@ -34,8 +34,8 @@ from nfvbench.traffic_client import GeneratorConfig
 from nfvbench.traffic_client import IpBlock
 from nfvbench.traffic_client import TrafficClient
 from nfvbench.traffic_client import TrafficClientException
-import nfvbench.traffic_gen.traffic_utils as traffic_utils
-import nfvbench.utils as utils
+from nfvbench.traffic_gen import traffic_utils
+from nfvbench import utils
 
 # just to get rid of the unused function warning
 no_op()