Contextualization scripting

I have a number of templates for virtual firewalls. These are set up so that when instantiating one, you have textfields where you insert the desired ip-addresses and masks for the interfaces and these are added to context.
Now im trying to get this automated, as in: I want OpenNebula to use the api of an iexternal pam tool to look up what ip’s correspond to the given name. Any suggestions on how i can realise that?

I have been trying to figure out a way to make use of the IPAM driver, but the issue i have with this is that
it assumes that OpenNebula is going to reserve the ip’s assigned to the created machine. In my situation its supposed to be the other way around, all ip management happens in the ipam tool, I want OpenNebula to just look up what ip’s it should use.