-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
(Extracted from #4971)
Environment
- Python version: 3.6.9
- NetBox version: 2.9.8
Summary: missing validation of the consistency of links from Device, Rack and Rackgroup tree to Site.
Steps to Reproduce
Case 1: Device-Site not matching Rack-Site
1. Create sites A and B
2. Create rack R in site A
3. Create device D in site A and rack R
4. Change rack R to site B
Case 2: Rack-Site not matching Rackgroup-Site
- Create sites A and B
- Create rackgroup G in site A
- Create rack R in site A and rackgroup G
- Change rackgroup G to site B
Case 3: Rackgroup-Site not matching parent Rackgroup-Site
- Create sites A and B
- Create rackgroup G1 in site A
- Create rackgroup G2 in site A with parent rackgroup G1
- Change rackgroup G1 to site B
Case 4: These relationships also apply transitively: parent rackgroup -> child rackgroup -> rack -> device
- Create sites A and B
- Create rackgroup G1 in site A
- Create rackgroup G2 in site A with parent rackgroup G1
- Create rack R in site A and rackgroup G2
- Create device D in site A and rack R
- Change rackgroup G1 to site B
Expected Behavior
In case 1: either change to be rejected, or rack R's new site to be propagated to all Devices underneath it
In case 2: either change to be rejected, or rack group G's new site to be propagated to all Racks underneath it
In case 3: either change to be rejected, or rack group G1's new site to be propagated to all child and descendant rackgroups
In case 4: either change to be rejected, or rack group G1's new site to be propagated recursively to all child and descendant rackgroups, racks and devices
Observed Behavior
In case 1: device D is in site A but its rack is in site B
In case 2: rack R is in site A but its rackgroup is in site B
In case 3: rackgroup G2 is in site A but its parent rackgroup G1 is in site B
In case 4: device D, rack R, rackgroup G2 are all in site A but the ancestor rackgroup G1 is in site B
Additional Note
PowerPanel also has a link to Site and RackGroup, so a similar issue applies there too.