Connection > Cable ID not searchable #6493

Closed
opened 2025-12-29 19:41:29 +01:00 by adam · 11 comments
Owner

Originally created by @pertoft on GitHub (May 18, 2022).

NetBox version

2c0d76833e79 (v3.1.7)

Python version

3.8

Steps to Reproduce

Click on search filter on top search filed. Select DCIM > Cables.
Enter a valid Cable ID E.g. 7 and click search
Browser query: https://netbox.netic.dk/dcim/cables/?q=7
No results found
image

Expected Behavior

I Expected to show the cable with id 7

Observed Behavior

No cables found

Originally created by @pertoft on GitHub (May 18, 2022). ### NetBox version 2c0d76833e79 (v3.1.7) ### Python version 3.8 ### Steps to Reproduce Click on search filter on top search filed. Select DCIM > Cables. Enter a valid Cable ID E.g. 7 and click search Browser query: https://netbox.netic.dk/dcim/cables/?q=7 No results found <img width="1528" alt="image" src="https://user-images.githubusercontent.com/3786972/169032667-cc8ea3b3-c05e-4c61-8888-5e22e5cdbdaf.png"> ### Expected Behavior I Expected to show the cable with id 7 ### Observed Behavior No cables found
adam added the type: featurepending closurestatus: under review labels 2025-12-29 19:41:29 +01:00
adam closed this issue 2025-12-29 19:41:29 +01:00
Author
Owner

@jeremystretch commented on GitHub (May 18, 2022):

The cable filter search intentionally matches only on label values, because a) matching on IDs is likely to return false matches and b) if you already know the ID of a cable, you can use the id filter to retrieve it. We could also search by the ID field, though I suspect it would be quite messy. For example, searching for the ID 7 would also return any cables with 7 in their label.

@jeremystretch commented on GitHub (May 18, 2022): The cable filter search intentionally matches only on label values, because a) matching on IDs is likely to return false matches and b) if you already know the ID of a cable, you can use the `id` filter to retrieve it. We _could_ also search by the ID field, though I suspect it would be quite messy. For example, searching for the ID `7` would also return any cables with `7` in their label.
Author
Owner

@pertoft commented on GitHub (May 18, 2022):

Hi,

Thanks for clarifying the issue. I could like to print a label on all physical cables, and have a quick and easy way to lookup the entry in netbox. Therefore I would like a quick option to search for the cable id from the main page.

I was expecting that all cable colums were included, when I explicit specify "Cable" in the dropdown filter.
image
Would that be an option to include the cable ID when this filter is set?

Alternative, I suggest to introduce keywords E.g. cableid:7 in the search which only will return cable ids.
Could that be an option?

Any other ideas how to quickly navigate to a cable?

@pertoft commented on GitHub (May 18, 2022): Hi, Thanks for clarifying the issue. I could like to print a label on all physical cables, and have a quick and easy way to lookup the entry in netbox. Therefore I would like a quick option to search for the cable id from the main page. I was expecting that all cable colums were included, when I explicit specify "Cable" in the dropdown filter. ![image](https://user-images.githubusercontent.com/3786972/169048159-056e55ce-8dec-467d-a4b0-69f8cb9ee6b6.png) Would that be an option to include the cable ID when this filter is set? Alternative, I suggest to introduce keywords E.g. cableid:7 in the search which only will return cable ids. Could that be an option? Any other ideas how to quickly navigate to a cable?
Author
Owner

@kkthxbye-code commented on GitHub (May 18, 2022):

Any other ideas how to quickly navigate to a cable?

If you'll accept a non-netbox solution, you can add a custom search provider in Chrome.

Screenshot 2022-05-18 at 15 32 21

In the addressbar of chrome type nbcable 123 and press enter.

Not sure how common a usecase it is to use the auto-generated ID as the label for the cable.

@kkthxbye-code commented on GitHub (May 18, 2022): > Any other ideas how to quickly navigate to a cable? If you'll accept a non-netbox solution, you can add a custom search provider in Chrome. <img width="511" alt="Screenshot 2022-05-18 at 15 32 21" src="https://user-images.githubusercontent.com/400797/169051924-3923ecf0-9031-4e42-be5a-04ed54fffe33.png"> In the addressbar of chrome type `nbcable 123` and press enter. Not sure how common a usecase it is to use the auto-generated ID as the label for the cable.
Author
Owner

@pertoft commented on GitHub (May 19, 2022):

It is a nice hack :-)
However, we are allot of people working with Netbox and it will be too complicated to install this addon on all the browsers.

I really hope it would be possible to search for a cable id in netbox. It is possible to develop a custom addon or search?
What are the perspectives if I open a pull request with the search implemented?

@pertoft commented on GitHub (May 19, 2022): It is a nice hack :-) However, we are allot of people working with Netbox and it will be too complicated to install this addon on all the browsers. I really hope it would be possible to search for a cable id in netbox. It is possible to develop a custom addon or search? What are the perspectives if I open a pull request with the search implemented?
Author
Owner

