-
Notifications
You must be signed in to change notification settings - Fork 336
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
T6045: Recreate show lldp detail views & improve remote port selection #3590
Conversation
op-mode-definitions/lldp.xml.in
Outdated
<properties> | ||
<help>Show extended detail for LLDP neighbors</help> | ||
</properties> | ||
<command>/usr/sbin/lldpcli show neighbors detail</command> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use lldp.py
which should show data in the formatted or raw format.
op-mode-definitions/lldp.xml.in
Outdated
<script>${vyos_completion_dir}/list_interfaces</script> | ||
</completionHelp> | ||
</properties> | ||
<command>/usr/sbin/lldpcli show neighbors ports $5 detail</command> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use lldp.py
which should show data in the formatted or raw format.
op-mode-definitions/lldp.xml.in
Outdated
@@ -13,6 +13,12 @@ | |||
</properties> | |||
<command>${vyos_op_scripts_dir}/lldp.py show_neighbors</command> | |||
<children> | |||
<node name="details"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use detail
Apologies - didn't realise wrapping opmode commands in Python was a hard requirement, I added a commit to fix that and the "details" => "detail" change. The existing op_mode/lldp.py code already dealt with detail raw-mode, it just didn't expose this in the XML or handle it properly to output a plain text view. Let me know if this solution still isn't suitable. |
Squashed the fixup commits and rebased on current. |
If the remote device has explicitly sent the interface name as the portID, we should use that first as the interface name, before working through the previous priority order. I've brought back LLDP detail views directly calling lldpcli. This can be extended to render a template from op_mode/lldp.py, but lldpcli isn't bad at rendering readable info. Raw mode (including detailed raw) is still accessible for programmatic access.
👍 |
Looks good:
|
Change Summary
If the remote device has explicitly sent the interface name as the portID, we should use that first as the interface name, before working through the previous priority order.
I've brought back LLDP detail views by directly calling lldpcli. This can be extended to render a template from op_mode/lldp.py, but lldpcli isn't bad at rendering readable info. Raw mode (including detailed raw) is still accessible for programmatic access.
Types of changes
Related Task(s)
Related PR(s)
Component(s) name
Proposed changes
Different NOSes and full blown OSes return interface information differently, making a proper universal selection on the "Remote Port" field difficult. It's a similar situation in net-snmp between ifName, ifAlias and ifDescr. However, we do get a type attribute for the PortID returned in LLDP (ref: https://github.com/lldpd/lldpd/blob/master/src/lib/atoms/port.c#L41), so if the remote explicitly says it's the interface name (eg, Cisco & HPE do), that's the interface name.
It will likely need some tweaking and testing, as I'm sure there are still vendors misusing the attribute, but it's a bit closer in the most common use cases from large vendors.
I started re-implementing a detail view in
op_mode/lldp.py
using some Cisco output samples as a template and calling in with--detail
set for those tag branches from the XML. However - it's a decent bit of effort, source JSON is very flexible in structure depending on the devices found, we already have an competent renderer in lldpcli.I can revisit this one to complete the re-rendering in lldp.py if that's the preferred way of doing things, but this should be a working implementation as-is.
How to test
and
Smoketest result
There doesn't appear to be a smoketest for op-mode schema changes.
Checklist: