-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Labels
complexity: mediumRequires a substantial but not unusual amount of effort to implementRequires a substantial but not unusual amount of effort to implementstatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the applicationIntroduction of new functionality to the application
Milestone
Description
NetBox version
v4.3.5
Feature type
New functionality
Proposed functionality
For all device components, cache the assigned site and location of the parent device. This assignment will be read-only, and updated automatically whenever the device's assignment is altered.
There is an existing pattern for how this can be handled using a receiver for the post_save signal.
Use case
Saving these assignments directly on each component will obviate the need for SQL table joins when filtering device components by parent site or location. For example, consider the following REST API query:
GET /api/dcim/interfaces/?site_id=123
This currently requires a JOIN of the dcim_interface table with the dcim_device table to query the site. Copying this relationship to the dcim_interface table allows the filter to query that table directly.
Database changes
No response
External dependencies
No response
Metadata
Metadata
Assignees
Labels
complexity: mediumRequires a substantial but not unusual amount of effort to implementRequires a substantial but not unusual amount of effort to implementstatus: acceptedThis issue has been accepted for implementationThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the applicationIntroduction of new functionality to the application