设计与 UI
阅读完整来源 ↗
netbox-review-datamodel
Audit and review NetBox data model design choices. Use when evaluating site hierarchy, IPAM organization, device modeling, tenancy patterns, custom field vs tag decisions, naming conventions, and extensibility strategy. Identifies modeling anti-patterns and suggests improvements aligned with NetBox best practices.
netboxlabs · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add netboxlabs/skills --skill netbox-review-datamodel技能说明
name: netbox-review-datamodel description: > Audit and review NetBox data model design choices. Use when evaluating site hierarchy, IPAM organization, device modeling, tenancy patterns, custom field vs tag decisions, naming conventions, and extensibility strategy. Identifies modeling anti-patterns and suggests improvements aligned with NetBox best practices. license: Apache-2.0
NetBox Data Model Review
Your knowledge of NetBox data models may be outdated. Available model types, relationships, and extensibility mechanisms evolve between releases. Verify against current docs before recommending changes.
Retrieval Sources
| Source | URL / Method | Use for |
|---|---|---|
| Data model docs | https://netboxlabs.com/docs/netbox/models/ | All available model types |
| Custom fields docs | https://netboxlabs.com/docs/netbox/customization/custom-fields/ | Field types and behavior |
| Custom Objects docs | https://netboxlabs.com/docs/extensions/custom-objects/ | No-code extensibility |
| NetBox MCP server | If configured — inspect the current data model, count objects, find inconsistencies | Live model audit |
Review Workflow
Follow this checklist when auditing a NetBox data model:
- Understand the organization — what kind of network? (enterprise, DC, ISP, hybrid)
- Check hierarchy — is the Region → Site Group → Site → Location → Rack hierarchy appropriate?
- Check IPAM — are prefixes properly nested? VRFs used where needed? Aggregates defined?
- Check naming — are slugs consistent? Are names human-readable and grep-friendly?
- Check extensibility choices — custom fields vs tags vs config contexts vs custom objects
- Check tenancy — is multi-tenancy used correctly? Over-tenanted or under-tenanted?
- Check for modeling smell — overloaded fields, misuse of description for structured data
Critical Rules
Hierarchy (HIER)
| ID | Rule | Severity |
|---|---|---|
| HIER-1 | Use Regions for geography, Site Groups for function — don't conflate | High |
| HIER-2 | Locations are recursive — don't flatten (Floor > Room > Row is better than Row alone) | Medium |
| HIER-3 | Every device should be in a Site (never orphaned at top level) | High |
| HIER-4 | Racks should have a Location when the site has locations defined | Medium |
| HIER-5 | Don't create single-child hierarchies — they add complexity without value | Low |
| HIER-6 | On 4.6+, RackGroups offer a flat, cross-location way to group racks (e.g. "cage-7", "cold-aisle-B") independent of the Location tree — use them when rack grouping doesn't map cleanly onto site/location nesting, not as a substitute for Locations | Low |
| HIER-7 | On 4.7+, hierarchies are ltree-backed: flag scripts/saved filters/exports that filter or order by level (no longer a DB column) — use parent_id/ancestor_id or get_ancestors() instead. Modeling advice is unchanged | Medium |
| HIER-8 | On 4.7+, if the instance was restored from a 4.7.0 pg_dump, descendant paths may be stale after renames/moves — have the admin run manage.py rebuild_ltree_paths --check and repair before trusting hierarchy reports | Medium |
IPAM (IPAM)
| ID | Rule | Severity |
|---|---|---|
| IPAM-1 | Define RIR Aggregates to track address space allocation boundaries | Medium |
| IPAM-2 | Prefixes should nest correctly (child within parent CIDR) | High |
| IPAM-3 | Use VRFs to separate overlapping address spaces — never duplicate prefixes in global table | Critical |
| IPAM-4 | IP Addresses must have prefix length (/32 for loopbacks, actual mask for interfaces) | High |
| IPAM-5 | Use Roles to classify prefix purpose (infrastructure, customer, management); on NetBox 4.6+ ASNs can also carry a Role — use it to classify ASN purpose | Medium |
| IPAM-6 | VLANs should be in VLAN Groups with an appropriate scope. Scope can be Region/SiteGroup/Site/Location/Rack/ClusterGroup/Cluster (and RackGroup on 4.6+) — don't assume site/location are the only options; pick the tightest scope that matches the VLANs' reuse boundary | Medium |
| IPAM-7 | On 4.7+, a service that listens on one port over several protocols (DNS tcp/53 + udp/53) is one Service with multiple port_mappings — flag duplicate per-protocol services (dns-tcp, dns-udp) and merge them; flag integrations still writing the deprecated protocol/ports pair (removed 5.0). On 4.5–4.6 one-service-per-protocol is the only option | Low |
Device Modeling (DEV)
| ID | Rule | Severity |
|---|---|---|
| DEV-1 | Every device needs a Device Type (not just a name) — this enables port planning | High |
| DEV-2 | Use Roles to classify function (router, switch, firewall) — not naming convention alone | High |
| DEV-3 | Platforms indicate software — assign them for config template compatibility | Medium |
| DEV-4 | Virtual chassis members should have proper VC position and master assignment | Medium |
| DEV-5 | Interface types must match reality (1000base-t vs 10gbase-sr) for capacity planning | Medium |
| DEV-6 | Every Rack should have a Rack Type with dimensions defined there. On 4.7 the per-rack form_factor, width, and outer_* fields are deprecated; in 5.0 they are removed and rack_type becomes mandatory — flag racks whose rack_type is null (walk GET /api/dcim/racks/?brief=1 — there is no null filter on rack_type_id) and per-rack dimensions that differ from their type | High |
| DEV-7 | On 4.7+, model breakout/channelized ports with channels on the parent and channel_id subinterfaces (channel type), not as loose virtual interfaces or extra physical interfaces — otherwise cable paths and port counts are wrong | Medium |
| DEV-8 | On 4.7+, use Module Bay Types where a chassis restricts which modules fit which slots (line-card vs supervisor vs fan bays) — an empty bay-type set means "anything fits", so absence is fine for simple hardware but flag cha |