06-13-2025, 01:39 PM
Hello me again
The green answer is wrong because the actual code does:
u2.append(u101)
Which appends the entire list of fields [Device-ID, Local-Intf, Hold-time, Capability, Port-ID]
for each LLDP neighbor—not just the first element (hostname).
To make the script produce only the hostname I believe you would change that line to:
u2.append(u101[0])
u101[0] is the first element of that list—the Device ID or hostname.
I'm still quite new to this subject so if I'm wrong, forgive me but I think the logic I mentioned has some truth to it.
Thanks

The green answer is wrong because the actual code does:
u2.append(u101)
Which appends the entire list of fields [Device-ID, Local-Intf, Hold-time, Capability, Port-ID]
for each LLDP neighbor—not just the first element (hostname).
To make the script produce only the hostname I believe you would change that line to:
u2.append(u101[0])
u101[0] is the first element of that list—the Device ID or hostname.
I'm still quite new to this subject so if I'm wrong, forgive me but I think the logic I mentioned has some truth to it.
Thanks