dropbox / nsot

Network Source of Truth is an open source IPAM and network inventory database
https://nsot.readthedocs.io
Other
399 stars 66 forks source link

Fix for get_next_network assigned state regression #250

Closed nickpegg closed 7 years ago

nickpegg commented 7 years ago

A regression was introduced in #226 to where if a child was in the assigned state (such as a /32 assigned to an interface), it would be considered as a candidate for get_next_network, while allocated children where not.

My fix for this builds the list of dirty subnets as the set of Networks that match the prefix length we're looking for and are in a 'busy' state, which are the subnets that should be immediately discounted as we look through all the possible subnets of the desired prefix length.

I've also added a test to the regression tests to check for this. I've verified that the test fails with the version of models.py that excludes my fix.

nickpegg commented 7 years ago

Bumped!