devicetype-library icon indicating copy to clipboard operation
devicetype-library copied to clipboard

Add functionality to support Module Types

Open bastianleicht opened this issue 11 months ago • 3 comments

As implemented in Netbox 4.3.X Modules are now able to get a "Profile"

Image

This is currently not implemented in this Library.

Here is the Netbox Documentation for Module Profiles: https://netbox.city-pc.cloud/static/docs/models/dcim/moduletypeprofile/

bastianleicht avatar May 21 '25 12:05 bastianleicht

I currently don't understand how this should be modeled in Yaml. If you export a Module with those Profiles, they are missing in the exported Config.

bastianleicht avatar May 22 '25 08:05 bastianleicht

I currently don't understand how this should be modeled in Yaml. If you export a Module with those Profiles, they are missing in the exported Config.

Not if you have a custom one. I cloned the HDD and created two sub module type profiles for magnetic / flash storage:

{
    "properties": {
        "size": {
            "description": "Raw disk capacity",
            "title": "Size (GB)",
            "type": "integer"
        },
        "speed": {
            "title": "Speed (RPM)",
            "type": "integer"
        },
        "transfer_rate": {
            "description": "Theoretical maximum transfer rate in MB/s",
            "title": "Transfer Rate (MB/s)",
            "type": "integer"
        }
    },
    "required": [
        "size"
    ]
}

and

{
    "properties": {
        "size": {
            "description": "Raw disk capacity",
            "title": "Size (GB)",
            "type": "integer"
        },
        "transfer_rate": {
            "description": "Theoretical maximum transfer rate in MB/s",
            "title": "Transfer Rate (MB/s)",
            "type": "integer"
        },
        "type": {
            "default": "SSD",
            "enum": [
                "SSD",
                "NVME"
            ],
            "title": "Disk type",
            "type": "string"
        }
    },
    "required": [
        "size"
    ]
}

I then create a module type using those profiles and this is what the export button gives me:

profile: Hard disk (Magnetic)
manufacturer: Western Digital
model: WD100EMAZ
part_number: WD100EMAZ
description: ''
weight: null
weight_unit: null
comments: ''

Modeling a module-type-profile does appear to just be:

  • Name (required)
  • Description
  • Schema
  • Tags
  • Comments

Given that the module-type-profiles are just additional attributes that can be bespoke, it would probably be best to adopt a "not in this repo / you BYO" approach here?

I can still "upstream" a module type for each HDD/Model that I have and individual users can manually create/enrich as they see fit.

kquinsland avatar Jun 18 '25 00:06 kquinsland

Hi All,

Yes I was having a look at this yesterday if we did support this it would only be based on the default ones, however after doing some import testing it doesn't look like you can currently import modules with their profiles defined in yaml. If you export a module that has a profile defined it will only output the profile name as shown above it does seem to output any of the parameters.

harryajc avatar Jun 18 '25 07:06 harryajc