Skip to content

[Feature] Expose 7 missing writable Device fields on New-/Set-NBDCIMDevice #411

@ctrl-alt-automate

Description

@ctrl-alt-automate

Follow-up from #409.

While verifying #409 against the live NetBox 4.5.7 OpenAPI schema (WritableDeviceWithConfigContextRequest), seven writable Device fields turned out to have no parameter on New-NBDCIMDevice or Set-NBDCIMDevice. All seven are nullable=true, so each one should be clearable via $null on the Set- variant from day one (consistent with the #409 pattern).

Missing fields

Field Schema type nullable Notes
location integer (FK) true Sub-site hierarchy — widely used since NetBox 3.x
airflow string (enum) true 7 values: front-to-rear, rear-to-front, left-to-right, right-to-left, side-to-rear, passive, mixed. Needs [ValidateSet] + parity check via scripts/Verify-ValidateSetParity.ps1
oob_ip integer (FK) true Out-of-band management IP — FK to IPAddress
latitude number (decimal 5,2) true Use [double] / [Nullable[double]] — not integer
longitude number (decimal 6,2) true Use [double] / [Nullable[double]] — not integer
config_template integer (FK) true FK to ConfigTemplate
local_context_data object (JSON) true Freeform JSON — pass as [hashtable] / [object]

Proposed parameter types

Following the #409 pattern — [T] on New-, [Nullable[T]] on Set- for integers/doubles; [string] on both for airflow with clearing via "" (standard PrimaryModel blank=True convention); [hashtable] on both for local_context_data.

Parameter New-NBDCIMDevice Set-NBDCIMDevice Clearing
Location [uint64] [Nullable[uint64]] -Location $null
Airflow [ValidateSet(...)][string] [ValidateSet(...)][string] -Airflow '' (verify against schema — may need $null)
OOB_IP [uint64] [Nullable[uint64]] -OOB_IP $null
Latitude [double] [Nullable[double]] -Latitude $null
Longitude [double] [Nullable[double]] -Longitude $null
Config_Template [uint64] [Nullable[uint64]] -Config_Template $null
Local_Context_Data [hashtable] [hashtable] -Local_Context_Data @{} (TBD — verify against schema)

Implementation notes

  • airflow null-clearing — schema says nullable=true but NetBox enums are historically blank=True strings. Before implementing, verify with a live PATCH whether "" or null clears it. See empty-string vs null clearing memory patterns.
  • airflow ValidateSet — run scripts/Verify-ValidateSetParity.ps1 -NetboxVersion v4.5.8 after adding. NetBox 4.6 GA may expand the set; gate on current version's values.
  • latitude / longitude precision — schema enforces decimal(5,2) and decimal(6,2) respectively. Use [double]; let server-side validation handle rounding / range.
  • Tests — follow the [Feature] Null out various parameters on Set-NBDICMDevice #409 pattern: one $null assertion per nullable parameter, one happy-path assertion, one ValidateSet rejection for airflow.

Out of scope

  • Site stays [uint64] (nullable=false — Device must live somewhere).
  • Role / Device_Type / Status / Face stay unchanged (all nullable=false).
  • Position precision bug ([uint16][double]) — tracked separately because it crosses more than just the Device scope.

Context

Original observation documented in the comment on #409. @mkarel expressed interest in contributing this one — assigning first right of refusal. If it's stale for ~2-3 days we'll pick it up on this side with Co-Authored-By credit per established pattern.

Targets v4.6.0 (accumulator branch on dev).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions