NFVBENCH-188: Add an option for dumping the TRex log file 29/71329/3
authorPierrick Louin <pierrick.louin@orange.com>
Tue, 13 Oct 2020 21:52:04 +0000 (23:52 +0200)
committerFran�ois-R�gis Menguy <francoisregis.menguy@orange.com>
Thu, 5 Nov 2020 08:13:18 +0000 (08:13 +0000)
Change-Id: Icd48638a5d789ea780ef8c39bc3a2cb963b8bc8a
Signed-off-by: Pierrick Louin <pierrick.louin@orange.com>
nfvbench/nfvbench.py

index da069bf..19c402f 100644 (file)
@@ -576,6 +576,12 @@ def _parse_opts_from_cli():
                         default=None,
                         help='Change json/log files ownership with this group (int)')
 
+    parser.add_argument('--show-trex-log', dest='show_trex_log',
+                        default=None,
+                        action='store_true',
+                        help='Show the current TRex local server log file contents'
+                               + ' => diagnostic/help in case of configuration problems')
+
     parser.add_argument('--debug-mask', dest='debug_mask',
                         type=int_arg,
                         metavar='<mask>',
@@ -687,6 +693,14 @@ def main():
             print((default_cfg.decode("utf-8")))
             sys.exit(0)
 
+        # dump the contents of the trex log file
+        if opts.show_trex_log:
+            try:
+                print(open('/tmp/trex.log').read(), end="")
+            except FileNotFoundError:
+                print("No TRex log file found!")
+            sys.exit(0)
+
         config.name = ''
         if opts.config:
             # do not check extra_specs in flavor as it can contain any key/value pairs