IPAM REST API questions

Hello everyone,
I have never touched SolarWinds before and now I have a task to automate some IPAM tasks using ansible.

I cannot find any useful documentation on this, apart from some Github pages. If anyone can point me to the right document I would appreciate it.

From what I have read so far, my understanding is that the REST API uses SWQL to perform the required action. Is that true? If yes, is there any other method?

What I want to achieve is:


1. Reserve an IP from a specific subnet.
All the information I have here is the subnet. Is it sufficient?

2. Release (Delete reservation, return IP to pool) IP.
In this case I only have the IP. Is it sufficient?

Has anyone examples of those actions using Ansible or Curl?

  • https://solarwinds.github.io/OrionSDK/swagger-ui/#/ + SWQL studio from the SDK from the github is what you want

    Something like that looks like it from SWQL

    Not using ansible or ipam much at the mo

  • To expand on your questions a bit
    There's a rest API, if you use it you'll end up using SWQL sooner or later for querying something. There are API calls with no SWQL though.

    1/2 on sufficiency, on a technical level you need time and such as in my SS, or on  non-technical level depends on your org i suppose.

    I think release is Cancel or Remove.

  • THANK YOU
    It's extremely useful and what I was looking for.
    I guess I need to play around those settings as soon as I get access to the systems.

    First of all I need to find how the IPs are "reserved". Are they reserved as DHCP records, or it's just a "available" "not available" status? 
    Then, I need the correct option (unfortunately I cannot find what I have to type there, but I believe that's for another day).

    But many thanks, it's a very good starting point

  • Someone IPAM-ey will have to jump to help from there I think, I'm more familiar with the api stuff

  • Hello.

    For your inspiration, I have been doing some lookups in SolarWinds with Ansible:

    - name: Prepare SWQL query for SolarWinds search by vlan_id
      ansible.builtin.set_fact:
        solarwinds_query: >
          SELECT
              sn.Address as "network_address",
              sn.AddressMask,
              sn.CIDR as "cidr",
              sn.VLAN AS "vlan_id",
              sn.location AS vlanLocation
          FROM
              IPAM.Subnet AS sn
          WHERE
              sn.VLAN = '{{ solarwinds_search_vlan_id }}'
              AND sn.location LIKE '%{{ solarwinds_search_location }}%'
              
    - name: Post request to SolarWinds API
      ansible.builtin.uri:
        url: "{{ solarwinds.url }}"
        method: POST
        body_format: json
        body:
          query: "{{ solarwinds_query }}"
        headers:
          Content-Type: "application/json"
        user: "{{ solarwinds.username }}"
        password: "{{ solarwinds.password }}"
        validate_certs: false
      register: solarwinds_response
    
    - name: Check response and print data
      ansible.builtin.debug:
        msg: "{{ solarwinds_response.json }}"
      when: solarwinds_response.status == 200
    
    - name: Handle failed API request
      ansible.builtin.fail:
        msg: "Failed to retrieve data: {{ solarwinds_response.status }} {{ solarwinds_response.content }}"
      when: solarwinds_response.status != 200

  • Hey, little late to this party but my whole automation workflow is using Ansible to then interface with the solarwinds api via powershell.

    I have written out playbooks on doing the ip reservations. I also have plays on querying ipam based on comments but can be done with any parameter. 

    Ive been doing this the past 1.5 years but hadnt done a whole lot beyond ip reservation start, cancel, finish and change ip status. World map updates and using   's dependencies scripts.

    Im currently working on using this flow to develop plays to update ipam subnets/supernets comments/names, add subnets to ipam, add supernets to ipam,  move subets/supernets to appropriate folder hierarchy. Ultimately, I will be using ipam to source subnets for scripted discovery schedules that will filter, import and then customize custom properties based upon site.

    Would be interested to know what youve been able to do over the past few months as well as share what Ive done if interested!!