lexicographical sorting order of device bays #182

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

Originally created by @Zanthras on GitHub (Jul 9, 2016).

Minor issue but slightly annoying. If I create say a blade chassis container and add device bays with the names Server[1-16]. It creates them as expected, but then displays the sort order in a technically correct, but unrealistic way. aka Server1, Server10, Server11... Server16, Server2.

Originally created by @Zanthras on GitHub (Jul 9, 2016). Minor issue but slightly annoying. If I create say a blade chassis container and add device bays with the names Server[1-16]. It creates them as expected, but then displays the sort order in a technically correct, but unrealistic way. aka Server1, Server10, Server11... Server16, Server2.
adam added the type: feature label 2025-12-29 16:19:01 +01:00
adam closed this issue 2025-12-29 16:19:01 +01:00
Author
Owner

@bellwood commented on GitHub (Jul 9, 2016):

@jeremystretch this should have been ... sorted ... in #9 right?

@bellwood commented on GitHub (Jul 9, 2016): @jeremystretch this should have been ... sorted ... in #9 right?
Author
Owner

@jeremystretch commented on GitHub (Jul 9, 2016):

That fix only applied to interfaces and interface templates. We could use an additional, more generic natural sort manager for this sort of thing. The same problem applies to device names, console ports, etc.

@jeremystretch commented on GitHub (Jul 9, 2016): That fix only applied to interfaces and interface templates. We could use an additional, more generic natural sort manager for this sort of thing. The same problem applies to device names, console ports, etc.
Author
Owner

@jeremystretch commented on GitHub (Jul 12, 2016):

Merged #248 which should address this. Need to pip install natsort or run upgrade.sh.

@jeremystretch commented on GitHub (Jul 12, 2016): Merged #248 which should address this. Need to `pip install natsort` or run `upgrade.sh`.
Author
Owner

@JNR8 commented on GitHub (Jul 14, 2016):

After updating today I still see that all Device interfaces I've created are ordered incorrectly. Seems very Random. Device Type Template Interfaces are ordered OK, but any devices created from them get a random sort. Does this fix apply to devices you've already created?

@JNR8 commented on GitHub (Jul 14, 2016): After updating today I still see that all Device interfaces I've created are ordered incorrectly. Seems very Random. Device Type Template Interfaces are ordered OK, but any devices created from them get a random sort. Does this fix apply to devices you've already created?
Author
Owner

@jeremystretch commented on GitHub (Jul 14, 2016):

The same ordering is used for both Interfaces and InterfaceTemplates. This issue is only for natsorted objects; we don't use natsort on interfaces because they're ordered by position rather than by name.

@jeremystretch commented on GitHub (Jul 14, 2016): The [same ordering](https://github.com/digitalocean/netbox/blob/develop/netbox/dcim/models.py#L98) is used for both Interfaces and InterfaceTemplates. This issue is only for `natsorted` objects; we don't use natsort on interfaces because they're ordered by position rather than by name.
Author
Owner

@JNR8 commented on GitHub (Jul 15, 2016):

OK, so a different ordering for interfaces regardless of on the device or
in a template. But Interfaces on a device template are sorted in reverse
order and also in the order in which they were added. So for example if I
add "[1-48]" followed by "Management" virtual interface followed by
"[49-52]" then they appear in the imterface list in the order in which they
were added. But if I create a device from that template the order is
randomised (or so it seems), such as in the included screen shot.

[image: Inline images 1]

If you would prefer I could log this as a separate issue, so you can track
it easier. I appreciate I have kind of hijacked this issue thread.

Chris Jenner
Mob: 07739712218

On 14 July 2016 at 17:48, Jeremy Stretch notifications@github.com wrote:

The same ordering
https://github.com/digitalocean/netbox/blob/develop/netbox/dcim/models.py#L98
is used for both Interfaces and InterfaceTemplates. This issue is only for
natsorted objects; we don't use natsort on interfaces because they're
ordered by position rather than by name.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/digitalocean/netbox/issues/243#issuecomment-232723543,
or mute the thread
https://github.com/notifications/unsubscribe/AEDGqXVmG4sDzHMATHGujhFmJ1oXpD59ks5qVmhTgaJpZM4JIdbW
.

@JNR8 commented on GitHub (Jul 15, 2016): OK, so a different ordering for interfaces regardless of on the device or in a template. But Interfaces on a device template are sorted in reverse order and also in the order in which they were added. So for example if I add "[1-48]" followed by "Management" virtual interface followed by "[49-52]" then they appear in the imterface list in the order in which they were added. But if I create a device from that template the order is randomised (or so it seems), such as in the included screen shot. [image: Inline images 1] If you would prefer I could log this as a separate issue, so you can track it easier. I appreciate I have kind of hijacked this issue thread. Chris Jenner Mob: 07739712218 On 14 July 2016 at 17:48, Jeremy Stretch notifications@github.com wrote: > The same ordering > https://github.com/digitalocean/netbox/blob/develop/netbox/dcim/models.py#L98 > is used for both Interfaces and InterfaceTemplates. This issue is only for > natsorted objects; we don't use natsort on interfaces because they're > ordered by position rather than by name. > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > https://github.com/digitalocean/netbox/issues/243#issuecomment-232723543, > or mute the thread > https://github.com/notifications/unsubscribe/AEDGqXVmG4sDzHMATHGujhFmJ1oXpD59ks5qVmhTgaJpZM4JIdbW > .
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#182