Skip to content

Commit 489a1ef

Browse files
authored
Updated LLDP startup configuration for multi-asic (sonic-net#15440)
What I did: Changes in LLDP Configuration to handle this: Enable LLDP only on front panel interfaces. Why I did: This is done to free up CPU cycle as we don't see use for that in multi-asic and also for Chassis we have disable lldp docker on supervisor so there is no lldp peering even if send LLDP BPDU on backplane ports For multi-asic do not generate lldpd.conf with eth0 related configuration Why I did: In namespace lldp docker there is no need to generate eth0 configuration. It gives not needed errror message as seen here sonic-net#15382 How I did it: Instead of relying on DEVICE_METADTA sub_role we are using NAMESPACE_ID environmental variable (passed to all docker instance) which will be > 0 for multiasic docker instance and not define for global/host docker instance. --------- Signed-off-by: Abhishek Dosi <abdosi@microsoft.com>
1 parent 7a26fd7 commit 489a1ef

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
22
#Generate supervisord.conf based on device metadata
33
mkdir -p /etc/supervisor/conf.d/
4-
sonic-cfggen -d -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
4+
sonic-cfggen -d -a "{\"namespace_id\":\"$NAMESPACE_ID\"}" -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
55
exec /usr/local/bin/supervisord

dockers/docker-lldp/lldpd.conf.j2

+2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
{% endfor %}
99
{% endif %}
1010
{% if mgmt_if %}
11+
{% if not (namespace_id is defined and namespace_id|length) %}
1112
{# If MGMT port alias is available, use it for port ID subtype, otherwise use port name #}
1213
{% if MGMT_PORT and MGMT_PORT[mgmt_if.port_name] and MGMT_PORT[mgmt_if.port_name].alias %}
1314
configure ports eth0 lldp portidsubtype local {{ MGMT_PORT[mgmt_if.port_name].alias }}
1415
{% else %}
1516
configure ports eth0 lldp portidsubtype local {{ mgmt_if.port_name }}
1617
{% endif %}
18+
{% endif %}
1719
configure system ip management pattern {{ mgmt_if.ipv4 }}
1820
{% endif %}
1921
configure system hostname {{ DEVICE_METADATA['localhost']['hostname'] }}

dockers/docker-lldp/lldpmgrd

+3-5
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ try:
2222

2323
from sonic_py_common import daemon_base
2424
from swsscommon import swsscommon
25-
from sonic_py_common.interface import inband_prefix, recirc_prefix
25+
from sonic_py_common.interface import inband_prefix, recirc_prefix, backplane_prefix
2626
from sonic_py_common import device_info
27-
2827
except ImportError as err:
2928
raise ImportError("%s - required module not found" % str(err))
3029

@@ -138,9 +137,8 @@ class LldpManager(daemon_base.DaemonBase):
138137
"""
139138
port_desc = None
140139

141-
# Skip recirc and inband interface prefixes. These are recycle ports exposed in PORT_TABLE for
142-
# asic-to-asic communication in VOQ based chassis system. We do not configure LLDP on these.
143-
if port_name.startswith(inband_prefix()) or port_name.startswith(recirc_prefix()):
140+
# Skip special (recirc/inband) and backplane interfaces as we don't enable lldp on those interfaaces.
141+
if any([port_name.startswith(inband_prefix()),port_name.startswith(recirc_prefix()),port_name.startswith(backplane_prefix())]):
144142
return
145143

146144
# Get the port alias. If None or empty string, use port name instead

dockers/docker-lldp/start.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env bash
22
CFGGEN_PARAMS=" \
33
-d \
4+
-a "{\"namespace_id\":\"$NAMESPACE_ID\"}" \
45
-t /usr/share/sonic/templates/lldpd.conf.j2 \
56
-y /etc/sonic/sonic_version.yml \
67
-t /usr/share/sonic/templates/lldpdSysDescr.conf.j2 \

dockers/docker-lldp/supervisord.conf.j2

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ dependent_startup_wait_for=rsyslogd:running
4545
# - `-dd` means to stay in foreground, log warnings to console
4646
# - `-ddd` means to stay in foreground, log warnings and info to console
4747
# - `-dddd` means to stay in foreground, log all to console
48-
{% if DEVICE_METADATA['localhost']['sub_role'] is defined and DEVICE_METADATA['localhost']['sub_role']|length %}
49-
command=/usr/sbin/lldpd -d -I Ethernet* -C Ethernet*
48+
{% if namespace_id is defined and namespace_id|length %}
49+
command=/usr/sbin/lldpd -d -I Ethernet[0-9]* -C Ethernet[0-9]*
5050
{% else %}
51-
command=/usr/sbin/lldpd -d -I Ethernet*,eth0 -C eth0
51+
command=/usr/sbin/lldpd -d -I Ethernet[0-9]*,eth0 -C eth0
5252
{% endif %}
5353
priority=3
5454
autostart=false

0 commit comments

Comments
 (0)