Closed julsemaan closed 4 years ago
There's a couple different ways we can deal with switch/netmask. We can either change/add a locationlog.switch_ip
db column as an INT so we can use >
and <
operators, otherwise the network has to be split into compound OR
s using string operators starts_with
, which can generate pretty verbose statements using many ORs across large subnets.
Example, 10.0.0.0/9 = range 10.0.0.1 - 10.127.255.254, thus we'd need to concat 128 OR statements to filter/search properly using string (locationlog.switch_ip
starts_with '10.0.' or locationlog.switch_ip
starts_with '10.1.' ... locationlog.switch_ip
starts_with '10.127.')
For the maintenance: could we use a starts_with for the masks that can work in strings (/8, /16, /24, /32) and show an error to the user for the other masks ?
Then for the real fix, I think storing the switch as an int in another field would be useful for searching.
Using the string representation to search uncommon masks will be too messy like @satkunas described.
Could we implement a fix for the maintenance so that it works for common subnets and provides an error to users for subnets we can't support at the moment?
Describe the bug When you use the switch group search menu on the left in the nodes and search for a switch range, the search is inconsistent with how the data is stored in the DB.
To Reproduce
Expected behavior When searching for a switch range, all the nodes that are connected in a switch in that switch range should show up
Additional context This is on 10.1.0 in the new admin but I tested on 8.1.0 in the old admin and it was also broken.