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

better solution for STATIC_ROUTE_EXPIRY_TIME check #12824

Merged
merged 1 commit into from
Nov 25, 2022
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
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