Inventory Item uniqueness #5687

Closed
opened 2025-12-29 19:31:29 +01:00 by adam · 8 comments
Owner

Originally created by @hiddenman on GitHub (Nov 18, 2021).

NetBox version

v3.0.10

Feature type

Change to existing functionality

Proposed functionality

I'd like to propose these changes to the InventoryItem class:

  1. Change uniqueness checking.
    Right now it's not possible to add more than one inventory item with the same type and name to the same device. For example, memory modules or cables. This error is thrown:
    CORSAIR Vengeance LPX Black Heat spreader: Inventory item with this Device, Parent and Name already exists.
    So we have to rename each item while all of them are the same.
    I think there is no need to check uniqueness at all here. What is this for?

Use case

This will help to track inventory items more accurately and conveniently.

Database changes

Add Status field

External dependencies

No response

Originally created by @hiddenman on GitHub (Nov 18, 2021). ### NetBox version v3.0.10 ### Feature type Change to existing functionality ### Proposed functionality I'd like to propose these changes to the InventoryItem class: 1. Change uniqueness checking. Right now it's not possible to add more than one inventory item with the same type and name to the same device. For example, memory modules or cables. This error is thrown: `CORSAIR Vengeance LPX Black Heat spreader: Inventory item with this Device, Parent and Name already exists. ` So we have to rename each item while all of them are the same. I think there is no need to check uniqueness at all here. What is this for? ### Use case This will help to track inventory items more accurately and conveniently. ### Database changes Add Status field ### External dependencies _No response_
adam added the type: feature label 2025-12-29 19:31:29 +01:00
adam closed this issue 2025-12-29 19:31:29 +01:00
Author
Owner

@jeremystretch commented on GitHub (Nov 18, 2021):

I think there is no need to check uniqueness at all here. What is this for?

The uniqueness check is there to prevent the addition of duplicate items. If you're adding items which don't have any unique name, they probably don't belong in NetBox to begin with. Inventory items are components like line cards, power supplies, etc., each of which typically has a unique identifier. A heatsink definitely doesn't sound appropriate.

@jeremystretch commented on GitHub (Nov 18, 2021): > I think there is no need to check uniqueness at all here. What is this for? The uniqueness check is there to prevent the addition of duplicate items. If you're adding items which don't have any unique name, they probably don't belong in NetBox to begin with. Inventory items are components like line cards, power supplies, etc., each of which typically has a unique identifier. A heatsink definitely doesn't sound appropriate.
Author
Owner

@hiddenman commented on GitHub (Nov 18, 2021):

I think there is no need to check uniqueness at all here. What is this for?

The uniqueness check is there to prevent the addition of duplicate items. If you're adding items which don't have any unique name, they probably don't belong in NetBox to begin with. Inventory items are components like line cards, power supplies, etc., each of which typically has a unique identifier. A heatsink definitely doesn't sound appropriate.

Actually, i just wanted to reduce the unique set, somehow like there: https://github.com/netbox-community/netbox/issues/7354

Just imaging, there are 48 SFP modules of the same type as inventory items.
Would you name them as SFP #1, SFP #2...SFP #48?

Of course, i do use a workaround like serial number in the name. However, i can't think of a situation when such a strict uniqueness check would help here.

" Inventory items are components like line cards, power supplies, etc., each of which typically has a unique identifier." - these items usually have the same name and the only unique part is a serial number (although sometimes even the serials are not unique).

How would you name two identical power supplies, for example? Power Supply #1 and Power Supply #2? What is best practices here?

@hiddenman commented on GitHub (Nov 18, 2021): > > I think there is no need to check uniqueness at all here. What is this for? > > The uniqueness check is there to prevent the addition of duplicate items. If you're adding items which don't have any unique name, they probably don't belong in NetBox to begin with. Inventory items are components like line cards, power supplies, etc., each of which typically has a unique identifier. A heatsink definitely doesn't sound appropriate. Actually, i just wanted to reduce the unique set, somehow like there: https://github.com/netbox-community/netbox/issues/7354 Just imaging, there are 48 SFP modules of the same type as inventory items. Would you name them as SFP #1, SFP #2...SFP #48? Of course, i do use a workaround like serial number in the name. However, i can't think of a situation when such a strict uniqueness check would help here. " Inventory items are components like line cards, power supplies, etc., each of which typically has a unique identifier." - these items usually have the same name and the only unique part is a serial number (although sometimes even the serials are not unique). How would you name two identical power supplies, for example? Power Supply #1 and Power Supply #2? What is best practices here?
Author
Owner

