test_l4: Fix bare except

Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
Matthew Stidham
2021-11-29 14:58:25 -08:00
parent ea79a485e0
commit 2177dd3575

View File

@@ -304,12 +304,11 @@ python3 ./test_l4.py
# Create directory # Create directory
if args.report_file is None: if args.report_file is None:
try: if os.path.isdir('/home/lanforge/report-data'):
homedir = str(datetime.datetime.now().strftime("%Y-%m-%d-%H-%M")).replace(':', homedir = str(datetime.datetime.now().strftime("%Y-%m-%d-%H-%M")).replace(':', '-') + 'test_l4'
'-') + 'test_l4'
path = os.path.join('/home/lanforge/report-data/', homedir) path = os.path.join('/home/lanforge/report-data/', homedir)
os.mkdir(path) os.mkdir(path)
except: else:
path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
print('Saving file to local directory') print('Saving file to local directory')
if args.output_format in ['csv', 'json', 'html', 'hdf', 'stata', 'pickle', 'pdf', 'png', 'df', 'parquet', if args.output_format in ['csv', 'json', 'html', 'hdf', 'stata', 'pickle', 'pdf', 'png', 'df', 'parquet',
@@ -349,10 +348,7 @@ python3 ./test_l4.py
ip_test.build() ip_test.build()
ip_test.start() ip_test.start()
try: layer4traffic = ','.join([[*x.keys()][0] for x in ip_test.local_realm.json_get('layer4')['endpoint']])
layer4traffic = ','.join([[*x.keys()][0] for x in ip_test.local_realm.json_get('layer4')['endpoint']])
except:
pass
ip_test.cx_profile.monitor(col_names=['name', 'bytes-rd', 'urls/s', 'bytes-wr'], ip_test.cx_profile.monitor(col_names=['name', 'bytes-rd', 'urls/s', 'bytes-wr'],
report_file=rpt_file, report_file=rpt_file,
duration_sec=ip_test.local_realm.parse_time(args.test_duration).total_seconds(), duration_sec=ip_test.local_realm.parse_time(args.test_duration).total_seconds(),