Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jeverett-syl opened this issue Nov 2, 2023 · 0 comments

Comments

@jeverett-syl
Copy link

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!

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

No branches or pull requests

1 participant