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

New matching case for related devices UI #1180

Closed
lampwins opened this issue May 15, 2017 · 4 comments
Closed

New matching case for related devices UI #1180

lampwins opened this issue May 15, 2017 · 4 comments
Labels
type: feature Introduction of new functionality to the application

Comments

@lampwins
Copy link
Contributor

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 --?

@jeremystretch
Copy link
Member

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 jeremystretch added the type: feature Introduction of new functionality to the application label May 15, 2017
@lampwins
Copy link
Contributor Author

lampwins commented 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

@jeremystretch
Copy link
Member

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
Copy link
Member

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.

lampwins pushed a commit to lampwins/netbox that referenced this issue Oct 13, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

2 participants