From 3ac808107bf69e55697374758a1e092d8eb5137c Mon Sep 17 00:00:00 2001 From: Hanne Moa Date: Fri, 15 Mar 2024 08:51:20 +0100 Subject: [PATCH] Improve clear_flapping (#50) * Fix typo in clear_flapping * Let clear_flapping accept an event id --- src/zinolib/controllers/zino1.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/zinolib/controllers/zino1.py b/src/zinolib/controllers/zino1.py index e6a3d75..6d67022 100644 --- a/src/zinolib/controllers/zino1.py +++ b/src/zinolib/controllers/zino1.py @@ -69,7 +69,7 @@ from typing import Dict, Iterable, List, TypedDict, Optional, Set import logging -from .base import EventManager +from .base import EventManager, EventOrId from ..compat import StrEnum from ..event_types import EventType, Event, HistoryEntry, LogEntry, AdmState from ..event_types import PortStateEvent @@ -463,14 +463,15 @@ def disconnect(self): self._verify_session() self.session = self._session_adapter.close_session(self.session) - def clear_flapping(self, event: PortStateEvent): + def clear_flapping(self, event_or_id: EventOrId): """Clear flapping state of a PortStateEvent Usage: c = ritz_session.case(123) c.clear_flapping() """ - if event.type == Event.Type.PortState: + event = self._get_event(event_or_id) + if event.type == Event.Type.PORTSTATE: return self.session.request.clear_flapping(event.router, event.if_index) return None