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

Fix bug for #34 and add func get_lldp_neighbors_detail() #40

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

Conversation

owochen
Copy link

@owochen owochen commented Oct 15, 2024

Fix bug for #34
Add feature get_lldp_neighbors_detail() for #38

@humbertogaliza
Copy link
Collaborator

@owochen thanks for the bug/fix + feat! Do you mind adding a unit test as well? Cheers!

@mathieumd
Copy link

Thanks @owochen!

It's working, my NetBox's LLDP Neighbors tab finally has values in LLDP Device and LLDP Interface.

However, it looks like it's not retrieving all neighbors. For example, on XGE0/0/3 I have 6 hosts shown by display lldp neighbor (see below, 1 physical and 5 VMs), but I only get a single one in the table (the last one, a VM).
(BTW, looks like ESXi hosts -- on the first NIC below -- are not replying to LLDP, contrary to Proxmox PVE -- see the next sample)

XGigabitEthernet0/0/3 has 6 neighbor(s):

Neighbor index :1
Chassis type   :MAC address
Chassis ID     :d404-e66d-xxyy
Port ID type   :MAC address
Port ID        :d404-e66d-xxyy
Port description    :NIC 1/10Gb SFP+ DA
System name         :10Gb 2-port SFP+ BCM57412 Adapter fw_version:AFW_230.0.168.0
System description  :230.0.168.0 fw_version:AFW_230.0.168.0
System capabilities supported   :stationOnly
System capabilities enabled     :stationOnly
Management address type  :all802
Management address value :d404-e66d-xxyy
OID  :
Expired time   :118s



Neighbor index :2
Chassis type   :Locally assigned
Chassis ID     :VMware virtual machine (netbox01)
Port ID type   :MAC address
Port ID        :0050-568b-xyxy
Port description    :ens192
System name         :netbox01.example.com
System description  :Ubuntu 22.04.4 LTS Linux 5.15.0-122-generic #132-Ubuntu SMP Thu Aug 29 13:45:52 UTC 2024 x86_64
Management address type  :ipv4
Management address value :10.xy.xy.xy
OID  :
Management address type  :ipv6
Management address value :FE80::250:56FF:FE8B:xyxy
OID  :
Expired time   :101s


Auto-negotiation supported    :No
Auto-negotiation enabled      :No
OperMau   :speed(Unknown)/duplex(Unknown)

Link aggregation supported:Yes
Link aggregation enabled :No
Aggregation port ID      :0


Neighbor index :3
Chassis type   :Locally assigned
Chassis ID     :VMware virtual machine (gitlab-runner01)
Port ID type   :MAC address
Port ID        :0050-568b-xyyx
Port description    :ens33
System name         :gitlab-runner01.example.com
System description  :Ubuntu 22.04.3 LTS Linux 5.15.0-101-generic #111-Ubuntu SMP Tue Mar 5 20:16:58 UTC 2024 x86_64
Management address type  :ipv4
Management address value :10.xy.yx.yx
OID  :
Management address type  :ipv6
Management address value :FE80::250:56FF:FE8B:xyyx
OID  :
Expired time   :101s


Auto-negotiation supported    :No
Auto-negotiation enabled      :No
OperMau   :speed(Unknown)/duplex(Unknown)

Link aggregation supported:Yes
Link aggregation enabled :No
Aggregation port ID      :0


Neighbor index :4
Chassis type   :Locally assigned
Chassis ID     :VMware virtual machine (apt-proxy01)
Port ID type   :MAC address
Port ID        :0050-568b-yxyx
Port description    :ens192
System name         :apt-proxy01.example.com
System description  :Ubuntu 22.04.4 LTS Linux 5.15.0-122-generic #132-Ubuntu SMP Thu Aug 29 13:45:52 UTC 2024 x86_64
Management address type  :ipv4
Management address value :10.yx.yx.xx
OID  :
Management address type  :ipv6
Management address value :FE80::250:56FF:FE8B:xyxy
OID  :
Expired time   :101s


Auto-negotiation supported    :No
Auto-negotiation enabled      :No
OperMau   :speed(Unknown)/duplex(Unknown)

Link aggregation supported:Yes
Link aggregation enabled :No
Aggregation port ID      :0


Neighbor index :5
[...]

As another example, on XGE0/0/13 I have 2 hosts (both the same physical host), but only the last one is shown:

XGigabitEthernet0/0/13 has 2 neighbor(s):

Neighbor index :1
Chassis type   :MAC address
Chassis ID     :f403-43f8-xxxx
Port ID type   :MAC address
Port ID        :f403-43f8-xxxx
Port description    :NIC 1/10Gb SFP+ DA
System name         :HPE Eth 10Gb 2p 537SFP+ Adptr fw_version:AFW_230.0.168.0
System description  :SU 10G/1G GEN3 x8 14W fw_version:AFW_230.0.168.0
System capabilities supported   :stationOnly
System capabilities enabled     :stationOnly
Management address type  :all802
Management address value :f403-43f8-xxxx
OID  :
Expired time   :107s



Neighbor index :2
Chassis type   :MAC address
Chassis ID     :9440-c945-yyyy
Port ID type   :MAC address
Port ID        :f403-43f8-xxxx
Port description    :ens2f1np1
System name         :pve02.example.com
System description  :Debian GNU/Linux 12 (bookworm) Linux 6.8.12-2-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-2 (2024-09-05T10:03Z) x86_64
Management address type  :ipv4
Management address value :10.yy.yy.yy
OID  :
Management address type  :ipv6
Management address value :FE80::9640:C9FF:FE45:yyyy
OID  :
Expired time   :93s


Auto-negotiation supported    :Yes
Auto-negotiation enabled      :Yes
OperMau   :speed(Unknown)/duplex(Unknown)

Link aggregation supported:Yes
Link aggregation enabled :Yes
Aggregation port ID      :14

Is it the expected behavior?

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.

3 participants