Netbox: Feature request: Extend inventory items fields

Created on 23 Mar 2017  路  5Comments  路  Source: netbox-community/netbox

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']

Most helpful comment

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.

All 5 comments

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.

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.

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.

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

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

Was this page helpful?
0 / 5 - 0 ratings