Introduces a NetBox 4.6 plugin for planning rack layouts (RackConcept, ConceptDevice) without creating real dcim.Rack/dcim.Device objects, so blueprints never appear in rack/device lists, utilization reports, or IPAM. Features: - Copy paths: real rack -> concept, concept -> concept (clone), and concept -> one or more real racks (deploy, with name patterning and dry-run support) - Manual concept creation via a dedicated "Rack Concepts" nav menu - Tenant and tenant group assignment on concepts and planned devices - Partial-width device placement (1/1-1/4) with slot-based collision detection, matching netbox_utilities' partial-width feature - Custom drag-and-drop elevation (netbox-reorder-rack operates on real Device querysets, which concepts don't have) with server-side validation of every move - Full REST API, filtering, CSV import, bulk edit, search integration - Optional, config-driven interop with netbox_utilities (partial-width field mapping) and netbox-reorder-rack, degrading gracefully when either plugin is absent Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
62 lines
1.7 KiB
Python
62 lines
1.7 KiB
Python
from utilities.choices import ChoiceSet
|
|
|
|
|
|
class ConceptStatusChoices(ChoiceSet):
|
|
"""Lifecycle of a rack blueprint."""
|
|
key = 'RackConcept.status'
|
|
|
|
STATUS_DRAFT = 'draft'
|
|
STATUS_REVIEW = 'review'
|
|
STATUS_APPROVED = 'approved'
|
|
STATUS_ARCHIVED = 'archived'
|
|
|
|
CHOICES = [
|
|
(STATUS_DRAFT, 'Draft', 'gray'),
|
|
(STATUS_REVIEW, 'In review', 'orange'),
|
|
(STATUS_APPROVED, 'Approved', 'green'),
|
|
(STATUS_ARCHIVED, 'Archived', 'red'),
|
|
]
|
|
|
|
|
|
class ConceptDeviceStatusChoices(ChoiceSet):
|
|
"""
|
|
What a planned device means. This is deliberately *not* dcim's device status:
|
|
a blueprint describes intent, not operational state.
|
|
"""
|
|
key = 'ConceptDevice.status'
|
|
|
|
STATUS_PLANNED = 'planned'
|
|
STATUS_EXISTING = 'existing'
|
|
STATUS_OPTIONAL = 'optional'
|
|
STATUS_RESERVED = 'reserved'
|
|
|
|
CHOICES = [
|
|
(STATUS_PLANNED, 'Planned', 'blue'),
|
|
(STATUS_EXISTING, 'Existing', 'green'),
|
|
(STATUS_OPTIONAL, 'Optional', 'cyan'),
|
|
(STATUS_RESERVED, 'Reserved space', 'gray'),
|
|
]
|
|
|
|
|
|
class WidthFractionChoices(ChoiceSet):
|
|
"""
|
|
Horizontal subdivision of a rack unit, mirroring the partial-width feature of
|
|
netbox_utilities. The value is the denominator: 1 = full width, 2 = half, ...
|
|
"""
|
|
FRACTION_FULL = 1
|
|
FRACTION_HALF = 2
|
|
FRACTION_THIRD = 3
|
|
FRACTION_QUARTER = 4
|
|
|
|
CHOICES = (
|
|
(FRACTION_FULL, 'Full width'),
|
|
(FRACTION_HALF, '1/2'),
|
|
(FRACTION_THIRD, '1/3'),
|
|
(FRACTION_QUARTER, '1/4'),
|
|
)
|
|
|
|
|
|
# Least common multiple of all supported denominators. The elevation is laid out
|
|
# on this many lanes so that every fraction lands on an integer lane boundary.
|
|
LANE_COUNT = 12
|