Skip to content

Commit

Permalink
4099606: PDR plugin: Traceback: AttributeError: 'dict' object has no …
Browse files Browse the repository at this point in the history
…attribute 'active_speed' (#266)
  • Loading branch information
vg12345 authored Oct 1, 2024
1 parent f3cdeac commit 0d3efc7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,19 @@ def _remove_files(self, files: list) -> None:
:param files: (List) List of files to be removed
:return: None
"""
self.logger.info(f"removing {len(files)} old files")
self.logger.info(f"Removing {len(files)} old files")
for file in files:
try:
if exists(file):
remove(file)
except FileNotFoundError:
pass
except OSError as exc:
self.logger.error("failed to remove file %s [%s]", file, exc)
self.logger.error("Failed to remove file %s [%s]", file, exc)

def save(self, dataframe:pd.DataFrame, file_name:str) -> None:
"""
save dataframe to the file name
"""
self.logger.info(f"saving data to {file_name}")
self.logger.info(f"Saving data to {file_name}")
dataframe.to_csv(file_name)
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def update_ports_data(self):
for port in meta_data:
port_name = port.get(Constants.PORT_NAME)
if not self.ports_data.get(port_name):
self.ports_data[port_name] = {}
self.ports_data[port_name] = PortData(port_name)
self.update_port_metadata(port_name, port)
ports_updated = True
return ports_updated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,13 @@ def check_link_down_issue(self, port_obj, row, timestamp, ports_counters):
return None
peer_link_downed_rate = self.get_rate(peer_obj, Constants.LNK_DOWNED_COUNTER, peer_link_downed, peer_row_timestamp)
if peer_link_downed_rate > 0:
self.logger.info(f"Isolation issue ({Constants.ISSUE_LINK_DOWN}) detected for port {port_obj.port_name}: "
f"link down counter raised from {old_link_downed} to {link_downed} "
f"and its peer ({port_obj.peer}) link down rate is {peer_link_downed_rate}")
info_msg = ""
if link_downed == old_link_downed:
info_msg += f"link down counter is {link_downed} with link down rate {link_downed_rate} "
else:
info_msg += f"link down counter raised from {old_link_downed} to {link_downed} "
info_msg += f"and its peer ({port_obj.peer}) link down rate is {peer_link_downed_rate}"
self.logger.info(f"Isolation issue ({Constants.ISSUE_LINK_DOWN}) detected for port {port_obj.port_name}: {info_msg}")
return Issue(port_obj.port_name, Constants.ISSUE_LINK_DOWN)
return None

Expand Down

0 comments on commit 0d3efc7

Please sign in to comment.