@kkthxbye-code commented on GitHub (May 20, 2022):

It is a nice hack :-)
However, we are allot of people working with Netbox and it will be too complicated to install this addon on all the browsers.

It's built-in functionality, but fair enough.

What are the perspectives if I open a pull request with the search implemented?

The feature request would need to be accepted first. If you can provide a proposal for an implementation that takes into account Jeremy's concerns and adds the functionality in generic way, we would be happy to accept PR's.

@kkthxbye-code commented on GitHub (May 20, 2022): >It is a nice hack :-) However, we are allot of people working with Netbox and it will be too complicated to install this addon on all the browsers. It's built-in functionality, but fair enough. > What are the perspectives if I open a pull request with the search implemented? The feature request would need to be accepted first. If you can provide a proposal for an implementation that takes into account Jeremy's concerns and adds the functionality in generic way, we would be happy to accept PR's.
Author
Owner

@TheNetworkGuy commented on GitHub (May 23, 2022):

Just my 2 cents but i wouldn't rely on a database index number for the Cable identifier. Especially with import / export related operations. The DB index can change when editing data in those scenario's. If there are no labels to begin with i would rather:

  1. Generate new labels (for instance with format ABC123, ABC124 etc)
  2. Bulk edit the existing cables with a python script of some sort and assign the new labels to the existing cables
  3. Print the new labels and put them over the existing cables (this step is the same wether you use the Netbox object ID or the Netbox Cable identifier string)
@TheNetworkGuy commented on GitHub (May 23, 2022): Just my 2 cents but i wouldn't rely on a database index number for the Cable identifier. Especially with import / export related operations. The DB index can change when editing data in those scenario's. If there are no labels to begin with i would rather: 1. Generate new labels (for instance with format ABC123, ABC124 etc) 2. Bulk edit the existing cables with a python script of some sort and assign the new labels to the existing cables 3. Print the new labels and put them over the existing cables (this step is the same wether you use the Netbox object ID or the Netbox Cable identifier string)
Author
Owner

@jeremystretch commented on GitHub (May 23, 2022):

i wouldn't rely on a database index number for the Cable identifier

The label field is optional, and we need some way of uniquely identifying an individual cable that isn't dependent on its attachment points. Labels are ideal but ultimately it's up to the user.

@jeremystretch commented on GitHub (May 23, 2022): > i wouldn't rely on a database index number for the Cable identifier The label field is optional, and we need _some_ way of uniquely identifying an individual cable that isn't dependent on its attachment points. Labels are ideal but ultimately it's up to the user.
Author
Owner

@TheNetworkGuy commented on GitHub (May 23, 2022):

i wouldn't rely on a database index number for the Cable identifier

The label field is optional, and we need some way of uniquely identifying an individual cable that isn't dependent on its attachment points. Labels are ideal but ultimately it's up to the user.

Agreed, its not negatieve feedback to Netbox or the implementation. However if you do start from scratch then why not make the best out of it :)

@TheNetworkGuy commented on GitHub (May 23, 2022): > > i wouldn't rely on a database index number for the Cable identifier > > The label field is optional, and we need _some_ way of uniquely identifying an individual cable that isn't dependent on its attachment points. Labels are ideal but ultimately it's up to the user. Agreed, its not negatieve feedback to Netbox or the implementation. However if you do start from scratch then why not make the best out of it :)
Author
Owner

@pertoft commented on GitHub (May 24, 2022):

Rolling back to the initial problem. Today we are printing long labels with devices and cross connects in between, but we would like to simplify and print a label with a distinct id which we can lookup in Netbox as a cable or cable trace.

I agree that a database id might not be the optimal path in an import/export scenario where IDs could be colliding with the imported id.

I think the integer ID would be optimal to have printed on the cable label, and in an import scenario where the IDs collide we could 1) reject the import or 2) prefix the IDs E.g. ID 10 exists in the database and the import circuit have the same, then 1000 could appended, so the new circuit would be 1010.

@pertoft commented on GitHub (May 24, 2022): Rolling back to the initial problem. Today we are printing long labels with devices and cross connects in between, but we would like to simplify and print a label with a distinct id which we can lookup in Netbox as a cable or cable trace. I agree that a database id might not be the optimal path in an import/export scenario where IDs could be colliding with the imported id. I think the integer ID would be optimal to have printed on the cable label, and in an import scenario where the IDs collide we could 1) reject the import or 2) prefix the IDs E.g. ID 10 exists in the database and the import circuit have the same, then 1000 could appended, so the new circuit would be 1010.
Author
Owner

@github-actions[bot] commented on GitHub (Jul 24, 2022):

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. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Jul 24, 2022): 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. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@github-actions[bot] commented on GitHub (Aug 23, 2022):

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions[bot] commented on GitHub (Aug 23, 2022): This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6493