openwisp / django-ipam

The development of this project has moved to openwisp-ipam
https://github.com/openwisp/openwisp-ipam
BSD 3-Clause "New" or "Revised" License
78 stars 28 forks source link

[admin/models] Implement nested subnets #21

Closed nemesifier closed 4 years ago

nemesifier commented 6 years ago

@hispanico what is the purpose of the master subnet field?

Right now I think the current implementation doesn't really do much with it, infact I can select pretty much any rubbish value and the system will accept it. Implementing this correctly will take effort because we'll also probably need to have any subnet which is flagged as master (by another subnet) to show part of its address space occupied.

I suggest removing it temporarily and discuss of how it should be properly implemented.

nemesifier commented 6 years ago

I'd say just remove master_subnet and all its related logic because we don't have time to implement this right now, we need to hurry up to implement #19, #17 and #10 and move on to integrate this module with the rest of OpenWISP 2.

hispanico commented 6 years ago

I'm totally agree, the master subnet with nested subnets cloud be implemented in the future.

nemesifier commented 6 years ago

@hispanico shall we start defining how to implement this feature?

anurag-ks commented 6 years ago

The python's ipaddress module provides some helpful functions, like subnet_of, supernet, etc. which we can use while implementing nested subnet feature. Source - https://docs.python.org/3/library/ipaddress.html#ip-network-definitions

hispanico commented 6 years ago

what happens if a user tries to create a new subnet which is part of an existing subnet? Does the system propose to make the new subnet a child of the parent subnet?

The system should be show a message to explain the issue:

how does the visualization of address allocation take master subnets into account?

When a subnet has at least one nested subnet, the visualization should be only the nested subnets, because we cannot add IP address into the master subnet . image

If a nested subnet has been created in a master subnet with IP address already the visualization should be somting like this: image

how does the visualization of address allocation take children subnets into account?

Linke the current one for the IP address with a Hierarchy field image

Maybe we can create a drop-down menu with the availeble nested subnets up to the prefix /24: image

anurag-ks commented 6 years ago

@nemesisdesign @hispanico the subnet and master subnet validation checks are done on my local branch, but I am not sure about the visualizations, how do they work in case of master subnet and subnets, could explain a bit more?

hispanico commented 6 years ago

The master subnet view, in case of nested subnets, shows the child subnets instead of the ip address. See the following image: image

atb00ker commented 5 years ago

Update: Implemented the hierarchical network view for subnets. Implementing the same for IPv6, please review and suggest accordingly. :smile: yay

nemesifier commented 5 years ago

@atb00ker that looks great! Is a PR already open for that?

nemesifier commented 4 years ago

AFAIK this can be closed.