IPAM driver example

Hi !

I would like to start a new IPAM driver to do the glue between OpenNebula and PowerDNS, but I cannot find any example driver (except dummy) on the internet…
Is there really nobody who share this or I’m just missing something ? I’m probably not the first one to need it.

Cordially,

Nicolas B

I’m surprised that there are not more conversations around this.topic. I have been searching for hours and seeing very little on this topic. The documentation is fairly sparse in regards to the IPAM driver as well. We are looking to integrate with InfloBox DDI for our environment.

Can someone point to some useful links that would expedite the research? I am hoping that there might already be some community or vendor supplied for the major players in the IPAM market.

Warm Regards,
Christina

Hello Christina,

I’ve finally wrote my IPAM driver. It’s not open source but I can share my work with you. I will push it on GitHub.

This is an IPAM driver with powerdns and it works very well in my company.

1 Like

Thank you Niicolas! That would be very helpful I’m sure. A working example would go along way to moving forward, even it is for another type of endpoint!

I mean, I wasn’t even sure what my starting point would be, other then familiarizing myself with the Infoblox DDI rest api’s. It is appearing that ‘‘tis is going to take quite a bit longer than I had anticipated to integrate IPAM. :slight_smile:

I’m open-sourcing our code at leboncoin. This is the repository : https://github.com/leboncoin/opennebula-drivers

Hello,

I reopen this topic, since we would like to associate opennebula with the efficient IP ipam(SolidRest).

We have a problem when we go through the sunstone GUI. (In cli, we do not encounter any problems, we create our xml with all the necessary information and via the Solidrest API, all the information is well written on the ipam).

let me explain where our problem is.

When we want to add a new AR in an already existing network on OpenNebula via the GUI, the arguments received on the script are:

ARGV 1 → 25 (Request ID ??? ) How to retrie the request id ???
ARGV 0 → / var / lib / one / remotes / ipam / efficient/ register_address_range (The script used ? )

While normally we should receive a base64 argument containing the AR request in xml

anybody can help me ?

Kind regards

Hello @David_Martins,

When adding a new AR to an existing network, the script called is register_address_range as you said. This script has just one argument, which is the request ID, this argument is managed internally by the OpenNebula core, so you don’t need to take care about it.

Then, through STDIN, you will receive the base64 of the AR XML information so you can process it. This is also managed by the core, you just need to implement the register_address_range functionality, the STDIN will be sent by the core.

Best,
Álex.

Hi @ahuertas,

My script need to be in python, because the API of my ipam is in python.
this is possible to retrieve the AR XML with a python script or i need to have a ruby script and import the module of opennebula ?

If you have an exemple with python, i would appreciate.

kind regard

Thank you @ahuertas with the stdin, i’ve the AR XML in base64 :slight_smile:
DEBUG:root:PElQQU1fRFJJVkVSX0FDVElPTl9EQVRBPjxBUj48SVA+PCFbQ0RBVEFbMTkyLjE2OC4xOTMuNzhdXT48L0lQPjxJUEFNX01BRD48IVtDREFUQVtvcGVubmVidWxhXV0+PC9JUEFNX01BRD48U0laRT48IVtDREFUQVsxXV0+PC9TSVpFPjxUWVBFPjwhW0NEQVRBW0lQNF1dPjwvVFlQRT48L0FSPjxBRERSRVNTPjxNQUMvPjxJUC8+PElQNl9HTE9CQUwvPjxJUDZfVUxBLz48SVA2Lz48U0laRS8+PC9BRERSRVNTPjwvSVBBTV9EUklWRVJfQUNUSU9OX0RBVEE+

Kind regard

You can use the scripting language you prefer, the only mandatory thing is that it should have execution permissions so OpenNebula can execute it.

Best,
Álex.

I’ve finish all of the scripts but i’m sending to the ipam a generic name for the name of my VM.

vm-$ip

example on my ipam :

this is not possible to retrieve the real name of the virtual machine and send it to the ipam ?

the only solution is to create a hook to retrieve first the name of the virtual machine and after to push the modification of the name on my ipam ?

Another question :
Why when I provision a machine and I select the network card, the script used is get_address and not allocate_address? The problem is that in the STDin of the get_address script I do not receive the information from the mac while in the STDin of the allocate_address script, I get the mac associated with the ip…

STDin–> Get_address

image

STDin–> allocate_address

image

kind regard

Hello @David_Martins

this is not possible to retrieve the real name of the virtual machine and send it to the ipam ?

It’s not possible, IPAM only gets information about the address range.

the only solution is to create a hook to retrieve first the name of the virtual machine and after to push the modification of the name on my ipam ?

It can be a solution yes.

Why when I provision a machine and I select the network card, the script used is get_address and not allocate_address?

Yes, get address is used because OpenNebula is requesting for a new IP address in order to instantiate the VM so the only information needed is the size, because the rest will be provided by the IPAM itself. And the allocate script is used to register a new address into OpenNebula, that’s why you get the MAC.

Best,
Álex.