From db30dcb7be1b9b8e3d1ad1098ae497429a47049d Mon Sep 17 00:00:00 2001 From: Vitaly Gavensky Date: Wed, 4 Sep 2024 14:57:51 +0300 Subject: [PATCH] Cosmetic changes after review --- .../ufm_sim_web_service/isolation_mgr.py | 4 ++-- .../ufm_sim_web_service/pdr_algorithm.py | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py index 5dec3fae..73e16bb4 100644 --- a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py +++ b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/isolation_mgr.py @@ -294,7 +294,7 @@ def main_flow(self): self.logger.error("Couldn't retrieve telemetry data") else: # Detect ports to be isolated or deisolated - issues = pdr_alg.read_next_set_of_high_ber_or_pdr_ports(self.ports_data, ports_counters) + issues = pdr_alg.analyze_telemetry_data(self.ports_data, ports_counters) except (KeyError,) as e: self.logger.error(f"Failed to read information with error {e}") @@ -316,7 +316,7 @@ def main_flow(self): # deisolate ports if self.do_deisolate: for port_state in list(self.ports_states.values()): - if pdr_alg.should_deisolate(port_state): + if pdr_alg.check_deisolation_conditions(port_state): self.eval_deisolate(port_state.name) ports_updated = self.update_ports_data() if ports_updated: diff --git a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/pdr_algorithm.py b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/pdr_algorithm.py index 55c6e56b..11fe7ddb 100644 --- a/plugins/pdr_deterministic_plugin/ufm_sim_web_service/pdr_algorithm.py +++ b/plugins/pdr_deterministic_plugin/ufm_sim_web_service/pdr_algorithm.py @@ -403,11 +403,11 @@ def check_ber_issue(self, port_obj, row, timestamp): return Issue(port_obj.port_name, Constants.ISSUE_BER) return None - def read_next_set_of_high_ber_or_pdr_ports(self, ports_data, ports_counters): + def analyze_telemetry_data(self, ports_data, ports_counters): """ Read the next set of ports and check if they have high BER, PDR, temperature or link downed issues Receives: detected ports, isolated ports and telemetry data - Returns: lists of isolation issues + Returns: lists of isolation candidates """ self.ports_data = ports_data @@ -448,8 +448,10 @@ def read_next_set_of_high_ber_or_pdr_ports(self, ports_data, ports_counters): issues[port_name] = Constants.ISSUE_OONOC return list(issues.values()) - def should_deisolate(self, port_state): + def check_deisolation_conditions(self, port_state): """ + Check if given port should be deisolated + Function doesn't perform deisolation itself, just checks deisolation conditions only Return True if given port should be deisolated """ state = port_state.get_state()