Skip to content

Commit

Permalink
fixup! Use enums instead of literals for comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
johannaengland committed Jul 23, 2024
1 parent feb76e8 commit 0d0ff96
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/zino/tasks/bgpstatemonitortask.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def _update_established_peer(self, data: BaseBGPRow, uptime: int):

def _update_nonestablished_peer(self, data: BaseBGPRow, uptime: int):
saved_bgp_peer_session = self.device_state.bgp_peers.get(data.peer_remote_address)
if data.peer_admin_status in ["stop", "halted"]:
if data.peer_admin_status in [BGPAdminStatus.STOP, BGPAdminStatus.HALTED]:
if not saved_bgp_peer_session or saved_bgp_peer_session.admin_status != data.peer_admin_status:
self._bgp_admin_down(data)
_logger.debug(
Expand All @@ -286,7 +286,7 @@ def _update_peer_with_admin_status_start_or_running(
):
if not saved_bgp_peer_session or saved_bgp_peer_session.admin_status != data.peer_admin_status:
self._bgp_admin_up(data)
if not saved_bgp_peer_session or saved_bgp_peer_session.oper_state == "established":
if not saved_bgp_peer_session or saved_bgp_peer_session.oper_state == BGPOperState.ESTABLISHED:
# First verify that we've been up longer than the required time before we flag it as an alert
if uptime > TIME_BEFORE_OPER_DOWN_ALERT:
self._bgp_oper_down(data)
Expand Down

0 comments on commit 0d0ff96

Please sign in to comment.