Skip to main content

NetBox Plugin to order interfaces more intuitively

Project description

NetBox plugin to order interfaces more intuitively

Compatibility

This plugin in compatible with NetBox 2.8. Because of the way this plugin hacks into the internals of NetBox compatibility with other versions is not guaranteed.

Installation

First, add netbox_reorder to your /opt/netbox/local_requirements.txt file. Create it if it doesn't exist.

If you are using a local version of the plugin, for example for development, add -e /opt/path/to/plugin instead.

Then enable the plugin in /opt/netbox/netbox/netbox/configuration.py, like:

PLUGINS = [
    'netbox_reorder',
]

And finally run /opt/netbox/upgrade.sh. This will download and install the plugin and update the database when necessary. Don't forget to run sudo systemctl restart netbox netbox-rq like upgrade.sh tells you!

Usage

This plugin overrides the default interface sorting algorithm of NetBox.

Ordering of mixed interface type names

Some devices (for example Juniper switches) can have mixed interface type names. By default NetBox orders these as follows:

  • ge-0/0/1
  • ge-0/0/3
  • xe-0/0/0
  • xe-0/0/2
  • xe-0/0/4
  • ge-0/1/1
  • ge-0/1/3
  • xe-0/1/0
  • xe-0/1/2
  • xe-0/1/4

This is because the interface type (ge or xe) has precedence over the last part of the interface name. This makes sense when using certain Cisco equipment that has both FastEthernet and GigabitEthernet interfaces with the same numbers:

  • FastEthernet0/0
  • FastEthernet0/1
  • GigabitEthernet0/0
  • GigabitEthernet0/1

NetBox has consciously chosen this sorting algorithm. This plugin implements an alternative more intuitive algorithm where the ordering will be:

  • xe-0/0/0
  • ge-0/0/1
  • xe-0/0/2
  • ge-0/0/3
  • xe-0/0/4
  • xe-0/1/0
  • ge-0/1/1
  • xe-0/1/2
  • ge-0/1/3
  • xe-0/1/4

The downside is that Cisco equipment with duplicate ports numbers will be less intuitive:

  • FastEthernet0/0
  • GigabitEthernet0/0
  • FastEthernet0/1
  • GigabitEthernet0/1

Ordering of virtual chassis interfaces

NetBox orders interfaces first by device name and then by name. This can cause interfaces in a virtual chassis to appear in an unexpected order. Consider for example the following virtual chassis:

Device Name Position Interface names
one 1 xe-1/x/y
two 2 xe-2/x/y
three 3 xe-3/x/y

When viewing the virtual chassis the intuitive order of interfaces would be first xe-1/x/y, then xe-2/x/y and finally xe-3/x/y.

However, because NetBox by default sorts first on device name, the order will be first xe-1/x/y, then xe-3/x/y and finally xe-2/x/y.

Why? Because "three" comes before "two" alphabetically.

This plugin patches NetBox to implement the intuitive order.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netbox_reorder-1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

netbox_reorder-1.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file netbox_reorder-1.0.tar.gz.

File metadata

  • Download URL: netbox_reorder-1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2

File hashes

Hashes for netbox_reorder-1.0.tar.gz
Algorithm Hash digest
SHA256 b13d96b234fe308d9cbd46a751ab1d3e34008ad713926c85c90fafb1baf73e04
MD5 4770e7b28d299468fa5f6b0d84a1e451
BLAKE2b-256 04f5f0fc752ecd1941aa1f841283ab20f810e57ebffbbfdc2771f2fc9d381b23

See more details on using hashes here.

File details

Details for the file netbox_reorder-1.0-py3-none-any.whl.

File metadata

  • Download URL: netbox_reorder-1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2

File hashes

Hashes for netbox_reorder-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c93a2dec3314ce28101dec301541da8775fe299634986e3372979f8a124f4831
MD5 c9791c1244256947abade27110cd79da
BLAKE2b-256 c3b5f95c437ace21c58c85dccbc9334644106da877c83ea6c4422cb59ad8adca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page