Integrate Network Management Solutions with Webhooks

ElasticBox integrates with IPAM, DNS, DHCP, and CMDB network management solutions over webhooks. Webhooks are available in the Enterprise Edition.

A webhook requires a custom web service to connect to your network management solution. You can build this custom web service as a box. We show how this works for Infoblox as an example. Say you deploy an instance to vCenter from ElasticBox. ElasticBox calls the custom Infoblox web service over the webhook and provides the instance IP configuration. The web service passes it to Infoblox. Once the web service gets the IP and domain name from Infoblox, it returns the information to ElasticBox, which assigns the IP configuration to the instance.

In this article:

Integrating with Infoblox

In this example, Infoblox provides a static IP and domain name for every instance you deploy through ElasticBox in vCenter.

Before You Begin

  • Set up a custom specification in vCenter for Linux and Windows if deploying to both platforms.

  • Install Infoblox and set it up as follows:

    1. Create a network for every vCenter network to which you deploy from ElasticBox. This has the CIDR range of IP addresses Infoblox can assign.

      Under Data Management > Toolbar, click Add and Add Network.

    2. Add global extensible attributes for the vCenter networks.

      Under Administration > Extensible Attributes, add these four:

      Add Extensible Attributes Globally in Infoblox
      • Network. Name of the vCenter network.
      • Gateway. Address of the vCenter network gateway node.
      • Netmask. Subnet address for the vCenter network.
      • DNS Suffix. Domain name suffix that registers and resolves the DNS name.
    3. Add the four global extensible attributes to each network.

      Edit each network. Under Extensible Attributes, add the four attributes and specify values.

      Add Extensible Attributes to the Network in Infoblox

      When you deploy, ElasticBox maps the network you select in the deployment policy to these Infoblox network attributes to derive the right IP configuration.


  1. Create a custom Infoblox web service.

    We define the web service in a box. Contact us to share the box with you.

    Infoblox Custom Web Service Box

    Install script

    This box installs Python, Python dependencies, and the Apache web server.

    yum -y install httpd mod_wsgi python-virtualenv
    curl -k | python
    pip install --upgrade bottle
    pip install --upgrade requests

    Configure script

    The box configures Apache using the virtual.conf file variable. To create the web service endpoint, it runs the script from a file variable.

    mkdir -p /var/www/webhook
    curl -k {{ VIRTUAL_CONF }} -o /etc/httpd/conf.d/default.conf
    curl -k {{ WEBHOOK_PY }} | elasticbox config -o /var/www/webhook/

    Here’s the Python script to create the web service endpoint:

    # -*- coding: utf-8 -*-
    ElasticBox Confidential
    Copyright (c) 2013 All Rights Reserved, ElasticBox Inc.
    NOTICE:  All information contained herein is, and remains the property
    of ElasticBox. The intellectual and technical concepts contained herein are
    proprietary and may be covered by U.S. and Foreign Patents, patents in process,
    and are protected by trade secret or copyright law. Dissemination of this
    information or reproduction of this material is strictly forbidden unless prior
    written permission is obtained from ElasticBox
    import json
    import bottle
    import requests
    from bottle import route, run, request
    def allocate_address_with_infoblox(network, name):
        net_url = \
        ip_url = \
        a_record_url = 'https:///wapi/v1.4/record:a'
        ptr_record_url = \
        auth = ('', '')
        networks = requests.get(net_url % network, auth=auth,
        if len(networks) > 0:
            address = % networks[0]['_ref'],
                                    auth=auth, verify=False).json()['ips'
            dns_suffix = networks[0]['extattrs']['Suffix']['value']
            name = '{0}.{1}'.format(dns_suffix, name)
            a_record = {'ipv4addr': address, 'name': name,
                        'view': 'default'}
            ptr_record = {'ipv4addr': address, 'ptrdname': name,
                          'view': 'default'}
            a_response =, auth=auth,
            ptr_response =, auth=auth,
                    data=json.dumps(ptr_record), verify=False)
            return {
                'ipv4_address': address,
                'subnet_mask': networks[0]['extattrs']['Netmask']['value'],
                'default_gateway': networks[0]['extattrs']['Gateway'
                'preferred_nameserver': '',
    def search(items, name):
        for item in items:
            if item['name'] == name:
                return item['value']
        return ''
    @route('/requestIP', method='POST')
    def requestIP():
        body = json.load(request.body)
        machine = body['machine']
        service = body['service']
        instance = body['instance']
        variables = []
        if 'vsphere' in machine['schema']:
            if instance['operation'] == 'terminate':
                print 'Deallocate IP address'
                return {}
            is_infoblox = True
            variables = instance['variables']
            for variable in instance['variables']:
                if variable['name'] == 'IPV4_ADDRESS' and variable['value'] \
                    != '':
                    is_infoblox = False
            if is_infoblox:
                network = allocate_address_with_infoblox(service['profile'
                        ]['network'], machine['name'])
                if network:
                    machine['customization'] = \
                        {'instance_networks': [network]}
                nameservers = find(variables, 'NAME_SERVERS')
                preferred_nameserver = nameservers.split(',')[0]
                alternate_nameserver = nameservers.split(',')[1]
                machine['customization'] = {
                    'ipv4_address': find(variables, 'IPV4_ADDRESS'),
                    'subnet_mask': find(variables, 'SUBNET_MASK'),
                    'default_gateway': find(variables, 'DEFAULT_GATEWAY'),
                    'preferred_nameserver': preferred_nameserver,
                    'alternate_nameserver': alternate_nameserver,
                    'dns_suffixes': find(variables, 'DNS_SUFFIXES'
        return machine
    @route('/test//', method='GET')
    def testIP(network, name):
        return allocate_address_with_infoblox(network, name)
    application = bottle.default_app()
  2. Deploy the custom Infoblox web service box.

    We provide values for the address, password, and user. These are admin credentials to access Infoblox.

    Deploy the Infoblox Web Service
  3. Add the custom Infoblox web service endpoint as a webhook.

    Under Admin Console > Webhooks, enter the endpoint of the deployed webservice as a webhook like this: http://endpoint_of_webservice_instance/requestIP

    Add Webhook to the Infoblox Web Service
  4. To see the Infoblox integration in action, we deploy an instance from ElasticBox to vCenter.

    In the deployment policy, we select a custom specification. This acts as a holder for the network information ElasticBox gets from InfoBlox. vCenter overrides the values of the custom specification with the values from Infoblox.