@@ -262,10 +262,12 @@ def _main():
262
262
"right" : "select the RIGHT side of the GLS to use the MFB Generator or set loopback" ,
263
263
"left" : "select the LEFT side of the GLS to use the MFB Generator or set loopback" ,
264
264
"loopback" : "enable (1) or disable (0) loopback (on the '-R' or '-L' side)" ,
265
- "generate" : "start (1) or stop (0) generating (to the '-R' or '-L' side), 'c' to print its config " ,
265
+ "generate" : "start (1) or stop (0) generating (to the '-R' or '-L' side)" ,
266
266
"size" : "set frame size for the ('-R' or '-L') MFB Generator" ,
267
267
"measure" : "measure the throughput using selected Speed Meter (SM), 'a' for all, '0,1' by default" ,
268
268
"config" : "print full configuration and exit" ,
269
+ "gen-config" : "generator config - either print full configuration (no args) or set a value"
270
+ " with two extra args"
269
271
}
270
272
271
273
gls_desc = """
@@ -307,10 +309,11 @@ def _main():
307
309
arg_parser .add_argument ("-R" , "--right" , action = "store_true" , help = help_dict ["right" ])
308
310
arg_parser .add_argument ("-L" , "--left" , action = "store_true" , help = help_dict ["left" ])
309
311
arg_parser .add_argument ("-l" , "--loopback" , type = int , choices = [0 , 1 ], help = help_dict ["loopback" ])
310
- arg_parser .add_argument ("-g" , "--generate" , nargs = "?" , choices = ["0" , "1" , "c" ], help = help_dict ["generate" ])
312
+ arg_parser .add_argument ("-g" , "--generate" , nargs = "?" , choices = ["0" , "1" ], help = help_dict ["generate" ])
311
313
arg_parser .add_argument ("-s" , "--size" , type = int , help = help_dict ["size" ])
312
314
arg_parser .add_argument ("-m" , "--measure" , nargs = '?' , const = "default" , choices = ["default" , "0" , "1" , "2" , "3" , "a" ], help = help_dict ["measure" ])
313
315
arg_parser .add_argument ("-c" , "--config" , action = "store_true" , help = help_dict ["config" ])
316
+ arg_parser .add_argument ("-C" , "--gen-config" , nargs = "*" , help = help_dict ["gen-config" ])
314
317
args = arg_parser .parse_args ()
315
318
316
319
try :
@@ -377,9 +380,15 @@ def _main():
377
380
elif "0" in args .generate :
378
381
s .gen_stop ()
379
382
380
- if "c" in args .generate :
383
+ if args .gen_config is not None :
384
+ if len (args .gen_config ) == 0 :
381
385
print ("MFB Generator configuration:" )
382
386
print (tabulate (s .gen .get_fconfiguration ()))
387
+ elif len (args .gen_config ) == 2 :
388
+ attr , value = args .gen_config
389
+ s .gen .configure_attr (attr , value )
390
+ else :
391
+ raise ValueError ("Invalid number of arguments" )
383
392
384
393
385
394
def main ():
0 commit comments