Skip to content

Commit

Permalink
better solution for STATIC_ROUTE_EXPIRY_TIME check (sonic-net#12824)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcaiMR authored and yxieca committed Nov 28, 2022
1 parent 4c44e4e commit 80837d4
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/sonic-bgpcfgd/bgpcfgd/static_rt_timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@ def __init__(self):
MAX_TIMER = 1800

def set_timer(self):
""" Check for custom route expiry time in STATIC_ROUTE:EXPIRY_TIME """
keys = self.db.keys(self.db.APPL_DB, "STATIC_ROUTE_EXPIRY_TIME")
if len(keys) == 0:
return
""" Check for custom route expiry time in STATIC_ROUTE_EXPIRY_TIME """
timer = self.db.get(self.db.APPL_DB, "STATIC_ROUTE_EXPIRY_TIME", "time")
if timer is not None:
timer = int(timer)
if timer > 0 and timer <= self.MAX_TIMER:
self.timer = timer
return
log_err("Custom static route expiry time of {}s is invalid!".format(timer))
if timer.isdigit():
timer = int(timer)
if timer > 0 and timer <= self.MAX_TIMER:
self.timer = timer
return
log_err("Custom static route expiry time of {}s is invalid!".format(timer))
return

def alarm(self):
Expand Down

0 comments on commit 80837d4

Please sign in to comment.