Normalize lldp devices (hostnames) in "LLDP Neighbors" Tab #1486

Closed
opened 2025-12-29 16:32:25 +01:00 by adam · 5 comments
Owner

Originally created by @tom-myny on GitHub (Jan 7, 2018).

Issue type
[X] Feature request

Environment
NetBox version: 2.2.8
Description
Currently, the "LLDP Neighbors" tab represents lldp devices in a shorter name then given.

Example:
A juniper switch configured as:
system {
host-name spine1.bru-hdc.be;
domain-name tigron.net;
...

Will be represented in netbox as 'spine0'.

This is not correct, juniper gives the following information to NAPALM:

root@spine0.bru-hdc.be> show lldp neighbors
Local Interface Parent Interface Chassis Id Port info System Name
et-0/1/1 ae0 xx:xx:xx:xx:xx:xx et-0/1/0 spine1.bru-hdc.be
et-0/1/0 ae0 xx:xx:xx:xx:xx:xx et-0/1/1 spine1.bru-hdc.be

NAPALM will give the following information to netbox:

{ "get_lldp_neighbors": { "et-0/1/1": [ { "hostname": "spine1.bru-hdc.be", "port": "et-0/1/0" } ], "et-0/1/0": [ { "hostname": "spine1.bru-hdc.be", "port": "et-0/1/1" } ] } }

However, netbox will return only spine1, resulting in a red (incorrect) field.

Originally created by @tom-myny on GitHub (Jan 7, 2018). Issue type [X] Feature request Environment NetBox version: 2.2.8 Description Currently, the "LLDP Neighbors" tab represents lldp devices in a shorter name then given. Example: A juniper switch configured as: system { host-name spine1.bru-hdc.be; domain-name tigron.net; ... Will be represented in netbox as 'spine0'. This is not correct, juniper gives the following information to NAPALM: root@spine0.bru-hdc.be> show lldp neighbors Local Interface Parent Interface Chassis Id Port info System Name et-0/1/1 ae0 xx:xx:xx:xx:xx:xx et-0/1/0 spine1.bru-hdc.be et-0/1/0 ae0 xx:xx:xx:xx:xx:xx et-0/1/1 spine1.bru-hdc.be NAPALM will give the following information to netbox: ` { "get_lldp_neighbors": { "et-0/1/1": [ { "hostname": "spine1.bru-hdc.be", "port": "et-0/1/0" } ], "et-0/1/0": [ { "hostname": "spine1.bru-hdc.be", "port": "et-0/1/1" } ] } } ` However, netbox will return only spine1, resulting in a red (incorrect) field.
adam closed this issue 2025-12-29 16:32:25 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 10, 2018):

IIRC NetBox strips off anything after a period in the hostname because some platforms will return a FQDN (e.g. router01.example.com):

var lldp_device = neighbor['hostname'].split(".")[0];  // Strip off any trailing domain name

However, I can't find any documentation of this change. It's also possible that the observed behavior has since been changed in the affected NAPALM driver(s). I'm ok with removing the alteration and seeing if anyone else complains. (If so, we can evaluate how best to satisfy both cases.)

@jeremystretch commented on GitHub (Jan 10, 2018): IIRC NetBox strips off anything after a period in the hostname because some platforms will return a FQDN (e.g. router01.example.com): ``` var lldp_device = neighbor['hostname'].split(".")[0]; // Strip off any trailing domain name ``` However, I can't find any documentation of this change. It's also possible that the observed behavior has since been changed in the affected NAPALM driver(s). I'm ok with removing the alteration and seeing if anyone else complains. (If so, we can evaluate how best to satisfy both cases.)
Author
Owner

@tom-myny commented on GitHub (Jan 12, 2018):

I agree with this new behavior :)

@tom-myny commented on GitHub (Jan 12, 2018): I agree with this new behavior :)
Author
Owner

@jeremystretch commented on GitHub (Feb 1, 2018):

Testing suggests that many devices return their FQDN rather than just their hostname. To avoid breaking these, the current approach to stripping the domain name will stay in place.

@jeremystretch commented on GitHub (Feb 1, 2018): Testing suggests that many devices return their FQDN rather than just their hostname. To avoid breaking these, the current approach to stripping the domain name will stay in place.
Author
Owner

@jkrauska commented on GitHub (Feb 20, 2018):

I have a middle use case, where I want the final domain name stripped, but NOT the sub domain.

eg. I WANT
storage1.iad1
to differentiate from
storage1.iad2

but I don't want the trailing example.com

How about making a configuration field of what domain(s) we'd like to strip?

@jkrauska commented on GitHub (Feb 20, 2018): I have a middle use case, where I want the final domain name stripped, but NOT the sub domain. eg. I WANT storage1.iad1 to differentiate from storage1.iad2 but I don't want the trailing example.com How about making a configuration field of what domain(s) we'd like to strip?
Author
Owner

@TvL2386 commented on GitHub (Feb 7, 2019):

I'm having this same issue.
Would it be a good idea to make this a configuration option at the Platform view?

Example: I create a Platform with napalm driver junos and disable "strip domain name".
This way there's a simple way to toggle this behaviour for sets of devices.

Kind regards!

@TvL2386 commented on GitHub (Feb 7, 2019): I'm having this same issue. Would it be a good idea to make this a configuration option at the Platform view? Example: I create a Platform with napalm driver junos and disable "strip domain name". This way there's a simple way to toggle this behaviour for sets of devices. Kind regards!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1486