Fixing lldp issue displaying mac-addr instead of ports#1515
Merged
jleveque merged 1 commit intosonic-net:masterfrom Mar 20, 2018
Merged
Fixing lldp issue displaying mac-addr instead of ports#1515jleveque merged 1 commit intosonic-net:masterfrom
jleveque merged 1 commit intosonic-net:masterfrom
Conversation
Current lldp.conf.j2 template demands the presence of MGMT_INTERFACE attribute in configDB, and by extension, also in config_db.json file. However, MGMT_INTERFACE configuration attribute is optional, so lldp shouldn't bail out if this one isn't provided in configuration.
For this reason, no lldp.conf file is ever created in lldp's container, and lldpd defaults to advertise the mac-address of the connected interface, instead of the interface name.
The fix is to simply relax this jinja2 statement to verify if MGMT_INTERFACE attribute is present.
<-- Before
root@lnos-x1-a-asw02:/# sonic-cfggen -d -t /usr/share/sonic/templates/lldpd.conf.j2 > /etc/lldpd.conf
Traceback (most recent call last):
File "/usr/local/bin/sonic-cfggen", line 223, in <module>
main()
File "/usr/local/bin/sonic-cfggen", line 204, in main
print template.render(data)
File
"/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line
1008,
in render return self.environment.handle_exception(exc_info, True)
File
"/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 780, in handle_exception reraise(exc_type, exc_value, tb)
File "/usr/share/sonic/templates/lldpd.conf.j2", line 1, in top-level template code
{% if MGMT_INTERFACE.keys() %}
File
"/usr/local/lib/python2.7/dist-packages/jinja2/environment.py",
line 430, in getattr return getattr(obj, attribute) jinja2.exceptions.UndefinedError: 'MGMT_INTERFACE' is undefined
admin@lnos-x1-a-csw01:~$ show lldp table
Command: sudo lldpshow
Capability codes: (R) Router, (B) Bridge, (O) Other
LocalPort RemoteDevice RemotePortID Capability RemotePortDescr
----------- --------------- ----------------- -----------------------------
Ethernet4 lnos-x1-a-asw02 00:e0:ec:3c:0a:16 BR Ethernet112
--------------------------------------------------
<-- After
root@lnos-x1-a-asw02:/# sonic-cfggen -d -t /usr/share/sonic/templates/lldpd.conf.j2
...
configure ports Ethernet112 lldp portidsubtype local Eth29/1 description lnos-x1-a-csw01:Ethernet1
admin@lnos-x1-a-csw01:~$ show lldp table
Command: sudo lldpshow
Capability codes: (R) Router, (B) Bridge, (O) Other
LocalPort RemoteDevice RemotePortID Capability RemotePortDescr
----------- --------------- ----------------- -------------------------------------
Ethernet4 lnos-x1-a-asw02 Eth29/1 BR lnos-x1-a-csw01:Ethernet1
--------------------------------------------------
RB=
G=lnos-reviewers
R=ntrianta,pmao,rmolina,sfardeen,zxu
A=
lguohan
approved these changes
Mar 20, 2018
jleveque
approved these changes
Mar 20, 2018
yxieca
added a commit
to yxieca/sonic-buildimage
that referenced
this pull request
Apr 19, 2021
* 72510da 2021-04-19 | [201811] Stop PMON docker before cold boot and soft reboot (sonic-net#1515) (HEAD -> 201811, github/201811) [Aravind Mani] Signed-off-by: Ying Xie <ying.xie@microsoft.com>
yxieca
added a commit
that referenced
this pull request
Apr 20, 2021
* 72510da 2021-04-19 | [201811] Stop PMON docker before cold boot and soft reboot (#1515) (HEAD -> 201811, github/201811) [Aravind Mani] Signed-off-by: Ying Xie <ying.xie@microsoft.com>
theasianpianist
pushed a commit
to theasianpianist/sonic-buildimage
that referenced
this pull request
Feb 5, 2022
…c-net#1515) Signed-off-by: Vasant <vapatil@linkedin.com> Co-authored-by: Danny Allen <daall@microsoft.com>
tshalvi
pushed a commit
to tshalvi/sonic-buildimage
that referenced
this pull request
Aug 25, 2025
…1515) <!-- Please make sure you've read and understood our contributing guidelines: https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md ** Make sure all your commits include a signature generated with `git commit -s` ** If this is a bug fix, make sure your description includes "fixes #xxxx", or "closes #xxxx" or "resolves #xxxx" Please provide the following information: --> #### Why I did it - Add heartbeat ping from linecard to supervisor - Allow changing target temperature of xcvrs through config - pali: migrate to common minke implementation - onie: change simulation detection logic - systemd: Start platform-arista-swss service after rc-local - denali: fix psu input/output status gpio inversion - cli: Add PCIe debug read/write commands - build wheel package for our platform library - cpu: provide common getPciPort implementation - cleanup: remove deprecated eeprom module - psu: skip autodetection on forced model - cpu: implement proper powercycle on Cormorant - Modify LC reboot cause on ungraceful supervisor reboot - sku: refactor QuicksilverP512 code - quicksilver: update psu led and scm to use arista daemon - quartz: Add syscpld and scd members to QuartzDd platform - quartz: add leds to cpu cpld instead of switch scd - tools: fix dynamic loading of platforms - cooling: improve cooling algorithm stability - drivers: allow build to go through up to 6.12 kernel - psu: remove FlexBmr313 from auto-detect - Add support for PCA954x - cli: sort ports in show platform xcvr - upperlake: avoid SEU trigger reboot - Improve LC reboot cause when chassis is powercycled - i2c: add send_byte, recv_byte and io logging - quicksilver: update TH5 core values - psu: avoid reporting leakage current of PSU in platform API - Ensure powercycle available without setup - moby: add support for cartridge get presence ##### Work item tracking - Microsoft ADO **(number only)**: #### How I did it #### How to verify it <!-- If PR needs to be backported, then the PR must be tested against the base branch and the earliest backport release branch and provide tested image version on these two branches. For example, if the PR is requested for master, 202211 and 202012, then the requester needs to provide test results on master and 202012. --> #### Which release branch to backport (provide reason below if selected) <!-- - Note we only backport fixes to a release branch, *not* features! - Please also provide a reason for the backporting below. - e.g. - [x] 202006 --> - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 - [ ] 202111 - [ ] 202205 - [ ] 202211 #### Tested branch (Please provide the tested image version) <!-- - Please provide tested image version - e.g. - [x] 20201231.100 --> - [ ] <!-- image version 1 --> - [ ] <!-- image version 2 --> #### Description for the changelog <!-- Write a short (one line) summary that describes the changes in this pull request for inclusion in the changelog: --> <!-- Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU. --> #### Link to config_db schema for YANG module changes <!-- Provide a link to config_db schema for the table for which YANG model is defined Link should point to correct section on https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md --> #### A picture of a cute animal (not mandatory but encouraged)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current lldp.conf.j2 template demands the presence of MGMT_INTERFACE attribute in configDB, and by extension, also in config_db.json file. However, MGMT_INTERFACE configuration attribute is optional, so lldp shouldn't bail out if this one isn't provided in configuration.
For this reason, no lldp.conf file is ever created in lldp container in scenarios where MGMT_INTERFACE is not defined, and lldpd defaults to advertise the mac-address of the connected interface, instead of the interface name.
The fix is to simply relax this jinja2 statement to verify if MGMT_INTERFACE attribute is present.
<-- Before
root@lnos-x1-a-asw02:/# sonic-cfggen -d -t /usr/share/sonic/templates/lldpd.conf.j2 > /etc/lldpd.conf
Traceback (most recent call last):
File "/usr/local/bin/sonic-cfggen", line 223, in
main()
File "/usr/local/bin/sonic-cfggen", line 204, in main
print template.render(data)
File
"/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line
1008,
in render return self.environment.handle_exception(exc_info, True)
File
"/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 780, in handle_exception reraise(exc_type, exc_value, tb)
File "/usr/share/sonic/templates/lldpd.conf.j2", line 1, in top-level template code
{% if MGMT_INTERFACE.keys() %}
File
"/usr/local/lib/python2.7/dist-packages/jinja2/environment.py",
line 430, in getattr return getattr(obj, attribute) jinja2.exceptions.UndefinedError: 'MGMT_INTERFACE' is undefined
<-- After