### Install Pre-commit and Hooks Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/validation-testing.md Install the pre-commit framework and its associated hooks by installing requirements and then initializing the hooks. ```bash pip install -r requirements.txt pre-commit install ``` -------------------------------- ### Example Device Bays Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/components.md Provides an example of how to define multiple device bays with names and labels. ```yaml device-bays: - name: Blade1 label: Blade Server Slot 1 - name: Blade2 label: Blade Server Slot 2 ``` -------------------------------- ### 42U Open Frame Example Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/rack-types.md Example YAML definition for a 42U open frame rack. ```yaml manufacturer: StarTech model: 4 Post 42U slug: startech-4postrack42 form_factor: 4-post-frame width: 19 u_height: 42 starting_unit: 1 ``` -------------------------------- ### Example Console Server Port Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/components.md An example of how to define a console server port with a name, type, and label. ```yaml console-server-ports: - name: port-01 type: rj-45 label: Device A Console ``` -------------------------------- ### Module Bay Example Configuration Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/components.md An example showing the configuration of two module bays, 'Slot1' and 'Slot2', with their respective positions 'S1' and 'S2'. ```yaml module-bays: - name: Slot1 position: S1 - name: Slot2 position: S2 ``` -------------------------------- ### Wall-Mounted Cabinet Example Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/rack-types.md Example YAML definition for a wall-mounted cabinet. ```yaml manufacturer: APC model: AR3100 slug: apc-ar3100 form_factor: 4-post-cabinet width: 19 u_height: 42 starting_unit: 1 outer_height: 1991 outer_depth: 1070 outer_unit: mm weight: 125 max_weight: 1701 weight_unit: kg mounting_depth: 190 desc_units: false description: NetShelter SX 42U Server Rack Enclosure 600mm x 1070mm w/ Sides Black ``` -------------------------------- ### Example Module Definition with Power Supply Profile Source: https://github.com/netbox-community/devicetype-library/blob/master/README.md This example demonstrates how to define a module with a 'Power supply' profile, including its associated attributes like wattage, hot-swappable status, input current, and voltage. ```yaml profile: Power supply attribute_date: wattage: 550 hot_swappable: true input_current: AC input_voltage: 240 ``` -------------------------------- ### Install pre-commit Hooks Source: https://github.com/netbox-community/devicetype-library/blob/master/README.md Installs the pre-commit script to help identify simple issues before raising a PR. Ensure you have pre-commit installed (`pip install pre-commit`). ```bash pre-commit install ``` -------------------------------- ### Install Test Dependencies Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/usage-guide.md Installs necessary Python packages and Git hooks for local validation of device type definitions. ```bash pip install -r requirements.txt pre-commit install ``` -------------------------------- ### Rear Port Example Configuration Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/components.md An example demonstrating the configuration of two rear ports, 'A:1' and 'A:2', both of type 'splice' and with one position. ```yaml rear-ports: - name: 'A:1' type: splice positions: 1 - name: 'A:2' type: splice positions: 1 ``` -------------------------------- ### Power Outlet Configuration Example Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/components.md Example of defining power outlets, specifying their names, types, connected power ports, and feed legs. Ensure the 'type' and 'power_port' properties are correctly set. ```yaml power-outlets: - name: outlet-1 type: iec-60320-c13 power_port: PSU1 feed_leg: A - name: outlet-2 type: iec-60320-c13 power_port: PSU1 feed_leg: B ``` -------------------------------- ### Console Port Example Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/components.md An example demonstrating how to define a console port with a name, type, and optional label. This configuration is used within the device or module YAML definition. ```yaml console-ports: - name: console type: rj-45 label: Management Console ``` -------------------------------- ### Example Device Type File Paths Source: https://github.com/netbox-community/devicetype-library/blob/master/CONTRIBUTING.md Illustrates the directory structure and naming convention for device type definition files. ```text device-types/Acme/BFR-1000.yaml device-types/Acme/BFR-2000.yaml ``` -------------------------------- ### Example Power Ports Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/components.md An example demonstrating the definition of two power ports, specifying their type, maximum draw, and allocated draw. ```yaml power-ports: - name: PSU1 type: iec-60320-c14 maximum_draw: 500 allocated_draw: 400 - name: PSU2 type: iec-60320-c14 maximum_draw: 500 ``` -------------------------------- ### Install Test Dependencies Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/README.md Installs the necessary Python packages for running validation tests. Ensure you are in the project's root directory. ```bash # Install test dependencies pip install -r requirements.txt ``` -------------------------------- ### Rack Type Definition Example Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/README.md Defines a physical enclosure like a server rack, specifying its manufacturer, model, form factor, dimensions, and starting unit. The 'slug' provides a URL-friendly identifier. ```yaml manufacturer: APC model: NetShelter SX 42U slug: apc-netshelter-sx-42u form_factor: 4-post-cabinet width: 19 u_height: 42 starting_unit: 1 ``` -------------------------------- ### Example Front Port Configuration Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/components.md Illustrates how to define multiple front ports with different configurations, including specifying connector types, colors, and rear port connections. ```yaml front-ports: - name: 'A:1' type: 8p8c color: 2196f3 rear_port: 'A:1' rear_port_position: 1 - name: 'A:2' type: 8p8c rear_port: 'A:2' ``` -------------------------------- ### Standard 42U 4-Post Cabinet Example Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/rack-types.md Example YAML definition for a standard 42U 4-post cabinet. ```yaml manufacturer: APC model: AR1300 slug: apc-ar1300 form_factor: 4-post-cabinet description: APC NetShelter SX, Server Rack Enclosure, 42U, Black, 1991H x 600W x 1070D mm [TAA] width: 19 u_height: 42 starting_unit: 1 outer_width: 600 outer_height: 1991 outer_depth: 1070 outer_unit: mm mounting_depth: 914 weight: 125.09 max_weight: 1020 weight_unit: kg desc_units: false ``` -------------------------------- ### Slug Naming Convention Examples Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/usage-guide.md Examples of valid slugs for network devices, illustrating the required format and character restrictions. ```text cisco-catalyst-2960x-48ts-l dell-poweredge-r750 juniper-ex4400-48p ``` -------------------------------- ### Slug Generation Process Example Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/usage-guide.md Demonstrates the step-by-step process for generating a unique and compliant slug for a Cisco Catalyst model, including character transformations. ```text 1. Manufacturer → cisco 2. Model → catalyst-2960x-48ts-l 3. Combined → cisco-catalyst-2960x-48ts-l Character transformations: - Spaces → hyphens - Remove parentheses - Remove special characters (!, *, &, /, ') - Lowercase all letters - Replace "+" with "plus" ``` -------------------------------- ### Interface Configuration Example Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/components.md Example of defining network interfaces, including their names, types, management-only status, PoE mode, and PoE type. The 'type' property must correspond to a valid interface type. ```yaml interfaces: - name: eth0 type: 1000base-t mgmt_only: true poe_mode: pd poe_type: 802.3at - name: eth1 type: 10gbase-x-sfp - name: wifi0 type: wifi-6 rf_role: ap ``` -------------------------------- ### Module Component Definition Example Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/module-types.md Example of defining network components within a module, similar to device type component definitions. The '{module}' placeholder is dynamically replaced. ```yaml manufacturer: ADC model: PPP-LC-SM part_number: 7033 1 092-000 description: PPP module with 6 x Duplex LC Single Mode front-ports: - name: '{module}:1' type: lc-upc color: 2196f3 rear_port: '{module}:1' rear_port_position: 1 rear-ports: - name: '{module}:1' type: splice positions: 1 ``` -------------------------------- ### Example PoE Interface Configuration Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/usage-guide.md This snippet shows how to configure a network interface with PoE (Power over Ethernet) capabilities, specifying the PoE mode and type. ```yaml interfaces: - name: eth0 type: 1000base-t poe_mode: pse # Device provides PoE poe_type: 802.3at # PoE Plus (30W) ``` -------------------------------- ### Simple 1U Switch Definition Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/device-types.md Example YAML definition for a basic 1U network switch. ```yaml manufacturer: 3Com model: 2226-SFP-Plus slug: 3com-2226-sfp-plus part_number: 3CBLSF26 u_height: 1 is_full_depth: false weight: 1.7 weight_unit: kg airflow: left-to-right console-ports: - name: console type: rj-45 power-ports: - name: PS1 type: iec-60320-c14 maximum_draw: 20 interfaces: - name: FastEthernet0/1 type: 100base-tx - name: GigabitEthernet0/1 type: 1000base-x-sfp ``` -------------------------------- ### Patch Panel Device Type Example with Mapping Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/usage-guide.md Defines a patch panel, including its dimensions, front ports, and rear ports with mapping information. This example uses '8p8c' for both front and rear port types. ```yaml manufacturer: Panduit model: Cat6A UTP Patch Panel slug: panduit-cat6a-utp-patch-panel-24 u_height: 1 is_full_depth: false is_powered: false front-ports: - name: port-1 type: 8p8c rear_port: rear-1 - name: port-2 type: 8p8c rear_port: rear-1 rear_port_position: 2 # ... continue for all ports rear-ports: - name: rear-1 type: 8p8c positions: 2 # ... continue for all rear ports ``` -------------------------------- ### Define Console Ports Source: https://github.com/netbox-community/devicetype-library/wiki/Console-Ports Example of how to define console ports for a device, specifying name, label, and type. Ensure the 'type' value is one of the accepted slugs. ```yaml console-ports: - name: Console label: RJ-45 Console type: rj-45 - name: USB label: USB Console type: usb-mini-b ``` -------------------------------- ### Chassis with Module Bays Definition Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/device-types.md Example YAML definition for a network chassis device with multiple module bays. ```yaml manufacturer: 3Com model: 4400 24 port slug: 3com-4400-24-port part_number: 3C17203 u_height: 1 is_full_depth: false weight: 2.8 weight_unit: kg airflow: right-to-left module-bays: - name: Slot1 position: S1 - name: Slot2 position: S2 power-ports: - name: PSU type: iec-60320-c14 maximum_draw: 100 console-ports: - name: Console type: de-9 interfaces: - name: FastEthernet0/1 type: 100base-tx ``` -------------------------------- ### Device Type Definition Example Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/README.md Defines a specific hardware model, including its physical characteristics, power ports, and network interfaces. Ensure all required fields are present for a valid definition. ```yaml manufacturer: Dell model: PowerEdge R750 slug: dell-poweredge-r750 # URL-friendly unique ID u_height: 2 # Height in rack units is_full_depth: true # Front + rear footprint console-ports: - name: iDRAC type: rj-45 power-ports: - name: PSU1 type: iec-60320-c14 maximum_draw: 750 interfaces: - name: Ethernet1/1 type: 1000base-t ``` -------------------------------- ### Rack Type Definition Example Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/usage-guide.md This YAML snippet defines a standard 4-post server cabinet rack type, including its physical dimensions and weight specifications. ```yaml --- manufacturer: APC model: NetShelter SX 42U slug: apc-netshelter-sx-42u form_factor: 4-post-cabinet width: 19 u_height: 42 starting_unit: 1 description: Standard 19" 4-post server cabinet outer_width: 600 outer_height: 1991 outer_depth: 1070 outer_unit: mm weight: 125 max_weight: 1020 weight_unit: kg mounting_depth: 914 ``` -------------------------------- ### Rack Type Definition Example Source: https://github.com/netbox-community/devicetype-library/blob/master/README.md Defines a 4-post 42U rack with specified dimensions and unit numbering. Ensure the slug is unique per manufacturer and follows the specified pattern. ```yaml manufacturer: Startech model: 4 Post 42U slug: startech-4postrack42 form_factor: 4-post-frame width: 19 u_height: 42 starting_unit: 1 ``` -------------------------------- ### Module Type Definition Example Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/README.md Represents a field-replaceable component, such as a CPU, with its manufacturer, model, and specific attributes. The 'profile' field helps categorize the module. ```yaml manufacturer: Intel model: Xeon Platinum 8380 profile: CPU attribute_data: architecture: x86-64 cores: 28 speed: 2.3 ``` -------------------------------- ### Example Device Type Definition Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/usage-guide.md Defines a Cisco Catalyst 2960X-48TS-L switch, including its physical characteristics, ports, and power requirements. This serves as a template for new device type entries. ```yaml --- manufacturer: Cisco model: Catalyst 2960X-48TS-L slug: cisco-catalyst-2960x-48ts-l part_number: WS-C2960X-48TS-L u_height: 1 is_full_depth: false weight: 3.5 weight_unit: kg airflow: front-to-rear console-ports: - name: Console type: rj-45 power-ports: - name: PS1 type: iec-60320-c13 maximum_draw: 65 interfaces: - name: FastEthernet1 type: 100base-tx - name: FastEthernet2 type: 100base-tx # ... continue for all 48 ports - name: GigabitEthernet49 type: 1000base-x-sfp - name: GigabitEthernet50 type: 1000base-x-sfp ``` -------------------------------- ### Modular Chassis Device Type Example Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/usage-guide.md Defines a modular chassis device, including its manufacturer, model, dimensions, console ports, power ports, module bays, and management interface. ```yaml manufacturer: Cisco model: Nexus 5696Q slug: cisco-nexus-5696q u_height: 3 is_full_depth: true weight: 45 weight_unit: kg console-ports: - name: console type: rj-45 power-ports: - name: PSU1 type: iec-60320-c14 maximum_draw: 500 - name: PSU2 type: iec-60320-c14 maximum_draw: 500 module-bays: - name: Line Card Slot 1 position: 1 - name: Line Card Slot 2 position: 2 - name: Supervisor Module Slot position: SUP interfaces: - name: Management type: 1000base-t mgmt_only: true ``` -------------------------------- ### Blade Chassis Device Type Example Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/usage-guide.md Defines a blade chassis device, including manufacturer, model, dimensions, console port, power ports, and device bays for blades. ```yaml manufacturer: IBM model: BladeCenter H slug: ibm-bladecenter-h u_height: 10 is_full_depth: true console-ports: - name: serial console type: rj-45 power-ports: - name: PSU1 type: iec-60309-3p-n-e-16h maximum_draw: 3500 - name: PSU2 type: iec-60309-3p-n-e-16h maximum_draw: 3500 device-bays: - name: Blade 1 label: Blade Bay 1 - name: Blade 2 label: Blade Bay 2 - name: Blade 3 label: Blade Bay 3 - name: Blade 4 label: Blade Bay 4 ``` -------------------------------- ### PCIe Interface Values Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/types-reference.md Defines the specifications for PCI Express interfaces, including version and lane count. Examples include PCIe 4.0, PCIe 4.0 x8, PCIe 4.0 x16, and PCIe 5.0 x16. ```text PCIe 4.0 PCIe 4.0 x8 PCIe 4.0 x16 PCIe 5.0 x16 ``` -------------------------------- ### Create and Validate a Device Type Definition Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/README.md Demonstrates the practical workflow for creating a new device type definition file, validating it using pre-commit, and then adding and committing it to version control. ```bash # Create device definition cat > device-types/Cisco/cisco-catalyst-9300.yaml << 'EOF' manufacturer: Cisco model: Catalyst 9300 slug: cisco-catalyst-9300 u_height: 2 is_full_depth: true # ... rest of definition EOF # Validate pre-commit run -a # Add to git and push git add device-types/Cisco/cisco-catalyst-9300.yaml git commit -m "Add Cisco Catalyst 9300 device type" git push origin feature-branch ``` -------------------------------- ### Add Elevation Images Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/usage-guide.md Creates a directory for elevation images and copies front/rear view images, naming them according to the device slug. ```bash mkdir -p elevation-images/Manufacturer/ # Add image files with naming: slug.front.png, slug.rear.png cp front-view.png elevation-images/Manufacturer/slug.front.png ``` -------------------------------- ### Passive Device Definition Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/device-types.md Example YAML definition for a passive device that does not consume power. ```yaml manufacturer: 3Com model: 3CFSU08 slug: 3com-3cfsu08 part_number: 3CFSU08 u_height: 0 is_full_depth: false weight: 252 weight_unit: g airflow: passive is_powered: false interfaces: - name: FastEthernet1 type: 100base-tx ``` -------------------------------- ### Run Pre-commit Hooks on All Files Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/validation-testing.md Execute pre-commit hooks on all files in the repository, regardless of staging status. ```bash pre-commit run -a ``` -------------------------------- ### Run pre-commit on All Files Source: https://github.com/netbox-community/devicetype-library/blob/master/README.md Executes the pre-commit script on all files in the repository. ```bash pre-commit run -a ``` -------------------------------- ### Run Pre-commit Checks Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/README.md Applies all pre-commit hooks to the repository to ensure code quality and consistency. This is a quick way to check for common issues. ```bash # Or use pre-commit pre-commit run -a ``` -------------------------------- ### Devicetype Library File Structure Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/README.md Illustrates the standard directory layout for organizing device type, module type, and rack type definitions, along with associated images and schema files. ```directory device-types/ ├── Manufacturer1/ │ ├── model1-slug.yaml │ └── model2-slug.yaml └── Manufacturer2/ module-types/ └── Manufacturer/ └── module-slug.yaml rack-types/ └── Manufacturer/ └── rack-slug.yaml elevation-images/ └── Manufacturer/ ├── slug.front.png └── slug.rear.png module-images/ └── Manufacturer/ └── module.front.png schema/ ├── devicetype.json # Device type JSON Schema ├── moduletype.json # Module type JSON Schema ├── racktype.json # Rack type JSON Schema ├── components.json # Component definitions ├── reusable.json # Shared type definitions └── generated_schema.json # Enumerations from NetBox ``` -------------------------------- ### Module Definition with Placeholder Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/components.md This YAML snippet shows how to define front ports using the `{module}` placeholder in their names and rear port associations. This enables the module definition to be reused across different module bays. ```yaml front-ports: - name: '{module}:1' type: lc-upc rear_port: '{module}:1' ``` -------------------------------- ### Define a Device Type Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/00-START-HERE.md Use this YAML structure to define a new device type. Required fields include manufacturer, model, slug, u_height, and is_full_depth. Console ports can also be specified. ```yaml manufacturer: Cisco # Required: equipment maker model: Catalyst 2960X-48TS-L # Required: model number slug: cisco-catalyst-2960x-48ts-l # Required: unique URL-safe ID u_height: 1 # Required: rack units is_full_depth: true # Required: front+rear facing console-ports: - name: console type: rj-45 # One of 500+ valid types ``` -------------------------------- ### Run All Tests with Pytest Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/validation-testing.md Execute all tests in the project using the pytest command. ```bash pytest ``` -------------------------------- ### Run pre-commit on Staged Files Source: https://github.com/netbox-community/devicetype-library/blob/master/README.md After staging your files with git, run this command to execute the pre-commit script on changed files. ```bash pre-commit run ``` -------------------------------- ### Use Local Cache Files for Tests Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/validation-testing.md Configure tests to use local cache files instead of cloning upstream repositories by setting the DTL_USE_LOCAL_KNOWN_SLUGS environment variable. ```bash DTL_USE_LOCAL_KNOWN_SLUGS=1 pytest ``` -------------------------------- ### Basic Device Type Structure (YAML) Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/device-types.md Defines the fundamental fields required for a device type. Ensure 'slug' follows the pattern 'manufacturer-model-variant'. ```yaml manufacturer: model: slug: u_height: is_full_depth: [optional fields...] ``` -------------------------------- ### Run Pre-commit Hooks on Staged Files Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/validation-testing.md Execute pre-commit hooks on files that are currently staged for commit. ```bash pre-commit run ``` -------------------------------- ### CPU Profile Attributes Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/module-types.md Defines the required and optional attributes for a CPU profile. Use this when specifying CPU components. ```yaml profile: CPU attribute_data: architecture: # Required: CPU architecture (e.g., "x86-64", "ARM") cores: # Required: Number of cores (minimum 1) speed: # Optional: Clock speed in GHz ``` ```yaml manufacturer: Intel model: Xeon W7-2595 profile: CPU attribute_data: architecture: x86-64 cores: 60 speed: 3.5 ``` -------------------------------- ### Subdevice Role Enumeration Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/device-types.md Valid roles for devices within a hierarchical structure. ```text parent Device acts as a chassis hosting child devices child Device is a blade or module installed in a parent ``` -------------------------------- ### Device Type with Image Indicators Source: https://github.com/netbox-community/devicetype-library/blob/master/README.md Indicates the presence of front and rear elevation images in the 'elevation-images' folder. File naming conventions must be followed. ```yaml front_image: true ``` ```yaml rear_image: true ``` -------------------------------- ### Power Supply Profile Attributes Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/module-types.md Defines the required and optional attributes for a Power supply profile. Use this for PSU components. ```yaml profile: Power supply attribute_data: wattage: # Optional: Power output in watts (minimum 0) hot_swappable: # Required: Whether PSU can be swapped without shutting down input_current: # Required: AC or DC input_voltage: # Required: Input voltage value (minimum 0) ``` ```yaml manufacturer: Delta model: 550W PSU profile: Power supply attribute_data: wattage: 550 hot_swappable: true input_current: AC input_voltage: 240 ``` -------------------------------- ### Basic Device Type Definition Source: https://github.com/netbox-community/devicetype-library/blob/master/README.md A minimal device type definition including manufacturer, model, slug, height, and depth. ```yaml manufacturer: Dell model: PowerEdge R670 slug: dell-poweredge-r670 u_height: 1 is_full_depth: true ``` -------------------------------- ### Run Local Validation Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/usage-guide.md Executes the pre-commit framework to validate all definitions locally. Alternatively, uses pytest for more specific definition testing. ```bash pre-commit run -a ``` ```bash DTL_USE_LOCAL_KNOWN_SLUGS=1 pytest tests/definitions_test.py -v ``` -------------------------------- ### Expansion Card Profile Attributes Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/module-types.md Defines the optional attributes for an Expansion card profile. Use this for add-in cards. ```yaml profile: Expansion card attribute_data: bandwidth: # Optional: Bandwidth in Gbps (minimum 0) connector_type: # Optional: Connector type (e.g., "PCIe", "QSFP+") ``` ```yaml manufacturer: Mellanox model: ConnectX-6 profile: Expansion card attribute_data: bandwidth: 200 connector_type: PCIe ``` -------------------------------- ### Device Type with Comments Source: https://github.com/netbox-community/devicetype-library/blob/master/README.md Allows for adding descriptive comments that will appear on NetBox devices of this type. ```yaml comments: This is a comment that will appear on all NetBox devices of this type ``` -------------------------------- ### Device Type with Weight and Unit Source: https://github.com/netbox-community/devicetype-library/blob/master/README.md Specifies the weight of the device and its unit of measurement. Weight must be a multiple of 0.01. ```yaml weight: 12.21 weight_unit: lb ``` -------------------------------- ### Module Type with Components Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/usage-guide.md Defines a module type that includes front and rear ports, suitable for patch panels or modules with connectors. The `{module}` placeholder is used for dynamic port naming. ```yaml --- manufacturer: ADC model: PPP-LC-SM part_number: 7033-1-092-000 description: Patch panel module with 6x duplex LC single-mode connectors front-ports: - name: '{module}:1' type: lc-upc color: 2196f3 rear_port: '{module}:1' rear-ports: - name: '{module}:1' type: splice positions: 1 ``` -------------------------------- ### Console Port Type Enumeration Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/components.md Lists the available enumerated types for console ports, specifying the physical connector and protocol. Use these exact values for the 'type' property. ```text de-9 DB-9 (RS-232) db-25 DB-25 (RS-232) rj-11 RJ-11 (6P4C) rj-12 RJ-12 (6P6C) rj-45 RJ-45 (8P8C) Ethernet mini-din-8 Mini-DIN 8-pin usb-a USB Type-A usb-b USB Type-B usb-c USB Type-C usb-mini-a USB Mini-A usb-mini-b USB Mini-B usb-micro-a USB Micro-A usb-micro-b USB Micro-B usb-micro-ab USB Micro-AB other Other type ``` -------------------------------- ### Hard Disk Profile Attributes Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/module-types.md Defines the required and optional attributes for a Hard disk profile. Use this for storage drive components. ```yaml profile: Hard disk attribute_data: size: # Required: Capacity in GB speed: # Optional: RPM for HDD, not applicable for SSD/NVME disk_type: # Required: Type (HD, SSD, NVME) ``` ```yaml manufacturer: Seagate model: Exos X18 profile: Hard disk attribute_data: size: 18000 speed: 7200 disk_type: HD ``` -------------------------------- ### Device Type with Part Number Source: https://github.com/netbox-community/devicetype-library/blob/master/README.md Includes an optional part number for an alternative model representation. ```yaml part_number: D109-C3 ``` -------------------------------- ### Commit and Push Changes Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/usage-guide.md Stages, commits, and pushes new or modified device type definitions and associated image files to a Git branch for a pull request. ```bash git checkout -b add-cisco-catalyst git add device-types/Cisco/cisco-catalyst-2960x-48ts-l.yaml git add elevation-images/Cisco/cisco-catalyst-2960x-48ts-l.front.png git commit -m "Add Cisco Catalyst 2960X-48TS-L device type" git push origin add-cisco-catalyst ``` -------------------------------- ### Device Type with Airflow Declaration Source: https://github.com/netbox-community/devicetype-library/blob/master/README.md Specifies the airflow pattern for the device. Ensure the value is one of the supported options. ```yaml airflow: side-to-rear ``` -------------------------------- ### Device Type for Non-Powered Devices Source: https://github.com/netbox-community/devicetype-library/blob/master/README.md Used for devices that do not consume power, such as rackmount kits or patch panels, mainly for validation testing. ```yaml is_powered: false ``` -------------------------------- ### GPU Profile Attributes Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/module-types.md Defines the required and optional attributes for a GPU profile. Use this for graphics card components. ```yaml profile: GPU attribute_data: gpu: # Optional: GPU model or type interface: # Optional: PCIe interface (PCIe 4.0, PCIe 4.0 x8, PCIe 4.0 x16, PCIe 5.0 x16) memory: # Required: Memory in GB ``` ```yaml manufacturer: NVIDIA model: A100 80GB profile: GPU attribute_data: gpu: NVIDIA A100 interface: PCIe 4.0 x16 memory: 80 ``` -------------------------------- ### Front Port Definition Structure Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/components.md Defines the schema for front ports, specifying required fields like name and type, and optional fields for labeling, coloring, and rear port connections. ```yaml front-ports: - name: # Required: Port name type: # Required: Connector type label: # Optional: Display label color: # Optional: Hex color code (6 digits) rear_port: # Required: Connected rear-port name rear_port_position: # Optional: Position on rear port (default: 1) description: # Optional: Descriptive text (max 200 chars) ``` -------------------------------- ### Update Schema Script Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/validation-testing.md This bash command executes the Python script to update the generated schema file. It fetches NetBox release metadata, downloads the schema, and updates it if differences are detected. ```bash python scripts/update-schema.py ``` -------------------------------- ### Width Enumerations Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/rack-types.md Valid values for the 'width' field, representing rack width in inches. ```text 10 10-inch rack (narrow) 19 19-inch rack (standard) 20 20-inch rack 23 23-inch rack (extended) ``` -------------------------------- ### Network Interface Definition Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/usage-guide.md Defines a network interface on a device, including its name, type, and an optional description. ```yaml interfaces: - name: ge-0/0/0 type: 10gbase-x-sfp description: 10G SFP uplink port ``` -------------------------------- ### Reference Images in Device Definition Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/usage-guide.md Updates the device YAML definition to indicate the presence of front and rear elevation images. ```yaml front_image: true rear_image: true ``` -------------------------------- ### Basic Module Type Structure Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/module-types.md A module type definition is a YAML file. It requires at least the manufacturer and model fields. ```yaml manufacturer: model: [optional fields...] ``` -------------------------------- ### Console Server Port Definition Source: https://github.com/netbox-community/devicetype-library/blob/master/_autodocs/components.md Defines a console server port, including its name, type, and optional label and description. The port type enumeration is identical to console-ports. ```yaml console-server-ports: - name: # Required: Port name type: # Required: Port type label: # Optional: Display label description: # Optional: Descriptive text (max 200 chars) ```