Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max isolation number #249

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def eval_deisolate(self, port_name):

self.logger.info(f"Evaluating deisolation of port {port_name}")
if not port_name in self.ufm_latest_isolation_state and not self.dry_run:
if self.isolated_ports.get(port_name):
if port_name in self.isolated_ports:
self.isolated_ports.pop(port_name)
return

Expand Down Expand Up @@ -286,30 +286,32 @@ def main_flow(self):
except (KeyError, TypeError, ValueError) as exception_error:
self.logger.error(f"failed to read information with error {exception_error}")

if issues:
if len(issues) > self.max_num_isolate:
# UFM send external event
event_msg = f"got too many ports detected as unhealthy: {len(issues)}, skipping isolation"
# deal with reported new issues
for issue in issues or []:
# ensure we are not ecxeeding allowed number of isolated ports
if len(self.isolated_ports) >= self.max_num_isolate:
# UFM send external event and break
event_msg = ("Reached muximum allowed number of isolated ports "
f"({len(self.isolated_ports)}), skipping isolation")
self.logger.warning(event_msg)
if not self.test_mode:
self.ufm_client.send_event(event_msg, event_id=Constants.EXTERNAL_EVENT_ALERT,
external_event_name="Skipping isolation")

# deal with reported new issues
else:
for issue in issues:
port = issue.port
cause = issue.cause # ber|pdr|oonoc|link_down
self.eval_isolation(port, cause)

# deisolate ports
if self.do_deisolate:
for isolated_port in list(self.isolated_ports.values()):
if self.pdr_alg.check_deisolation_conditions(isolated_port):
self.eval_deisolate(isolated_port.name)
ports_updated = self.update_ports_data()
if ports_updated:
self.update_telemetry_session()
break

# isolate port
port = issue.port
cause = issue.cause # ber|pdr|oonoc|link_down
self.eval_isolation(port, cause)

# deisolate ports
if self.do_deisolate:
for isolated_port in list(self.isolated_ports.values()):
if self.pdr_alg.check_deisolation_conditions(isolated_port):
self.eval_deisolate(isolated_port.name)
ports_updated = self.update_ports_data()
if ports_updated:
self.update_telemetry_session()
t_end = time.time()
#pylint: disable=broad-except
except Exception as exception:
Expand Down