NetBox Community Device Type Library

repository·master·Indexed 21 days ago

https://github.com/netbox-community/devicetype-library

A library of YAML-based device, module, and rack type definitions used to populate NetBox databases with manufacturer-specific hardware models. It includes specifications for defining device types, rack types, module types, and various components such as console ports, power ports, interfaces, and module bays.

Tokens
2.5K
Snippets
3
Records
16
Agent score
32%

What's inside netbox-community-devicetype-library

  1. Organize Module Type Images

    master

    Module type images are stored in a flat structure under module-images/<manufacturer>/. There are no per-module subdirectories.

    Requirements:

    • A corresponding module-type definition must exist in module-types/ before adding images.
    • Naming Convention: <module-type>.(front|rear).<ext> (e.g., RMCARD205.front.png). Filenames must include .front or .rear.
    • Content: Only clean, orthogonal front or rear face views. Do not use angled, marketing, or side/top shots.
    • Limit: Maximum of 2 images per module type (one front, one rear).
  2. Automate importing device type definitions

    master

    To automate the import of YAML device type template files into NetBox, use the NetBox Community Python script. This script provides features such as checking for duplicates and selectively importing specific vendors.

    It is available in the netbox-community/Device-Type-Library-Import repository.

  3. Set up pre-commit checks

    master

    Pre-commit checks help identify issues like trailing whitespace or YAML linting errors before raising a PR. It is highly recommended to use a virtual environment.

    Installation via Virtual Environment

    1. Create a virtual environment:
      python3 -m venv venv
    2. Install requirements:
      pip install -r requirements.txt
    3. Install pre-commit hooks:
      pre-commit install

    Installation via pre-commit only

    1. Install pre-commit:
      pip install pre-commit
    2. Install hooks:
      pre-commit install

    Useful Commands

    • Run on changed files (after git add):
      pre-commit run
    • Run on all files:
      pre-commit run -all
    • Uninstall hooks:
      pre-commit uninstall
    python3 -m venv venv
    pip install -r requirements.txt
    pre-commit install
  4. Define a Device Type

    master

    Device type definitions are expressed in YAML and represent discrete physical devices.

    Required Fields

    • manufacturer: (String) The name of the manufacturer.
    • model: (String) The model number. Must be unique per manufacturer.
    • slug: (String) A URL-friendly representation of the model number. Must be unique per manufacturer and follow the pattern ^[-a-z0-9_]+$. Note: Prepend the manufacturer's name followed by a dash (e.g., dell-poweredge-r670).
    • u_height: (Number) Height in rack units (supports 0.5U increments). Note: For child devices, u_height must be 0.
    • is_full_depth: (Boolean) Indicates if the device consumes both front and rear rack faces. Defaults to true.

    Optional Fields

    • part_number: (String) Alternative model representation/SKU.
    • airflow: (String) Airflow pattern. Options: front-to-rear, rear-to-front, left-to-right, right-to-left, side-to-rear, rear-to-side, bottom-to-top, top-to-bottom, passive, mixed.
    • front_image: (Boolean) If true, indicates a front elevation image exists in the elevation-images/ folder. File naming convention: <SLUG>.front.<format>.
    • rear_image: (Boolean) If true, indicates a rear elevation image exists in the elevation-images/ folder. File naming convention: <SLUG>.rear.<format>.
    • subdevice_role: (String) Indicates if the device is a parent or child.
    • is_powered: (Boolean) If false, the device does not take power (useful for patch panels).
    • weight: (Number) Numeric weight (multiple of 0.01).
    • weight_unit: (String) Unit of measurement. Options: kg, g, lb, oz.
    • comments: (String) Additional notes.
    manufacturer: Dell
    model: PowerEdge R670
    slug: dell-poweredge-r670
    u_height: 1
    is_full_depth: true
  5. Define Interfaces

    master

    Interfaces represent network interfaces used to exchange data (e.g., Ethernet).

    Available in all NetBox versions.

    Supported fields:

    • name: Name
    • label: Label
    • type: Interface type slug (Array)
    • mgmt_only: Boolean indicating if the interface is for management only (default: false)
    • poe_mode: Indicates if the device is POE powered (pd) or provides POE (pse)
    • poe_type: Classification of PoE transmission supported
  6. Define Console Ports

    master

    Console ports provide connectivity to a device's physical console, used for local access or remote out-of-band access via a console server.

    Available in NetBox 2 and later.

    Supported fields:

    • name: Name
    • label: Label
    • type: Port type slug (Array)
    • _is_power_source: Internal use for power validation (default: false)
  7. Define a Rack Type

    master

    Rack type definitions describe the physical characteristics of a rack.

    Required Fields

    • manufacturer: (String) The name of the manufacturer.
    • model: (String) The model number. Must be unique per manufacturer.
    • slug: (String) URL-friendly representation. Must follow pattern ^[-a-z0-9_]+$ and prepend the manufacturer name with a dash.
    • form_factor: (String) Physical characteristics (e.g., 4-post-frame).
    • width: (Integer) Width in inches/zoll (e.g., 19).
    • u_height: (Number) Height in rack units.
    • starting_unit: (Number) The unit number where the rack starts (e.g., 1).
    • outer_width, outer_height, outer_depth, outer_unit, weight, max_weight, weight_unit, mounting_depth, desc_units.
    manufacturer: Startech
    model: 4 Post 42U
    slug: startech-4postrack42
    form_factor: 4-post-frame
    width: 19
    u_height: 42
    starting_unit: 1
  8. Define Device Bays

    master

    Device bays represent slots in a parent device where a child device (e.g., a blade server in a chassis) is installed. Child devices are independent managed entities with their own platform, role, and components. They do not appear in rack elevations or consume rack units.

    Available in all NetBox versions.

    Supported fields:

    • name: Name
    • label: Label
  9. Define Power Ports

    master

    Power ports represent internal power supplies that draw power from an external source.

    Note: For devices with removable Power Supplies (like FRUs), model them using module-bays and place the power-port within the PSU module.

    Available in NetBox 1.7 and later.

    Supported fields:

    • name: Name
    • label: Label
    • type: Port type slug (Array)
    • maximum_draw: Maximum power draw in watts (optional)
    • allocated_draw: Allocated power draw in watts (optional)
  10. Define a Module Type

    master

    Module type definitions represent components that can be installed into devices.

    Required Fields

    • manufacturer: (String) The name of the manufacturer.
    • model: (String) The model number. Must be unique per manufacturer.

    Optional Fields

    • profile: (String) The module profile. Options: CPU, Fan, GPU, Hard disk, Memory, Power supply, Expansion card.
    • attribute_data: (Object) Data associated with the chosen profile:
      • CPU: architecture (string), cores (integer), speed (number).
      • Fan: rpm (integer).
      • GPU: gpu (string), interface (options: PCIe 4.0, PCIe 4.0 x8, PCIe 4.0 x16, PCIe 5.0 x16), memory (integer, Required).
      • Hard disk: size (integer), speed (integer), disk_type (options: HD, SSD, NVME, Required).
      • Memory: class (options: DDR3, DDR4, DDR5, Required), data_rate (integer), ecc (boolean), size (integer, Required).
      • Power supply: wattage (integer), hot_swappable (boolean, Required), input_current (options: AC, DC, Required), input_voltage (number, Required).
      • Expansion card: bandwidth (integer), connector_type (string).
    • airflow, comments, weight, weight_unit, part_number: (Same as Device Type definitions).