Development of IPAM Plugins

Hi,
i want to look in to the external ipam feature and extend it with an provider for NetBox

im not sure whats the right approach to contribute the code. should i extend the existing smart_proxy_ipam from @grizzthedj with the stuff for netbox?
Or should i create a new smart_proxy_ipam_netbox ?

thanks Matthias

3 Likes

The right approach is to extend the existing smart_proxy_ipam, however, there needs to be a refactoring of that implementation before additional providers can be added effectively. What sort of timeline were you looking to implement Netbox as a provider?

2 Likes

ok cool. i will do this in the next upcoming weeks. it doenst seem to be a lot of work, the netbox api looks quite easy and functional.

hey @lzap & @grizzthedj
i have some questsions for you two :slight_smile:

  1. are we sure that this part in foreman itself is working?
    https://github.com/theforeman/foreman/blob/c4c097fab09588a886da113e0c598120644f5d34/lib/proxy_api/external_ipam.rb#L233

    when i try this out, the smart proxy correctly sends a 404 if a ip is not allocated in external ipam

    2020-07-31T16:05:00 0371b8ba [I] Finished GET /ipam/subnet/10.100.60.0/24/10.100.60.3 with 404 (413.5 ms)

    but foreman throws an error

    Creating IPv4 in External IPAM for norma-dolbin.whatever.internal task failed with the following error: ERF12-7024 [ProxyAPI::ProxyException]: Unable to obtain IP address for subnet_id 10.100.60.0/24 from External IPAM. ([RestClient::NotFound]: 404 Not Found) for proxy https://tfm-katello-t01.whatever.de:9090/ipam

  2. it would be good to have the possibility to enrich the ipam system with more Information than it an ip is in use and its mac address.
    the hosts fqdn or a link to the hosts page in foreman would be good.

  3. if i got this correctly the ip cache feature relies on mac addresses
    when creating a foreman host with vmware, the mac address is not available till the vm is deployed.
    right now, if i create two host parallel without a mac address filled in the race condition still applies

thanks Matthias

The error handling needs a major overhaul, both on the Foreman and Smart Proxy side. It is full of layer violations. Quite often the error from the backend system is sent all the way to Foreman. The point you found is a good example of that.

You already found my PR (https://github.com/grizzthedj/smart_proxy_ipam/pull/36) but in the end I came to the point where I wanted to do a complete rewrite from scratch and didn’t have the time to do so.

The downside is that it’s already been merged to Foreman, so making changes to the API is painful now.

This is very recent, there might be dragons. The plugin is not official yet.

Sure, work with @grizzthedj on extending it. Although I’d slightly prefer making everything more robust, creating 2nd implementation, settling down on the final API and moving this into theforeman github organization.

Interesting, yeah. It’s a bug. The API probably needs to be extended with some UUID flag and VMs would use VM UUID instead.