Allow for optional DeviceType component creation when creating new Device #11533

Open
opened 2025-12-29 21:46:29 +01:00 by adam · 3 comments
Owner

Originally created by @tyler-8 on GitHub (Aug 27, 2025).

NetBox version

v4.3.7

Feature type

New functionality

Proposed functionality

When creating a new Device from a DeviceType, provide an option (field/flag in GUI and API "bypass_components") to bypass creating all the components of the DeviceType (interfaces, power/console ports, etc).

This would be somewhat similar to the behavior/experience of Changelog Comments https://github.com/netbox-community/netbox/issues/19713 in NetBox v4.4

Use case

When using automated tooling to synchronize data from external sources into NetBox (via the REST API), you often run into a scenario where you load the data from the external tool (ExtTool) and load the data from NetBox, and compare which operations need to be completed to synchronize things (like with the diffsync library).

So after the two data sets are compared, it's determined that a device and its associated data (Interfaces) needs to be created in NetBox. You then create the Device from the DeviceType and now suddenly those interfaces do exist - albeit with incomplete data - and your two data stores are 'out of date'. Your workflow previously determined that the Interfaces were missing and tries to continue the create operation of each interface, which then fail.

Providing an optional 'bypass' of adding the associated data would allow automated tools that may be pulling for an authoritative source for a particular vendor to be in control of what gets added, while still allowing the historical behavior of DeviceType components being created in other workflows/use cases.

Database changes

N/A

External dependencies

N/A

Originally created by @tyler-8 on GitHub (Aug 27, 2025). ### NetBox version v4.3.7 ### Feature type New functionality ### Proposed functionality When creating a new Device from a DeviceType, provide an option (field/flag in GUI and API "bypass_components") to bypass creating all the components of the DeviceType (interfaces, power/console ports, etc). This would be somewhat similar to the behavior/experience of Changelog Comments https://github.com/netbox-community/netbox/issues/19713 in NetBox v4.4 ### Use case When using automated tooling to synchronize data from external sources into NetBox (via the REST API), you often run into a scenario where you load the data from the external tool (ExtTool) and load the data from NetBox, and compare which operations need to be completed to synchronize things (like with the `diffsync` library). So after the two data sets are compared, it's determined that a device and its associated data (Interfaces) needs to be created in NetBox. You then create the Device from the DeviceType and now suddenly those interfaces do exist - albeit with incomplete data - and your two data stores are 'out of date'. Your workflow previously determined that the Interfaces were missing and tries to continue the create operation of each interface, which then fail. Providing an optional 'bypass' of adding the associated data would allow automated tools that may be pulling for an authoritative source for a particular vendor to be in control of what gets added, while still allowing the historical behavior of DeviceType components being created in other workflows/use cases. ### Database changes N/A ### External dependencies N/A
Author
Owner

@sleepinggenius2 commented on GitHub (Aug 28, 2025):

It sounds like you're looking for the same "Replicate components" boolean field/checkbox that is available when adding modules today, but on devices. If so, replicating the same functionality should be largely a copy and paste of the implementation from there.

@sleepinggenius2 commented on GitHub (Aug 28, 2025): It sounds like you're looking for the same "Replicate components" boolean field/checkbox that is available when adding modules today, but on devices. If so, replicating the same functionality should be largely a copy and paste of the implementation from there.
Author
Owner

@jeremystretch commented on GitHub (Aug 28, 2025):

Tagging this as needs milestone for now as the impact on the REST API (if any) needs to be explored.

@jeremystretch commented on GitHub (Aug 28, 2025): Tagging this as `needs milestone` for now as the impact on the REST API (if any) needs to be explored.
Author
Owner

@tyler-8 commented on GitHub (Aug 28, 2025):

Tagging this as needs milestone for now as the impact on the REST API (if any) needs to be explored.

In my mind it'd be a new field and work very similarly to the changelog_message implementation

https://github.com/netbox-community/netbox/issues/19713#issuecomment-3132752591

We ended up taking the per-object approach within the serializer. However, it was implemented in a manner that should not require plugins to adjust their serializers to support. For example:

curl -s -X POST \
-H "Authorization: Token $TOKEN" \
-H "Content-Type: application/json" \
http://netbox/api/dcim/sites/ \
--data '{
    "name": "Site A",
    "slug": "site-a",
    "changelog_message": "Adding a site for ticket #4137"
}'

but instead would look like:

curl -s -X POST \
-H "Authorization: Token $TOKEN" \
-H "Content-Type: application/json" \
http://netbox/api/dcim/devices/ \
--data '{
    "name": "router1",
    "slug": "router1",
    "device_type": 5,
    "inherit_components": false
}'
@tyler-8 commented on GitHub (Aug 28, 2025): > Tagging this as `needs milestone` for now as the impact on the REST API (if any) needs to be explored. In my mind it'd be a new field and work very similarly to the changelog_message implementation > https://github.com/netbox-community/netbox/issues/19713#issuecomment-3132752591 > > We ended up taking the per-object approach within the serializer. However, it was implemented in a manner that should not require plugins to adjust their serializers to support. For example: > > ``` > curl -s -X POST \ > -H "Authorization: Token $TOKEN" \ > -H "Content-Type: application/json" \ > http://netbox/api/dcim/sites/ \ > --data '{ > "name": "Site A", > "slug": "site-a", > "changelog_message": "Adding a site for ticket #4137" > }' > ``` > but instead would look like: ``` curl -s -X POST \ -H "Authorization: Token $TOKEN" \ -H "Content-Type: application/json" \ http://netbox/api/dcim/devices/ \ --data '{ "name": "router1", "slug": "router1", "device_type": 5, "inherit_components": false }' ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11533