-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Extend module types to support modeling FRU components #19002
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
Comments
I would like to suggest that JSON Schema enum type was accepted in addition to the basic json schemas types. One very common use case was to model transceivers. Today we use inventory itens to document transceivers, but most transceiver information can be specified using two enums - Ethernet Pmd (1000Base-T, 10GBASE-LR, ...) and Form Factor: (XFP, SFP, SFP+ ...), in addition the vendor part number field. The module instance UI form can render an 'Selection Input Box' to choose from the json enum choices. Also, I suggest that at least the 'required' keyword from json schema was accepted and enforced. |
Yep, this is supported by JSON schema. For example: {
"properties": {
"supply": {
"description": "Nature of the current delivered",
"enum": [
"AC",
"DC"
],
"title": "Supply type"
}
}
} |
* Move Module & ModuleType models to a separate file * Add ModuleTypeProfile & related fields * Initial work on JSON schema validation * Add attributes property on ModuleType * Introduce MultipleOfValidator * Introduce JSONSchemaProperty * Enable dynamic form field rendering * Misc cleanup * Fix migration conflict * Ensure deterministic ordering of attriubte fields * Support choices & default values * Include module type attributes on module view * Enable modifying individual attributes via REST API * Enable filtering by attribute values * Add documentation & tests * Schema should be optional * Include attributes column for profiles * Profile is nullable * Include some initial profiles to be installed via migration * Fix migrations conflict * Fix filterset test * Misc cleanup * Fixes #19023: get_field_value() should respect null values in bound forms (#19024) * Skip filters which do not specify a JSON-serializable value * Fix handling of array item types * Fix initial data in schema field during bulk edit * Implement sanity checking for JSON schema definitions * Fall back to filtering by string value
Uh oh!
There was an error while loading. Please reload this page.
NetBox version
v4.2.6
Feature type
Data model extension
Proposed functionality
ModuleTypeProfile
Introduce a new ModuleTypeProfile model to represent a meta class of module types (e.g. power supply, NIC, or GPU). Each instance of this model will define a user-configurable schema of attributes to be assigned on module types having this profile.
The
schema
field will hold a user-defined JSON schema which defines the scalar attributes that can be defined on module types with this profile. For example, a CPU profile might have a profile specify the following:Note that these attributes are intentionally limited to storing the basic types supported by JSON schema (strings, numbers, booleans, and null). Any more advanced needs will require the use of a custom field on the ModuleType model.
ModuleType
Two new fields will be added to the ModuleType model:
profile
: An optional ForeignKey to ModuleTypeProfileattributes
: A JSONField which stores the assigned key-value pairs for a module type as defined by the assigned profileWhen editing a module type, the UI form will be extended to render all profile attributes as discrete form fields, with simple validation applied automatically.
Use case
The introduction of module type profiles with configurable attributes will improve the ability to accurately model field-replaceable units (FRU) as modules in NetBox. Today, this is typically done using inventory items, however that model is considerably limited in several ways:
Modules are better suited for this task, as only the last constraint listed above affects modules as well, and is overcome by the changes proposed in this FR. (Ultimately, we'll likely deprecate inventory items in favor of this and related improvements to modules.)
Database changes
profile
ForeignKey on ModuleTypeattributes
JSONField on ModuleTypeExternal dependencies
This will introduce a dependency in the
jsonschema
Python library.The text was updated successfully, but these errors were encountered: