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

[chassis][lldp] Fix the lldp error log in host instance which doesn't contain front panel ports #14814

Merged
merged 2 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion dockers/docker-lldp/lldpmgrd
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ try:
from sonic_py_common import daemon_base
from swsscommon import swsscommon
from sonic_py_common.interface import inband_prefix, recirc_prefix
from sonic_py_common import device_info

except ImportError as err:
raise ImportError("%s - required module not found" % str(err))

Expand Down Expand Up @@ -357,7 +359,8 @@ def run_cmd(self, cmd):

def check_timeout(self, start_time):
if time.time() - start_time > PORT_INIT_TIMEOUT:
self.log_error("Port init timeout reached ({} seconds), resuming lldpd...".format(PORT_INIT_TIMEOUT))
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
Loading