Custom ipam provider - SolarWinds

Hello everyone,
I started doing a custom ipam provider for our company (We’re using solarwinds ipam).
I was able to add new provider etc.
A couple of questions:

  1. Is it possible to add a new dropdown option without modifying core modules in foreman?
    app/services/ipam.rb:2: MODES = {:solar => N_(‘SolarWinds’), :dhcp => N_(‘DHCP’), :db => N_(‘Internal DB’), :random_db => N_(‘Random DB’), :eui64 => N_(‘EUI-64’), :none => N_(‘None’)}
  2. Is there a way to create new submenu in settings from a new provider app/services/ipam/solarwinds.rb and access those from app/services/ipam/solarwinds.rb

Thank you!

Hi @kotyara85,

I’d suggest to implement this at the smart proxy level. That’s probably the easiest way to add a new IPAM, DNS and DHCP provider.
Solarwinds IPAM is also a DNS and DHCP server, right?

Something to get you started:

It should be pretty easy to adapt these for solarwinds. You can then reuse the core DHCP IPAM provider and the smart proxy is doing the heavy lifting and talking to solarwinds.

It’s possible to extend the core features from a plugin, but it won’t be pretty.

Let me know, what you think.

Timo

Hi Timo,
As far as I understand, smartproxies doesn’t not extend foreman functionality, they help to use some functions in the networks where foreman cannot be deployed. (I might be wrong)

The main question - is it possible to integrate a new provider through proxy, so i’d Need to add new select option in subnets etc.

Thank you and any help is appreciated!

Ps: solar winds in our env is solely for ipam purposes

I’d say that smart proxies do extend Foreman’s functionality - but in a standalone programme. It’s possible to deploy them in an isolated network segment, but you don’t have to. The smart proxy API provides a common abstraction for various implementations. When Foreman wants to - let’s say - create a DNS entry, it can just do a REST call to the smart proxy. The smart proxy then has different providers for Route 53, Bind, PowerDNS, etc. So Foreman does not have to know any specific details.
That’s why I was suggesting to implement this at the smart proxy level.

You can, however, do that in a plugin.
https://projects.theforeman.org/projects/foreman/wiki/How_to_Create_a_Plugin

Let me point you to some code that should be easy to adapt:

I see. What do you use for DNS & DHCP?

Apologies if I directed you in wrong direction, but in Foreman we have:

  • DHCP IPAM - integrates with smart-proxy which has a simple generic DHCP API (create reservation, delete reservation, list reservations and leases) and various implementations (ISC DHCP, MS DHCP, Infoblox, Route66…)
  • DB IPAM / RandomDB IPAM - continious or random simple IP allocation via database table
  • None - fill your own IP address

I was under impression that you want to implement another IPAM, but as @TimoGoebel explains, you might be more interested in creating your own DHCP smart proxy plugin. In that case you don’t actually change any of the Foreman code, everything is transparent.

The problem is - the source of truth is not DHCP, but IPAM solarwinds, which is basically ad MSSQL db.
So I think we need a new IPAM provider. During New server creation foreman will check what next ip is available in solarwinds DB and assign it.
After that foreman will create A record in MS DNS.

So I’m confused about DHCP smart proxy idea.

Thank you

Thank you, I will check your examples!

In our thinking, IPAM is really “give me next available IP” kind of service. And proxy DHCP API is “give me next recommended free IP, create or delete reservation, list reservations and leases” kind of service. In both cases, user can still edit the IP address manually to any value in the form.

You can setup your Subnet to either use DHCP IPAM (thus DHCP API) or DB/RandomDB internal db IPAM.

Make your pick, I think you can implement this both ways, I tend to think that IPAM implementation is better fit. Out of curiosity, are you going to use static IP assignment or DHCP reservation?

Anyway, here is one warning - Foreman requests free IP first and then in separate transaction it creates new host. Make sure your IPAM creates some temporary “reservation”, if you do quick provisioning of many hosts, you could run into issues when one IP is assigned to multiple hosts.

At cfgmgmtcamp I also talked to someone who wanted to integrate NPAPI which is a pure IPAM without any DHCP/DNS parts. It would be neat if IPAM was pluggable as well.