solarwinds / OrionSDK

SDK for the SolarWinds Orion platform, including tools, documentation, and samples in PowerShell, C#, Go, Perl, and Java.
https://thwack.com/OrionSDK
Apache License 2.0
397 stars 139 forks source link

Is it possible to create IPAM supernet using the code ? #294

Closed markatdxb closed 3 years ago

markatdxb commented 3 years ago

We have a scenario where we need to create multiple IPAM supernets. Is there a way to do this via API / PS / Python.... ?

Mesverrum commented 3 years ago

The git wiki has some examples of creating subnets from the api, ultimately a supernet is just another kind of subnet in the back end. I've not tried it myself but it seems possible. Otherwise you can go for a more direct approach by inserting exactly what you need into the db. I don't recall off hand if the required tables are about to be edited directly in SWQL with the insert/updates, but assuming the aren't you can alternatively use the orion.reporting execute sql verb to directly create the object in the database. The tricky part about doing things where there isn't a verb is you will probably need to do more testing to confirm that the object you create has all the correct properties and relationships as a supernet created via the GUI

markatdxb commented 3 years ago

@Mesverrum - it seems that supernet and subnets are separate objects within the IPAM. I'm able to create subnet using the API but there is no way to turn it to supernet. And also there is no verb for supernet https://github.com/solarwinds/OrionSDK/wiki/IPAM-2019.4-and-higher-versions-API#create-new-subnet

curl --location --request POST 'https://npm:17778/SolarWinds/InformationService/v3/Json/Invoke/IPAM.SubnetManagement/CreateSubnet' \
--header 'Authorization: Basic 2XHMtYWx2LmF1dG9tc2x3MDI6a2UjTGkhVGhpJktpQnlHaGlrYXk3' \
--header 'Content-Type: application/json' \
--data-raw '["192.168.0.0","16"]'

As you mentioned the only possible way i see is to hack it and do some direct sql objects creations.

Mesverrum commented 3 years ago

Responding to the bit you edited off, they've made changes to the IPAM API In almost every release since 4.6 in 2017 and it has had a release with new features at least once a year during that time. It's not the most exciting platform, but it generally gets the job done. Back when I worked with clients who had it we were always able to get what they wanted, but I've never been shy about just cracking the db open and doing the needful when I wanted something from it.