-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Napalm LLDP port names are splitted by dots (.) #7197
Comments
Despite this is issue is 100% reproducible, it is very hard to setup a functional Netbox/Napalm setup with these interface names if you don't have this kind of hardware. Because of that, I already investigated the cause for this issue. Interface names returned by Napalm are splitted by dots (.).
For
We need to review the reason for Ergo, there are two questions:
Btw. Before someone asks why dots inside interface names are necessary: I work a lot with Allied Telesis gear running Allied Ware+ where interfaces are named |
Yes.
No. The NAPALM-backed tools provided by NetBox are offered for convenience only. They do not and cannot feasibly accommodate every potential scenario. This particular naming format is so niche and unwieldy that I don't expect the effort required to support it would be worthwhile. |
Fully agree.
Niche or not - Why should a 'cleanup helper' in one direction influence the other direction negatively, when as you said, its NAPALM's responsibility to provide valid data? |
I don't understand your question. NetBox treats dots in the interface name as a separator for subinterfaces. My point is that modifying the logic solely to support this specific use case would be unduly burdensome. |
I fully understand your point in terms of support. The main question is why does Netbox have to support sub-interface separation. Please don't get me wrong. I don't want you to support dots under all circumstances. I just want to understand why the use of dots is prohibited for the benefit of the separator. If an interface name contains dots, then it contains dots. Background: LLDP is Link-layer, so any VLAN-sub-interface cannot be LLDP-enabled. For example on Linux: As said, I'm not sure about the reason for the split. But if its because of my example above, it's wrong to support it in my opinion. |
Probably because when the original code was written four years ago, it was deemed necessary to do so. Likely because some platforms/drivers do report as subinterfaces. Removing this logic to fit your use case will probably break someone else's use case. |
Yes, I understand that. What do you think about a way which preserves the old behavior but also fulfills other needs? e.g. in
This would give precedence to the existing methodology but also fail back to 'full match'. It would also be neccessary in the But...this is not applicable to the LLDP neighbor interfaces returned by NAPALM. The split() happens on both local and neighbor interfaces :( |
The exact implementation of your solution would be something along the lines of: let row = document.getElementById(iface) as Nullable<HTMLTableRowElement>;
if (row === null) {
row = document.getElementById(fullIface) as Nullable<HTMLTableRowElement>;
}
if (row !== null) {
// Current logic
} I'm not opposed to this approach, I agree that it provides a fallback mechanism for non-subinterfaces interfaces that do contain a
I think this could be achieved by abstracting the logic to a separate function to get the element by interface name. For example: function getInterfaceRow(iface: string): HTMLTableCellElement | null {
const [first] = iface.split('.');
let row = document.getElementById(first);
if (row === null) {
row = document.getElementById(iface);
}
if (row !== null) {
return row;
}
return null;
} If everyone's good with this approach, I can implement and test it. |
Your proposal would resolve the problem finding the correct interface row the NAPALM result is applied to. But it would not resolve the second one (neighbor information). netbox/netbox/project-static/src/device/lldp.ts Lines 37 to 40 in 2a293d5
This code will also strip neighbor port Before we think about how to mitigate this, let me summarize the facts:
Would it be OK to base the decision on the occurance count of char function updateRowStyle(data: LLDPNeighborDetail) {
for (const [fullIface, neighbors] of Object.entries(data.get_lldp_neighbors_detail)) {
// only split if interface name is splittable into two parts separated by '.'
const [iface] = fullIface.split('.').length === 2 ? fullIface.split('.')[0] : fullIface;
const row = document.getElementById(iface) as Nullable<HTMLTableRowElement>;
if (row !== null) {
for (const neighbor of neighbors) {
// other code
const nHost = neighbor.remote_system_name ?? '';
const nPort = neighbor.remote_port ?? '';
// only split if name is splittable into two parts separated by '.'
const [nDevice] = nHost.split('.').length === 2 ? nHost.split('.')[0] : nHost;
const [nInterface] = nPort.split('.').length === 2 ? nPort.split('.')[0] : nPort;
// more code
}
}
}
} |
@thatmattlove @jeremystretch I want to kindly ask how we can bring this topic forward. |
Honestly, I think it's reasonable to draw the line at not supporting interface names which use dots as separators. I understand this doesn't satisfy your use case, however what you're proposing is a considerable amount of extra logic to maintain for a very niche requirement. |
I expected this answer and I also can understand it. Currently, for me it's not a must to have it. But....Is there any way for you to reach out to users to "poll" how much are having LLDP interfaces with dot chars? I'm also interested in improving Netbox and this (unfortunately) includes discussions about past implementations, if they were right or wrong. You're already quite certain about my opinion. |
Users are encouraged to vote on items that are tagged as "under review" |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our contributing guide. |
Marking this as blocked by #8152. We may be able to come up with a solution if the evaluation logic is moved inside the UI view. |
Closing this out, to be revisited once NetBox's NAPALM proxy functionality has been moved to a plugin per #10520. |
NetBox version
v3.0.1
Python version
3.9
Steps to Reproduce
port2.5.3
)Expected Behavior
LLDP neighbor information is displayed in the corresponding interface row.
Observed Behavior
LLDP neighbor information is not displayed in the interface row.
The text was updated successfully, but these errors were encountered: