This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

IPAM Create Groups via API / SWQL / SQL

Is there really no way to create an IPAM group other than the GUI?

Parents
  • Hi Greg,

    It is possible, first you'll need to get the Orion SDK PowerShell working - https://github.com/solarwinds/OrionSDK/wiki/PowerShell 
    Then you'll need to familiarise yourself with:

    New-SwisObject $swis -EntityType 'IPAM.Subnet'

     
    Details can be found here - http://solarwinds.github.io/OrionSDK/2019.2/schema/IPAM.Subnet.html 

    But for the impatient, I found this minimal code worked Laughing

    $new_subnet = @{ Address = "192.168.1.0"; 
                      CIDR = "24"; 
                      FriendlyName = "Home" ; 
                      ParentID = [ParentID]; 
                      Comments = "No place like Thwack"; }
                    
    New-SwisObject -SwisConnection <connection> -EntityType IPAM.Subnet -Properties $new_subnet


    If you then look at IPAM.Subnet (SWQL) you can see the parent/child hierarchy:



    Compare this to your own UI and you'll work out who is the parent of which child pretty quickly.

    I used this method to extract every subnet from an aging IPAM and create the same set-up on a new IPAM server, all from the API, with SWQL and PowerShell. 


    I hope it helps!
    Rich

  • Hi, Rich. I'm missing how this is creating a group.

    This may be a separate question, but I have a similar situation in NPM. I have a list of 100 devices that need to be in a group or custom property added. There is nothing common from them to match on so I need to use their individual names. Group configuration nor custom property editor allows SWQL queries in the web UI, as far as I can tell.

    Thanks.

    Steve

  • Steve,

    These are IPAM Groups which are in reality subnets, that need to be defined in the system before they get polled for IP usage. Manually this takes a few minutes per subnet, so using SWIS is very handy for when there's more than a few to do 

    Or you second comment, that's not an enviable task you have there.
    But if the information is stored somewhere, say like in a spreadsheet, then you can use a script to parse them into Orion via SWIS. CSV to PowerShell is pretty easy, then parse that into Custom Properties you want.
    Are the custom properties pre-existing or do they need to be create with the import?

    Rich


Reply
  • Steve,

    These are IPAM Groups which are in reality subnets, that need to be defined in the system before they get polled for IP usage. Manually this takes a few minutes per subnet, so using SWIS is very handy for when there's more than a few to do 

    Or you second comment, that's not an enviable task you have there.
    But if the information is stored somewhere, say like in a spreadsheet, then you can use a script to parse them into Orion via SWIS. CSV to PowerShell is pretty easy, then parse that into Custom Properties you want.
    Are the custom properties pre-existing or do they need to be create with the import?

    Rich


Children
  • The custom property (just one) already exists. I just need to apply it to each node. I've devised a SQL query to do the work, but a little hesitant to run that in a production environment. So then I thought, maybe I can use a group, but then run into the same issue with the group.

    I did find a CSV import script in another post. I may give that a try.

    Thanks for your quick response!