When using the API, it's not possible to assign a Platform with a different Manufacturer than the Device Type #10785

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

Originally created by @Bastian-Kuhn on GitHub (Feb 19, 2025).

Deployment Type

Self-hosted

NetBox Version

v4.2.1

Python Version

3.10

Steps to Reproduce

Create 2 Manufacturer (e.g. "Manufacturer A" and "Manufacturer B")
Create 2 Device Types under those 2 Manufacturer (e.g. "Device Type C" under "Manufacturer A" and "Device Type D" under" Manufacturer B")
Create 2 Platforms, Platform A with Manufacturer A, Platform B with Manufacturer B
Assign Device Type C to a Device
Use the API to Assign Platform B

Expected Behavior

The Platform should now be assigned to the Device, like it would be if you had used the Web interface.
References:
30a6dc2f64

Observed Behavior

{'platform': ["The assigned platform is limited to Device Type C device
types, but this device's type belongs to Manufacturer B."]}

Originally created by @Bastian-Kuhn on GitHub (Feb 19, 2025). ### Deployment Type Self-hosted ### NetBox Version v4.2.1 ### Python Version 3.10 ### Steps to Reproduce Create 2 Manufacturer (e.g. "Manufacturer A" and "Manufacturer B") Create 2 Device Types under those 2 Manufacturer (e.g. "Device Type C" under "Manufacturer A" and "Device Type D" under" Manufacturer B") Create 2 Platforms, Platform A with Manufacturer A, Platform B with Manufacturer B Assign Device Type C to a Device Use the API to Assign Platform B ### Expected Behavior The Platform should now be assigned to the Device, like it would be if you had used the Web interface. References: https://github.com/netbox-community/netbox/pull/8968/commits/30a6dc2f6418a3d951f060798ca91771371e5daa ### Observed Behavior {'platform': ["The assigned platform is limited to Device Type C device types, but this device's type belongs to Manufacturer B."]}
adam closed this issue 2025-12-29 21:35:53 +01:00
Author
Owner

@jeremystretch commented on GitHub (Feb 20, 2025):

Per the error message, this is expected behavior. The platform must have the same manufacturer assigned as the device type, or have no manufacturer assigned.

@jeremystretch commented on GitHub (Feb 20, 2025): Per the error message, this is expected behavior. The platform must have the same manufacturer assigned as the device type, or have no manufacturer assigned.
Author
Owner

@Bastian-Kuhn commented on GitHub (Feb 20, 2025):

But it works in the GUI, why not in the API?

@Bastian-Kuhn commented on GitHub (Feb 20, 2025): But it works in the GUI, why not in the API?
Author
Owner

@Bastian-Kuhn commented on GitHub (Feb 21, 2025):

And makes in Fact so sense:
We have Device Type "Rack Server", Manufacturers are "Hewlett Packard", "Lenovo" and "Dell"
The Platforms are:
"Redhat Linux xyz", Manufacturer: "RedHat"
"Windoof Server 20xx" Manufacturer "Microsoft".

Only for AIX and HPux it works, since they are also the Manufacturer of the Server/ Device.

For now, I removed just the validation part in the dcim/models/devices to make it work and disable this check.

As a Compromise, how about a config switch, to allow Users to disable this Limitation?

@Bastian-Kuhn commented on GitHub (Feb 21, 2025): And makes in Fact so sense: We have Device Type "Rack Server", Manufacturers are "Hewlett Packard", "Lenovo" and "Dell" The Platforms are: "Redhat Linux xyz", Manufacturer: "RedHat" "Windoof Server 20xx" Manufacturer "Microsoft". Only for AIX and HPux it works, since they are also the Manufacturer of the Server/ Device. For now, I removed just the validation part in the dcim/models/devices to make it work and disable this check. As a Compromise, how about a config switch, to allow Users to disable this Limitation?
Author
Owner

@h0-online commented on GitHub (Feb 21, 2025):

in addition to Bastian which statement I fully agree to, I'll show you how insonsequent this is handled in the GUI:

Image

where OS is

Image

Can you (Jeremy or any other in charge) pls. explain what is wrong with the semantically and only correct device?

The way to produce this as a manually entered device is to set the platform at first without manufacturer, create the device with the incorrect platform, change the manufacturer from NULL to "Microsoft". With that you will not be informed that hundreds of devices from POV of Netbox (defintely not in mine!) are now incorrect! And you are not able to change any other attribute of the now correct device, because the incorrect behaviour of Netbox source is wiping the correct platform out of the device without any fruther notification and you'll loose essential information :-( ...
Does this make sense in your eyes to punish the user by forcing him to enter incorrect/incomplete content in the so called source of truth?
There are mostly servers hit by this issue in Netbox, but this is preventing me to enter ~700 Windows- and ALMA-Linux-Hardware-Systems into Netbox. The current Netbox behaviour is working nice for network devices where manufacturer for firmware and hardware is identical, but it won't work for the devices mentioned above!
I think Netbox should leave it at the Configuration Manager with a config switch, if the behaviour is really wanted or not, as described by Bastian I took the oppurtunity as well and commented the little part of "error handling" out of the source to make things running as expected in the server world.
BTW: the current behaviour of Netbox works fine for virtual devices too where the manufacturer can be set to any manufacturer and should not be left blank/empty/NULL/None (like for Windows now in my case Microsoft), but when you do this then (hardware) devices won't work any longer as described above with this really explainable "feature".
I really beg you now to think again about this kind of inconsequence and switching this bug into a new feature request with a configurable switch as I am not allowed to...

@h0-online commented on GitHub (Feb 21, 2025): in addition to Bastian which statement I fully agree to, I'll show you how insonsequent this is handled in the GUI: ![Image](https://github.com/user-attachments/assets/4d0eaed2-14c4-4fb7-950d-577f43732f81) where OS is ![Image](https://github.com/user-attachments/assets/6e3c6964-774b-4ff1-8f3a-72cc0dfa3b13) Can you (Jeremy or any other in charge) pls. explain what is wrong with the semantically and only correct device? The way to produce this as a manually entered device is to set the platform at first without manufacturer, create the device with the incorrect platform, change the manufacturer from NULL to "Microsoft". With that you will not be informed that hundreds of devices from POV of Netbox (defintely not in mine!) are now incorrect! And you are not able to change any other attribute of the now correct device, because the incorrect behaviour of Netbox source is wiping the correct platform out of the device without any fruther notification and you'll loose essential information :-( ... Does this make sense in your eyes to punish the user by forcing him to enter incorrect/incomplete content in the so called source of truth? There are mostly servers hit by this issue in Netbox, but this is preventing me to enter ~700 Windows- and ALMA-Linux-Hardware-Systems into Netbox. The current Netbox behaviour is working nice for network devices where manufacturer for firmware and hardware is identical, but it won't work for the devices mentioned above! I think Netbox should leave it at the Configuration Manager with a config switch, if the behaviour is really wanted or not, as described by Bastian I took the oppurtunity as well and commented the little part of "error handling" out of the source to make things running as expected in the server world. BTW: the current behaviour of Netbox works fine for virtual devices too where the manufacturer can be set to any manufacturer and should not be left blank/empty/NULL/None (like for Windows now in my case Microsoft), but when you do this then (hardware) devices won't work any longer as described above with this really explainable "feature". I really beg you now to think again about this kind of inconsequence and switching this bug into a new feature request with a configurable switch as I am not allowed to...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10785