Skip to content

Import-Inventory: accept dual-stack IPv6 addresses and CIDRs after #57 #58

Closed

Description

@jacobyoby

Context

#57 / #40 landed IPv6 in Test-IPInSubnet, Get-LocalARPTable / ConvertFrom-ArpText, and DrawIO subnet parenting. The stable inventory path still rejects v6:

  • Import-Inventory always calls ConvertTo-NormalizedIPv4Address / ConvertTo-NormalizedIPv4Cidr and throws on IPv6 literals.
  • README still documents: “The stable inventory contract is IPv4-only … IPv6 is rejected explicitly.”

So ARP can surface v6 neighbors and DrawIO can parent them, but users cannot round-trip a dual-stack inventory through the documented import path. That leaves #40’s “nodes survive import” incomplete for the inventory contract.

What

Extend the inventory contract to dual-stack:

  1. Accept IPv4 and IPv6 device ip values and subnet cidr values.
  2. Normalize both families (canonical string form; clear host bits in CIDRs for v4 and v6).
  3. Keep uniqueness per normalized address string; reject duplicates across the inventory.
  4. Mixed-family subnet placement continues to return false via existing Test-IPInSubnet (never throw).
  5. Update README inventory section + template comments to match the new contract (not “IPv4-only”).

Prefer small helpers (ConvertTo-NormalizedIPAddress / ConvertTo-NormalizedCidr) rather than forcing callers through IPv4-named functions.

Why it matters

Without import support, dual-stack sites cannot author or re-import inventories that the rest of the module can already render. Docs and behavior currently contradict each other.

Acceptance criteria

  • Import-Inventory accepts a fixture with IPv4 + IPv6 devices and both family CIDRs; nodes retain normalized IPs.
  • IPv6-only inventory imports and Export-DrawIO parents each v6 node into its matching v6 container (reuse / extend existing IPv6 nodes survive import, subnet matching and export #40 tests).
  • Invalid addresses still throw with a context that names the field index; malformed mixed junk still fails closed.
  • Duplicate normalized addresses (including compressed vs expanded v6 equivalents if normalized) are rejected.
  • README inventory contract no longer claims IPv4-only rejection; example JSON shows at least one v6 device/subnet.
  • Pester covers: v6 import, dual-stack import, duplicate v6, invalid v6, and DrawIO parenting after import.

Out of scope

Wizard / Invoke-NetworkDiscovery IPv6 scanning (separate follow-on). SNMP credential-map v6 CIDR keys. Gallery version bump.

Related

Follows #57 / #40. Complements remaining IPv4-only discovery surfaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions