l3_cxprofile.py: account for empty lists

Signed-off-by: Scott Wedge <scott.wedge@candelatech.com>
This commit is contained in:
Scott Wedge
2022-06-29 16:20:13 -05:00
committed by shivam
parent a1f7fac426
commit e20ac33709

View File

@@ -297,7 +297,7 @@ class L3CXProfile(LFCliBase):
eid_str=station,
debug=self.debug)
probe_results = dict()
probe_port.refreshProbe()
if (probe_port.refreshProbe()):
probe_results['Signal Avg Combined'] = probe_port.getSignalAvgCombined()
probe_results['Signal Avg per Chain'] = probe_port.getSignalAvgPerChain()
probe_results['Signal Combined'] = probe_port.getSignalCombined()
@@ -347,6 +347,7 @@ class L3CXProfile(LFCliBase):
probe_df_initial.columns = ['probe ' + x for x in probe_df_initial.columns]
probe_df_initial['alias'] = station.split('.')[-1]
probe_port_df_list.append(probe_df_initial)
if len(probe_port_df_list) > 0:
probe_port_df = pd.concat(probe_port_df_list)
timestamp_df = pd.merge(timestamp_df, probe_port_df, on='alias')
timestamp_df['Timestamp'] = timestamp
@@ -355,9 +356,13 @@ class L3CXProfile(LFCliBase):
timestamp_df['Duration elapsed'] = time_elapsed
timestamp_data.append(timestamp_df)
time.sleep(monitor_interval_ms)
else:
logger.info("port probe dataframe list is empty.")
if len(timestamp_data) > 0:
df = pd.concat(timestamp_data)
df = df.drop('alias', axis=1)
df.to_csv(str(report_file), index=False)
logger.critical("No csv generated. Check test input configuration (ssid, ssid-passwd, did stations get ip?)")
# comparison to last report / report inputted
if compared_report: