continuation of file output edits/formatting

This commit is contained in:
Dipti
2021-01-22 02:22:17 -08:00
parent 5c18c4edfd
commit 8910aea156
3 changed files with 13 additions and 14 deletions

View File

@@ -1702,7 +1702,6 @@ class L4CXProfile(LFCliBase):
raise ValueError("L4CXProfile::monitor wants a list of column names to monitor")
if output_format is not None:
if output_format.lower() != report_file.split('.')[-1]:
if output_format.lower() != 'excel':
raise ValueError('Filename %s does not match output format %s' % (report_file, output_format))
else:
output_format = report_file.split('.')[-1]
@@ -1712,12 +1711,13 @@ class L4CXProfile(LFCliBase):
fields=None
if col_names is not None and len(col_names) > 0:
fields = ",".join(col_names)
if self.debug:
print(fields)
else:
#todo:rename this...
header_row=list((list(self.json_get("/layer4/all")['endpoint'][0].values())[0].keys()))
if self.debug:
print(header_row)
print(fields)
# Step 2, monitor columns,

View File

@@ -140,12 +140,14 @@ python3 ./test_ipv4_l4_urls_per_ten.py
"an" : "10",
"bgnAC" : "11",
"abgnAX" : "12",
"bgnAX" : "13",
"bgnAX" : "13"} \\
--num_tests 1 \\
--url "dl http://10.40.0.1 /dev/null" \\
--ap "00:0e:8e:78:e1:76"
--target_per_ten 600 \\
--test_duration 2m
--output_format csv \\
--report_file ~/Documents/results.csv \\
--test_duration 2m \\
--debug
''')
required = None
@@ -168,7 +170,7 @@ python3 ./test_ipv4_l4_urls_per_ten.py
optional.add_argument('--mode',help='Used to force mode of stations')
optional.add_argument('--ap',help='Used to force a connection to a particular AP')
optional.add_argument('--report_file',help='where you want to store results')
optional.add_argument('--output_format', help='choose either csv or xlsx')
optional.add_argument('--output_format', help='choose csv or xlsx') #update once other forms are completed
args = parser.parse_args()
@@ -177,8 +179,8 @@ python3 ./test_ipv4_l4_urls_per_ten.py
num_stations_converted = int(args.num_stations)
num_sta = num_stations_converted
if args.report_file is None:
if args.output_format in ['csv','json','html','hdf','stata','pickle','pdf','parquet','xlsx']:
output_form=args.output_format
if args.output_format in ['csv','json','html','hdf','stata','pickle','pdf','parquet','png','df','xlsx']:
output_form=args.output_format.lower()
print("Defaulting file output placement to /home/lanforge.")
rpt_file='/home/lanforge/data.' + output_form
else:
@@ -220,10 +222,7 @@ python3 ./test_ipv4_l4_urls_per_ten.py
except:
pass
ip_test.l4cxprofile.monitor(report_file=rpt_file, duration_sec=ip_test.local_realm.parse_time(args.test_duration).total_seconds(),
created_cx=layer4traffic,
output_format=output_form,
script_name='test_ipv4_l4_urls_per_ten',
arguments=args)
created_cx=layer4traffic, output_format=output_form, script_name='test_ipv4_l4_urls_per_ten', arguments=args)
ip_test.stop()
if not ip_test.passes():
print(ip_test.get_fail_message())

View File

@@ -204,7 +204,7 @@ python3 ./test_ipv4_variable_time.py
os.mkdir('/home/lanforge/report_data/'+homedir)
if args.report_file is None:
if args.output_format in ['csv','json','html','hdf','stata','pickle','pdf','parquet','xlsx']:
if args.output_format in ['csv','json','html','hdf','stata','pickle','pdf','png','df','parquet','xlsx']:
report_f='/home/lanforge/report-data/'+homedir+'/data.' + args.output_format
output=args.output_format
else:
@@ -265,7 +265,7 @@ python3 ./test_ipv4_variable_time.py
if ip_var_test.passes():
ip_var_test.exit_success()
IPV4VariableTime.cx_profile.stop_cx()
IPV4VariableTime.cx_profile.stop_cx() #is this needed?
if __name__ == "__main__":
main()