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