How to change supernet CIDR in Orion IPAM through SWIS

Hi,

I'm trying to add / change Supernets in IPAM through the API (Powershell), but I encounter some difficulties:

- I figured out that Supernets are in table IPAM.Subnet with GroupType=4, but I'm not able to create them directly through CRUD. Below piece of code doesn't work, as it ignores the GroupType attribute and still creates a subnet (GroupType=8);
   $uri = New-SwisObject $SwisConnection -EntityType 'IPAM.Subnet' -Properties @{Address=$Address; CIDR=$CIDR;ParentId=$ParentId;GroupType=4}
- First creating a Subnet and then changing it to a Supernet does work, however this approach can lead to IP range conflicts if the Supernet to be added somehow overlaps with an existing Subnet (as the Supernet is initially added as Subnet);

  $uri = New-SwisObject $SwisConnection -EntityType 'IPAM.Subnet' -Properties @{Address=$Address; CIDR=$CIDR;ParentId=$ParentId}
  Set-SwisObject -SwisConnection $SwisConnection -Uri $uri -Properties @{GroupType=4}

- First creating a Subnet with "dummy" address and CIDR doesn't work either: the CIDR cannot be changed through the API (although it can be changed through the Web UI), so below piece of code does not work.

  Set-SwisObject -SwisConnection $SwisConnection -Uri $uri -Properties @{CIDR=$newcidr}

Probably I'm taking the wrong approach here: I would appreciate feedback / examples on how to do this.

Thanks in advance !

Parents Reply Children
No Data