Skip to content

Commit

Permalink
[lldpmgrd] Address the review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mlok-nokia committed Jun 8, 2023
1 parent 18031dd commit e126e37
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
11 changes: 1 addition & 10 deletions dockers/docker-lldp/lldpmgrd
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,6 @@ class LldpManager(daemon_base.DaemonBase):
elif key == "PortConfigDone":
self.port_config_done = True

def appdb_contains_lldp_port(self):
if device_info.is_supervisor():
return False
if device_info.is_multi_npu():
namespace_id = os.getenv("NAMESPACE_ID")
if not namespace_id:
return False
return True

def run(self):
"""
Subscribes to notifications of changes in the PORT table
Expand Down Expand Up @@ -368,7 +359,7 @@ def run_cmd(self, cmd):

def check_timeout(self, start_time):
if time.time() - start_time > PORT_INIT_TIMEOUT:
if self.appdb_contains_lldp_port():
if device_info.is_frontend_port_present_in_host():
self.log_error("Port init timeout reached ({} seconds), resuming lldpd...".format(PORT_INIT_TIMEOUT))
return True
return False
Expand Down
10 changes: 10 additions & 0 deletions src/sonic-py-common/sonic_py_common/device_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,3 +713,13 @@ def is_fast_reboot_enabled():

state_db.close(state_db.STATE_DB)
return fb_enable_state


def is_frontend_port_present_in_host():
if is_supervisor():
return False
if is_multi_npu():
namespace_id = os.getenv("NAMESPACE_ID")
if not namespace_id:
return False
return True

0 comments on commit e126e37

Please sign in to comment.