openwisp/openwisp-controller

[bug] Multiple SubnetDivisionRule of different sizes

pandafy opened this issue · 1 comments

Steps to replicate

  1. Ensure you have at least one device for the default organization in OpenWISP
  2. Create a subnet 10.0.0.0/16
  3. Add a SubnetDivisionRule as follows:
    Label: DEV1
    Type: Device
    Organization: Default
    Size of subnet: 31
    Number of subnet: 1
    Number of IPs: 1
  4. Ensure that subnets and IPs are created for the exsiting device
  5. Add another SubnetDivisionRule as follows:
    Label: DEV2
    Type: Device
    Organization: Default
    Size of subnet: 29
    Number of subnet: 1
    Number of IPs : 8

Expected Outcome

IPs and Subnets are provisioned for the device according to the DEV2 subnet divison rule.

Actual Outcome

Only IPs and Subnets are created for DEV1

Note: Both the subnet division rules are created for the same subnet

I suspect this occurs because of the Reserved Subnet. The size of the reserve subnet is dictating the size of the subsequent subnets.

If we change the order of created of subnet division rules, i.e. create DEV2 before DEV1, then the subnet created for DEV1 would be /29 instead of /31