Skip to content

Commit

Permalink
[lldpmgrd] Fix lldpmgrd issue where it sets the lldp system name to None
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
zhenggen-xu committed Aug 31, 2022
1 parent 1e75abc commit a63cb16
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions dockers/docker-lldp/lldpmgrd
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,13 @@ class LldpManager(daemon_base.DaemonBase):
if not op in ["SET", "DEL"]:
return
self.log_info("Device Config Opcode: {} Dict {} Key {}".format(op, device_dict, key))
hostname = device_dict.get("hostname")
if not self.hostname == hostname:
self.log_info("Hostname changed old {0}, new {1}".format(self.hostname, hostname))
self.update_hostname(hostname)
# only check hostname in key:localhost
if key == "localhost":
hostname = device_dict.get("hostname")
# check hostname is valid and not the same as before
if hostname and not self.hostname == hostname:
self.log_info("Hostname changed old {0}, new {1}".format(self.hostname, hostname))
self.update_hostname(hostname)

def lldp_process_port_table_event(self, key, op, fvp):
if (key != "PortInitDone") and (key != "PortConfigDone"):
Expand Down

0 comments on commit a63cb16

Please sign in to comment.