Feature request: Extend inventory items fields #787

Closed
opened 2025-12-29 16:25:50 +01:00 by adam · 5 comments
Owner

Originally created by @marc-us on GitHub (Mar 23, 2017).

feature request:

The usecase behind it, that we could make periodic check on the PCI devices within server, make sure all of them still present and nothing has been changed. (This is done by external monitoring script which polls netbox API)

We done it in the following way, but would like to share with community:

+++ b/netbox/dcim/models.py
    class_id = models.CharField(max_length=50, verbose_name='PCI Class id', blank=True)
    class_name = models.CharField(max_length=50, verbose_name='PCI Class name', blank=True)
    pci_vendor_id = models.CharField(max_length=50, verbose_name='PCI Vendor id', blank=True)
    pci_device_id = models.CharField(max_length=50, verbose_name='PCI Device id', blank=True)
    device_type = models.CharField(max_length=50, verbose_name='Device type', blank=True)
    slot = models.CharField(max_length=50, verbose_name='Slot', blank=True)
    comments = models.TextField(blank=True)

Should be editable when I open the form on GUI:

+++ b/netbox/dcim/forms.py
+        fields = ['name', 'manufacturer', 'part_id', 'serial', 'class_id', 'class_name', 'pci_vendor_id', 'pci_device_id', 'device_type', 'slot', 'comments']
+++ b/netbox/dcim/api/serializers.py
+        fields = ['id', 'device', 'parent', 'name', 'manufacturer', 'part_id', 'serial', 'discovered', 'class_id', 'class_name', 'pci_vendor_id', 'pci_device_id', 'device_type', 'slot', 'comments']

Just like when I query it via API:

+++ b/netbox/dcim/api/serializers.py
+        fields = ['id', 'device', 'parent', 'name', 'manufacturer', 'part_id', 'serial', 'discovered', 'class_id', 'class_name', 'pci_vendor_id', 'pci_device_id', 'device_type', 'slot', 'comments']
Originally created by @marc-us on GitHub (Mar 23, 2017). ### feature request: The usecase behind it, that we could make periodic check on the PCI devices within server, make sure all of them still present and nothing has been changed. (This is done by external monitoring script which polls netbox API) We done it in the following way, but would like to share with community: ``` +++ b/netbox/dcim/models.py class_id = models.CharField(max_length=50, verbose_name='PCI Class id', blank=True) class_name = models.CharField(max_length=50, verbose_name='PCI Class name', blank=True) pci_vendor_id = models.CharField(max_length=50, verbose_name='PCI Vendor id', blank=True) pci_device_id = models.CharField(max_length=50, verbose_name='PCI Device id', blank=True) device_type = models.CharField(max_length=50, verbose_name='Device type', blank=True) slot = models.CharField(max_length=50, verbose_name='Slot', blank=True) comments = models.TextField(blank=True) ``` Should be editable when I open the form on GUI: ``` +++ b/netbox/dcim/forms.py + fields = ['name', 'manufacturer', 'part_id', 'serial', 'class_id', 'class_name', 'pci_vendor_id', 'pci_device_id', 'device_type', 'slot', 'comments'] +++ b/netbox/dcim/api/serializers.py + fields = ['id', 'device', 'parent', 'name', 'manufacturer', 'part_id', 'serial', 'discovered', 'class_id', 'class_name', 'pci_vendor_id', 'pci_device_id', 'device_type', 'slot', 'comments'] ``` Just like when I query it via API: ``` +++ b/netbox/dcim/api/serializers.py + fields = ['id', 'device', 'parent', 'name', 'manufacturer', 'part_id', 'serial', 'discovered', 'class_id', 'class_name', 'pci_vendor_id', 'pci_device_id', 'device_type', 'slot', 'comments'] ```
adam closed this issue 2025-12-29 16:25:50 +01:00
Author
Owner

@jeremystretch commented on GitHub (Mar 23, 2017):

This is probably extending the data model a bit too far. I'd like to keep inventory data fairly generic to ensure that we can support all hardware.

Moving forward, the plan is to replace NetBox's very limited RPC functionality with NAPALM. NAPALM will use the OpenConfig platform model to represent hardware components, which we will store as InventoryItems in NetBox.

@jeremystretch commented on GitHub (Mar 23, 2017): This is probably extending the data model a bit too far. I'd like to keep inventory data fairly generic to ensure that we can support all hardware. Moving forward, the plan is to replace NetBox's _very_ limited RPC functionality with [NAPALM](https://github.com/napalm-automation/napalm). NAPALM will use the [OpenConfig platform model](https://github.com/openconfig/public/blob/master/release/models/platform/openconfig-platform.yang) to represent hardware components, which we will store as InventoryItems in NetBox.
Author
Owner

@marc-us commented on GitHub (Mar 23, 2017):

Okay, but two fields in any case would be good, slot/position and comments.
The first one would be the key for searching and rest of the content could be passed within the comment.

What you mention with napalm and openconfig is mean that netbox should be able to access to the equipments, however I think it is not so much good in multi site environment. I still belive that some middleware should upload/modify the data in the netbox.

@marc-us commented on GitHub (Mar 23, 2017): Okay, but two fields in any case would be good, slot/position and comments. The first one would be the key for searching and rest of the content could be passed within the comment. What you mention with napalm and openconfig is mean that netbox should be able to access to the equipments, however I think it is not so much good in multi site environment. I still belive that some middleware should upload/modify the data in the netbox.
Author
Owner

@jeremystretch commented on GitHub (Mar 23, 2017):

NetBox may or may not access the devices directly in a given deployment, but I want to make sure that its API endpoint for inventory items matches the OpenConfig model very closely.

@jeremystretch commented on GitHub (Mar 23, 2017): NetBox may or may not access the devices directly in a given deployment, but I want to make sure that its API endpoint for inventory items matches the OpenConfig model very closely.
Author
Owner

@jeremystretch commented on GitHub (Mar 27, 2017):

Closing this out for now. Let's wait and see how the NAPALM integration goes before we make any further changes to this model.

@jeremystretch commented on GitHub (Mar 27, 2017): Closing this out for now. Let's wait and see how the NAPALM integration goes before we make any further changes to this model.
Author
Owner

@misch42 commented on GitHub (Feb 14, 2019):

Any update on this topic? Is it possible to get the data of a device in a format described in the openconfig_interface model?

@misch42 commented on GitHub (Feb 14, 2019): Any update on this topic? Is it possible to get the data of a device in a format described in the openconfig_interface model?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#787