New matching case for related devices UI #952

Closed
opened 2025-12-29 16:27:13 +01:00 by adam · 4 comments
Owner

Originally created by @lampwins on GitHub (May 15, 2017).

Issue type: feature request

There was some discussion on the networktocode slack the other day about how related devices are correlated. I know @jeremystretch mentioned wanting revisit this in a larger fashion but I was wondering if you would be open to adding one more case for matching in the mean time.

This stems from the way I am currently representing switch stacks in netbox. Each member of the stack is named like so: Access-Stack-1F--RE-N1. In this scheme, Access-Stack-1F is the name of the stack and this node's role is RE and it is node 1 in the stack. This is denoted after the delimiter --.

I really like the related devices feature but it obviously cannot match all members of a stack in this case when we factor in multiple roles (RE, LC, etc). Would it be possible to add a case to match anything up to a delimiter of --?

Originally created by @lampwins on GitHub (May 15, 2017). <!-- Please note: GitHub issues are to be used only for feature requests and bug reports. For installation assistance or general discussion, please join us on the mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please indicate "bug report" or "feature request" below. Be sure to search the existing set of issues (both open and closed) to see if a similar issue has already been raised. --> ### Issue type: feature request There was some discussion on the networktocode slack the other day about how related devices are correlated. I know @jeremystretch mentioned wanting revisit this in a larger fashion but I was wondering if you would be open to adding one more case for matching in the mean time. This stems from the way I am currently representing switch stacks in netbox. Each member of the stack is named like so: `Access-Stack-1F--RE-N1`. In this scheme, `Access-Stack-1F` is the name of the stack and this node's role is `RE` and it is node 1 in the stack. This is denoted after the delimiter `--`. I really like the related devices feature but it obviously cannot match all members of a stack in this case when we factor in multiple roles (RE, LC, etc). Would it be possible to add a case to match anything up to a delimiter of `--`?
adam added the type: feature label 2025-12-29 16:27:13 +01:00
adam closed this issue 2025-12-29 16:27:13 +01:00
Author
Owner

@jeremystretch commented on GitHub (May 15, 2017):

The current approach of looking for devices with similar names was a "good enough" hack for when it was implemented. It should really be replaced with something more robust, but I don't have anything in mind.

@jeremystretch commented on GitHub (May 15, 2017): The current approach of looking for devices with similar names was a "good enough" hack for when it was implemented. It should really be replaced with something more robust, but I don't have anything in mind.
Author
Owner

@lampwins commented on GitHub (May 16, 2017):

Coincidentally I ran across the python built in difflib library in some other work today. It immediately struck me a possible solution to this. Among other things, it can be used to calculate a percentile difference in two string. So for instance, you could say something like: two device names that are >=90% similar are related. http://stackoverflow.com/questions/17388213/find-the-similarity-percent-between-two-strings

@lampwins commented on GitHub (May 16, 2017): Coincidentally I ran across the python built in `difflib` library in some other work today. It immediately struck me a possible solution to this. Among other things, it can be used to calculate a percentile difference in two string. So for instance, you could say something like: two device names that are >=90% similar are related. http://stackoverflow.com/questions/17388213/find-the-similarity-percent-between-two-strings
Author
Owner

@jeremystretch commented on GitHub (May 16, 2017):

It's one way to go. We'd have to pull in the names from all devices from the database and then do the matching in Python, but that might not be too bad if we limit it to devices assigned to the same site.

@jeremystretch commented on GitHub (May 16, 2017): It's one way to go. We'd have to pull in the names from all devices from the database and then do the matching in Python, but that might not be too bad if we limit it to devices assigned to the same site.
Author
Owner

@jeremystretch commented on GitHub (Jun 9, 2017):

difflib has some really neat logic, but after some experimentation it can sometimes return very unexpected results. Probably best to keep things simple and just return a truncated list of devices in the same site with the same role.

@jeremystretch commented on GitHub (Jun 9, 2017): `difflib` has some really neat logic, but after some experimentation it can sometimes return very unexpected results. Probably best to keep things simple and just return a truncated list of devices in the same site with the same role.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#952