New Plugin: foreman_phpipam

Hello Community,

I have pushed up a first cut at new Foreman and Smart Proxy plugins for phpIPAM integration, and also new branches for Foreman and Smart Proxy patches(branch is plugin/foreman_phpipam for both). This mainly for a preliminary review and is still a WIP.

Here is what as been done at a high level(so far):

1). New Foreman Plugin - Repo: https://github.com/grizzthedj/foreman_phpipam

  • Provides a simple view in the Foreman UI(Infrastructure => phpIPAM Dashboard) to look at phpIPAM sections, subnets. More functionality will be added here. See the TOOD section in https://github.com/grizzthedj/foreman_phpipam/blob/master/README.md for more info.
  • Adds new phpIPAM feature to Features table via seed file.
  • Queries phpIPAM API via the Smart Proxy interface

2). New Smart Proxy Plugin - Repo: https://github.com/grizzthedj/smart_proxy_phpipam

  • Provides interface to phpIPAM API
    • Get all sections
    • Get all subnets for a given section
    • Get next available IP for a given subnet
    • More features will be integrated here

3). Patch to Foreman core:
https://github.com/grizzthedj/foreman/tree/plugin/foreman_phpipam

  • Added new IPAM provider phpipam (NOTE: I have not made this “pluggable”(yet), but this will be done)
  • Persists suggested IP back to phpIPAM on Host create

4). Patch to Smart Proxy core: https://github.com/grizzthedj/smart-proxy/tree/plugin/smart_proxy_phpipam

  • Simply added config/settings.d/phpipam.yml.example for phpIPAM URL and credentials

I have not created any PRs yet as it is not complete!(still need to write tests, finish translations, release to rubygems.org etc). I was hoping to get a preliminary code review, and also get a few questions answered(below). Would also welcome any other feedback here as well.

Questions:

1). In terms of getting the Smart Proxy base URL, I’m not quite sure how to do that. To get this working locally, I just used the Smart Proxy URL of the first SmartProxy from the DB(which is obviously not correct).

I tried following the way DHCP was implemented, but I didn’t really follow. Any guidance here on how this part should be implemented would be appreciated.

2). I have made modifications to some HTML that exists in the following translation: “You can select one of the IPAM modes supported by the selected IP protocol: …”. This has already been translated in the following .pot files:

es, fr, ja, pt_BR, zh_CN

Should I reset the “msgstr” to blank string so that it will be translated again? How are updates to existing translations handled?

Thanks in advance!

Chris

3 Likes