help option for ipv4_var_time until further GUI-JSON implementation is done

This commit is contained in:
Dipti
2021-01-30 00:55:38 -08:00
parent a81aaa8557
commit ae9e2f1445
2 changed files with 82 additions and 19 deletions

View File

@@ -1153,7 +1153,8 @@ class L3CXProfile(BaseProfile):
output_format=None, output_format=None,
script_name=None, script_name=None,
arguments=None, arguments=None,
compared_report=None): compared_report=None,
debug=False):
try: try:
duration_sec = self.parse_time(duration_sec).seconds duration_sec = self.parse_time(duration_sec).seconds
except: except:
@@ -1173,16 +1174,16 @@ class L3CXProfile(BaseProfile):
raise ValueError('Filename %s does not match output format %s' % (report_file, output_format)) raise ValueError('Filename %s does not match output format %s' % (report_file, output_format))
else: else:
output_format = report_file.split('.')[-1] output_format = report_file.split('.')[-1]
#retrieve compared report if specified - turn into dataframe #retrieve compared report if specified - turn into dataframe -- under construction
if compared_report is not None: if compared_report is not None:
supported_formats = ['csv', 'json', 'stata', 'pickle','html'] supported_formats = ['csv', 'json', 'stata', 'pickle','html']
for format in supported_formats: for format in supported_formats:
if compared_format.lower() == format: if compared_report.lower() == format:
# exec('df.to_' + x + '("' + report_file + '",index=False' + ')') #exec('df.to_' + x + '("' + report_file + '",index=False' + ')')
previous_data_df= read_csv() #previous_data_df= read_csv()
pass
#Step 1, column names
# Step 1, column names
fields=None fields=None
if col_names is not None and len(col_names) > 0: if col_names is not None and len(col_names) > 0:
fields = ",".join(col_names) fields = ",".join(col_names)
@@ -1208,13 +1209,13 @@ class L3CXProfile(BaseProfile):
print(response) print(response)
raise ValueError("no endpoint?") raise ValueError("no endpoint?")
if monitor: if monitor:
if self.debug: if debug:
print(response) print(response)
t = datetime.datetime.now() t = datetime.datetime.now()
timestamps.append(t) timestamps.append(t)
value_map[t] = response value_map[t] = response
new_cx_rx_values = self.__get_rx_values() new_cx_rx_values = self.__get_rx_values()
if self.debug: if debug:
print(old_cx_rx_values, new_cx_rx_values) print(old_cx_rx_values, new_cx_rx_values)
print("\n-----------------------------------") print("\n-----------------------------------")
print(t) print(t)
@@ -1223,12 +1224,12 @@ class L3CXProfile(BaseProfile):
if self.__compare_vals(old_cx_rx_values, new_cx_rx_values): if self.__compare_vals(old_cx_rx_values, new_cx_rx_values):
passes += 1 passes += 1
else: else:
self._fail("FAIL: Not all stations increased traffic") self.fail("FAIL: Not all stations increased traffic")
self.exit_fail() self.exit_fail()
old_cx_rx_values = new_cx_rx_values old_cx_rx_values = new_cx_rx_values
#write csv file here - open, write, and close file #write csv file here - open, write, and close file
time.sleep(monitor_interval) time.sleep(monitor_interval)
if self.debug: if debug:
print("Printing value map...") print("Printing value map...")
print(value_map) print(value_map)
@@ -1238,13 +1239,10 @@ class L3CXProfile(BaseProfile):
#reduce the endpoint data to single dictionary of dictionaries #reduce the endpoint data to single dictionary of dictionaries
for datum in data["endpoint"]: for datum in data["endpoint"]:
for endpoint_data in datum.values(): for endpoint_data in datum.values():
if self.debug: if debug:
print(endpoint_data) print(endpoint_data)
endpoint_data["Timestamp"] = test_timestamp endpoint_data["Timestamp"] = test_timestamp
full_test_data_list.append(endpoint_data) full_test_data_list.append(endpoint_data)
if self.debug:
print("Printing full data list...")
print(full_test_data_list)
header_row.append("Timestamp") header_row.append("Timestamp")

