Skip to content

Getting full subnet hierarchy, including folders from Get-PhpIpamSubnets #30

@jeverett-syl

Description

@jeverett-syl

Is it possible to get the full subnet hierarchy, including folders from Get-PhpIpamSubnets?

Looking in the phpIPAM web UI, each subnet view has a "Hierarchy" display like:
Hierarchy | Section / Folder / Folder / Supernet (CIDR) / Subnet (CIDR)

Get-PhpIpamSubnets seems to return a sectionId and masterSubnetId which gets me some info, and I can construct fields like, say:

Get-PhpIpamSubnets |
Select-Object `
    @{Name = 'Subnet'; Expression = {$_.subnet+"/"+$_.mask}},
    @{Name = 'Section'; Expression = {(get-PhpIpamSection -id ([int]($_.sectionId))).name}},
    @{Name = 'Supernet_Description'; Expression = {if($_.masterSubnetId -and $_.masterSubnetId -ne 0 ){(Get-PhpIpamSubnet ([int]$_.masterSubnetId)).description}}},
    @{Name = 'Supernet'; Expression = {if($_.mastersubnetid -and $_.masterSubnetId -ne 0){(Get-PhpIpamSubnet ([int]$_.masterSubnetId)).subnet +"/"+ (Get-PhpIpamSubnet ([int]$_.masterSubnetId)).mask}}}

However, it doesn't seem like masterSubnetId registers folders, just supernets above the subnet, nor do I see any other properties returned related to folders.

Is that data just not returned by the API? If so, is there any other approaches possible to get the full hierarchy output for a subnet.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions