Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Overlapping validation with nested subnets is bugged #87

Closed
nemesifier opened this issue Mar 24, 2021 · 0 comments · Fixed by #100
Closed

[bug] Overlapping validation with nested subnets is bugged #87

nemesifier opened this issue Mar 24, 2021 · 0 comments · Fixed by #100

Comments

@nemesifier
Copy link
Member

When editing a subnet which has one or multiple level of children the overlap validation doesn't work as expected.

Here's how to replicate the issue:

  • create a subnet 10.0.0.0/16 (call it master subnet)
  • create a subnet 10.0.0.0/24 which has as master subnet the subnet created in the step above
  • create a subnet 10.0.1.0/24 which has as master subnet the subnet created in the first step
  • open the master subnet 10.0.0.0/16, change the description, hit save

When a subnet is

Expected result:

The change is saved.

Actual result:

ValidationError is raised:

Screenshot from 2021-03-23 19-28-18

Possible solution:

  • first of all a failing test which replicates the bug should be written.
  • then we need to make _validate_overlapping_subnets and make it exclude children, eg: qs = qs.exclude(pk__in=exclude).exclude(subnet=self.subnet, master_subnet=self, master_subnet__master_subnet=self)
  • however, the solution proposed in the previous point will work only for 2 level nesting and not for more, so we have to find a solution that can traverse the available parents and if it finds that the last parent is itself the validation skips
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

1 participant