mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 03:07:56 +00:00
ipv4_var_time now writes to disk - works
This commit is contained in:
@@ -578,20 +578,28 @@ class LFCliBase:
|
||||
abgnAX : 12,
|
||||
bgnAX : 13
|
||||
"""
|
||||
def write_to_csv_file(self,new_data_list=None, csvwriter=None,debug=False):
|
||||
print(new_data_list)
|
||||
def write_to_csv_file(self,new_data_list=None, num_cols=0, csvwriter=None,debug=False):
|
||||
if num_cols == 0:
|
||||
raise ValueError("Number of columns cannot be zero. Exiting script.")
|
||||
exit(1)
|
||||
if type(new_data_list) is not list:
|
||||
raise ValueError("Data type passed to write into CSV is not a list. Exiting script.")
|
||||
exit(1)
|
||||
if debug:
|
||||
print("Writing data: "+ new_data_list)
|
||||
|
||||
for data_value in new_data_list:
|
||||
if isinstance(data_value,datetime.datetime):
|
||||
csvwriter.write("\n")
|
||||
csvwriter.write(data_value)
|
||||
exit(1)
|
||||
print("Writing data : ")
|
||||
print(new_data_list)
|
||||
|
||||
indiv_data_line=[]
|
||||
col_counter_per_line=0
|
||||
for data_value in new_data_list:
|
||||
if col_counter_per_line >= num_cols:
|
||||
if debug:
|
||||
print(indiv_data_line)
|
||||
csvwriter.writerow(indiv_data_line)
|
||||
col_counter_per_line=0
|
||||
indiv_data_line.clear()
|
||||
indiv_data_line.append(data_value)
|
||||
col_counter_per_line += 1
|
||||
|
||||
#================ Pandas Dataframe Functions ======================================
|
||||
def df_to_file(dataframe, file_name, file_type):
|
||||
|
||||
@@ -366,7 +366,8 @@ class Realm(LFCliBase):
|
||||
wait_more = False
|
||||
endp_list = self.json_get("/endp/list")
|
||||
found_endps = {}
|
||||
print("Waiting on endpoint endp_list {}".format(endp_list))
|
||||
if debug:
|
||||
print("Waiting on endpoint endp_list {}".format(endp_list))
|
||||
if (endp_list is not None) and ("items" not in endp_list):
|
||||
try:
|
||||
endp_list = list(endp_list['endpoint'])
|
||||
@@ -1241,7 +1242,7 @@ class L3CXProfile(LFCliBase):
|
||||
temp_list.extend([timestamp,t_to_millisec_epoch])
|
||||
for name in header_row[2:]:
|
||||
temp_list.append(temp_endp_values[name])
|
||||
self.write_to_csv_file(new_data_list=temp_list,csvwriter=csvwriter,debug=debug)
|
||||
self.write_to_csv_file(new_data_list=temp_list,num_cols=len(header_row),csvwriter=csvwriter,debug=debug)
|
||||
new_cx_rx_values = self.__get_rx_values()
|
||||
if debug:
|
||||
print(old_cx_rx_values, new_cx_rx_values)
|
||||
@@ -1256,7 +1257,6 @@ class L3CXProfile(LFCliBase):
|
||||
self.exit_fail()
|
||||
old_cx_rx_values = new_cx_rx_values
|
||||
time.sleep(monitor_interval)
|
||||
#close csv file after while loop
|
||||
csvfile.close()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user