mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-19 09:53:34 -06:00
Sanitize hostname and port values returned through LLDP
If hostname or port are null set to empty string (""). This avoids breaking the LLDP neighbors (NAPALM) view
This commit is contained in:
parent
841db3b0c2
commit
1daf7f8e2b
@ -64,8 +64,10 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clean up hostnames/interfaces learned via LLDP
|
// Clean up hostnames/interfaces learned via LLDP
|
||||||
var lldp_device = neighbor['hostname'].split(".")[0]; // Strip off any trailing domain name
|
var neighbor_host = neighbor['hostname'] || ""; // sanitize hostname if it's null to avoid breaking the split func
|
||||||
var lldp_interface = neighbor['port'].split(".")[0]; // Strip off any trailing subinterface ID
|
var neighbor_port = neighbor['port'] || ""; // sanitize port if it's null to avoid breaking the split func
|
||||||
|
var lldp_device = neighbor_host.split(".")[0]; // Strip off any trailing domain name
|
||||||
|
var lldp_interface = neighbor_port.split(".")[0]; // Strip off any trailing subinterface ID
|
||||||
|
|
||||||
// Add LLDP neighbors to table
|
// Add LLDP neighbors to table
|
||||||
row.children('td.device').html(lldp_device);
|
row.children('td.device').html(lldp_device);
|
||||||
|
Loading…
Reference in New Issue
Block a user