@jeremystretch commented on GitHub (Nov 18, 2021):

Just imaging, there are 48 SFP modules of the same type as inventory items.
Would you name them as SFP #1, SFP #2...SFP #48?

Yes, exactly. Just as they appear under the output of e.g. show chassis hardware (using JunOS as an example). How else would you know which is which?

How would you name two identical power supplies, for example? Power Supply #1 and Power Supply #2? What is best practices here?

By the unique positions in which they are installed. Otherwise there's no way to easily distinguish which is which. I can't think of any reason why you wouldn't do this.

@jeremystretch commented on GitHub (Nov 18, 2021): > Just imaging, there are 48 SFP modules of the same type as inventory items. > Would you name them as SFP #1, SFP #2...SFP #48? Yes, exactly. Just as they appear under the output of e.g. `show chassis hardware` (using JunOS as an example). How else would you know which is which? > How would you name two identical power supplies, for example? Power Supply #1 and Power Supply #2? What is best practices here? By the unique positions in which they are installed. Otherwise there's no way to easily distinguish which is which. I can't think of any reason why you _wouldn't_ do this.
Author
Owner

@hiddenman commented on GitHub (Nov 18, 2021):

By the unique positions in which they are installed. Otherwise there's no way to easily distinguish which is which. I can't think of any reason why you wouldn't do this.

In case of active and plugged in a particular port hardware/cable/whatever i would agree with you.

Just wanted to add some inventory items which do not belong to a particular port but must be tracked along with the device.
So may be this issue should be closed.

@hiddenman commented on GitHub (Nov 18, 2021): > By the unique positions in which they are installed. Otherwise there's no way to easily distinguish which is which. I can't think of any reason why you _wouldn't_ do this. In case of active and plugged in a particular port hardware/cable/whatever i would agree with you. Just wanted to add some inventory items which do not belong to a particular port but must be tracked along with the device. So may be this issue should be closed.
Author
Owner

@hiddenman commented on GitHub (Nov 18, 2021):

Btw, what do you think about the Status field. Does it make sense?

@hiddenman commented on GitHub (Nov 18, 2021): Btw, what do you think about the Status field. Does it make sense?
Author
Owner

@jeremystretch commented on GitHub (Nov 18, 2021):

Just wanted to add some inventory items which do not belong to a particular port but must be tracked along with the device.

It sounds like you're trying to repurpose the model to function as a general asset tracking mechanism, which is not its intended use.

Btw, what do you think about the Status field. Does it make sense?

Please open a separate FR for this.

@jeremystretch commented on GitHub (Nov 18, 2021): > Just wanted to add some inventory items which do not belong to a particular port but must be tracked along with the device. It sounds like you're trying to repurpose the model to function as a general asset tracking mechanism, which is not its intended use. > Btw, what do you think about the Status field. Does it make sense? Please open a separate FR for this.
Author
Owner

@hiddenman commented on GitHub (Nov 19, 2021):

Just wanted to add some inventory items which do not belong to a particular port but must be tracked along with the device.

It sounds like you're trying to repurpose the model to function as a general asset tracking mechanism, which is not its intended use.

Btw, what do you think about the Status field. Does it make sense?

Please open a separate FR for this.

Thank you, created a new one and edited this.

@hiddenman commented on GitHub (Nov 19, 2021): > > Just wanted to add some inventory items which do not belong to a particular port but must be tracked along with the device. > > It sounds like you're trying to repurpose the model to function as a general asset tracking mechanism, which is not its intended use. > > > Btw, what do you think about the Status field. Does it make sense? > > Please open a separate FR for this. Thank you, created a new one and edited this.
Author
Owner

@jeremystretch commented on GitHub (Dec 8, 2021):

I'm going to decline this FR as I believe the existing uniqueness enforcement is reasonable and necessary.

@jeremystretch commented on GitHub (Dec 8, 2021): I'm going to decline this FR as I believe the existing uniqueness enforcement is reasonable and necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5687