netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
16.04k stars 2.57k forks source link

Include Network information in Prefix/Aggregate view #9505

Closed basti1508 closed 2 years ago

basti1508 commented 2 years ago

NetBox version

v3.2.4

Feature type

Change to existing functionality

Proposed functionality

Inlcude additinal information in the Prefix/Aggregate view to make it easier for admins to get more knowledge to the network. The example would be the output of sipcalc. For me the most valueable information is boradcast address, quick view on the usable range and cisco wildcard address.

$ sipcalc 10.14.0.0/19
-[ipv4 : 10.14.0.0/19] - 0

[CIDR]
Host address        - 10.14.0.0
Host address (decimal)  - 168689664
Host address (hex)  - A0E0000
Network address     - 10.14.0.0
Network mask        - 255.255.224.0
Network mask (bits) - 19
Network mask (hex)  - FFFFE000
Broadcast address   - 10.14.31.255
Cisco wildcard      - 0.0.31.255
Addresses in network    - 8192
Network range       - 10.14.0.0 - 10.14.31.255
Usable range        - 10.14.0.1 - 10.14.31.254

Use case

Get additional network information more quickly.

Database changes

No response

External dependencies

No response

jeremystretch commented 2 years ago

What specifically are you proposing be added?

ITJamie commented 2 years ago

I did some of this (netmask/wildcard) in my gateways plugin as it was highly requested internally during our migration from racktables which had similar data.

https://github.com/ITJamie/netbox_gateways/blob/main/docs/images/prefix_view_gw.png

basti1508 commented 2 years ago

From the example above the most valuable information would be:

Network mask        - 255.255.224.0
Cisco wildcard      - 0.0.31.255
Network range       - 10.14.0.0 - 10.14.31.255
weidi commented 2 years ago

Would love to add that showing the netmask in addition to the CIDR notation for each IP would help a lot so this might not only help in the prefix view.

PieterL75 commented 2 years ago

I have this plugin : https://github.com/PieterL75/netbox_ipcalculator It is a client-side javascript based subnet calculator...

Feel free to use/modify it !

renatoalmeidaoliveira commented 2 years ago

Which implementation you think is better? 1 - add model methods that calculate netmask, wildcard and etc, 2 - add templatetags in the helpers that do the same thing?

jeremystretch commented 2 years ago

@renatoalmeidaoliveira I'd expect that most such attributes are already available via netaddr as properties of the prefix value. But where needed, model attributes and methods would be preferable: Template tags should only be introduced to fill a general need.