Bulk device import no longer works with parent/child devices when "tags" present in import data #11491

Closed
opened 2025-12-29 21:45:58 +01:00 by adam · 4 comments
Owner

Originally created by @pmsharp2 on GitHub (Aug 17, 2025).

Originally assigned to: @bctiemann on GitHub.

Deployment Type

Self-hosted: bare-metal
self-hosted: docker

NetBox Version

4.3.4 & 4.3.6

Python Version

3.12

Steps to Reproduce

create a role: test_device
create a site: SFO
create a location : DC1 (site = SFO)
create a manufacturer: nebox
create a rack: A01 (site = SFO)(Location = DC1)
create device role: test_device
create tag: tag1
create a device type "test-shelf" with "netbox" as the manufacture with the "parent" flag and a single device bay named "bay1"
create a device type "test-device" with "netbox" as the manufacture the "child" flag and "0" as height

Bulk device import

role	manufacturer	device_type	status	site	location	name	rack	position	face	parent	device_bay	tags
test_device	netbox	test-shelf	planned	SFO	DC1	test-shelf	A01	18	front			tag1
test_device	netbox	test-device	planned	SFO	DC1	test-device	A01			test-shelf	bay1	tag1

Expected Behavior

child device is assigned to the bay of the parent with correct tags assigned to each device

Observed Behavior

Devices are imported but the child device is set as a "non-racked devices" rather than being assigned to the correct device bay. ONLY when a tag is present during the import.
This fails both when the parent and child are imported at the same time and when the parent already exists.

Tested on 4.3.4 and 4.3.6 with same results

Originally created by @pmsharp2 on GitHub (Aug 17, 2025). Originally assigned to: @bctiemann on GitHub. ### Deployment Type Self-hosted: bare-metal self-hosted: docker ### NetBox Version 4.3.4 & 4.3.6 ### Python Version 3.12 ### Steps to Reproduce create a role: test_device create a site: SFO create a location : DC1 (site = SFO) create a manufacturer: nebox create a rack: A01 (site = SFO)(Location = DC1) create device role: test_device create tag: tag1 create a device type "test-shelf" with "netbox" as the manufacture with the "parent" flag and a single device bay named "bay1" create a device type "test-device" with "netbox" as the manufacture the "child" flag and "0" as height Bulk device import ``` role manufacturer device_type status site location name rack position face parent device_bay tags test_device netbox test-shelf planned SFO DC1 test-shelf A01 18 front tag1 test_device netbox test-device planned SFO DC1 test-device A01 test-shelf bay1 tag1 ``` ### Expected Behavior child device is assigned to the bay of the parent with correct tags assigned to each device ### Observed Behavior Devices are imported but the child device is set as a "non-racked devices" rather than being assigned to the correct device bay. ONLY when a tag is present during the import. This fails both when the parent and child are imported at the same time and when the parent already exists. Tested on 4.3.4 and 4.3.6 with same results
adam added the type: bugstatus: acceptednetboxseverity: low labels 2025-12-29 21:45:58 +01:00
adam closed this issue 2025-12-29 21:45:58 +01:00
Author
Owner

@arthanson commented on GitHub (Aug 18, 2025):

@pmsharp2 can you please expand and cleanup on your reproduction steps - the csv you've given assumes a lot of things are existing (like site, rack, etc..) that aren't specified in the reproduction steps. Can you please add those and make sure the reproduction steps are complete. I don't think all of the columns in the CSV are needed either, the position, face, etc I don' think are needed?

@arthanson commented on GitHub (Aug 18, 2025): @pmsharp2 can you please expand and cleanup on your reproduction steps - the csv you've given assumes a lot of things are existing (like site, rack, etc..) that aren't specified in the reproduction steps. Can you please add those and make sure the reproduction steps are complete. I don't think all of the columns in the CSV are needed either, the position, face, etc I don' think are needed?
Author
Owner

@pmsharp2 commented on GitHub (Aug 19, 2025):

@pmsharp2 can you please expand and cleanup on your reproduction steps - the csv you've given assumes a lot of things are existing (like site, rack, etc..) that aren't specified in the reproduction steps. Can you please add those and make sure the reproduction steps are complete. I don't think all of the columns in the CSV are needed either, the position, face, etc I don' think are needed?

site, statues, manufacturer, role are all required and part of the device types.
For this import the only non-required fields I have included are rack, position, parent, device_bay. But I hope it's clear that those are the fields that seem to be having some issues. I will amend with some more detailed comments

@pmsharp2 commented on GitHub (Aug 19, 2025): > [@pmsharp2](https://github.com/pmsharp2) can you please expand and cleanup on your reproduction steps - the csv you've given assumes a lot of things are existing (like site, rack, etc..) that aren't specified in the reproduction steps. Can you please add those and make sure the reproduction steps are complete. I don't think all of the columns in the CSV are needed either, the position, face, etc I don' think are needed? site, statues, manufacturer, role are all required and part of the device types. For this import the only non-required fields I have included are rack, position, parent, device_bay. But I hope it's clear that those are the fields that seem to be having some issues. I will amend with some more detailed comments
Author
Owner

@pmsharp2 commented on GitHub (Aug 19, 2025):

I went back and did the full reproduction steps to make sure I wasn't missing anything and narrowed it down a bit more. The bad importing only seems to occur when "tags" are present in the import data. Even when device tags match child and parent the child devices are set as non-rack devices. I have amended my title and steps to reflect that.

@pmsharp2 commented on GitHub (Aug 19, 2025): I went back and did the full reproduction steps to make sure I wasn't missing anything and narrowed it down a bit more. The bad importing only seems to occur when "tags" are present in the import data. Even when device tags match child and parent the child devices are set as non-rack devices. I have amended my title and steps to reflect that.
Author
Owner

@arthanson commented on GitHub (Aug 21, 2025):

This is a strange one, does seem to operate different without the tags - here is the csv comma separated as the tab separate is difficult without the tags:

role,manufacturer,device_type,status,site,location,name,rack,position,face,parent,device_bay
test_device,netbox,test-shelf,planned,SFO,DC1,test-shelf,A01,18,front,,
test_device,netbox,test-device,planned,SFO,DC1,test-device,A01,,,test-shelf,bay1
@arthanson commented on GitHub (Aug 21, 2025): This is a strange one, does seem to operate different without the tags - here is the csv comma separated as the tab separate is difficult without the tags: ``` role,manufacturer,device_type,status,site,location,name,rack,position,face,parent,device_bay test_device,netbox,test-shelf,planned,SFO,DC1,test-shelf,A01,18,front,, test_device,netbox,test-device,planned,SFO,DC1,test-device,A01,,,test-shelf,bay1 ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11491