Skip to content

feat: IPv6 support in subnet matching, ARP discovery, and export (#40) - #57

Merged
jacobyoby merged 4 commits into
mainfrom
feature/ipv6-support-40
Sep 9, 2026
Merged

jacobyoby merged 4 commits into
mainfrom
feature/ipv6-support-40

Conversation

@jacobyoby

Copy link
Copy Markdown
Owner

Dual-stack support for network diagrams.

Test-IPInSubnet: Generalized from IPv4-only to byte-level prefix comparison for both IPv4 and IPv6. Mixed families return false (never throw).

Get-LocalARPTable: Removed -AddressFamily IPv4 restriction. Both v4 and v6 neighbors returned with AddressFamily field.

ConvertFrom-ArpText: Added IPv6 parsing for macOS (ndp) and Linux (ip neigh) output.

Export-DrawIO: No changes needed — v6 nodes now automatically parent into v6 subnet containers via the fixed Test-IPInSubnet.

Tests: 5 new Pester tests covering IPv6 /32 match, /48 mismatch, mixed-family safety (both directions), and v6 container parenting in DrawIO export.

Note: pwsh not available locally — CI should validate Pester tests.

Closes #40.

Generated with Qwen Code

…GE-MIB

Walk dot1dTpFdbTable (address/port/status columns) on each eligible node
to discover MAC addresses the switch has learned. Resolves MACs to IPs via
the local ARP table and emits edges with Confidence='L2-FDB' when the IP
matches a topology node. Fills in layer-2 edges that CDP/LLDP miss.

Changes:
- New function Get-SnmpBridgeNeighbors in Public/
  - Reuses Invoke-SnmpWalk for SNMP walks (redaction + injection guards)
  - Status filtering: only status=3 (learned) entries produce edges
  - MAC-to-IP resolution via local ARP table (queried once)
  - No ARP match produces Write-Verbose, not Write-Warning
- Updated Merge-Edges confidence ranking: L2-SNMP > L2-FDB > L2-SNMP-Heuristic > L3-Inferred
- Added Get-SnmpBridgeNeighbors to FunctionsToExport in psd1
- Pester tests:
  - Get-SnmpBridgeNeighbors: edge count, status filtering, unresolvable MAC
  - Merge-Edges: three-way confidence ranking in both input orders
@cursor
cursor Bot force-pushed the feature/ipv6-support-40 branch from 6c1a6b6 to 5e1765d Compare September 9, 2026 13:11
cursoragent and others added 3 commits September 9, 2026 13:15
The SNMP mock returned the same FDB table for every eligible node, so
host walks created an extra L2-FDB edge. Empty topology.Edges unwraps
to $null and Merge-Edges then returned @($null); return a real empty
array when nothing survives the merge.

Co-authored-by: Jacobrakai <jacobyoby@users.noreply.github.com>
- Generalize Test-IPInSubnet to handle both IPv4 and IPv6 using
  byte-level prefix comparison; mixed families return false, never throw
- Remove -AddressFamily IPv4 restriction from Get-LocalARPTable on
  Windows so both v4 and v6 neighbors are returned
- Add AddressFamily field to ARP table entries across all platforms
- Extend ConvertFrom-ArpText to parse IPv6 neighbor entries on macOS
  and Linux (ip neigh)
- Export-DrawIO automatically places v6 nodes in v6 subnet containers
  via the generalized Test-IPInSubnet
- Fix .gitignore: scope test-*.ps1 pattern to tests/ and repo root so
  module source files (Test-IPInSubnet, etc.) are not accidentally ignored
- Add IPv6 tests: CIDR match, CIDR mismatch, mixed-family safety
- Add Export-DrawIO IPv6 container parenting test
[int]::TryParse(..., [ref]$null) does not write a prefix length and
can reject valid IPv4 and IPv6 CIDRs. Use a local [int] out variable.

Co-authored-by: Jacobrakai <jacobyoby@users.noreply.github.com>
@cursor
cursor Bot force-pushed the feature/ipv6-support-40 branch from 5e1765d to 4109f29 Compare September 9, 2026 13:16
@jacobyoby
jacobyoby merged commit 138c03c into main Sep 9, 2026
7 checks passed
@jacobyoby
jacobyoby deleted the feature/ipv6-support-40 branch September 9, 2026 13:18
jacobyoby added a commit that referenced this pull request Sep 9, 2026
Align the packaged smoke job with test/lint checkout@v7, assert every
FunctionsToExport command after staged Import-Module, and add an offline
dual-stack Export-DrawIO path (IPv6 parenting after #57).

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Jacobrakai <jacobyoby@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IPv6 nodes survive import, subnet matching and export

2 participants