Incorrect order of interfaces that start with numbers #2654

Closed
opened 2025-12-29 18:20:54 +01:00 by adam · 1 comment
Owner

Originally created by @zelfix on GitHub (Jun 5, 2019).

Environment

  • Python version: 3.6.7
  • NetBox version: 2.5.13

Huawei CE switches can have interface names start with numbers, for example: 10GE1/0/1 or 40GE1/0/5. Such names have incorrect order in the list of interfaces.

Steps to Reproduce

  1. Add interfaces with names 10GE1/0/[1-48] to device

Expected Behavior

list of interfaces with ascending order

Observed Behavior

Natural ordering doesn't work correctly
image

Originally created by @zelfix on GitHub (Jun 5, 2019). <!-- NOTE: This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 3.6.7 * NetBox version: 2.5.13 <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox (or the current beta release where applicable). Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a wrapper like pynetbox. --> Huawei CE switches can have interface names start with numbers, for example: 10GE1/0/1 or 40GE1/0/5. Such names have incorrect order in the list of interfaces. ### Steps to Reproduce 1. Add interfaces with names 10GE1/0/[1-48] to device <!-- What did you expect to happen? --> ### Expected Behavior list of interfaces with ascending order <!-- What happened instead? --> ### Observed Behavior Natural ordering doesn't work correctly ![image](https://user-images.githubusercontent.com/10135380/58948390-b26d6700-8792-11e9-9dd3-485c31b8cc77.png)
adam closed this issue 2025-12-29 18:20:54 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jun 5, 2019):

NetBox employs custom logic to naturally order interfaces as best we can. Unfortunately, it is not feasible to accommodate every naming scheme.

I'm going to close this as non-actionable. However, if you'd like to propose a specific modification to the existing logic that will address your use case without impacting any of the existing test cases, I'm happy to re-open it.

@jeremystretch commented on GitHub (Jun 5, 2019): NetBox employs [custom logic](https://github.com/digitalocean/netbox/blob/develop/netbox/dcim/managers.py#L27) to naturally order interfaces as best we can. Unfortunately, it is not feasible to accommodate every naming scheme. I'm going to close this as non-actionable. However, if you'd like to propose a specific modification to the existing logic that will address your use case without impacting any of [the existing test cases](https://github.com/digitalocean/netbox/blob/develop/netbox/dcim/tests/test_natural_ordering.py#L6), I'm happy to re-open it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2654