View File

@@ -168,10 +168,74 @@ python3 ./test_ipv4_variable_time.py
--b_min 1000 --b_min 1000
--ap "00:0e:8e:78:e1:76" --ap "00:0e:8e:78:e1:76"
--output_format csv --output_format csv
--report_file ~/Documents/results.csv (Example of csv file output - please use another extension for other files) --report_file ~/Documents/results.csv (Example of csv file output - please use another extension for other files)
--compared_report ~/Documents/results_prev.csv (Example of csv file retrieval - please use another extension for other files) - UNDER CONSTRUCTION --compared_report ~/Documents/results_prev.csv (Example of csv file retrieval - please use another extension for other files) - UNDER CONSTRUCTION
--col_names 'name','tx bytes', 'rx bytes','dropped' --col_names 'name', 'tx bytes', 'rx bytes', 'dropped' (names of according json columns, please read below to understand what to put here according to what you would like to track)
--debug --debug
===============================================================================
** FURTHER INFORMATION **
Using the col_names flag:
Currently the output function does not support inputting the columns in col_names the way they are displayed in the GUI. That is under construction. To output
certain columns in the GUI in your final report, please match the according GUI column display to it's counterpart to have the columns correctly displayed in
your report.
GUI Column Col_names argument (to print in report)
Name |
EID | 'eid'
Run | 'run'
Mng | 'mng'
Script | 'script'
Tx Rate | 'tx rate'
Tx Rate (1 min) | 'tx rate (1 min)'
Tx Rate (last) | 'tx rate (last)'
Tx Rate LL | 'tx rate ll'
Rx Rate | 'rx rate'
Rx Rate (1 min) | 'rx rate (1 min)'
Rx Rate (last) | 'rx rate (last)'
Rx Rate LL | 'rx rate ll'
Rx Drop % | 'rx drop %'
Tx PDUs | 'tx pdus'
Tx Pkts LL | 'tx pkts ll'
PDU/s TX | 'pdu/s tx'
Pps TX LL | 'pps tx ll'
Rx PDUs | 'rx pdus'
Rx Pkts LL | 'pps rx ll'
PDU/s RX | 'pdu/s tx'
Pps RX LL | 'pps rx ll'
Delay | 'delay'
Dropped | 'dropped'
Jitter | 'jitter'
Tx Bytes | 'tx bytes'
Rx Bytes | 'rx bytes'
Replays | 'replays'
TCP Rtx | 'tcp rtx'
Dup Pkts | 'dup pkts'
Rx Dup % | 'rx dup %'
OOO Pkts | 'ooo pkts'
Rx OOO % | 'rx ooo %'
RX Wrong Dev | 'rx wrong dev'
CRC Fail | 'crc fail'
RX BER | 'rx ber'
CX Active | 'cx active'
CX Estab/s | 'cx estab/s'
1st RX | '1st rx'
CX TO | 'cx to'
Pattern | 'pattern'
Min PDU | 'min pdu'
Max PDU | 'max pdu'
Min Rate | 'min rate'
Max Rate | 'max rate'
Send Buf | 'send buf'
Rcv Buf | 'rcv buf'
CWND | 'cwnd'
TCP MSS | 'tcp mss'
Bursty | 'bursty'
A/B | 'a/b'
Elapsed | 'elapsed'
Destination Addr| 'destination addr'
Source Addr | 'source addr'
''') ''')
required_args=None required_args=None
@@ -289,7 +353,8 @@ python3 ./test_ipv4_variable_time.py
output_format=output, output_format=output,
compared_report=compared_rept, compared_report=compared_rept,
script_name='test_ipv4_variable_time', script_name='test_ipv4_variable_time',
arguments=args) arguments=args,
debug=args.debug)
ip_var_test.stop() ip_var_test.stop()
if not ip_var_test.passes(): if not ip_var_test.passes():