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

[lldpmgrd] Fix lldpmgrd issue where it sets the lldp system name to None #11907

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

zhenggen-xu
Copy link
Collaborator

@zhenggen-xu zhenggen-xu commented Aug 31, 2022

[lldpmgrd] Fix lldpmgrd issue where it sets the lldp system name to None

  • Only check hostname field in key DEVICE_METADATA|localhost of configDB
  • If hostname does not exist, don't set lldp system name

Signed-off-by: Zhenggen Xu zxu@linkedin.com

Why I did it

lldpmgrd could set the system name to None incorrectly, which lead to peer to have wrong lldp information.

How I did it

Fix the lldpmgrd.

How to verify it

Before fix:
If loading below config:

{
    "DEVICE_METADATA": {
        "localhost": {
            "bgp_asn": "65100",
            "docker_routing_config_mode": "split",
            "hostname": "sonic-1",
            "hwsku": "Seastone-DX010",
            "mac": "00:e0:ec:3c:0a:16",
            "platform": "x86_64-cel_seastone-r0",
            "type": "LeafRouter"
        },
        "x509": {
            "ca_crt": "/etc/sonic/telemetry/dsmsroot.cer",
            "server_crt": "/etc/sonic/telemetry/streamingtelemetryserver.cer",
            "server_key": "/etc/sonic/telemetry/streamingtelemetryserver.key"
        }
    }
} 

lldp will set the system name to None, see syslog:

Aug 31 05:06:11.172655 lnos-x1-a-asw02 INFO lldp#lldpmgrd[32]: Device Config Opcode: SET Dict {'docker_routing_config_mode': 'split', 'hwsku': 'Seastone-DX010', 'mac': '00:e0:ec:3c:0a:16', 'platform': 'x86_64-cel_seastone-r0', 'bgp_asn': '65100', 'buffer_model': 'traditional', 'default_bgp_status': 'up', 'default_pfcwd_status': 'disable', 'hostname': 'sonic-1', 'type': 'LeafRouter'} Key localhost
Aug 31 05:06:11.172802 lnos-x1-a-asw02 INFO lldp#lldpmgrd[32]: Hostname changed old None, new sonic-1
Aug 31 05:06:11.192924 lnos-x1-a-asw02 INFO lldp#lldpmgrd[32]: Device Config Opcode: SET Dict {'ca_crt': '/etc/sonic/telemetry/dsmsroot.cer', 'server_crt': '/etc/sonic/telemetry/streamingtelemetryserver.cer', 'server_key': '/etc/sonic/telemetry/streamingtelemetryserver.key'} Key x509
Aug 31 05:06:11.192924 lnos-x1-a-asw02 INFO lldp#lldpmgrd[32]: Hostname changed old sonic-1, new None 
admin@lnos-x1-a-asw02:~$ sudo lldpcli show chassis | grep SysName
  SysName:      None

After the fix, if loading the same config:

Aug 31 05:53:38.686509 lnos-x1-a-asw02 INFO lldp#lldpmgrd[35]: Device Config Opcode: SET Dict {'docker_routing_config_mode': 'split', 'hwsku': 'Seastone-DX010', 'mac': '00:e0:ec:3c:0a:16', 'platform': 'x86_64-cel_seastone-r0', 'bgp_asn': '65100', 'buffer_model': 'traditional', 'default_bgp_status': 'up', 'default_pfcwd_status': 'disable', 'hostname': 'sonic-1', 'type': 'LeafRouter'} Key localhost
Aug 31 05:53:38.686509 lnos-x1-a-asw02 INFO lldp#lldpmgrd[35]: Hostname changed old None, new sonic-1
Aug 31 05:53:38.706948 lnos-x1-a-asw02 INFO lldp#lldpmgrd[35]: Device Config Opcode: SET Dict {'ca_crt': '/etc/sonic/telemetry/dsmsroot.cer', 'server_crt': '/etc/sonic/telemetry/streamingtelemetryserver.cer', 'server_key': '/etc/sonic/telemetry/streamingtelemetryserver.key'} Key x509
admin@lnos-x1-a-asw02:~$ sudo lldpcli show chassis | grep SysName
  SysName:      sonic-1
  

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

- Only check hostname field in key DEVICE_METADATA|localhost of configDB
- If hostname does not exist, don't set lldp system name

Signed-off-by: Zhenggen Xu <zxu@linkedin.com>
@zhenggen-xu zhenggen-xu requested a review from lguohan as a code owner August 31, 2022 05:46
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Aug 31, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@qiluo-msft qiluo-msft requested a review from abdosi August 31, 2022 20:30
Signed-off-by: Zhenggen Xu <zxu@linkedin.com>
@zhenggen-xu
Copy link
Collaborator Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list.

@zhenggen-xu
Copy link
Collaborator Author

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@zhenggen-xu
Copy link
Collaborator Author

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@abdosi abdosi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add UT

@yejianquan
Copy link
Contributor

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants