17268d913f
* Update APC NMC module ports * Update port names * Update with {module} names * Apparently you can't begin name with {module} --------- Co-authored-by: Robert Spadaro <squintfox@users.noreply.github.com> Co-authored-by: Daniel W. Anner <daniel.anner@danstechsupport.com> |
||
---|---|---|
.github | ||
device-types | ||
module-types | ||
schema | ||
tests | ||
.gitignore | ||
.pre-commit-config.yaml | ||
.yamllint.yaml | ||
CONTRIBUTING.md | ||
LICENSE.txt | ||
README.md | ||
requirements.txt |
NetBox Device Type Library
About this Library
This library is intended to be used for populating device types in NetBox. It contains a set of device type definitions expressed in YAML and arranged by manufacturer. Each file represents a discrete physical device type (e.g. make and model). These definitions can be loaded into NetBox instead of creating new device type definitions manually.
If you would like to contribute to this library, please read through our contributing guide before submitting content.
If you would like to automate the import of these devicetype template files, there is a community based python script that will check for duplicates, allow you to selectively import vendors, etc. available here minitriga/Netbox-Device-Type-Library-Import. Note: This is not related to NetBox in any official way and you will not get support for it here.
Device Type Definitions
Each definition must include at minimum the following fields:
manufacturer
: The name of the manufacturer which produces this device type.- Type: String
model
: The model number of the device type. This must be unique per manufacturer.- Type: String
slug
: A URL-friendly representation of the model number. Like the model number, this must be unique per manufacturer.- Type: String
- Pattern:
"^[-a-zA-Z0-9_]+$"
. Must match the following characters:-
,_
, Uppercase or Lowercasea
toz
, Numbers0
to9
.
🧪 Valid Example:
manufacturer: Dell model: PowerEdge R6515 slug: dell-poweredge-r6515
The following fields may optionally be declared:
part_number
: An alternative representation of the model number (e.g. a SKU). (Default: None)- Type: String
🧪 Example:
part_number: D109-C3
u_height
: The height of the device type in rack units. Increments of 0.5U are supported. (Default: 1)- Type: number (minimum of
0
, multiple of0.5
)
- Type: number (minimum of
🧪 Example:
u_height: 12.5
is_full_depth
: A boolean which indicates whether the device type consumes both the front and rear rack faces. (Default: true)- Type: Boolean
🧪 Example:
is_full_depth: false
airflow
: A decleration of the airflow pattern for the device. (Default: None)- Type: String
- Options:
front-to-rear
rear-to-front
left-to-right
right-to-left
side-to-rear
passive
🧪 Example:
airflow: side-to-rear
subdevice_role
: Indicates that this is aparent
orchild
device. (Default: None)- Type: String
- Options:
parent
child
🧪 Example:
subdevice_role: parent
comments
: A string field which allows for comments to be added to the device. (Default: None)- Type: String
🧪 Example:
comments: This is a comment that will appear on all NetBox devices of this type
weight
: An array with a single item that allow for a value and unit of measurement to be defined. (Default: None)- Type: Array
- Value: Number - must be multiple of 0.01
- Unit: String
- Options:
- kg
- g
- lb
- oz
- Options:
🧪 Example:
weight: - value: 12.21 unit: lb
For further detail on these attributes and those listed below, please reference the schema definitions and the Component Definitions below.
Component Definitions
Valid component types are listed below. Each type of component must declare a list of the individual component templates to be added.
console-ports
console-server-ports
power-ports
power-outlets
interfaces
front-ports
rear-ports
module-bays
device-bays
inventory-items
The available fields for each type of component are listed below.
Console Ports
name
: Namelabel
: Labeltype
: Port type slug (Array)
Console Server Ports
name
: Namelabel
: Labeltype
: Port type slug (Array)
Power Ports
name
: Namelabel
: Labeltype
: Port type slug (Array)maximum_draw
: The port's maximum power draw, in watts (optional)allocated_draw
: The port's allocated power draw, in watts (optional)
Power Outlets
name
: Namelabel
: Labeltype
: Port type slug (Array)power_port
: The name of the power port on the device which powers this outlet (optional)feed_leg
: The phase (leg) of power to which this outlet is mapped; A, B, or C (optional)
Interfaces
name
: Namelabel
: Labeltype
: Interface type slug (Array)mgmt_only
: A boolean which indicates whether this interface is used for management purposes only (default: false)
Front Ports
name
: Namelabel
: Labeltype
: Port type slug (Array)rear_port
: The name of the rear port on this device to which the front port mapsrear_port_position
: The corresponding position on the mapped rear port (default: 1)
Rear Ports
name
: Namelabel
: Labeltype
: Port type slug (Array)positions
: The number of front ports that can map to this rear port (default: 1)
Module Bays
name
: Namelabel
: Labelposition
: The module bay's position within the parent device
Device Bays
name
: Namelabel
: Label
Inventory Items
name
: Namelabel
: Labelmanufacturer
: The name of the manufacturer which produces this itempart_id
: The part ID assigned by the manufacturer
Data Validation / Commit Quality Checks
There are two ways this repo focuses on keeping quality device-type definitions:
- Pre-Commit Checks - Optional, but highly recommended, for helping to identify simple issues before committing. (trailing-whitespace, end-of-file-fixer, check-yaml, yamlfmt, yamllint)
- Installation
- Virtual Environment Route
- It is recommended to create a virtual env for your repo (
python3 -m venv venv
) - Install the required pip packages (
pip install -r requirements.txt
) - Continue to the "Install
pre-commit
Hooks"
- It is recommended to create a virtual env for your repo (
pre-commit
Only Route- Install pre-commit (
pip install pre-commit
)
- Install pre-commit (
- Install
pre-commit
Hooks- To install the pre-commit script:
pre-commit install
- To install the pre-commit script:
- Virtual Environment Route
- Usage & Useful
pre-commit
Commands- After staging your files with
git
, to run the pre-commit script on changed files:pre-commit run
- To run the pre-commit script on all files:
pre-commit run --all
- To uninstall the pre-commit script:
pre-commit uninstall
- After staging your files with
- Learn more about pre-commit
- Installation
- GitHub Actions - Automatically run before a PR can be merged. Repeats yamllint & validates against NetBox Device-Type Schema.