Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'role' to Inventory Items #3087

Closed
candlerb opened this issue Apr 18, 2019 · 14 comments
Closed

Add 'role' to Inventory Items #3087

candlerb opened this issue Apr 18, 2019 · 14 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Milestone

Comments

@candlerb
Copy link
Contributor

Environment

  • Python version: 3.5.4
  • NetBox version: 2.3.6

Proposed Functionality

Add a "role" field to Inventory Items.

Use Case

  • To classify inventory items by function, e.g. "OS disk", "data disk", "hot spare"; and/or
  • To classify inventory items by type, e.g. "motherboard", "CPU", "RAM", "NIC"

Inventory items already have Tags, but the idea of using Tags for this was rejected in #3082

Database Changes

Add a "role_id" column to Inventory Item, which references device role. Make it nullable for backwards compatibility.

Probably want to add a new flag to dcim_devicerole to say whether it's usable on an inventory item (comparable to existing vm_role flag)

At this point it may also be worth having a flag to say whether the role is usable on Device (since I can imagine roles which are relevant to Inventory Item but not Device, and vice versa)

External Dependencies

None

@jeremystretch jeremystretch added the status: under review Further discussion is needed to determine this issue's scope and/or implementation label Apr 19, 2019
@a31amit
Copy link

a31amit commented Apr 19, 2019

This will be very useful but there would be a need to filter them by role in inventory items list view

@mmahacek
Copy link
Contributor

Reading the request, I was initially in support of this, but have since grown mixed feelings. I am abstaining from voting on this. Not against this idea, but wouldn't expect to use it on my server.

@jeremystretch
Copy link
Member

jeremystretch commented Apr 27, 2019

Add a "role_id" column to Inventory Item, which references device role.

Wouldn't InventoryItem roles and Device roles generally by mutually exclusive of one another? E.g. a "router" can't be an InventoryItem and a "hard disk" can't be a Device.

Edit:

since I can imagine roles which are relevant to Inventory Item but not Device, and vice versa

Missed that. Can you provide some examples?

@candlerb
Copy link
Contributor Author

I was just saying what you said more clearly: that in many (most? all?) cases, Inventory Item roles would not be relevant to Device, or vice versa.

So there could be a separate Inventory Item Roles list - but doing so would mean code duplication (e.g. for editing them, setting colours etc) and some menu clutter.

Are there any examples where the same role would apply to both? Probably not. Maybe "hot spare" - on a device that might be better managed by Status, although there isn't one exactly that matches that (there are "offline" and "planned")

@a31amit
Copy link

a31amit commented Apr 27, 2019

Or this can be exposed only in ADMIN panel and Netbox Administrator can create them in advance.

@wols
Copy link

wols commented Jun 5, 2019

My wish: add Inventory to 'Device Type - Status' = 'Parent/Child/Inventory status'

Reuse the 'Device Bay' logic...
...and update 'Editing device role' with 'VM Role/Inventory Role'.

So I could map the following:

  1. 'Add a new device type': select Manufacturer / Power Supply / Part number / 0U / Status Inventory
  2. Go to (non-racked/racked server) 'Device - Inventory - Add Inventory Item'
  3. 'Add a new inventory item': Name Power Supply 1 / select Manufacturer / Part from step '1.' / Serial number
  4. 'Add a new inventory item': Name Power Supply 2 / select Manufacturer / Part from step '1.' / Serial number

...two Power Supplies added to the server inventory - no more CopyPaste Part Numbers.

@candlerb The 'Inventory Item' dialog needs the 'Inventory Role' now. For my Power Supplies eg. master/slave, left/right, primary/secondary or top/bottom...

@candlerb
Copy link
Contributor Author

candlerb commented Jun 6, 2019

I think what you want is instead to have Inventory Item Type (analagous to Device Type). This seems like a reasonable idea to me.

Devices cannot contain other Devices as Inventory Items, they are completely distinct types of objects.

@a31amit
Copy link

a31amit commented Jun 14, 2019

I believe making device roles to more generic could be good and another boolean similar to VM Role.

As of now, Devices and VirtualMachines are different models but shares the same Device Roles. We could have something similar flag inventory_item which can be assigned only to inventory items.

As in original request, it was proposed that roles could be a function or physical type.

@hSaria
Copy link
Contributor

hSaria commented Jan 2, 2020

@jeremystretch I think this ticket can be closed as it is a duplicate of #3333

@jeremystretch
Copy link
Member

@hSaria The two proposals are related but different. Similar to the difference between the DeviceRole and DeviceType models.

@hSaria
Copy link
Contributor

hSaria commented Jan 2, 2020 via email

@ibivibiv
Copy link

FYI, both the typing and the role have been implemented in a fork here:

nmereddi@80943c7

If we can get an actual issue up for this and get it accepted we can get this ball rolling? If we are deadlocked then maybe we build out something else in a companion app? I think it would be better to have this functionality built in rather than having to go around it just to track what a component inside a server is and its role?

@jeremystretch jeremystretch added type: feature Introduction of new functionality to the application needs milestone Awaiting prioritization for inclusion with a future NetBox release and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Jul 24, 2020
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed needs milestone Awaiting prioritization for inclusion with a future NetBox release labels May 25, 2021
@jeremystretch jeremystretch added this to the v3.2 milestone May 25, 2021
@PieterL75
Copy link
Contributor

Can we have the 'Inventory' also made part of the 'Device template' ?
At least to create the 'items' that can be in the inventory of a device, but also the option to put 'default' parts in the inventory.
Ex: MY switches have 4 fans. 2 psu and 2 empty slots... So the template would create 8 inventory items, with the fan and power models already populates but with the slots just empty items

@jeremystretch
Copy link
Member

jeremystretch commented Dec 23, 2021

Can we have the 'Inventory' also made part of the 'Device template' ?

FYI @PieterL75 opened #8118 for this. We may take this on as part of the related work already scheduled for v3.2.

@jeremystretch jeremystretch self-assigned this Dec 27, 2021
jeremystretch added a commit that referenced this issue Dec 27, 2021
jeremystretch added a commit that referenced this issue Dec 27, 2021
jeremystretch added a commit that referenced this issue Dec 27, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

8 participants